15 #include "wordWrapStreamBuf.h"
16 #include "wordWrapStream.h"
17 #include "programBase.h"
21 #ifndef HAVE_STREAMSIZE
23 typedef int streamsize;
36 _literal_mode =
false;
45 ~WordWrapStreamBuf() {
56 int WordWrapStreamBuf::
58 streamsize n = pptr() - pbase();
59 write_chars(pbase(), n);
73 int WordWrapStreamBuf::
75 streamsize n = pptr() - pbase();
77 if (n != 0 && sync() != 0) {
98 void WordWrapStreamBuf::
99 write_chars(
const char *start,
int length) {
102 string new_data(start, length);
103 size_t newline = new_data.find_first_of(
"\n\r");
105 while (newline != string::npos) {
107 _data += new_data.substr(p, newline - p + 1);
110 newline = new_data.find_first_of(
"\n\r", p);
114 _data += new_data.substr(p);
125 void WordWrapStreamBuf::
127 if (!_data.empty()) {
This is intended to be the base class for most general-purpose utility programs in the PANDATOOL tree...
void show_text(const string &text)
Formats the indicated text to stderr with the known _terminal_width.
static ios_fmtflags get_literal_flag()
Returns a flag that may be set on the Notify stream via setf() that, when set, enables "literal" mode...
A special ostream that formats all of its output through ProgramBase::show_text().