CppUnit project page FAQ CppUnit home page

Message.h
Go to the documentation of this file.
1#ifndef CPPUNIT_MESSAGE_H
2#define CPPUNIT_MESSAGE_H
3
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
12#include <string>
13
14
16
17
18#if CPPUNIT_NEED_DLL_DECL
19// template class CPPUNIT_API std::deque<std::string>;
20#endif
21
39{
40public:
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 &operator =( const Message &other );
61
65 const std::string &shortDescription() const;
66
70 int detailCount() const;
71
77 std::string detailAt( int index ) const;
78
92 std::string details() const;
93
96 void clearDetails();
97
101 void addDetail( const std::string &detail );
102
107 void addDetail( const std::string &detail1,
108 const std::string &detail2 );
109
115 void addDetail( const std::string &detail1,
116 const std::string &detail2,
117 const std::string &detail3 );
118
122 void addDetail( const Message &message );
123
127 void setShortDescription( const std::string &shortDescription );
128
133 bool operator ==( const Message &other ) const;
134
139 bool operator !=( const Message &other ) const;
140
141private:
143
146};
147
148
150
151#if CPPUNIT_NEED_DLL_DECL
152#pragma warning( pop )
153#endif
154
155
156#endif // CPPUNIT_MESSAGE_H
#define CPPUNIT_API
Definition CppUnitApi.h:27
#define CppUnitDeque
Definition CppUnitDeque.h:20
#define CPPUNIT_NS_END
Definition Portability.h:120
#define CPPUNIT_NS_BEGIN
Definition Portability.h:119
std::string detailAt(int index) const
Returns the detail at the specified index.
Definition Message.cpp:82
const std::string & shortDescription() const
Returns the short description.
Definition Message.cpp:68
std::string m_shortDescription
Definition Message.h:142
int detailCount() const
Returns the number of detail string.
Definition Message.cpp:75
Message()
Definition Message.cpp:8
void setShortDescription(const std::string &shortDescription)
Sets the short description.
Definition Message.cpp:148
CppUnitDeque< std::string > Details
Definition Message.h:144
void addDetail(const std::string &detail)
Adds a single detail string.
Definition Message.cpp:113
Details m_details
Definition Message.h:145
void clearDetails()
Removes all detail strings.
Definition Message.cpp:106
std::string details() const
Returns a string that represents a list of the detail strings.
Definition Message.cpp:92

SourceForge Logo hosts this site. Send comments to:
CppUnit Developers