bes
Updated for version 3.20.5
|
36 using std::ostringstream;
38 #include "BESTextInfo.h"
51 BESInfo(), _ishttp(ishttp), _header(false)
75 BESInfo(key, strm, strm_owned), _ishttp(ishttp), _header(false)
79 BESTextInfo::~BESTextInfo()
103 add_data(_indent + tag_name +
": " + tag_data +
"\n");
105 map<string, string>::const_iterator i = attrs->begin();
106 map<string, string>::const_iterator e = attrs->end();
107 for (; i != e; i++) {
108 string name = (*i).first;
109 string val = (*i).second;
110 add_data(_indent +
" " + name +
": " + val +
"\n");
122 BESInfo::begin_tag(tag_name);
123 add_data(_indent + tag_name +
"\n");
126 map<string, string>::const_iterator i = attrs->begin();
127 map<string, string>::const_iterator e = attrs->end();
128 for (; i != e; i++) {
129 string name = (*i).first;
130 string val = (*i).second;
131 add_data(_indent + name +
": " + val +
"\n");
144 BESInfo::end_tag(tag_name);
145 if (_indent.length() >= 4) _indent = _indent.substr(0, _indent.length() - 4);
154 if (_ishttp && !_header && !_buffered) {
168 for (
unsigned long i = 0; i < num_spaces; i++) {
181 for (
unsigned long i = 0; i < num_breaks; i++) {
197 string newkey = key +
".TXT";
211 transmitter->send_text(*
this, dhi);
223 strm << BESIndent::LMarg <<
"BESTextInfo::dump - (" << (
void *)
this <<
")" << endl;
225 strm << BESIndent::LMarg <<
"has header been added? " << _header << endl;
226 strm << BESIndent::LMarg <<
"indentation \"" << _indent <<
"\"" << endl;
227 strm << BESIndent::LMarg <<
"is http? " << _ishttp << endl;
229 BESIndent::UnIndent();
233 BESTextInfo::BuildTextInfo(
const string &)
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_space(unsigned long num_spaces)
add a space to the informational response
virtual void dump(ostream &strm) const
dumps information about this object
virtual void begin_response(const string &response_name, BESDataHandlerInterface &dhi)
begin the informational response
virtual void add_data(const string &s)
add string data to the informational response
informational response object
virtual void dump(ostream &strm) const
Displays debug information about this object.
static void set_mime_text(ostream &strm)
Generate an HTTP 1.0 response header for a text document.
virtual void add_data_from_file(const string &key, const string &name)
add data from a file to the informational object
virtual void end_tag(const string &tag_name)
end a tagged part of the informational response
virtual void add_tag(const string &tag_name, const string &tag_data, map< string, string > *attrs=0)
add tagged information to the inforamtional 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...
BESTextInfo(bool ishttp=false)
constructs a basic text information response object.
virtual void begin_response(const string &response_name, BESDataHandlerInterface &dhi)
begin the informational response
Structure storing information used by the BES to handle the request.
virtual void add_break(unsigned long num_breaks)
add a line break to the information
virtual void add_data_from_file(const string &key, const string &name)
add data from a file to the informational object.
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)
transmit the text information as text