41#ifndef Foam_ICharStream_H
42#define Foam_ICharStream_H
69 virtual public std::ios,
74 typedef std::istream stream_type;
84 stream_type(static_cast<buffer_type*>(this))
92 reset(buffer, nbytes);
104 template<
int SizeMin>
138 auto view(
size_t pos,
size_t len = std::string::npos)
const
155 std::string
str()
const
167 buffer_type::pubseekpos(0, std::ios_base::in);
168 stream_type::clear();
176 buffer_type::pubseekpos(
pos, std::ios_base::in);
177 stream_type::clear();
182 void reset(
const char* buffer,
size_t nbytes)
185 stream_type::clear();
192 stream_type::clear();
196 template<
int SizeMin>
200 stream_type::clear();
207 stream_type::clear();
253 const std::string& buffer,
275 template<
int SizeMin>
293 std::streampos
tellg()
const {
return stream_.input_pos(); }
312 auto view(
size_t pos,
size_t len = std::string::npos)
const
318 UList<char>
list()
const {
return stream_.list(); }
328 void reset(
const char* buffer,
size_t nbytes)
335 void swap(List<char>& other)
342 template<
int SizeMin>
358 virtual void rewind()
override
378 os <<
"icharstream: ";
A wrapper to hold a std::stream type for OpenFOAM wrapped streams. This is necessary since the OpenFO...
Foam::icharstream stream_
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
An ISstream with internal List storage. Always UNCOMPRESSED.
ICharStream(List< char > &&buffer, IOstreamOption streamOpt=IOstreamOption())
Move construct from List.
void swap(List< char > &other)
Exchange stream content and parameter contents, reset positions.
std::streamsize remaining() const
The number of characters remaining in the get area. Same as (capacity() - input_pos()).
std::streampos tellg() const
Position of the get buffer.
Istream & operator()() const
A non-const reference to const Istream.
ICharStream(IOstreamOption streamOpt=IOstreamOption())
Default construct (empty), optionally with specified stream option.
void swap(DynamicList< char, SizeMin > &other)
Exchange stream content and parameter contents, reset positions.
std::streamsize capacity() const
The get buffer capacity.
ICharStream(DynamicList< char, SizeMin > &&buffer, IOstreamOption streamOpt=IOstreamOption())
Move construct from DynamicList (uses current size).
DynamicList< char > release()
Reset stream and return contents as a List.
auto view(size_t pos, size_t len=std::string::npos) const
A sub-slice string view of the buffer contents.
UList< char > list() const
A list span of the input characters (is modifiable!).
auto str() const
For IStringStream compatibility, return the buffer as string copy.
void seek(std::streampos pos)
Reposition the stream from the start.
label size() const
The input list size. Same as capacity().
auto view() const
A string_view of buffer contents.
virtual void rewind() override
Rewind the stream, clearing any old errors.
std::streampos input_pos() const
The current get position within the buffer (tellg).
virtual void print(Ostream &os) const override
Print stream description.
void reset(const char *buffer, size_t nbytes)
Reset content (copy).
ICharStream(const std::string &buffer, IOstreamOption streamOpt=IOstreamOption())
Copy construct from string content.
A simple container for options an IOstream can normally have.
versionNumber version() const noexcept
Get the stream version.
constexpr IOstreamOption(streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
Default construct (ASCII, UNCOMPRESSED, currentVersion) or construct with format, compression.
streamFormat format() const noexcept
Get the current stream format.
Generic input stream using a standard (STL) stream.
void syncState()
Set stream state to match that of the std::istream.
ISstream(std::istream &is, const string &streamName, IOstreamOption streamOpt=IOstreamOption())
Construct wrapper around std::istream, set stream status.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
virtual void rewind()=0
Rewind the stream so that it may be read again.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An OSstream with internal List storage.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Similar to std::istringstream, but with the ability to swap character content. Has some similarity to...
void swap(List< char > &other)
Exchange stream content and parameter contents, reset positions.
std::streamsize remaining() const
The number of characters remaining in the get area. Same as (capacity() - input_pos()).
void swap(DynamicList< char, SizeMin > &other)
Exchange stream content and parameter contents, reset positions.
icharstream(DynamicList< char, SizeMin > &&buffer)
Move construct from DynamicList.
std::streamsize capacity() const
The get buffer capacity.
icharstream()
Default construct - empty.
DynamicList< char > release()
Reset stream and return contents as a List.
auto view(size_t pos, size_t len=std::string::npos) const
A sub-slice string view of the buffer contents.
void print(Ostream &os) const
Information about stream.
UList< char > list() const
A list 'span' of buffer contents (caution: is modifiable!!).
void debug_info(Ostream &os) const
Some information about the input buffer position/capacity.
void seek(std::streampos pos)
Reposition the stream from the start.
auto view() const
A string_view of buffer contents.
void rewind()
Rewind the stream, clearing any old errors.
std::streampos input_pos() const
The current get position within the buffer (tellg).
icharstream(List< char > &&buffer)
Move construct from List.
icharstream(const char *buffer, size_t nbytes)
Copy construct from content.
void reset(const char *buffer, size_t nbytes)
Reset stream content (copy), reset positions.
std::string str() const
For istringstream compatibility, return the buffer as string copy.
char * data_bytes() const
The span data (start of input characters).
std::streamsize span_capacity() const
The get buffer capacity.
bool in_range(std::streampos pos) const
True if position is within the current input range.
std::streamsize span_remaining() const
The number of characters remaining in the get area.
auto view() const
A string view of the current input region.
std::streamsize span_tellg() const
The current buffer get position.
std::streamsize size_bytes() const
The span size (number of input characters).
An output streambuf for memory access.
void swap(List< char > &other)
Exchange buffer content and parameter contents, reset positions.
DynamicList< char > release()
Reset buffer and return contents. The list size and capacity are identical.
void reset(const char *s, std::streamsize n)
Reset content (copy).
OBJstream os(runTime.globalPath()/outputName)
dimensionedScalar pos(const dimensionedScalar &ds)
word format(conversionProperties.get< word >("format"))