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.size() >= 4) _indent = _indent.substr(0, _indent.size() - 4);
103 if (_indent.size() >= 4) _indent = _indent.substr(0, _indent.size() - 4);
105 if (_indent.size() >= 4) _indent = _indent.substr(0, _indent.size() - 4);
116 const string &tag_data,
117 map<
string,
string, std::less<>> *attrs){
118 string to_add = tag_name +
": " + tag_data +
"<BR />\n";
123 for (; i != e; i++) {
124 string name = (*i).first;
125 string val = (*i).second;
138 BESInfo::begin_tag(tag_name);
139 string to_add = tag_name +
"<BR />\n";
145 for (; i != e; i++) {
146 string name = (*i).first;
147 string val = (*i).second;
161 BESInfo::end_tag(tag_name);
162 if (_indent.size() >= 4) _indent = _indent.substr(0, _indent.size() - 4);
172 for (
unsigned long i = 0; i < num_spaces; i++) {
186 for (
unsigned long i = 0; i < num_breaks; i++) {
205 if (!_header && !_buffered) {
226 string newkey = key +
".HTML";
240 transmitter->send_html(*
this, dhi);
252 strm << BESIndent::LMarg <<
"BESHTMLInfo::dump - (" << (
void *)
this <<
")" << endl;
254 strm << BESIndent::LMarg <<
"has header been added? " << _header << endl;
255 strm << BESIndent::LMarg <<
"indentation \"" << _indent <<
"\"" << endl;
256 strm << BESIndent::LMarg <<
"do indent? " << _do_indent << endl;
258 BESIndent::UnIndent();
262BESHTMLInfo::BuildHTMLInfo(
const string &)
Structure storing information used by the BES to handle the request.
void add_data(const std::string &s) override
add data to this informational object.
void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi) override
transmit the text information as text
void begin_tag(const std::string &tag_name, std::map< std::string, std::string, std::less<> > *attrs=nullptr) override
begin a tagged part of the information, information to follow
void add_break(unsigned long num_breaks) override
add a line break to the information
void begin_response(const std::string &response_name, BESDataHandlerInterface &dhi) override
begin the informational response
void end_tag(const std::string &tag_name) override
end a tagged part of the informational response
void dump(std::ostream &strm) const override
dumps information about this object
void add_data_from_file(const std::string &key, const std::string &name) override
add data from a file to the informational object
void add_tag(const std::string &tag_name, const std::string &tag_data, std::map< std::string, std::string, std::less<> > *attrs=nullptr) override
add tagged information to the inforamtional response
BESHTMLInfo()
constructs an html formatted information response object.
void add_space(unsigned long num_spaces) override
add a space to the informational response
void end_response() override
end the response
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...
BESInfo()
constructs a BESInfo object
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.