1
#include <cppunit/Message.h>
12
Message::Message( const Message &other )
18
Message::Message( const std::string &shortDescription )
19
: m_shortDescription( shortDescription )
24
Message::Message( const std::string &shortDescription,
25
const std::string &detail1 )
26
: m_shortDescription( shortDescription )
32
Message::Message( const std::string &shortDescription,
33
const std::string &detail1,
34
const std::string &detail2 )
35
: m_shortDescription( shortDescription )
37
addDetail( detail1, detail2 );
41
Message::Message( const std::string &shortDescription,
42
const std::string &detail1,
43
const std::string &detail2,
44
const std::string &detail3 )
45
: m_shortDescription( shortDescription )
47
addDetail( detail1, detail2, detail3 );
51
Message::operator =( const Message &other )
55
m_shortDescription = other.m_shortDescription.c_str();
57
Details::const_iterator it = other.m_details.begin();
58
Details::const_iterator itEnd = other.m_details.end();
60
m_details.push_back( (*it++).c_str() );
68
Message::shortDescription() const
70
return m_shortDescription;
75
Message::detailCount() const
77
return m_details.size();
82
Message::detailAt( int index ) const
84
if ( index < 0 || index >= detailCount() )
85
throw std::invalid_argument( "Message::detailAt() : invalid index" );
87
return m_details[ index ];
92
Message::details() const
95
for ( Details::const_iterator it = m_details.begin(); it != m_details.end(); ++it )
106
Message::clearDetails()
113
Message::addDetail( const std::string &detail )
115
m_details.push_back( detail );
120
Message::addDetail( const std::string &detail1,
121
const std::string &detail2 )
123
addDetail( detail1 );
124
addDetail( detail2 );
129
Message::addDetail( const std::string &detail1,
130
const std::string &detail2,
131
const std::string &detail3 )
133
addDetail( detail1, detail2 );
134
addDetail( detail3 );
139
Message::addDetail( const Message &message )
141
m_details.insert( m_details.end(),
142
message.m_details.begin(),
143
message.m_details.end() );
148
Message::setShortDescription( const std::string &shortDescription )
150
m_shortDescription = shortDescription;
155
Message::operator ==( const Message &other ) const
157
return m_shortDescription == other.m_shortDescription &&
158
m_details == other.m_details;
163
Message::operator !=( const Message &other ) const
165
return !( *this == other );