class StatusMsg

Base Class For Handling System Status Messages. More...

Full nameStatusMsgs::StatusMsg
Definition#include <status.H>
Inherited byError, Log
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Static Methods


Detailed Description

This base class is responsible for storing, handling, and printing status messages which consists of a header and message body. This primarily helps in simplifying the task of displaying system messages to the user and/or developer.

To make the output formating of all status messages work together, global variables were created to handle the message header and body sizes. Therefore when one of these change, it effects all status messages which use the StatusMsg base class.

See also: Log, Error

 StatusMsg ()

Sets default message of SM_DBODY[]

 StatusMsg (const StatusMsg& msg)

Copy constructor

 StatusMsg (const string& header, const string border = SM_BORDER, const short hsize = head_size, const short bsize = body_size)

Sets default message of SM_DBODY[] along with specified string header and with border style, header size, and body size if needed.

Parameters:
headerHeader of status message
borderDefault header border: SM_BORDER[]
hsizeDefault header size for all objects: SM_HDRSZ
bsizeDefault body size for all objects: SM_BODYSZ

void  setHeader (const string hd, const string bdr = SM_BORDER)

Set header of message along with boarder style if needed

Parameters:
hdHeader
bdrHeader border

void  setBoader (const string bdr)

Set boarder style

Parameters:
bdrHeader border

void  setBody (const string bdy, const string ag = SM_NULL)

Set body of message along with one string argument if needed

Parameters:
bdyStatus message
agArgument associated with message. Only able to handle one but might handle more in the future if needed. By default the argument is none.

void  setBody (const string bdy, const unsigned char& ag)

Same as above but handles an unsigned character for the argument

void  setBody (const string bdy, const unsigned long ag)

Same as above but handles an unsigned integer for the argument

void  setHeaderSize (const short hsz)

[static]

Set header size for all StatusMsg objects. This method can be called either by an object or directly within the class by "StatusMsg::setHeaderSize(size)". If the actual string size of the header is less then this size, then spaces are appended to the header when displayed. And if the string size is greater than this size then the header is truncated when displayed.

Parameters:
hszHeader Size. If 0, then a header is not displayed.

void  setBodySize (const short msz)

[static]

Set message body size for all StatusMsg object. This method can be called either by an object or directly within the class by "StatusMsg::setBodySize(size)". If the actual string size is less than this size and an arguement exists, then spaces are added in between when displayed. And if the string size is greater than this size then the message is truncated when displayed.

Parameters:
msgMessage Body Size

string  getBody ()

[const]

Returns: body of message

string  getArgument ()

[const]

Returns: argument of message

void  printMsg (ostream& out = cout)

[const]

Display status message with the appropriate formatting of the header and message body along with its argument if it exists. A default message would look something like:


 |header|  Default Message               [Argument]

Parameters:
outostream to output onto (default: cout)


Generated on Fri Mar 9 02:04:42 2001, using kdoc 2.0a43.