summaryrefslogtreecommitdiff
path: root/src/cppunit/SourceLine.cpp
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2004-11-19 19:00:44 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2004-11-19 19:00:44 +0000
commit707400b4c6de94a22075b17d8d4ef08fa75813d9 (patch)
tree08bcc0e2b57394ba592b82fafa810c15f4114c29 /src/cppunit/SourceLine.cpp
parente321ba14ae0d69ee07bb90fdb6393b8173809644 (diff)
downloadcppunit-707400b4c6de94a22075b17d8d4ef08fa75813d9.tar.gz
added specific copy constructor implementatin to ensure string buffer are detached during copy (therefore providing thread-safe copy constructor for non thread-safe std::string copy constructor implementation).
Diffstat (limited to 'src/cppunit/SourceLine.cpp')
-rw-r--r--src/cppunit/SourceLine.cpp25
1 files changed, 22 insertions, 3 deletions
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;
}