37using std::ostringstream;
43#include "BESHTMLInfo.h"
52 BESInfo(), _header(false), _do_indent(true)
65 BESInfo(key, strm, strm_owned), _header(false), _do_indent(true)
69BESHTMLInfo::~BESHTMLInfo()
87 add_data((
string)
"<TITLE>" + response_name +
"</TITLE>\n");
88 if (_indent.length() >= 4) _indent = _indent.substr(0, _indent.length() - 4);
103 if (_indent.length() >= 4) _indent = _indent.substr(0, _indent.length() - 4);
105 if (_indent.length() >= 4) _indent = _indent.substr(0, _indent.length() - 4);
117 string to_add = tag_name +
": " + tag_data +
"<BR />\n";
120 map<string, string>::const_iterator i = attrs->begin();
121 map<string, string>::const_iterator e = attrs->end();
122 for (; i != e; i++) {
123 string name = (*i).first;
124 string val = (*i).second;
137 BESInfo::begin_tag(tag_name);
138 string to_add = tag_name +
"<BR />\n";
142 map<string, string>::const_iterator i = attrs->begin();
143 map<string, string>::const_iterator e = attrs->end();
144 for (; i != e; i++) {
145 string name = (*i).first;
146 string val = (*i).second;
160 BESInfo::end_tag(tag_name);
161 if (_indent.length() >= 4) _indent = _indent.substr(0, _indent.length() - 4);
171 for (
unsigned long i = 0; i < num_spaces; i++) {
185 for (
unsigned long i = 0; i < num_breaks; i++) {
204 if (!_header && !_buffered) {
225 string newkey = key +
".HTML";
239 transmitter->send_html(*
this, dhi);
251 strm << BESIndent::LMarg <<
"BESHTMLInfo::dump - (" << (
void *)
this <<
")" << endl;
253 strm << BESIndent::LMarg <<
"has header been added? " << _header << endl;
254 strm << BESIndent::LMarg <<
"indentation \"" << _indent <<
"\"" << endl;
255 strm << BESIndent::LMarg <<
"do indent? " << _do_indent << endl;
257 BESIndent::UnIndent();
261BESHTMLInfo::BuildHTMLInfo(
const string &)
Structure storing information used by the BES to handle the request.
virtual void add_data(const std::string &s)
add data to this informational object.
virtual void begin_tag(const std::string &tag_name, std::map< std::string, std::string > *attrs=0)
begin a tagged part of the information, information to follow
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)
transmit the text information as text
virtual void add_tag(const std::string &tag_name, const std::string &tag_data, std::map< std::string, std::string > *attrs=0)
add tagged information to the inforamtional response
virtual void end_tag(const std::string &tag_name)
end a tagged part of the informational response
virtual void end_response()
end the response
virtual void add_break(unsigned long num_breaks)
add a line break to the information
virtual void begin_response(const std::string &response_name, BESDataHandlerInterface &dhi)
begin the informational response
virtual void add_space(unsigned long num_spaces)
add a space to the informational response
BESHTMLInfo()
constructs an html formatted information response object.
virtual void dump(std::ostream &strm) const
dumps information about this object
virtual void add_data_from_file(const std::string &key, const std::string &name)
add data from a file to the informational object
informational response object
virtual void add_data(const std::string &s)
add data to this informational object. If buffering is not set then the information is output directl...
virtual void begin_response(const std::string &response_name, BESDataHandlerInterface &dhi)
begin the informational response
virtual void dump(std::ostream &strm) const
Displays debug information about this object.
virtual void add_data_from_file(const std::string &key, const std::string &name)
add data from a file to the informational object.
static void set_mime_html(std::ostream &strm)
Generate an HTTP 1.0 response header for a html document.