[Cppunit-cvs] cppunit2/include/opentest properties.h,1.8,1.9
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2004-11-21 22:28:01
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27414/include/opentest Modified Files: properties.h Log Message: * fixed bug in Properties::hasList() * added PropertiesAccessor::listValues() Index: properties.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/properties.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** properties.h 20 Nov 2004 16:17:33 -0000 1.8 --- properties.h 21 Nov 2004 22:26:32 -0000 1.9 *************** *** 218,268 **** - /// Helper to navigate the property tree in read-only mode and - /// avoid testing if every single node exist. - class OPENTEST_API PropertiesAccessor - { - public: - PropertiesAccessor( const Properties *properties = 0 ); - - PropertiesAccessor operator[]( unsigned int index ) const; - - PropertiesAccessor operator[]( const PropertyPath &path ) const; - - const Properties &properties() const; - - bool isValid() const; - - bool has( const PropertyPath &path ) const; - - const Property &getProperty( const PropertyPath &path ) const; - - /// If the current node is valid then returns the value of the property - /// named 'name', otherwise returns an empty value. - Value getValue( const PropertyPath &path ) const; - - Value at( unsigned int index ) const; - - /// If current node is valid and has a property named 'name' returns its - /// values, otherwise returns the 'defaultValue'. - Value getValue( const PropertyPath &path, - const Value &defaultValue ) const; - - /// If current node is valid and has a indexed value at the specified - //// index returns its values, otherwise returns the 'defaultValue'. - Value at( unsigned int index, - const Value &defaultValue ) const; - - unsigned int listSize() const; - - bool hasList() const; - - private: - const Properties *properties_; - }; - - /* Properties properties; properties["result"]["status"]["general"] = "pass"; // pass, fail, skip properties["result"]["status"]["detail"] = "success"; properties["result"]["duration"] = 163.5; --- 218,225 ---- /* Properties properties; properties["result"]["status"]["general"] = "pass"; // pass, fail, skip + properties["result/status/general"] = "pass"; // pass, fail, skip properties["result"]["status"]["detail"] = "success"; properties["result"]["duration"] = 163.5; *************** *** 384,387 **** --- 341,391 ---- }; + + + /// Helper to navigate the property tree in read-only mode and + /// avoid testing if every single node exist. + class OPENTEST_API PropertiesAccessor + { + public: + PropertiesAccessor( const Properties *properties = 0 ); + + PropertiesAccessor operator[]( unsigned int index ) const; + + PropertiesAccessor operator[]( const PropertyPath &path ) const; + + const Properties &properties() const; + + bool isValid() const; + + bool has( const PropertyPath &path ) const; + + const Property &getProperty( const PropertyPath &path ) const; + + /// If the current node is valid then returns the value of the property + /// named 'name', otherwise returns an empty value. + Value getValue( const PropertyPath &path ) const; + + Value at( unsigned int index ) const; + + /// If current node is valid and has a property named 'name' returns its + /// values, otherwise returns the 'defaultValue'. + Value getValue( const PropertyPath &path, + const Value &defaultValue ) const; + + /// If current node is valid and has a indexed value at the specified + //// index returns its values, otherwise returns the 'defaultValue'. + Value at( unsigned int index, + const Value &defaultValue ) const; + + Properties::ValueEnum listValues() const; + + unsigned int listSize() const; + + bool hasList() const; + + private: + const Properties *properties_; + }; + } // namespace OpenTest |