19 return this->outstream;
22 void TextDebugView::write_line(
const char * line )
24 std::string prefix = this->prefix();
25 std::string postfix = this->postfix();
26 this->
print_line( prefix.c_str(), line, postfix.c_str() );
29 void TextDebugView::init_line()
32 for(
auto & pref : this->prefixes )
33 this->_prefix = this->_prefix + pref;
36 for(
auto & postf : this->postfixes )
37 this->_postfix = postf + this->_postfix;
42 this->prefixes.push_back( pref );
47 size_t size = this->outstream.get_line_size();
48 size_t active = this->_prefix.size();
50 for(
auto & pref : this->prefixes )
55 inactive = full - active;
59 align = size - inactive;
62 for(
size_t i = 0; i < align; i++ )
70 this->prefixes.pop_back();
73 std::string TextDebugView::prefix()
80 this->postfixes.push_back( postf );
85 this->postfixes.pop_back();
88 std::string TextDebugView::postfix()
90 return this->_postfix;
95 this->outstream.endline();
99 TextDebugView::tdc_streambuf::tdc_streambuf(
TextDebugView * context ) :
104 std::streambuf::int_type TextDebugView::tdc_streambuf::overflow( std::streambuf::int_type value )
106 if( value == traits_type::eof() )
108 this->flush_as_line();
112 auto c = traits_type::to_char_type( value );
115 this->flush_as_line();
119 if( this->buffer.empty() )
120 this->context->init_line();
121 this->buffer.push_back( c );
125 return traits_type::not_eof( value );
128 void TextDebugView::tdc_streambuf::flush_as_line()
130 this->context->write_line( this->buffer.c_str() );
131 this->buffer.clear();
134 void TextDebugView::tdc_streambuf::endline()
136 if( this->buffer.size() )
137 this->flush_as_line();
140 size_t TextDebugView::tdc_streambuf::get_line_size()
142 return this->buffer.size();
146 TextDebugView::tdc_ostream::tdc_ostream( TextDebugView * context ) :
147 std::ostream( new tdc_streambuf( context ) )
151 TextDebugView::tdc_ostream::~tdc_ostream()
153 delete this->rdbuf();
156 void TextDebugView::tdc_ostream::endline()
161 size_t TextDebugView::tdc_ostream::get_line_size()