bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
BESHTMLInfo Class Reference

represents an html formatted response object More...

#include <BESHTMLInfo.h>

Inheritance diagram for BESHTMLInfo:
Inheritance graph
Collaboration diagram for BESHTMLInfo:
Collaboration graph

Public Member Functions

void add_break (unsigned long num_breaks) override
 add a line break to the information
 
void add_data (const std::string &s) override
 add data to this informational object.
 
void add_data_from_file (const std::string &key, const std::string &name) override
 add data from a file to the informational object
 
virtual void add_exception (const BESError &e, const std::string &admin)
 add exception information to this informational object
 
void add_space (unsigned long num_spaces) override
 add a space to the informational response
 
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
 
void begin_response (const std::string &response_name, BESDataHandlerInterface &dhi) override
 begin the informational response
 
virtual void begin_response (const std::string &response_name, std::map< std::string, std::string, std::less<> > *attrs, BESDataHandlerInterface &dhi)
 begin the informational response
 
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
 
 BESHTMLInfo ()
 constructs an html formatted information response object.
 
 BESHTMLInfo (const std::string &key, std::ostream *strm, bool strm_owned)
 constructs a basic text information response object.
 
void dump (std::ostream &strm) const override
 dumps information about this object
 
void end_response () override
 end the response
 
void end_tag (const std::string &tag_name) override
 end a tagged part of the informational response
 
virtual bool is_buffered ()
 return whether the information is to be buffered or not.
 
virtual void print (std::ostream &strm)
 print the information from this informational object to the specified stream
 
void transmit (BESTransmitter *transmitter, BESDataHandlerInterface &dhi) override
 transmit the text information as text
 

Static Public Member Functions

static BESInfoBuildHTMLInfo (const std::string &info_type)
 

Protected Attributes

bool _buffered
 
std::string _response_name
 
bool _response_started
 
std::ostream * _strm
 
bool _strm_owned
 
std::stack< std::string > _tags
 

Detailed Description

represents an html formatted response object

Uses the default add_data method, but overwrites print method in order to set the mime type to html.

See also
BESInfo
BESResponseObject

Definition at line 46 of file BESHTMLInfo.h.

Constructor & Destructor Documentation

◆ BESHTMLInfo() [1/2]

BESHTMLInfo::BESHTMLInfo ( )

constructs an html formatted information response object.

See also
BESInfo
BESResponseObject

Definition at line 51 of file BESHTMLInfo.cc.

◆ BESHTMLInfo() [2/2]

