summaryrefslogtreecommitdiffstats
blob: 917d75414eb7f4a292b2818b2d4f404e71980188 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef CPPUNIT_ADDITIONALMESSAGE_H
#define CPPUNIT_ADDITIONALMESSAGE_H

#include <cppunit/Message.h>


CPPUNIT_NS_BEGIN


/*! \brief An additional Message for assertions.
 * \ingroup CreatingNewAssertions
 *
 * 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:
 * \code
 * 
 *   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 )
 * \endcode
 *
 * In the previous example, the user can specify a simple string for \a message,
 * or a complex Message object.
 *
 * \see Message
 */
class CPPUNIT_API AdditionalMessage : public Message
{
public:
  typedef Message SuperClass;

  /// Constructs an empty Message.
  AdditionalMessage();

  /*! \brief Constructs a Message with the specified detail string.
   * \param detail1 Detail string of the message. If empty, then it is not added.
   */
  AdditionalMessage( const std::string &detail1 );

  /*! \brief Constructs a Message with the specified detail string.
   * \param detail1 Detail string of the message. If empty, then it is not added.
   */
  AdditionalMessage( const char *detail1 );

  /*! \brief Constructs a copy of the specified message.
   * \param other Message to copy.
   */
  AdditionalMessage( const Message &other );

  /*! \brief Assignment operator.
   * \param other Message to copy.
   * \return Reference on this object.
   */
  AdditionalMessage &operator =( const Message &other );

private:
};


CPPUNIT_NS_END



#endif  // CPPUNIT_ADDITIONALMESSAGE_H