37using std::ostringstream;
43#include "BESTextInfo.h"
56 BESInfo(), _ishttp(ishttp), _header(false)
80 BESInfo(key, strm, strm_owned), _ishttp(ishttp), _header(false)
84BESTextInfo::~BESTextInfo()
108 add_data(_indent + tag_name +
": " + tag_data +
"\n");
110 map<string, string>::const_iterator i = attrs->begin();
111 map<string, string>::const_iterator e = attrs->end();
112 for (; i != e; i++) {
113 string name = (*i).first;
114 string val = (*i).second;
115 add_data(_indent +
" " + name +
": " + val +
"\n");
127 BESInfo::begin_tag(tag_name);
128 add_data(_indent + tag_name +
"\n");
131 map<string, string>::const_iterator i = attrs->begin();
132 map<string, string>::const_iterator e = attrs->end();
133 for (; i != e; i++) {
134 string name = (*i).first;
135 string val = (*i).second;
136 add_data(_indent + name +
": " + val +
"\n");
149 BESInfo::end_tag(tag_name);
150 if (_indent.length() >= 4) _indent = _indent.substr(0, _indent.length() - 4);
159 if (_ishttp && !_header && !_buffered) {
173 for (
unsigned long i = 0; i < num_spaces; i++) {
186 for (
unsigned long i = 0; i < num_breaks; i++) {
202 string newkey = key +
".TXT";
216 transmitter->send_text(*
this, dhi);
228 strm << BESIndent::LMarg <<
"BESTextInfo::dump - (" << (
void *)
this <<
")" << endl;
230 strm << BESIndent::LMarg <<
"has header been added? " << _header << endl;
231 strm << BESIndent::LMarg <<
"indentation \"" << _indent <<
"\"" << endl;
232 strm << BESIndent::LMarg <<
"is http? " << _ishttp << endl;
234 BESIndent::UnIndent();
238BESTextInfo::BuildTextInfo(
const string &)
Structure storing information used by the BES to handle the request.
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.
represents simple text information in a response object, such as version and help information.
BESTextInfo(bool ishttp=false)
constructs a basic text information response object.
virtual void add_space(unsigned long num_spaces)
add a space to the informational response
virtual void add_break(unsigned long num_breaks)
add a line break to the information
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 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 begin_response(const std::string &response_name, BESDataHandlerInterface &dhi)
begin the informational response
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)
transmit the text information as text
virtual void end_tag(const std::string &tag_name)
end a tagged part of the informational response
virtual void add_data(const std::string &s)
add string data to the informational response
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
static void set_mime_text(std::ostream &strm)
Generate an HTTP 1.0 response header for a text document.