Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

MCMsg Class Reference

A message contains a string, a code number and a level. More...

#include <mcllib/MCMsg.h>

Inheritance diagram for MCMsg:

MCSrcMsg List of all members.

Public Types

typedef unsigned long msgcode_t
 message codes for message number
typedef unsigned long msglevel_t

Public Member Functions

msgcode_t getCode () const
 Get the msgCode of the message.
const MCStringgetCodeString () const
 Get the msgCode as a text string.
msglevel_t getLevel () const
 Get the level number of the message.
const MCStringgetLevelString () const
 Get the output level of this message as a string.
const MCStringgetString () const
 Get the original message text provided at construction time.
virtual MCString getText () const
 Get the entire msg as an MCString.
 MCMsg (const MCString &msg, msglevel_t msgLevel=MSGLVL_ALL, msgcode_t msgCode=MSGCODE_NONE)
 Construct a message.
virtual ~MCMsg ()
 Virtual destructor.

Static Public Member Functions

const MCStringgetCodeString (msgcode_t code)
 Get a specific msgCode as a text string.
const MCStringgetLevelString (msglevel_t lvl)
 Get a specific output level as a string.

Static Public Attributes

msgcode_t MSGCODE_MAX
 Maximum system supplied message number.
msgcode_t MSGCODE_MIN
 Minimum system supplied message number.
msgcode_t MSGCODE_NONE
 no message code - the default
msglevel_t MSGLVL_ALL
 A message which is always produced (copyright, banner etc.).
msglevel_t MSGLVL_DEBUG
 Debug message.
msglevel_t MSGLVL_DEBUG_L1
 Debug message.
msglevel_t MSGLVL_DEBUG_L2
 Low level debug message.
msglevel_t MSGLVL_DEBUG_L3
 Low level debug message.
msglevel_t MSGLVL_DEBUG_L4
 Low level debug message.
msglevel_t MSGLVL_ERROR
 Indicates an error message.
msglevel_t MSGLVL_FATAL
 Indicates a fatal message.
msglevel_t MSGLVL_INFO
 Indicates an informational message.
msglevel_t MSGLVL_WARN
msglevel_t MSGLVL_WARNING
 Indicates a warning (system operational).

Protected Attributes

MCString m_msg
msgcode_t m_msgCode
msglevel_t m_msgLevel

Detailed Description

A message contains a string, a code number and a level.

The string is descriptive text. The code number identifies the descriptive text in a message catalog. The level indicates the priority of the message. This allows different priority messages to be directed, routed and filtered. The library logging functions use the level to determine if the message should be directed to the log file or discarded.


Constructor & Destructor Documentation

MCMsg const MCString msg,
msglevel_t  msgLevel = MSGLVL_ALL,
msgcode_t  msgCode = MSGCODE_NONE
 

Construct a message.

A message denotes an textual message contained in a source file.

Parameters:
msg provides the default text for the message if no translation is available in the message catalog for the msgCode.
msgLevel indicates the output level of the message.
msgCode a code corresponding to the message which may be used to retrieve localized text for the message.
Todo:
implement message catalogs


Member Function Documentation

msgcode_t getCode  )  const
 

Get the msgCode of the message.

Returns:
the msgCode of the message

const MCString& getCodeString msgcode_t  code  )  [static]
 

Get a specific msgCode as a text string.

Parameters:
code the code to obtain a string for
Returns:
the msgCode as a text string

const MCString& getCodeString  )  const
 

Get the msgCode as a text string.

Returns:
the msgCode as a text string

msglevel_t getLevel  )  const
 

Get the level number of the message.

Returns:
the level number of the message

const MCString& getLevelString msglevel_t  lvl  )  [static]
 

Get a specific output level as a string.

Parameters:
lvl the level to obtain a string for
Returns:
the output level as a text string

const MCString& getLevelString  )  const
 

Get the output level of this message as a string.

Returns:
the output level as a text string (e.g. "ERROR")

const MCString& getString  )  const
 

Get the original message text provided at construction time.

Returns:
the original message text

virtual MCString getText  )  const [virtual]
 

Get the entire msg as an MCString.

Returns:
the entire message formatted as a string

Reimplemented in MCSrcMsg.


Member Data Documentation

msglevel_t MSGLVL_FATAL [static]
 

Indicates a fatal message.

Fatal messages should be reserved for catastrophic problems which will prevent the application from continuing. i.e. they indicate unrecoverable situations after which the application will terminate


Generated on Wed Jan 12 19:05:49 2005 for MCLLIB by  doxygen 1.3.9.1