36 using std::ostringstream;
38 #include "BESHTMLInfo.h" 47 BESInfo(), _header(false), _do_indent(true)
60 BESInfo(key, strm, strm_owned), _header(false), _do_indent(true)
64 BESHTMLInfo::~BESHTMLInfo()
82 add_data((
string)
"<TITLE>" + response_name +
"</TITLE>\n");
83 if (_indent.length() >= 4) _indent = _indent.substr(0, _indent.length() - 4);
98 if (_indent.length() >= 4) _indent = _indent.substr(0, _indent.length() - 4);
100 if (_indent.length() >= 4) _indent = _indent.substr(0, _indent.length() - 4);
112 string to_add = tag_name +
": " + tag_data +
"<BR />\n";
115 map<string, string>::const_iterator i = attrs->begin();
116 map<string, string>::const_iterator e = attrs->end();
117 for (; i != e; i++) {
118 string name = (*i).first;
119 string val = (*i).second;
132 BESInfo::begin_tag(tag_name);
133 string to_add = tag_name +
"<BR />\n";
137 map<string, string>::const_iterator i = attrs->begin();
138 map<string, string>::const_iterator e = attrs->end();
139 for (; i != e; i++) {
140 string name = (*i).first;
141 string val = (*i).second;
155 BESInfo::end_tag(tag_name);
156 if (_indent.length() >= 4) _indent = _indent.substr(0, _indent.length() - 4);
166 for (
unsigned long i = 0; i < num_spaces; i++) {
180 for (
unsigned long i = 0; i < num_breaks; i++) {
199 if (!_header && !_buffered) {
220 string newkey = key +
".HTML";
234 transmitter->send_html(*
this, dhi);
246 strm << BESIndent::LMarg <<
"BESHTMLInfo::dump - (" << (
void *)
this <<
")" << endl;
248 strm << BESIndent::LMarg <<
"has header been added? " << _header << endl;
249 strm << BESIndent::LMarg <<
"indentation \"" << _indent <<
"\"" << endl;
250 strm << BESIndent::LMarg <<
"do indent? " << _do_indent << endl;
252 BESIndent::UnIndent();
256 BESHTMLInfo::BuildHTMLInfo(
const string &)
virtual void dump(ostream &strm) const
dumps information about this object
virtual void dump(ostream &strm) const
Displays debug information about this object.
BESHTMLInfo()
constructs an html formatted information response object.
virtual void add_data_from_file(const string &key, const string &name)
add data from a file to the informational object.
virtual void end_response()
end the response
virtual void add_space(unsigned long num_spaces)
add a space to the informational response
informational response 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_tag(const string &tag_name, const string &tag_data, map< string, string > *attrs=0)
add tagged information to the inforamtional response
static void set_mime_html(ostream &strm)
Generate an HTTP 1.0 response header for a html document.
virtual void add_data(const string &s)
add data to this informational object.
virtual void add_break(unsigned long num_breaks)
add a line break to the information
virtual void end_tag(const string &tag_name)
end a tagged part of the informational response
Structure storing information used by the BES to handle the request.
virtual void add_data_from_file(const string &key, const string &name)
add data from a file to the informational object
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 begin_response(const string &response_name, BESDataHandlerInterface &dhi)
begin the informational response