Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
InputStreamFromStdIStream.h File Reference
#include "Stroika/Foundation/StroikaPreComp.h"
#include <istream>
#include "Stroika/Foundation/Common/Common.h"
#include "Stroika/Foundation/Streams/InputStream.h"
#include "Stroika/Foundation/Streams/InternallySynchronizedInputStream.h"
#include "InputStreamFromStdIStream.inl"

Go to the source code of this file.

Namespaces

namespace  Stroika::Foundation
 
namespace  Stroika::Foundation::Streams::iostream
 

Functions

template<typename ELEMENT_TYPE , typename BASIC_ISTREAM_ELEMENT_TYPE , typename BASIC_ISTREAM_TRAITS_TYPE >
requires ((same_as<ELEMENT_TYPE, byte> and same_as<BASIC_ISTREAM_ELEMENT_TYPE, char>) or (same_as<ELEMENT_TYPE, Characters::Character> and same_as<BASIC_ISTREAM_ELEMENT_TYPE, wchar_t>))
Ptr< ELEMENT_TYPE > Stroika::Foundation::Streams::iostream::InputStreamFromStdIStream::New (basic_istream< BASIC_ISTREAM_ELEMENT_TYPE, BASIC_ISTREAM_TRAITS_TYPE > &originalStream)
 

Detailed Description

Function Documentation

◆ New()

template<typename ELEMENT_TYPE , typename BASIC_ISTREAM_ELEMENT_TYPE , typename BASIC_ISTREAM_TRAITS_TYPE >
requires ((same_as<ELEMENT_TYPE, byte> and same_as<BASIC_ISTREAM_ELEMENT_TYPE, char>) or (same_as<ELEMENT_TYPE, Characters::Character> and same_as<BASIC_ISTREAM_ELEMENT_TYPE, wchar_t>))
Ptr< ELEMENT_TYPE > Stroika::Foundation::Streams::iostream::InputStreamFromStdIStream::New ( basic_istream< BASIC_ISTREAM_ELEMENT_TYPE, BASIC_ISTREAM_TRAITS_TYPE > &  originalStream)

InputStreamFromStdIStream wraps an argument std::istream or std::wistream or std::basic_istream<> as a Stroika InputStream object

Example Usage
stringstream tmpStrm;
tmpStrm << "some xml";
XML::SAXParse (InputStreamFromStdIStream::New<byte> (tmpStrm), MyCallback{});
Note
InputStreamFromStdIStream ::Close () does not call close on the owned basic_istream, because there is no such stdC++ method (though filestream has one)

Default seekability should be determined automatically, but for now, I cannot figure out how...

Example Usage
stringstream tmpStrm;
WriteTextStream_ (newDocXML, tmpStrm);
return InputStreamFromStdIStream::New<byte>(tmpStrm).ReadAll ();
Example Usage
stringstream tmpStrm;
WriteTextStream_ (newDocXML, tmpStrm);
MyCallback myCallback;
XML::SAXParse (InputStreamFromStdIStream::New<byte> (tmpStrm), myCallback);
Note
The lifetime of the underlying created (shared_ptr) Stream must be >= the lifetime of the argument std::istream
Thread-Safety C++-Standard-Thread-Safety-For-Envelope-Plus-Must-Externally-Synchronize-Letter It is also up to the caller to assure no references to or calls to that istream be made from another thread. However, no data is cached in this class - it just delegates, so calls CAN be made the the underlying istream - so long as not concurrently.

If you pass in eInternallySynchronized, the internal rep is internally synchronized, but you still must assure no other threads access the IStreamType object.

Definition at line 125 of file InputStreamFromStdIStream.inl.