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

Message Class Reference

Represents a message which can be passed from the error/warning/... (generating) functions via the message manager to all the message handlers. More...

#include <message.h>

Collaboration diagram for Message:

Collaboration graph
[legend]
List of all members.

Public Types

enum  Type {
  MTNone = 0x00000000, MTFatal = 0x00000001, MTError = 0x00000002, MTWarning = 0x00000004,
  MTAnyDebug = 0xfffffff8, MTAllNonDebug = 0x00000007, MTAll = 0xffffffff
}
 Message type bitfield. Limited to 32 bits. More...


Public Member Functions

 Message (Type t)
 Construct empty message of given type.

 Message (const Message &m)
 Copy constructor; copy message.

 Message (Type t, const TLString &msg)
 Create message with specified type and message string.

 Message (Type t, const TLString &msg, const SCLocation &l)
 Create message with specified type, message string and location.

 Message (Type t, const TLString &msg, const SCLocationRange &l)
 Create message with specified type, message string and loc. range.

 Message (const SError &e, const SCLocation &l=SCLocation())
 Create message from error.

 ~Message ()
 Destructor; no-op.

Messageoperator= (const Message &m)
 Assignment works by copying the message.

Type type () const
 Get message type:.

const SCLocationlocation () const
 Get the (start) location (if any):.

const SCLocationRangeLocationRange () const
 Get the location (range) (if any; end loc is NULL for non-range):.

const TLStringmsg () const
 Get message text:.

bool MatchesTypeMask (Type t) const
 Returns 1 if this message matches the passed type mask.


Private Attributes

TLString msgstr
SCLocationRange loc
Type mtype
 Type of this message (only 1 bit set).


Detailed Description

Represents a message which can be passed from the error/warning/... (generating) functions via the message manager to all the message handlers.

This class is completely "C++-safe".

Definition at line 70 of file message.h.


Member Enumeration Documentation

enum Message::Type
 

Message type bitfield. Limited to 32 bits.

This is limited to 32 types as the manager internally uses an atomic integer for them. The library routines do not have to know about the various debug message types, however the message handlers maybe should.

NOTE: The least significant 3 bits are reserved for the built-in types (fatal, error, warning); all other bits may be used by the application level for different verbose messages.

Enumeration values:
MTNone  no message type
MTFatal  fatal message (abort afterwards)
MTError  error message
MTWarning  warning message
MTAnyDebug  any/all debug message types
MTAllNonDebug  all non-debug messages
MTAll  simply all :)

Definition at line 85 of file message.h.

Referenced by type().


Constructor & Destructor Documentation

Message::Message Type  t  )  [inline]
 

Construct empty message of given type.

Definition at line 105 of file message.h.

References loc, msgstr, and mtype.

Message::Message const Message m  )  [inline]
 

Copy constructor; copy message.

Definition at line 107 of file message.h.

References loc, msgstr, and mtype.

Message::Message Type  t,
const TLString msg
[inline]
 

Create message with specified type and message string.

Definition at line 110 of file message.h.

References loc, msg(), msgstr, and mtype.

Message::Message Type  t,
const TLString msg,
const SCLocation l
[inline]
 

Create message with specified type, message string and location.

Definition at line 113 of file message.h.

References loc, msgstr, and mtype.

Message::Message Type  t,
const TLString msg,
const SCLocationRange l
[inline]
 

Create message with specified type, message string and loc. range.

Definition at line 116 of file message.h.

References loc, msgstr, and mtype.

Message::Message const SError e,
const SCLocation l = SCLocation()
 

Create message from error.

Message type will be TNError for code>0, TNWarning for code<0 and empty for code=0 (success).

Definition at line 139 of file message.cc.

Message::~Message  )  [inline]
 

Destructor; no-op.

Definition at line 126 of file message.h.


Member Function Documentation

const SCLocation& Message::location  )  const [inline]
 

Get the (start) location (if any):.

Definition at line 137 of file message.h.

References loc, and SCLocationRange::loc0.

Referenced by MessageHandler_Console::HandleMessage().

const SCLocationRange& Message::LocationRange  )  const [inline]
 

Get the location (range) (if any; end loc is NULL for non-range):.

Definition at line 141 of file message.h.

References loc.

Referenced by MessageHandler_Console::HandleMessage().

bool Message::MatchesTypeMask Type  t  )  const [inline]
 

Returns 1 if this message matches the passed type mask.

Definition at line 149 of file message.h.

References mtype.

Referenced by MessageManager::_PostMessage().

const TLString& Message::msg  )  const [inline]
 

Get message text:.

Definition at line 145 of file message.h.

References msgstr.

Referenced by MessageHandler_Console::HandleMessage(), and Message().

Message& Message::operator= const Message m  )  [inline]
 

Assignment works by copying the message.

Definition at line 129 of file message.h.

References loc, msgstr, and mtype.

Type Message::type  )  const [inline]
 

Get message type:.

Definition at line 133 of file message.h.

References mtype, and Type.

Referenced by MessageManager::_PostMessage(), and MessageHandler_Console::HandleMessage().


Member Data Documentation

SCLocationRange Message::loc [private]
 

Location (range) of message (e.g. for syntax errors); not a _range_ if the end location is NULL.

Definition at line 100 of file message.h.

Referenced by location(), LocationRange(), Message(), and operator=().

TLString Message::msgstr [private]
 

Message string.

Definition at line 97 of file message.h.

Referenced by Message(), msg(), and operator=().

Type Message::mtype [private]
 

Type of this message (only 1 bit set).

Definition at line 101 of file message.h.

Referenced by MatchesTypeMask(), Message(), operator=(), and type().


The documentation for this class was generated from the following files:
Generated on Sat Feb 19 22:35:29 2005 for Ray by doxygen 1.3.5