36 using std::ostringstream ;
38 #include "BESTextInfo.h" 77 bool strm_owned,
bool ishttp )
78 :
BESInfo( key, strm, strm_owned ),
84 BESTextInfo::~BESTextInfo()
110 const string &tag_data,
111 map<string,string> *attrs )
113 add_data( _indent + tag_name +
": " + tag_data +
"\n" ) ;
116 map<string,string>::const_iterator i = attrs->begin() ;
117 map<string,string>::const_iterator e = attrs->end() ;
120 string name = (*i).first ;
121 string val = (*i).second ;
122 add_data( _indent +
" " + name +
": " + val +
"\n" ) ;
134 map<string,string> *attrs )
136 BESInfo::begin_tag( tag_name ) ;
137 add_data( _indent + tag_name +
"\n" ) ;
141 map<string,string>::const_iterator i = attrs->begin() ;
142 map<string,string>::const_iterator e = attrs->end() ;
145 string name = (*i).first ;
146 string val = (*i).second ;
147 add_data( _indent + name +
": " + val +
"\n" ) ;
161 BESInfo::end_tag( tag_name ) ;
162 if( _indent.length() >= 4 )
163 _indent = _indent.substr( 0, _indent.length()-4 ) ;
173 if( _ishttp && !_header && !_buffered )
189 for(
unsigned long i = 0; i < num_spaces; i++ )
204 for(
unsigned long i = 0; i < num_breaks; i++ )
222 string newkey = key +
".TXT" ;
238 transmitter->send_text( *
this, dhi ) ;
251 strm << BESIndent::LMarg <<
"BESTextInfo::dump - (" 252 << (
void *)
this <<
")" << endl ;
253 BESIndent::Indent() ;
254 strm << BESIndent::LMarg <<
"has header been added? " << _header << endl ;
255 strm << BESIndent::LMarg <<
"indentation \"" << _indent <<
"\"" << endl ;
256 strm << BESIndent::LMarg <<
"is http? " << _ishttp << endl ;
258 BESIndent::UnIndent() ;
262 BESTextInfo::BuildTextInfo(
const string & )
virtual void begin_response(const string &response_name, BESDataHandlerInterface &dhi)
begin the informational response
virtual void add_space(unsigned long num_spaces)
add a space to the informational response
virtual void dump(ostream &strm) const
Displays debug information about this object.
virtual void begin_tag(const string &tag_name, map< string, string > *attrs=0)
begin a tagged part of the information, information to follow
virtual void add_data_from_file(const string &key, const string &name)
add data from a file to the informational object.
virtual void dump(ostream &strm) const
dumps information about this object
informational response object
virtual void add_data_from_file(const string &key, const string &name)
add data from a file to the informational object
static void set_mime_text(ostream &strm)
Generate an HTTP 1.0 response header for a text document.
virtual void add_tag(const string &tag_name, const string &tag_data, map< string, string > *attrs=0)
add tagged information to the inforamtional response
BESTextInfo(bool ishttp=false)
constructs a basic text information response object.
virtual void end_tag(const string &tag_name)
end a tagged part of the informational response
virtual void add_break(unsigned long num_breaks)
add a line break to the information
Structure storing information used by the BES to handle the request.
virtual void begin_response(const string &response_name, BESDataHandlerInterface &dhi)
begin the informational response
virtual void add_data(const string &s)
add data to this informational object. If buffering is not set then the information is output directl...
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)
transmit the text information as text
virtual void add_data(const string &s)
add string data to the informational response