source: trunk/contrib/cppunit-1.12.2/include/cppunit/AdditionalMessage.h @ 876

Last change on this file since 876 was 876, checked in by sam, 9 years ago

contrib: add a precompiled Win32 version of CppUnit and update build system
accordingly.

File size: 2.2 KB
Line 
1#ifndef CPPUNIT_ADDITIONALMESSAGE_H
2#define CPPUNIT_ADDITIONALMESSAGE_H
3
4#include <cppunit/Message.h>
5
6
7CPPUNIT_NS_BEGIN
8
9
10/*! \brief An additional Message for assertions.
11 * \ingroup CreatingNewAssertions
12 *
13 * Provides a implicit constructor that takes a single string. This allow this
14 * class to be used as the message arguments in macros.
15 *
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.
18 *
19 * Here is an example of usage:
20 * \code
21 *
22 *   void checkStringEquals( const std::string &expected,
23 *                          const std::string &actual,
24 *                           const CppUnit::SourceLine &sourceLine,
25 *                           const CppUnit::AdditionalMessage &message );
26 * 
27 *   #define XTLUT_ASSERT_STRING_EQUAL_MESSAGE( expected, actual, message )  \
28 *     ::XtlUt::Impl::checkStringEquals( ::Xtl::toString(expected),        \
29 *                                       ::Xtl::toString(actual),          \
30 *                                       CPPUNIT_SOURCELINE(),             \
31 *                                       message )
32 * \endcode
33 *
34 * In the previous example, the user can specify a simple string for \a message,
35 * or a complex Message object.
36 *
37 * \see Message
38 */
39class CPPUNIT_API AdditionalMessage : public Message
40{
41public:
42  typedef Message SuperClass;
43
44  /// Constructs an empty Message.
45  AdditionalMessage();
46
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.
49   */
50  AdditionalMessage( const std::string &detail1 );
51
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.
54   */
55  AdditionalMessage( const char *detail1 );
56
57  /*! \brief Constructs a copy of the specified message.
58   * \param other Message to copy.
59   */
60  AdditionalMessage( const Message &other );
61
62  /*! \brief Assignment operator.
63   * \param other Message to copy.
64   * \return Reference on this object.
65   */
66  AdditionalMessage &operator =( const Message &other );
67
68private:
69};
70
71
72CPPUNIT_NS_END
73
74
75
76#endif  // CPPUNIT_ADDITIONALMESSAGE_H
Note: See TracBrowser for help on using the repository browser.