64 #ifndef Foam_ISpanStream_H 65 #define Foam_ISpanStream_H 95 virtual public std::ios,
100 typedef std::istream stream_type;
120 #if __cplusplus >= 201703L 124 buffer_type(const_cast<char*>(
s.data()),
s.size()),
125 stream_type(static_cast<buffer_type*>(
this));
132 buffer_type(const_cast<char*>(
s.data()),
s.size()),
133 stream_type(static_cast<buffer_type*>(this))
139 buffer_type(const_cast<char*>(
s.data()),
s.size()),
140 stream_type(static_cast<buffer_type*>(this))
176 auto view() const -> decltype(buffer_type::
view())
183 std::string
str()
const 195 buffer_type::pubseekpos(0, std::ios_base::in);
200 void reset(
const char* buffer,
size_t nbytes)
207 void reset(
const std::string&
s)
230 class ISpanStreamAllocator
255 public Detail::ISpanStreamAllocator,
258 typedef Detail::ISpanStreamAllocator allocator_type;
284 reset(buffer, nbytes);
290 const std::string& buffer,
303 const ::Foam::UList<char>& buffer,
310 #if __cplusplus >= 201703L 378 void reset(
const char* buffer,
size_t nbytes)
385 void reset(
const std::string&
s)
391 #if __cplusplus >= 201703L 393 void reset(std::string_view
s)
415 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.
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)...
ISpanStreamAllocator()=default
Default construct (empty)
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.
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))
Foam::ispanstream stream_
The stream.
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()