CppUnit project page FAQ CppUnit home page

SourceLine.h
Go to the documentation of this file.
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 #if CPPUNIT_NEED_DLL_DECL
00016 #pragma warning( push )
00017 #pragma warning( disable: 4251 )  // X needs to have dll-interface to be used by clients of class Z
00018 #endif 
00019 
00020 CPPUNIT_NS_BEGIN
00021 
00022 
00034 class CPPUNIT_API SourceLine
00035 {
00036 public:
00037   SourceLine();
00038 
00039   // Ensure thread-safe copy by detaching the string buffer.
00040   SourceLine( const SourceLine &other );
00041 
00042   SourceLine( const std::string &fileName,
00043               int lineNumber );
00044 
00045   SourceLine &operator =( const SourceLine &other );
00046 
00048   virtual ~SourceLine();
00049 
00050   bool isValid() const;
00051 
00052   int lineNumber() const;
00053 
00054   std::string fileName() const;
00055 
00056   bool operator ==( const SourceLine &other ) const;
00057   bool operator !=( const SourceLine &other ) const;
00058 
00059 private:
00060   std::string m_fileName;
00061   int m_lineNumber;
00062 };
00063 
00064 
00065 CPPUNIT_NS_END
00066 
00067 #if CPPUNIT_NEED_DLL_DECL
00068 #pragma warning( pop )
00069 #endif
00070 
00071 #endif  // CPPUNIT_SOURCELINE_H

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