Imported Upstream version 2.81
[platform/upstream/libbullet.git] / UnitTests / cppunit / include / cppunit / AdditionalMessage.h
1 #ifndef CPPUNIT_ADDITIONALMESSAGE_H
2 #define CPPUNIT_ADDITIONALMESSAGE_H
3
4 #include <cppunit/Message.h>
5
6
7 CPPUNIT_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  */
39 class CPPUNIT_API AdditionalMessage : public Message
40 {
41 public:
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
68 private:
69 };
70
71
72 CPPUNIT_NS_END
73
74
75
76 #endif  // CPPUNIT_ADDITIONALMESSAGE_H