CppUnit project page FAQ CppUnit home page

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

AdditionalMessage Class Reference
[Creating custom assertions]

An additional Message for assertions. More...

#include <AdditionalMessage.h>

Inheritance diagram for AdditionalMessage:

Message List of all members.

Public Types

typedef Message SuperClass

Public Member Functions

 AdditionalMessage ()
 Constructs an empty Message.

 AdditionalMessage (const std::string &detail1)
 Constructs a Message with the specified detail string.

 AdditionalMessage (const char *detail1)
 Constructs a Message with the specified detail string.

 AdditionalMessage (const Message &other)
 Constructs a copy of the specified message.

AdditionalMessageoperator= (const Message &other)
 Assignment operator.


Detailed Description

An additional Message for assertions.

Provides a implicit constructor that takes a single string. This allow this class to be used as the message arguments in macros.

The constructed object is either a Message with a single detail string if a string was passed to the macro, or a copy of the Message passed to the macro.

Here is an example of usage:

void checkStringEquals( const std::string &expected, const std::string &actual, const CppUnit::SourceLine &sourceLine, const CppUnit::AdditionalMessage &message ); #define XTLUT_ASSERT_STRING_EQUAL_MESSAGE( expected, actual, message ) \ ::XtlUt::Impl::checkStringEquals( ::Xtl::toString(expected), \ ::Xtl::toString(actual), \ CPPUNIT_SOURCELINE(), \ message )

In the previous example, the user can specify a simple string for message, or a complex Message object.

See also:
Message


Member Typedef Documentation

typedef Message AdditionalMessage::SuperClass
 


Constructor & Destructor Documentation

CPPUNIT_NS_BEGIN AdditionalMessage::AdditionalMessage  ) 
 

Constructs an empty Message.

AdditionalMessage::AdditionalMessage const std::string &  detail1  ) 
 

Constructs a Message with the specified detail string.

Parameters:
detail1 Detail string of the message. If empty, then it is not added.

AdditionalMessage::AdditionalMessage const char *  detail1  ) 
 

Constructs a Message with the specified detail string.

Parameters:
detail1 Detail string of the message. If empty, then it is not added.

AdditionalMessage::AdditionalMessage const Message other  ) 
 

Constructs a copy of the specified message.

Parameters:
other Message to copy.


Member Function Documentation

AdditionalMessage & AdditionalMessage::operator= const Message other  ) 
 

Assignment operator.

Parameters:
other Message to copy.
Returns:
Reference on this object.


The documentation for this class was generated from the following files:
SourceForge Logo hosts this site. Send comments to:
CppUnit Developers