#include <row_buffer.h>
Public Types | |
typedef DerivStrmBuf::char_type | char_type |
typedef DerivStrmBuf::traits_type | traits_type |
Public Member Functions | |
void | check (void) const |
augm_basic_stringbuf (void) | |
'out' : At construction, created for writing into it. | |
bool | a_empty (void) const |
void | a_clear (void) |
bool | a_flush (std::basic_streambuf< char_type, traits_type > *aStrmBuf) |
Private Member Functions | |
size_t | size (void) const |
bool | dmp_fd (int aFilDes) |
bool | dmp_file (FILE *aOutFile) |
typedef DerivStrmBuf::char_type rpa::augm_basic_stringbuf< DerivStrmBuf >::char_type |
typedef DerivStrmBuf::traits_type rpa::augm_basic_stringbuf< DerivStrmBuf >::traits_type |
rpa::augm_basic_stringbuf< DerivStrmBuf >::augm_basic_stringbuf | ( | void | ) | [inline] |
'out' : At construction, created for writing into it.
void rpa::augm_basic_stringbuf< DerivStrmBuf >::a_clear | ( | void | ) | [inline] |
This empties the buffer without deallocating its memory, for reusing. Called prior to using it as an output buffer without size limit. NOTE: Not called for limited-size buffer. See basic_stringbuf::setbuf(). Therefore, it is not only here that we should actually empty the buffer. Equivalent to ' buffer_type::str("") ', but faster.
bool rpa::augm_basic_stringbuf< DerivStrmBuf >::a_empty | ( | void | ) | const [inline] |
This tells whether something was written into the buffer or not. Must be very fast and avoid costly conversions.
This is equivalent to ' str().size() == 0 '.
bool rpa::augm_basic_stringbuf< DerivStrmBuf >::a_flush | ( | std::basic_streambuf< char_type, traits_type > * | aStrmBuf | ) | [inline] |
Dumps the content to any kind of std::basic_streambuf. This avoids the member str(), which involves a costly std::string. This is equivalent to : aOStr << str() ;
Limited-size buffers do not flush when empty. However, this check is not done with unlimited buffers. So, if the buffer is already empty, we do nothing. This check is very fast, and it should happen rarely.
sputn is slightly faster than 'write' and allows error processing. xsputn is slightly faster than sputn, but is protected.
void rpa::augm_basic_stringbuf< DerivStrmBuf >::check | ( | void | ) | const [inline] |
bool rpa::augm_basic_stringbuf< DerivStrmBuf >::dmp_fd | ( | int | aFilDes | ) | [inline, private] |
When the output has 'fd', dumps the stringbuf in an int file descriptor. Unix-like only. Returns true if the input must be cleaned.
Limited-size buffers do not flush when empty. However, this check is not done with unlimited buffers. So, if the buffer is already empty, we do nothing. This check is very fast, and it should happen rarely.
bool rpa::augm_basic_stringbuf< DerivStrmBuf >::dmp_file | ( | FILE * | aOutFile | ) | [inline, private] |
When the output has the member 'file', it is possible to write the content of the stringbuf in the FILE ptr, with POSIX functions.
Limited-size buffers do not flush when empty. However, this check is not done with unlimited buffers. So, if the buffer is already empty, we do nothing. This check is very fast, and it should happen rarely.
We are sure that we have exclusive access to this file. Therefore, it is possible to use 'fwrite_unlocked' on Linux.
size_t rpa::augm_basic_stringbuf< DerivStrmBuf >::size | ( | void | ) | const [inline, private] |
This returns the number of chars in the buffer. This is modelled after the member std::basic_stringbuf::str(void) : if (this->pptr()) { The current egptr() may not be the actual string end. if (this->pptr() > this->egptr()) return __string_type(this->pbase(), this->pptr()); else return __string_type(this->pbase(), this->egptr()); } else return _M_string;
We could use std::max but, because of the depth of function calls, we are sure here that it will be inlined.