64 #ifndef Foam_ISpanStream_H 65 #define Foam_ISpanStream_H 94 virtual public std::ios,
99 typedef std::istream stream_type;
119 #if __cplusplus >= 201703L 123 buffer_type(const_cast<char*>(
s.data()),
s.size()),
124 stream_type(static_cast<buffer_type*>(
this));
131 buffer_type(const_cast<char*>(
s.data()),
s.size()),
132 stream_type(static_cast<buffer_type*>(this))
138 buffer_type(const_cast<char*>(
s.data()),
s.size()),
139 stream_type(static_cast<buffer_type*>(this))
175 auto view() const -> decltype(buffer_type::
view())
182 std::string
str()
const 194 buffer_type::pubseekpos(0, std::ios_base::in);
199 void reset(
const char* buffer,
size_t nbytes)
206 void reset(
const std::string&
s)
257 reset(buffer, nbytes);
263 const std::string& buffer,
276 const ::Foam::UList<char>& buffer,
283 #if __cplusplus >= 201703L 351 void reset(
const char* buffer,
size_t nbytes)
358 void reset(
const std::string&
s)
364 #if __cplusplus >= 201703L 366 void reset(std::string_view
s)
388 virtual void rewind()
override auto str() const -> decltype(stream_.str())
For IStringStream compatibility, return the buffer as string copy.
void resetg(char *s, std::streamsize n)
Reset get buffer with character data (can be nullptr) and count.
A wrapper to hold a std::stream type for OpenFOAM wrapped streams. This is necessary since the OpenFO...
Istream & operator()() const
A non-const reference to const Istream.
Similar to std::istringstream, but with an externally managed input buffer which makes it most simila...
void reset(const char *buffer, size_t nbytes)
Reset input area, position to buffer start and clear errors.
std::streamsize span_capacity() const
The get buffer capacity.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
void syncState()
Set stream state to match that of the std::istream.
ispanstream(const char *buffer, size_t nbytes)
Construct (shallow copy) for character array and number of bytes.
std::streamsize capacity() const
The get buffer capacity.
A simple container for options an IOstream can normally have.
std::string str() const
For istringstream compatibility, return the buffer as string copy.
void rewind()
Rewind the stream, clearing any old errors.
std::streampos input_pos() const
The current get position within the buffer (tellg)
constexpr IOstreamOption(streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
Default construct (ASCII, UNCOMPRESSED, currentVersion) or construct with format, compression...
std::streamsize remaining() const
The number of characters remaining in the get area. Same as (capacity() - input_pos()) ...
std::streamsize capacity() const
The get buffer capacity.
Foam::ispanstream stream_
The std::stream.
std::streamsize remaining() const
The number of characters remaining in the get area. Same as (capacity() - input_pos()) ...
The base input streambuf with memory access.
UList< char > list() const
Span of the input characters (is modifiable!)
std::streamsize span_remaining() const
The number of characters remaining in the get area.
void reset(const char *buffer, size_t nbytes)
Reset the get buffer area.
virtual void rewind() override
Rewind the stream, clearing any old errors.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void debug_info(Ostream &os) const
Some information about the input buffer position/capacity.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
std::streampos tellg() const
Position of the get buffer.
UList< char > list() const
Span of the current input characters (is modifiable!)
ISpanStream(IOstreamOption streamOpt=IOstreamOption())
Default construct (empty), optionally with specified stream option.
Generic input stream using a standard (STL) stream.
auto view() const -> decltype(buffer_type::view())
A string_view (c++17) or span view (older c++) of buffer contents.
versionNumber version() const noexcept
Get the stream version.
Rudimentary functionality similar to std::span for holding memory view.
std::streamsize size_bytes() const
The span size (number of input characters)
std::streampos input_pos() const
The current get position within the buffer (tellg)
stdFoam::span< const char > view() const
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Similar to IStringStream but using an externally managed buffer for its input. This allows the input ...
streamFormat format() const noexcept
Get the current stream format.
char * data_bytes() const
The span data (start of input characters)
virtual void print(Ostream &os) const override
Print stream description to Ostream.
auto view() const -> decltype(stream_.view())
A string_view (c++17) or span view (older c++) of buffer contents.
ispanstream()
Default construct - empty.
std::streamsize span_tellg() const
The current buffer get position.
label size() const
The input list size. Same as capacity()