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

MCSrcMsg Class Reference

A source message is an MCMsg with a file and line number. More...

#include <mcllib/MCSrcMsg.h>

Inheritance diagram for MCSrcMsg:

MCMsg List of all members.

Public Types

typedef const char * filename_t
 Typedef for the file name of the module in the source program.
typedef unsigned long linenum_t
 Typedef for a line number in the source program.

Public Member Functions

const MCStringgetFileName () const
 Get the file name.
const linenum_t getLineNum () const
 Get the line number.
virtual MCString getText () const
 Get the text of the source message as a string.
bool hasSrc () const
 Determine if the source is defined.
 MCSrcMsg (const MCMsg &msg, filename_t fileName=0, linenum_t lineNum=0)
 Construct from an MCMsg.
 MCSrcMsg (const char *msg, filename_t fileName=0, linenum_t lineNum=0, msglevel_t msgLevel=MSGLVL_ALL, msgcode_t msgCode=MSGCODE_NONE)
 Construct a source message.
virtual ~MCSrcMsg ()
 Virtual destructor.

Protected Member Functions

 MCSrcMsg (const MCSrcMsg &msg, msglevel_t msgLevel)
 Construct from a SrcMsg and a message level.
void setFile (const char *fileName)
 Set the file name.
void setLine (linenum_t lineNum)
 Set the line number.
void setString (const MCString &mcs)
 Set the message from a string.

Protected Attributes

MCString m_fileName
 source code file name
linenum_t m_line
 source code line number

Friends

class MCExcept
class MCExceptFatal

Detailed Description

A source message is an MCMsg with a file and line number.

Source messages are primarily used in a source file/line that a message relates to (for instance when exceptions are generated). It is unlikely that developers will construct objects of this class or further derive from it as it is primarily used to help with storing exception information when exceptions are generated.


Constructor & Destructor Documentation

MCSrcMsg const char *  msg,
filename_t  fileName = 0,
linenum_t  lineNum = 0,
msglevel_t  msgLevel = MSGLVL_ALL,
msgcode_t  msgCode = MSGCODE_NONE
 

Construct a source message.

Parameters:
msg provides the default text for the message if no translation is available in the message catalog for the msgCode.
fileName the name of the source code file the message relates to.
lineNum the line number in the source code file.
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

MCSrcMsg const MCMsg msg,
filename_t  fileName = 0,
linenum_t  lineNum = 0
 

Construct from an MCMsg.

fileName is the name of the source code file which the message relates to. lineNum is the line number in the source code file.

Parameters:
msg the MCMsg to obtain message text, level and code from.
fileName the name of the source code file the message relates to.
lineNum the line number in the source code file.

MCSrcMsg const MCSrcMsg msg,
msglevel_t  msgLevel
[protected]
 

Construct from a SrcMsg and a message level.

The specified message level overrides the one in the msg

Parameters:
msg the source message to use
msgLevel the message level to use


Member Function Documentation

const MCString& getFileName  )  const
 

Get the file name.

Returns:
the file name.

const linenum_t getLineNum  )  const
 

Get the line number.

Returns:
the line number.

virtual MCString getText  )  const [virtual]
 

Get the text of the source message as a string.

Returns:
the formatted components of the source message as a string.

Reimplemented from MCMsg.

bool hasSrc  )  const
 

Determine if the source is defined.

Returns:
true if source is defined (i.e. the line number is non-zero).

void setFile const char *  fileName  )  [protected]
 

Set the file name.

Parameters:
fileName the name of the file to use

void setLine linenum_t  lineNum  )  [protected]
 

Set the line number.

Parameters:
lineNum the line number to use

void setString const MCString mcs  )  [protected]
 

Set the message from a string.

Parameters:
mcs the string to use for the message


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