#include <row_buffer.h>
Inheritance diagram for rpa::augm_basic_filebuf< DerivStrmBuf >:
Public Types | |
typedef augm_basic_streambuf< DerivStrmBuf > | augm_base_t |
typedef augm_base_t::char_type | char_type |
typedef augm_base_t::traits_type | traits_type |
typedef augm_base_t::pos_type | pos_type |
typedef augm_base_t::int_type | int_type |
Public Member Functions | |
bool | a_empty (void) const |
void | a_clear (void) |
bool | a_flush (std::basic_streambuf< char_type, traits_type > *aStrmBuf) |
typedef augm_basic_streambuf< DerivStrmBuf > rpa::augm_basic_filebuf< DerivStrmBuf >::augm_base_t |
typedef augm_base_t::char_type rpa::augm_basic_filebuf< DerivStrmBuf >::char_type |
Reimplemented from rpa::augm_basic_streambuf< DerivStrmBuf >.
typedef augm_base_t::int_type rpa::augm_basic_filebuf< DerivStrmBuf >::int_type |
Reimplemented from rpa::augm_basic_streambuf< DerivStrmBuf >.
typedef augm_base_t::pos_type rpa::augm_basic_filebuf< DerivStrmBuf >::pos_type |
Reimplemented from rpa::augm_basic_streambuf< DerivStrmBuf >.
typedef augm_base_t::traits_type rpa::augm_basic_filebuf< DerivStrmBuf >::traits_type |
Reimplemented from rpa::augm_basic_streambuf< DerivStrmBuf >.
void rpa::augm_basic_filebuf< DerivStrmBuf >::a_clear | ( | void | ) | [inline] |
Simply returns to the beginning of the file. Note that 'clear' is called before 'begout', at first use. Called prior to using it as an output buffer without size limit. Beware that it is not called for limited-size buffer. Therefore, it is not only here that we should actually empty the buffer.
At this moment, the file must be open, otherwise there is no way to write anything in.
We should return a much better exception. This is maybe a pure IO problem. We should display errno too.
At opening, the file position is at the beginning, so it is useless to clean it before its first use with 'begout'. Maybe useless call ?
Reimplemented from rpa::augm_basic_streambuf< DerivStrmBuf >.
bool rpa::augm_basic_filebuf< DerivStrmBuf >::a_empty | ( | void | ) | const [inline] |
Tells whether the file is logically empty or not. It cannot be 'const' because 'seekoff' changes the position, although we stay in fact at the same position ( zero and ios_base::cur ). Used to know whether it is necessary to flush such a container. It is called once the buffer has been written into. As this member is called very often, as it uses only memory, the checks of 'tellp' are probably superfluous. So we call directly the buffer member.
We garanty that the file is emptied when opened, and stays opened as long as it is used. Therefore, if it is not opened, it is virtually empty. We need a non-const object, although it is not changed.
Reimplemented from rpa::augm_basic_streambuf< DerivStrmBuf >.
bool rpa::augm_basic_filebuf< DerivStrmBuf >::a_flush | ( | std::basic_streambuf< char_type, traits_type > * | aStrmBuf | ) | [inline] |
Dumps the content to a std::ostream. There can be specialization. We could inline 'flush_to_streambuf' in this function, but it it conceptually more general.
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.
Now we can call a function which knows nothing about the class DerivStrmBuf, because all it uses are virtuals.