CppUnit project page FAQ

Message.h
Go to the documentation of this file.
1 #ifndef CPPUNIT_MESSAGE_H
2 #define CPPUNIT_MESSAGE_H
3 
4 #include <cppunit/Portability.h>
5 
6 #if CPPUNIT_NEED_DLL_DECL
7 #pragma warning( push )
8 #pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z
9 #endif
10 
11 #include <deque>
12 #include <string>
13 
14 
16 
17 
35 {
36 public:
37  Message() {};
38 
39  // Ensure thread-safe copy by detaching the string.
40  Message( const Message &other );
41 
42  explicit Message( const std::string &shortDescription );
43 
44  Message( const std::string &shortDescription,
45  const std::string &detail1 );
46 
47  Message( const std::string &shortDescription,
48  const std::string &detail1,
49  const std::string &detail2 );
50 
51  Message( const std::string &shortDescription,
52  const std::string &detail1,
53  const std::string &detail2,
54  const std::string &detail3 );
55 
56  virtual ~Message();
57 
58  Message &operator =( const Message &other );
59 
63  const std::string &shortDescription() const;
64 
68  int detailCount() const;
69 
75  std::string detailAt( int index ) const;
76 
90  std::string details() const;
91 
94  void clearDetails();
95 
99  void addDetail( const std::string &detail );
100 
105  void addDetail( const std::string &detail1,
106  const std::string &detail2 );
107 
113  void addDetail( const std::string &detail1,
114  const std::string &detail2,
115  const std::string &detail3 );
116 
120  void addDetail( const Message &message );
121 
125  void setShortDescription( const std::string &shortDescription );
126 
131  bool operator ==( const Message &other ) const;
132 
137  bool operator !=( const Message &other ) const;
138 
139 private:
140  std::string m_shortDescription;
141 
142  typedef std::deque<std::string> Details;
144 };
145 
146 
148 
149 #if CPPUNIT_NEED_DLL_DECL
150 #pragma warning( pop )
151 #endif
152 
153 
154 #endif // CPPUNIT_MESSAGE_H
#define CPPUNIT_API
Definition: CppUnitApi.h:27
#define CPPUNIT_NS_END
Definition: Portability.h:106
#define CPPUNIT_NS_BEGIN
Definition: Portability.h:105
Message associated to an Exception.A message is composed of two items:
Definition: Message.h:35
std::string m_shortDescription
Definition: Message.h:140
Message()
Definition: Message.h:37
Details m_details
Definition: Message.h:143
std::deque< std::string > Details
Definition: Message.h:142

Send comments to:
CppUnit Developers