CppUnit project page FAQ CppUnit home page

Message.h
Go to the documentation of this file.
00001 #ifndef CPPUNIT_MESSAGE_H
00002 #define CPPUNIT_MESSAGE_H
00003 
00004 #include <cppunit/Portability.h>
00005 
00006 #if CPPUNIT_NEED_DLL_DECL
00007 #pragma warning( push )
00008 #pragma warning( disable: 4251 )  // X needs to have dll-interface to be used by clients of class Z
00009 #endif
00010 
00011 #include <cppunit/portability/CppUnitDeque.h>
00012 #include <string>
00013 
00014 
00015 CPPUNIT_NS_BEGIN
00016 
00017 
00018 #if CPPUNIT_NEED_DLL_DECL
00019 //  template class CPPUNIT_API std::deque<std::string>;
00020 #endif
00021 
00038 class CPPUNIT_API Message
00039 {
00040 public:
00041   Message();
00042 
00043   // Ensure thread-safe copy by detaching the string.
00044   Message( const Message &other );
00045 
00046   explicit Message( const std::string &shortDescription );
00047 
00048   Message( const std::string &shortDescription,
00049            const std::string &detail1 );
00050 
00051   Message( const std::string &shortDescription,
00052            const std::string &detail1,
00053            const std::string &detail2 );
00054 
00055   Message( const std::string &shortDescription,
00056            const std::string &detail1,
00057            const std::string &detail2,
00058            const std::string &detail3 );
00059 
00060   ~Message();
00061 
00062   Message &operator =( const Message &other );
00063 
00067   const std::string &shortDescription() const;
00068 
00072   int detailCount() const;
00073 
00079   std::string detailAt( int index ) const;
00080 
00094   std::string details() const;
00095 
00098   void clearDetails();
00099 
00103   void addDetail( const std::string &detail );
00104 
00109   void addDetail( const std::string &detail1,
00110                   const std::string &detail2 );
00111 
00117   void addDetail( const std::string &detail1,
00118                   const std::string &detail2,
00119                   const std::string &detail3 );
00120 
00124   void addDetail( const Message &message );
00125 
00129   void setShortDescription( const std::string &shortDescription );
00130 
00135   bool operator ==( const Message &other ) const;
00136 
00141   bool operator !=( const Message &other ) const;
00142 
00143 private:
00144   std::string m_shortDescription;
00145 
00146   typedef CppUnitDeque<std::string> Details;
00147   Details m_details;
00148 };
00149 
00150 
00151 CPPUNIT_NS_END
00152 
00153 #if CPPUNIT_NEED_DLL_DECL
00154 #pragma warning( pop )
00155 #endif
00156 
00157 
00158 #endif  // CPPUNIT_MESSAGE_H

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