00001 #ifndef CPPUNIT_TESTPATH_H
00002 #define CPPUNIT_TESTPATH_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 <deque>
00012 #include <string>
00013
00014 CPPUNIT_NS_BEGIN
00015
00016
00017 class Test;
00018
00029 class CPPUNIT_API TestPath
00030 {
00031 public:
00036 TestPath();
00037
00042 TestPath( Test *root );
00043
00051 TestPath( const TestPath &otherPath,
00052 int indexFirst,
00053 int count = -1 );
00054
00070 TestPath( Test *searchRoot,
00071 const std::string &pathAsString );
00072
00076 TestPath( const TestPath &other );
00077
00078 virtual ~TestPath();
00079
00083 virtual bool isValid() const;
00084
00088 virtual void add( Test *test );
00089
00093 virtual void add( const TestPath &path );
00094
00100 virtual void insert( Test *test, int index );
00101
00108 virtual void insert( const TestPath &path, int index );
00109
00114 virtual void removeTests();
00115
00120 virtual void removeTest( int index );
00121
00126 virtual void up();
00127
00131 virtual int getTestCount() const;
00132
00138 virtual Test *getTestAt( int index ) const;
00139
00144 virtual Test *getChildTest() const;
00145
00156 virtual std::string toString() const;
00157
00162 TestPath &operator =( const TestPath &other );
00163
00164 protected:
00169 void checkIndexValid( int index ) const;
00170
00172 typedef std::deque<std::string> PathTestNames;
00173
00180 bool splitPathString( const std::string &pathAsString,
00181 PathTestNames &testNames );
00182
00192 Test *findActualRoot( Test *searchRoot,
00193 const std::string &pathAsString,
00194 PathTestNames &testNames );
00195
00196 protected:
00197 typedef std::deque<Test *> Tests;
00198 Tests m_tests;
00199
00200 };
00201
00202
00203 CPPUNIT_NS_END
00204
00205 #endif // CPPUNIT_TESTPATH_H
00206