43 #ifndef Foam_OCharStream_H 44 #define Foam_OCharStream_H 70 virtual public std::ios,
75 typedef std::ostream stream_type;
115 std::streamsize
count()
const 155 buffer_type::pubseekpos(0, std::ios_base::out);
164 buffer_type::pubseekpos(
pos, std::ios_base::out);
173 auto view(
size_t pos,
size_t len = std::string::npos)
const 190 std::string
str()
const 207 template<
int SizeMin>
254 void append(
const char* data, std::streamsize
count)
256 if (data &&
count > 0)
274 std::streamsize
count 333 template<
int SizeMin>
380 auto view(
size_t pos,
size_t len = std::string::npos)
const 393 void swap(List<char>& other)
400 template<
int SizeMin>
432 os <<
"ocharstream: ";
453 void append(
const char* data, std::streamsize
count)
459 void append(std::string_view sv)
475 std::streamsize
count Generic output stream using a standard (STL) stream.
void reserve_exact(std::streamsize n)
Reserve output space for at least this amount. Does not apply min-size or capacity doubling etc...
A wrapper to hold a std::stream type for OpenFOAM wrapped streams. This is necessary since the OpenFO...
std::streamsize span_capacity() const
The put buffer capacity.
label size() const
The current output size. Same as count(), output_pos(), tellp().
virtual void print(Ostream &os) const override
Print stream description.
auto view() const
A string_view of buffer contents.
OCharStream(IOstreamOption streamOpt=IOstreamOption())
Default construct (empty output)
void rewind()
Rewind the stream, clearing any old errors.
UList< char > list() const
A list span of the current output characters (is modifiable!)
void syncState()
Set stream state to match that of the std::ostream.
ocharstream()
Default construct - empty.
void extend_exact(std::streamsize count)
Increase (reserve) space for another count entries.
Similar to std::ostringstream, but with the ability to swap character content. Has some similarity to...
void overwrite(std::streampos pos, char c)
Overwrite a single character.
auto view() const
A string view of the current output region.
void seek(std::streampos pos)
Reposition the stream from the start.
void overwrite(std::streampos pos, char c)
Overwrite a single character.
void reserve_exact(const std::streamsize len)
Increase capacity for at least this size. Does not apply min-size or capacity doubling etc...
std::streamsize count() const
The number of bytes outputted.
A simple container for options an IOstream can normally have.
const char * cdata_bytes() const
The output data (start of output characters)
char * data_bytes() const
The span data (start of output characters)
void debug_info(Ostream &os) const
Some information about the output buffer position/capacity.
void pop_back(int n=1)
Decrease the put area by 1 or more elements.
std::streamsize capacity() const
The put buffer capacity.
UList< char > list() const
A list span of current output contents (is modifiable!!)
auto view() const
A string_view of buffer contents.
void extend_exact(std::streamsize n)
Increase (reserve) space for another n entries.
constexpr IOstreamOption(streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
Default construct (ASCII, UNCOMPRESSED, currentVersion) or construct with format, compression...
dimensionedScalar pos(const dimensionedScalar &ds)
auto str() const
For OStringStream compatibility, return the buffer as string copy.
void extend(std::streamsize count)
Increase (reserve) space for another count entries.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
void reserve_exact(std::streamsize n)
Reserve output space for at least this amount. Does not apply min-size or capacity doubling etc...
void append(std::streamsize count, char c)
Append repeated character content.
Foam::ocharstream stream_
The std::stream.
std::streampos output_pos() const
The current output position within the buffer (tellp)
void swap(List< char > &other)
Exchange stream content and parameter contents, reset positions.
std::streamsize count() const
The number of bytes outputted.
void print(Ostream &os) const
Information about stream.
void pop_back(int n=1)
Rewind the end by 1 or more elements.
void push_back(char c)
Append a single character to the end.
std::streamsize size_bytes() const
The current number of output characters.
An OSstream with internal List storage.
void pop_back(int n=1)
Rewind the end by 1 or more elements.
An output streambuf for memory access.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void swap(List< char > &other)
Exchange buffer content and parameter contents, reset positions.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
std::streamsize capacity() const
The put buffer capacity.
void reserve(std::streamsize n)
Reserve output space for at least this amount. Applies a min-size and capacity doubling.
void reserve(const std::streamsize len)
Increase capacity (if needed) and adjust buffer pointers. Applies a min-size and capacity doubling...
void setBlockSize(int n)
Block size was used in OpenFOAM-v2306 and earlier.
DynamicList< char > release()
Reset buffer and return contents as a DynamicList. The list size corresponds to the region of output...
virtual void rewind()
Rewind the stream, clearing any old errors.
std::streamsize span_tellp() const
The current buffer put position.
void swap(List< char > &other)
Exchange stream content and parameter contents, reset positions.
void push_back(char c)
Append a single character to the end.
void extend(std::streamsize n)
Increase (reserve) space for another n entries.
void seek(std::streampos pos)
Reposition the stream from the start.
char * data_bytes()
The output data (start of output characters)
std::streampos tellp() const
Position of the put buffer.
const dimensionedScalar c
Speed of light in a vacuum.
versionNumber version() const noexcept
Get the stream version.
void extend(std::streamsize count)
Increase (reserve) space for another count entries.
bool in_range(std::streampos pos) const
True if position is within the current output range.
DynamicList< char > release()
Reset buffer and return contents.
void append(std::streamsize count, char c)
Append repeated character content.
void reserve(std::streamsize n)
Reserve output space for at least this amount.
std::streamsize size_bytes() const
The span size (size of output buffer)
void extend_exact(std::streamsize count)
Increase (reserve) space for another count entries.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
std::string str() const
For ostringstream compatibility, return the buffer as string copy.
streamFormat format() const noexcept
Get the current stream format.
void overwrite(std::streampos pos, const char *data, std::streamsize count)
Overwrite a sub-slice with character content.
std::streampos output_pos() const
The current output position within the buffer (tellp)
DynamicList< char > release()
Reset buffer and return contents.