BESHTMLInfo::BESHTMLInfo ( const std::string & key,
std::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.

See also
BESInfo
BESResponseObject

Definition at line 64 of file BESHTMLInfo.cc.

◆ ~BESHTMLInfo()

BESHTMLInfo::~BESHTMLInfo ( )
override

Definition at line 69 of file BESHTMLInfo.cc.

Member Function Documentation

◆ add_break()

void BESHTMLInfo::add_break ( unsigned long num_breaks)
overridevirtual

add a line break to the information

Parameters
num_breaksthe number of line breaks to add to the information

Implements BESInfo.

Definition at line 183 of file BESHTMLInfo.cc.

◆ add_data()

void BESHTMLInfo::add_data ( const std::string & s)
overridevirtual

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

Parameters
sinformation to be added to this response object

Reimplemented from BESInfo.

Definition at line 203 of file BESHTMLInfo.cc.

◆ add_data_from_file()

void BESHTMLInfo::add_data_from_file ( const std::string & key,
const std::string & name )
overridevirtual

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.

Parameters
keyKey from the initialization file specifying the file to be
nameA description of what is the information being loaded

Reimplemented from BESInfo.

Definition at line 224 of file BESHTMLInfo.cc.

◆ add_exception()

void BESInfo::add_exception ( const BESError & error,
const std::string & admin )
virtualinherited

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.

Parameters
eThe exception to add to the informational response object
adminThe contact information for the person responsible for this error

Reimplemented in BESVersionInfo.

Definition at line 221 of file BESInfo.cc.

◆ add_space()

void BESHTMLInfo::add_space ( unsigned long num_spaces)
overridevirtual

add a space to the informational response

Parameters
num_spacesthe number of spaces to add to the information

Implements BESInfo.

Definition at line 169 of file BESHTMLInfo.cc.

◆ add_tag()

void BESHTMLInfo::add_tag ( const std::string & tag_name,
const std::string & tag_data,
std::map< std::string, std::string, std::less<> > * attrs = nullptr )
overridevirtual

add tagged information to the inforamtional response

Parameters
tag_namename of the tag to be added to the response
tag_datainformation describing the tag
attrsmap of attributes to add to the tag

Implements BESInfo.

Definition at line 115 of file BESHTMLInfo.cc.

◆ begin_response() [1/2]

void BESHTMLInfo::begin_response ( const std::string & response_name,
BESDataHandlerInterface & dhi )
overridevirtual

begin the informational response

Because this is text informational object, no begin tags are needed

Parameters
response_namename of the response this information represents
dhiinformation about the request and response

Reimplemented from BESInfo.

Definition at line 80 of file BESHTMLInfo.cc.

◆ begin_response() [2/2]

void BESInfo::begin_response ( const std::string & response_name,
std::map< std::string, std::string, std::less<> > * attrs,
BESDataHandlerInterface & dhi )
virtualinherited

begin the informational response

basic setup of the response from abstract class

Parameters
response_namename of the response this information represents
dhiinformation about the request and response

Reimplemented in BESXMLInfo.

Definition at line 108 of file BESInfo.cc.

◆ begin_tag()

void BESHTMLInfo::begin_tag ( const std::string & tag_name,
std::map< std::string, std::string, std::less<> > * attrs = nullptr )
overridevirtual

begin a tagged part of the information, information to follow

Parameters
tag_namename of the tag to begin
attrsmap of attributes to begin the tag with

Reimplemented from BESInfo.

Definition at line 136 of file BESHTMLInfo.cc.

◆ BuildHTMLInfo()

BESInfo * BESHTMLInfo::BuildHTMLInfo ( const std::string & info_type)
static

Definition at line 262 of file BESHTMLInfo.cc.

◆ dump()

void BESHTMLInfo::dump ( std::ostream & strm) const
overridevirtual

dumps information about this object

Displays the pointer value of this instance along with values of private data members.

Parameters
strmC++ i/o stream to dump the information to

Reimplemented from BESInfo.

Definition at line 250 of file BESHTMLInfo.cc.

◆ end_response()

void BESHTMLInfo::end_response ( )
overridevirtual

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 101 of file BESHTMLInfo.cc.

◆ end_tag()

void BESHTMLInfo::end_tag ( const std::string & tag_name)
overridevirtual

end a tagged part of the informational response

If the named tag is not the current tag then an error is thrown.

Parameters
tag_namename of the tag to end

Reimplemented from BESInfo.

Definition at line 159 of file BESHTMLInfo.cc.

◆ is_buffered()

virtual bool BESInfo::is_buffered ( )
inlinevirtualinherited

return whether the information is to be buffered or not.

Returns
true if information is buffered, false if not

Definition at line 116 of file BESInfo.h.

◆ print()

void BESInfo::print ( std::ostream & strm)
virtualinherited

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.

Parameters
strmoutput to this file descriptor if information buffered.

Reimplemented in BESVersionInfo, and BESXMLInfo.

Definition at line 249 of file BESInfo.cc.

◆ transmit()

void BESHTMLInfo::transmit ( BESTransmitter * transmitter,
BESDataHandlerInterface & dhi )
overridevirtual

transmit the text information as text

use the send_html method on the transmitter to transmit the html formatted information back to the client

Parameters
transmitterThe type of transmitter to use to transmit the info
dhiinformation to help with the transmission

Implements BESInfo.

Definition at line 238 of file BESHTMLInfo.cc.

Member Data Documentation

◆ _buffered

bool BESInfo::_buffered
protectedinherited

Definition at line 67 of file BESInfo.h.

◆ _response_name

std::string BESInfo::_response_name
protectedinherited

Definition at line 71 of file BESInfo.h.

◆ _response_started

bool BESInfo::_response_started
protectedinherited

Definition at line 68 of file BESInfo.h.

◆ _strm

std::ostream* BESInfo::_strm
protectedinherited

Definition at line 65 of file BESInfo.h.

◆ _strm_owned

bool BESInfo::_strm_owned
protectedinherited

Definition at line 66 of file BESInfo.h.

◆ _tags

std::stack<std::string> BESInfo::_tags
protectedinherited

Definition at line 70 of file BESInfo.h.


The documentation for this class was generated from the following files: