CppUnit project page | FAQ

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 <cppunit/portability/CppUnitDeque.h>
12 #include <string>
13
14
15 CPPUNIT_NS_BEGIN
16
17
18 #if CPPUNIT_NEED_DLL_DECL
19 // template class CPPUNIT_API std::deque<std::string>;
20 #endif
21
38 class CPPUNIT_API Message
39 {
40 public:
41 Message();
42
43 // Ensure thread-safe copy by detaching the string.
44 Message( const Message &other );
45
46 explicit Message( const std::string &shortDescription );
47
48 Message( const std::string &shortDescription,
49 const std::string &detail1 );
50
51 Message( const std::string &shortDescription,
52 const std::string &detail1,
53 const std::string &detail2 );
54
55 Message( const std::string &shortDescription,
56 const std::string &detail1,
57 const std::string &detail2,
58 const std::string &detail3 );
59
60 ~Message();
61
62 Message &operator =( const Message &other );
63
67 const std::string &shortDescription() const;
68
72 int detailCount() const;
73
79 std::string detailAt( int index ) const;
80
94 std::string details() const;
95
98 void clearDetails();
99
103 void addDetail( const std::string &detail );
104
109 void addDetail( const std::string &detail1,
110 const std::string &detail2 );
111
117 void addDetail( const std::string &detail1,
118 const std::string &detail2,
119 const std::string &detail3 );
120
124 void addDetail( const Message &message );
125
129 void setShortDescription( const std::string &shortDescription );
130
135 bool operator ==( const Message &other ) const;
136
141 bool operator !=( const Message &other ) const;
142
143 private:
144 std::string m_shortDescription;
145
146 typedef CppUnitDeque<std::string> Details;
147 Details m_details;
148 };
149
150
151 CPPUNIT_NS_END
152
153 #if CPPUNIT_NEED_DLL_DECL
154 #pragma warning( pop )
155 #endif
156
157
158 #endif // CPPUNIT_MESSAGE_H
Portability.h
Message::m_details
Details m_details
Definition: Message.h:147
Message::Details
CppUnitDeque< std::string > Details
Definition: Message.h:146
CPPUNIT_NS_END
#define CPPUNIT_NS_END
Definition: Portability.h:120
CPPUNIT_NS_BEGIN
#define CPPUNIT_NS_BEGIN
Definition: Portability.h:119
Message
Message associated to an Exception.A message is composed of two items:
Definition: Message.h:38
CppUnitDeque.h
Message::m_shortDescription
std::string m_shortDescription
Definition: Message.h:144
CPPUNIT_API
#define CPPUNIT_API
Definition: CppUnitApi.h:27

| Send comments to: CppUnit Developers