bes  Updated for version 3.20.5
BESTextInfo Class Reference

represents simple text information in a response object, such as version and help information. More...

#include <BESTextInfo.h>

Collaboration diagram for BESTextInfo:
Collaboration graph

Public Member Functions

virtual void add_break (unsigned long num_breaks)
 add a line break to the information More...
 
virtual void add_data (const string &s)
 add string data to the informational response More...
 
virtual void add_data_from_file (const string &key, const string &name)
 add data from a file to the informational object More...
 
virtual void add_exception (BESError &e, const string &admin)
 add exception information to this informational object More...
 
virtual void add_space (unsigned long num_spaces)
 add a space to the informational response More...
 
virtual void add_tag (const string &tag_name, const string &tag_data, map< string, string > *attrs=0)
 add tagged information to the inforamtional response More...
 
virtual void begin_response (const string &response_name, BESDataHandlerInterface &dhi)
 begin the informational response More...
 
virtual void begin_response (const string &response_name, map< string, string > *attrs, BESDataHandlerInterface &dhi)
 begin the informational response More...
 
virtual void begin_tag (const string &tag_name, map< string, string > *attrs=0)
 begin a tagged part of the information, information to follow More...
 
 BESTextInfo (bool ishttp=false)
 constructs a basic text information response object. More...
 
 BESTextInfo (const string &key, ostream *strm, bool strm_owned, bool ishttp=false)
 constructs a basic text information response object. More...
 
virtual void dump (ostream &strm) const
 dumps information about this object More...
 
virtual void end_response ()
 
virtual void end_tag (const string &tag_name)
 end a tagged part of the informational response More...
 
virtual bool is_buffered ()
 return whether the information is to be buffered or not. More...
 
virtual void print (ostream &strm)
 print the information from this informational object to the specified stream More...
 
virtual void transmit (BESTransmitter *transmitter, BESDataHandlerInterface &dhi)
 transmit the text information as text More...
 

Static Public Member Functions

static BESInfoBuildTextInfo (const string &info_type)
 

Protected Attributes

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

Detailed Description

represents simple text information in a response object, such as version and help information.

Uses the default add_data and print methods, where the print method, if the response is going to a browser, sets the MIME type to text.

See also
BESInfo
BESResponseObject

Definition at line 48 of file BESTextInfo.h.

Constructor & Destructor Documentation

◆ BESTextInfo() [1/2]

BESTextInfo::BESTextInfo ( bool  ishttp = false)

constructs a basic text information response object.

Text informational objects can also be sent as html with an html header. We need to know this if the informationl is not buffered. If it isn't buffered then we need to send that text header.

See also
BESInfo
BESResponseObject

Definition at line 50 of file BESTextInfo.cc.

◆ BESTextInfo() [2/2]

BESTextInfo::BESTextInfo ( const string &  key,
ostream *  strm,
bool  strm_owned,
bool  ishttp = false 
)

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.

Text informational objects can also be sent as html with an html header. We need to know this if the informationl is not buffered. If it isn't buffered then we need to send that text header.

Parameters
keyparameter from BES configuration file
strmif not buffered then use the passed stream
strm_ownedif strm created (not cout or cerr for example) then tells whether strm owned or not and can be deleted
ishttptells whether this text information is html text and therefor requires the html header
See also
BESInfo
BESResponseObject

Definition at line 74 of file BESTextInfo.cc.

Member Function Documentation

◆ add_break()

void BESTextInfo::add_break ( unsigned long  num_breaks)
virtual

add a line break to the information

Parameters
num_breaksthe number of line breaks to add to the information

Implements BESInfo.

Definition at line 178 of file BESTextInfo.cc.

◆ add_data()

void BESTextInfo::add_data ( const string &  s)
virtual

add string data to the informational response

Parameters
sstring data to add the informational response

Reimplemented from BESInfo.

Definition at line 152 of file BESTextInfo.cc.

◆ add_data_from_file()

void BESTextInfo::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 .TXT 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 195 of file BESTextInfo.cc.

◆ add_exception()

void BESInfo::add_exception ( BESError e,
const 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, and BESDapErrorInfo.

Definition at line 234 of file BESInfo.cc.

◆ add_space()

void BESTextInfo::add_space ( unsigned long  num_spaces)
virtual

add a space to the informational response

Parameters
num_spacesthe number of spaces to add to the information

Implements BESInfo.

Definition at line 165 of file BESTextInfo.cc.

◆ add_tag()

void BESTextInfo::add_tag ( const string &  tag_name,
const string &  tag_data,
map< string, string > *  attrs = 0 
)
virtual

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

◆ begin_response() [1/2]

void BESTextInfo::begin_response ( const string &  response_name,
BESDataHandlerInterface dhi 
)
virtual

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 90 of file BESTextInfo.cc.

◆ begin_response() [2/2]

void BESInfo::begin_response ( const string &  response_name,
map< string, string > *  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 111 of file BESInfo.cc.

◆ begin_tag()

void BESTextInfo::begin_tag ( const string &  tag_name,
map< string, string > *  attrs = 0 
)
virtual

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 120 of file BESTextInfo.cc.

◆ dump()

void BESTextInfo::dump ( ostream &  strm) const
virtual

dumps information about this object

Displays the pointer value of this instance along with information about this text information object

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

Reimplemented from BESInfo.

Definition at line 221 of file BESTextInfo.cc.

◆ end_tag()

void BESTextInfo::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.

Parameters
tag_namename of the tag to end

Reimplemented from BESInfo.

Definition at line 142 of file BESTextInfo.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 ( 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, BESDapErrorInfo, and BESXMLInfo.

Definition at line 261 of file BESInfo.cc.

◆ transmit()

void BESTextInfo::transmit ( BESTransmitter transmitter,
BESDataHandlerInterface dhi 
)
virtual

transmit the text information as text

use the send_text method on the transmitter to transmit the 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 209 of file BESTextInfo.cc.


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