#include <BESHTMLInfo.h>
Public Member Functions | |
BESHTMLInfo () | |
constructs an html information response object. | |
BESHTMLInfo (const string &key, ostream *strm, bool strm_owned) | |
constructs a basic text information response object. | |
virtual | ~BESHTMLInfo () |
virtual void | begin_response (const string &response_name) |
begin the informational response | |
virtual void | end_response () |
end the 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 | begin_tag (const string &tag_name, map< string, string > *attrs=0) |
begin a tagged part of the information, information to follow | |
virtual void | end_tag (const string &tag_name) |
end a tagged part of the informational response | |
virtual void | add_data (const string &s) |
add data to this informational 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_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 | |
virtual void | dump (ostream &strm) const |
dumps information about this object | |
virtual void | add_exception (BESException &e) |
add exception information to this informational object | |
virtual void | print (ostream &strm) |
print the information from this informational object to the specified stream | |
virtual bool | is_buffered () |
return whether the information is to be buffered or not. | |
Static Public Member Functions | |
static BESInfo * | BuildHTMLInfo (const string &info_type) |
Protected Attributes | |
ostream * | _strm |
bool | _strm_owned |
bool | _buffered |
bool | _response_started |
stack< string > | _tags |
string | _response_name |
Uses the default add_data method, but overwrites print method in order to set the mime type to html.
Definition at line 46 of file BESHTMLInfo.h.
BESHTMLInfo::BESHTMLInfo | ( | ) |
constructs an html information response object.
Uses the default BES.Info.Buffered key in the bes configuration file to determine whether the information should be buffered or not.
Definition at line 53 of file BESHTMLInfo.cc.
Referenced by BuildHTMLInfo().
BESHTMLInfo::BESHTMLInfo | ( | const string & | key, | |
ostream * | strm, | |||
bool | strm_owned | |||
) |
constructs a basic text information response object.
Uses the default specified key in the bes configuration file to determine whether the information should be buffered or not.
Definition at line 68 of file BESHTMLInfo.cc.
BESHTMLInfo::~BESHTMLInfo | ( | ) | [virtual] |
Definition at line 75 of file BESHTMLInfo.cc.
void BESHTMLInfo::begin_response | ( | const string & | response_name | ) | [virtual] |
begin the informational response
Because this is text informational object, no begin tags are needed
response_name | name of the response this information represents |
Reimplemented from BESInfo.
Definition at line 86 of file BESHTMLInfo.cc.
References add_data(), and BESInfo::begin_response().
Referenced by infoT::run().
void BESHTMLInfo::end_response | ( | ) | [virtual] |
end the response
Add the terminating tags for the response and for the response name. If there are still tags that have not been closed then an exception is thrown.
Reimplemented from BESInfo.
Definition at line 109 of file BESHTMLInfo.cc.
References add_data().
Referenced by infoT::run().
void BESHTMLInfo::add_tag | ( | const string & | tag_name, | |
const string & | tag_data, | |||
map< string, string > * | attrs = 0 | |||
) | [virtual] |
add tagged information to the inforamtional response
tag_name | name of the tag to be added to the response | |
tag_data | information describing the tag |
Implements BESInfo.
Definition at line 125 of file BESHTMLInfo.cc.
References BESInfo::add_data(), and add_data().
Referenced by infoT::run().
void BESHTMLInfo::begin_tag | ( | const string & | tag_name, | |
map< string, string > * | attrs = 0 | |||
) | [virtual] |
begin a tagged part of the information, information to follow
tag_name | name of the tag to begin |
Reimplemented from BESInfo.
Definition at line 149 of file BESHTMLInfo.cc.
References BESInfo::add_data(), add_data(), and BESInfo::begin_tag().
Referenced by infoT::run().
void BESHTMLInfo::end_tag | ( | const string & | tag_name | ) | [virtual] |
end a tagged part of the informational response
If the named tag is not the current tag then an error is thrown.
tag_name | name of the tag to end |
Reimplemented from BESInfo.
Definition at line 176 of file BESHTMLInfo.cc.
References BESInfo::end_tag().
Referenced by infoT::run().
void BESHTMLInfo::add_data | ( | const string & | s | ) | [virtual] |
add data to this informational object.
If buffering is not set then the information is output directly to the output stream.
Formatting is up to the user
s | information to be added to this response object |
Reimplemented from BESInfo.
Definition at line 226 of file BESHTMLInfo.cc.
References BESInfo::_buffered, BESInfo::_strm, BESInfo::add_data(), and BESUtil::set_mime_html().
Referenced by add_break(), add_space(), add_tag(), begin_response(), begin_tag(), and end_response().
void BESHTMLInfo::add_space | ( | unsigned long | num_spaces | ) | [virtual] |
add a space to the informational response
num_spaces | the number of spaces to add to the information |
Implements BESInfo.
Definition at line 188 of file BESHTMLInfo.cc.
References add_data().
void BESHTMLInfo::add_break | ( | unsigned long | num_breaks | ) | [virtual] |
add a line break to the information
num_breaks | the number of line breaks to add to the information |
Implements BESInfo.
Definition at line 204 of file BESHTMLInfo.cc.
References add_data().
void BESHTMLInfo::add_data_from_file | ( | const string & | key, | |
const string & | name | |||
) | [virtual] |
add data from a file to the informational object
This method simply adds a .HTML to the end of the key and passes the request on up to the BESInfo parent class.
key | Key from the initialization file specifying the file to be | |
name | A description of what is the information being loaded |
Reimplemented from BESInfo.
Definition at line 249 of file BESHTMLInfo.cc.
References BESInfo::add_data_from_file().
void BESHTMLInfo::transmit | ( | BESTransmitter * | transmitter, | |
BESDataHandlerInterface & | dhi | |||
) | [virtual] |
transmit the text information as text
use the send_html method on the transmitter to transmit the html formatted information back to the client
transmitter | The type of transmitter to use to transmit the info | |
dhi | information to help with the transmission |
Implements BESInfo.
Definition at line 264 of file BESHTMLInfo.cc.
References BESTransmitter::send_html().
void BESHTMLInfo::dump | ( | ostream & | strm | ) | const [virtual] |
dumps information about this object
Displays the pointer value of this instance along with values of private data members.
strm | C++ i/o stream to dump the information to |
Reimplemented from BESInfo.
Definition at line 278 of file BESHTMLInfo.cc.
References BESInfo::dump(), BESIndent::Indent(), BESIndent::LMarg(), and BESIndent::UnIndent().
BESInfo * BESHTMLInfo::BuildHTMLInfo | ( | const string & | info_type | ) | [static] |
Definition at line 291 of file BESHTMLInfo.cc.
References BESHTMLInfo().
Referenced by BESDefaultModule::initialize(), and infoT::run().
void BESInfo::add_exception | ( | BESException & | e | ) | [virtual, inherited] |
add exception information to this informational object
Exception information is added differently to different informational objects, such as html, xml, plain text. But, using the other methods of this class we can take care of exceptions here.
type | The type of exception being thrown | |
e | The exception to add to the informational response object |
Reimplemented in BESSilentInfo, and BESVersionInfo.
Definition at line 218 of file BESInfo.cc.
References BESInfo::add_tag(), BESInfo::begin_tag(), BESInfo::end_tag(), BESException::get_context(), BESException::get_file(), BESException::get_line(), and BESException::get_message().
Referenced by BESVersionInfo::add_exception(), BESExceptionManager::handle_exception(), and TestException::handleException().
void BESInfo::print | ( | ostream & | strm | ) | [virtual, inherited] |
print the information from this informational object to the specified stream
If the information was not buffered then this method does nothing, otherwise the information is output to the specified ostream.
out | output to this file descriptor if information buffered. |
Reimplemented in BESSilentInfo, BESVersionInfo, and BESXMLInfo.
Definition at line 241 of file BESInfo.cc.
References BESInfo::_buffered, and BESInfo::_strm.
Referenced by BESXMLInfo::print(), BESVersionInfo::print(), pvolT::run(), plistT::run(), pfileT::run(), infoT::run(), defT::run(), BESFilterTransmitter::send_html(), BESBasicTransmitter::send_html(), BESFilterTransmitter::send_text(), BESBasicTransmitter::send_text(), and BESInterface::transmit_data().
virtual bool BESInfo::is_buffered | ( | ) | [inline, virtual, inherited] |
return whether the information is to be buffered or not.
Definition at line 122 of file BESInfo.h.
References BESInfo::_buffered.
Referenced by BESFilterTransmitter::send_html(), BESBasicHttpTransmitter::send_html(), BESFilterTransmitter::send_text(), and BESBasicHttpTransmitter::send_text().
ostream* BESInfo::_strm [protected, inherited] |
Definition at line 71 of file BESInfo.h.
Referenced by BESTextInfo::add_data(), add_data(), BESInfo::BESInfo(), BESInfo::print(), and BESInfo::~BESInfo().
bool BESInfo::_strm_owned [protected, inherited] |
bool BESInfo::_buffered [protected, inherited] |
Definition at line 73 of file BESInfo.h.
Referenced by BESTextInfo::add_data(), add_data(), BESInfo::BESInfo(), BESInfo::dump(), BESInfo::is_buffered(), and BESInfo::print().
bool BESInfo::_response_started [protected, inherited] |
Definition at line 74 of file BESInfo.h.
Referenced by BESInfo::begin_response(), BESInfo::dump(), and BESInfo::end_response().
stack<string> BESInfo::_tags [protected, inherited] |
Definition at line 76 of file BESInfo.h.
Referenced by BESInfo::begin_tag(), BESInfo::dump(), BESInfo::end_response(), and BESInfo::end_tag().
string BESInfo::_response_name [protected, inherited] |
Definition at line 77 of file BESInfo.h.
Referenced by BESXMLInfo::begin_response(), BESInfo::begin_response(), BESInfo::dump(), and BESXMLInfo::end_response().