00001 #ifndef CPPUNIT_SOURCELINE_H 00002 #define CPPUNIT_SOURCELINE_H 00003 00004 #include <cppunit/Portability.h> 00005 #include <string> 00006 00013 #define CPPUNIT_SOURCELINE() CPPUNIT_NS::SourceLine( __FILE__, __LINE__ ) 00014 00015 00016 CPPUNIT_NS_BEGIN 00017 00018 00030 class CPPUNIT_API SourceLine 00031 { 00032 public: 00033 SourceLine(); 00034 00035 // Ensure thread-safe copy by detaching the string buffer. 00036 SourceLine( const SourceLine &other ); 00037 00038 SourceLine( const std::string &fileName, 00039 int lineNumber ); 00040 00041 SourceLine &operator =( const SourceLine &other ); 00042 00044 virtual ~SourceLine(); 00045 00046 bool isValid() const; 00047 00048 int lineNumber() const; 00049 00050 std::string fileName() const; 00051 00052 bool operator ==( const SourceLine &other ) const; 00053 bool operator !=( const SourceLine &other ) const; 00054 00055 private: 00056 std::string m_fileName; 00057 int m_lineNumber; 00058 }; 00059 00060 00061 CPPUNIT_NS_END 00062 00063 #endif // CPPUNIT_SOURCELINE_H