diff options
Diffstat (limited to 'src/cppunit')
| -rw-r--r-- | src/cppunit/Message.cpp | 21 | ||||
| -rw-r--r-- | src/cppunit/SourceLine.cpp | 25 |
2 files changed, 43 insertions, 3 deletions
diff --git a/src/cppunit/Message.cpp b/src/cppunit/Message.cpp index 85f235e..9d6a0e9 100644 --- a/src/cppunit/Message.cpp +++ b/src/cppunit/Message.cpp @@ -9,6 +9,11 @@ Message::Message() { } +Message::Message( const Message &other ) +{ + *this = other; +} + Message::Message( const std::string &shortDescription ) : m_shortDescription( shortDescription ) @@ -42,6 +47,22 @@ Message::Message( const std::string &shortDescription, addDetail( detail1, detail2, detail3 ); } +Message & +Message::operator =( const Message &other ) +{ + if ( this != &other ) + { + m_shortDescription = other.m_shortDescription.c_str(); + m_details.clear(); + Details::const_iterator it = other.m_details.begin(); + Details::const_iterator itEnd = other.m_details.end(); + while ( it != itEnd ) + m_details.push_back( (*it++).c_str() ); + } + + return *this; +} + const std::string & Message::shortDescription() const diff --git a/src/cppunit/SourceLine.cpp b/src/cppunit/SourceLine.cpp index bd70709..dfadae3 100644 --- a/src/cppunit/SourceLine.cpp +++ b/src/cppunit/SourceLine.cpp @@ -10,11 +10,30 @@ SourceLine::SourceLine() : } +SourceLine::SourceLine( const SourceLine &other ) + : m_fileName( other.m_fileName.c_str() ) + , m_lineNumber( other.m_lineNumber ) +{ +} + + SourceLine::SourceLine( const std::string &fileName, - int lineNumber ) : - m_fileName( fileName ), - m_lineNumber( lineNumber ) + int lineNumber ) + : m_fileName( fileName.c_str() ) + , m_lineNumber( lineNumber ) +{ +} + + +SourceLine & +SourceLine::operator =( const SourceLine &other ) { + if ( this != &other ) + { + m_fileName = other.m_fileName.c_str(); + m_lineNumber = other.m_lineNumber; + } + return *this; } |
