memorybuf::out_base Class Reference

An output streambuf for memory access. More...

Inheritance diagram for memorybuf::out_base:
Collaboration diagram for memorybuf::out_base:

Public Member Functions

 out_base ()=default
 Default construct. More...
 
 out_base (char *s, std::streamsize n)
 Construct for character array (can be nullptr) and number of bytes. More...
 
void resetp (char *s, std::streamsize n)
 Reset put buffer with character data (can be nullptr) and count. More...
 
std::streamsize span_tellp () const
 The current buffer put position. More...
 
std::streamsize span_capacity () const
 The put buffer capacity. More...
 
char * data_bytes () const
 The span data (start of output characters) More...
 
std::streamsize size_bytes () const
 The span size (size of output buffer) More...
 
bool in_range (std::streampos pos) const
 True if position is within the current output range. More...
 
auto view () const
 A string view of the current output region. More...
 
auto view (size_t pos, size_t len) const
 A sub-slice string view of the current output region. More...
 
void pop_back (int n=1)
 Decrease the put area by 1 or more elements. More...
 
void overwrite (std::streampos pos, const char *data, std::streamsize count)
 Overwrite a sub-slice with character content. More...
 
void overwrite (std::streampos pos, char c)
 Overwrite a single character. More...
 
void info (Ostream &os) const
 Some information about the output buffer position/capacity. More...
 

Protected Member Functions

virtual std::streamsize xsputn (const char *s, std::streamsize n)
 Put sequence of characters to a fixed region. More...
 
- Protected Member Functions inherited from memorybuf
virtual std::streampos seekoff (std::streamoff off, std::ios_base::seekdir way, std::ios_base::openmode which=std::ios_base::in|std::ios_base::out)
 Set position pointer to relative position. More...
 
virtual std::streampos seekpos (std::streampos pos, std::ios_base::openmode which=std::ios_base::in|std::ios_base::out)
 Set position pointer to absolute position. More...
 

Detailed Description

An output streambuf for memory access.

Definition at line 422 of file memoryStreamBuffer.H.

Constructor & Destructor Documentation

◆ out_base() [1/2]

out_base ( )
default

Default construct.

◆ out_base() [2/2]

out_base ( char *  s,
std::streamsize  n 
)
inline

Construct for character array (can be nullptr) and number of bytes.

Definition at line 454 of file memoryStreamBuffer.H.

References n, memorybuf::out_base::resetp(), and s.

Here is the call graph for this function:

Member Function Documentation

◆ xsputn()

virtual std::streamsize xsputn ( const char *  s,
std::streamsize  n 
)
inlineprotectedvirtual

Put sequence of characters to a fixed region.

Reimplemented in memorybuf::out_dynamic.

Definition at line 431 of file memoryStreamBuffer.H.

References Foam::BitOps::count(), n, and s.

Here is the call graph for this function:

◆ resetp()

void resetp ( char *  s,
std::streamsize  n 
)
inline

Reset put buffer with character data (can be nullptr) and count.

Sets put pointer to the begin.

Definition at line 470 of file memoryStreamBuffer.H.

References n, and s.

Referenced by memorybuf::out_base::out_base(), ospanstream::reset(), and memorybuf::out_dynamic::sync_pbuffer().

Here is the caller graph for this function:

◆ span_tellp()

◆ span_capacity()

std::streamsize span_capacity ( ) const
inline

The put buffer capacity.

Definition at line 492 of file memoryStreamBuffer.H.

Referenced by ocharstream::capacity(), ospanstream::capacity(), and memorybuf::out_base::info().

Here is the caller graph for this function:

◆ data_bytes()

char* data_bytes ( ) const
inline

◆ size_bytes()

std::streamsize size_bytes ( ) const
inline

The span size (size of output buffer)

Definition at line 502 of file memoryStreamBuffer.H.

Referenced by ocharstream::count(), ospanstream::count(), ospanstream::list(), ocharstream::list(), ospanstream::size_bytes(), ocharstream::size_bytes(), ospanstream::str(), ocharstream::str(), and memorybuf::out_base::view().

Here is the caller graph for this function:

◆ in_range()

bool in_range ( std::streampos  pos) const
inline

True if position is within the current output range.

Definition at line 507 of file memoryStreamBuffer.H.

References Foam::pos(), and memorybuf::out_base::span_tellp().

Referenced by memorybuf::out_base::overwrite(), ospanstream::seek(), ocharstream::seek(), and memorybuf::out_base::view().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ view() [1/2]

auto view ( ) const
inline

A string view of the current output region.

Definition at line 515 of file memoryStreamBuffer.H.

References memorybuf::out_base::data_bytes(), and memorybuf::out_base::size_bytes().

Referenced by ospanstream::view(), and ocharstream::view().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ view() [2/2]

auto view ( size_t  pos,
size_t  len 
) const
inline

A sub-slice string view of the current output region.

Definition at line 523 of file memoryStreamBuffer.H.

References memorybuf::out_base::data_bytes(), memorybuf::out_base::in_range(), Foam::pos(), and memorybuf::out_base::size_bytes().

Here is the call graph for this function:

◆ pop_back()

void pop_back ( int  n = 1)
inline

Decrease the put area by 1 or more elements.

Definition at line 551 of file memoryStreamBuffer.H.

References n.

Referenced by ocharstream::pop_back().

Here is the caller graph for this function:

◆ overwrite() [1/2]

void overwrite ( std::streampos  pos,
const char *  data,
std::streamsize  count 
)
inline

Overwrite a sub-slice with character content.

Definition at line 563 of file memoryStreamBuffer.H.

References Foam::BitOps::count(), memorybuf::out_base::data_bytes(), memorybuf::out_base::in_range(), Foam::pos(), and memorybuf::out_base::span_tellp().

Referenced by ospanstream::overwrite(), and ocharstream::overwrite().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ overwrite() [2/2]

void overwrite ( std::streampos  pos,
char  c 
)
inline

Overwrite a single character.

Definition at line 583 of file memoryStreamBuffer.H.

References Foam::constant::universal::c, memorybuf::out_base::data_bytes(), memorybuf::out_base::in_range(), and Foam::pos().

Here is the call graph for this function:

◆ info()

void info ( Ostream os) const
inline

Some information about the output buffer position/capacity.

Definition at line 594 of file memoryStreamBuffer.H.

References memorybuf::out_base::span_capacity(), and memorybuf::out_base::span_tellp().

Here is the call graph for this function:

The documentation for this class was generated from the following file: