1 #ifndef CPPUNIT_ADDITIONALMESSAGE_H
2 #define CPPUNIT_ADDITIONALMESSAGE_H
4 #include <cppunit/Message.h>
10 /*! \brief An additional Message for assertions.
11 * \ingroup CreatingNewAssertions
13 * Provides a implicit constructor that takes a single string. This allow this
14 * class to be used as the message arguments in macros.
16 * The constructed object is either a Message with a single detail string if
17 * a string was passed to the macro, or a copy of the Message passed to the macro.
19 * Here is an example of usage:
22 * void checkStringEquals( const std::string &expected,
23 * const std::string &actual,
24 * const CppUnit::SourceLine &sourceLine,
25 * const CppUnit::AdditionalMessage &message );
27 * #define XTLUT_ASSERT_STRING_EQUAL_MESSAGE( expected, actual, message ) \
28 * ::XtlUt::Impl::checkStringEquals( ::Xtl::toString(expected), \
29 * ::Xtl::toString(actual), \
30 * CPPUNIT_SOURCELINE(), \
34 * In the previous example, the user can specify a simple string for \a message,
35 * or a complex Message object.
39 class CPPUNIT_API AdditionalMessage : public Message
42 typedef Message SuperClass;
44 /// Constructs an empty Message.
47 /*! \brief Constructs a Message with the specified detail string.
48 * \param detail1 Detail string of the message. If empty, then it is not added.
50 AdditionalMessage( const std::string &detail1 );
52 /*! \brief Constructs a Message with the specified detail string.
53 * \param detail1 Detail string of the message. If empty, then it is not added.
55 AdditionalMessage( const char *detail1 );
57 /*! \brief Constructs a copy of the specified message.
58 * \param other Message to copy.
60 AdditionalMessage( const Message &other );
62 /*! \brief Assignment operator.
63 * \param other Message to copy.
64 * \return Reference on this object.
66 AdditionalMessage &operator =( const Message &other );
76 #endif // CPPUNIT_ADDITIONALMESSAGE_H