[Cppunit-cvs] cppunit2/include/cpptl enumerator.h,1.7,1.8
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2005-11-07 22:43:24
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30871/include/cpptl Modified Files: enumerator.h Log Message: - replaced usage of OpenTest::Properties with Json::Value. Json::Value provides a simpler interface and a standard *simple* serialization format. - jsoncpp has been inlined in CppTL to make deploy easier and remove an external dependency. Index: enumerator.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/enumerator.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** enumerator.h 23 Feb 2005 22:07:39 -0000 1.7 --- enumerator.h 7 Nov 2005 22:43:07 -0000 1.8 *************** *** 238,242 **** { CPPTL_ENUMERATOR_CHECK_CURRENT; ! return *static_cast<const value_type *>(0); } --- 238,242 ---- { CPPTL_ENUMERATOR_CHECK_CURRENT; ! throw StopEnumerationError(); } *************** *** 851,854 **** --- 851,867 ---- + template<class ValueType> + class AddressOfAdaptor + { + public: + typedef ValueType *value_type; + + value_type operator()( const ValueType &value ) const + { + return &value; + } + }; + + namespace Enum { *************** *** 995,998 **** --- 1008,1022 ---- + template<class EnumeratorType> + TransformEnumerator< AddressOfAdaptor<CPPTL_TYPENAME EnumeratorType::value_type>, + EnumeratorType > + addressOfTransform( const EnumeratorType &enumerator ) + { + typedef AddressOfAdaptor<CPPTL_TYPENAME EnumeratorType::value_type> Adaptor; + typedef TransformEnumerator< Adaptor, EnumeratorType > EnumType; + return EnumType( enumerator, adaptor ); + } + + template<class EnumeratorType ,class Predicate> *************** *** 1151,1154 **** --- 1175,1186 ---- + template<class EnumeratorType> + AnyEnumerator<CPPTL_TYPENAME EnumeratorType::value_type *> + anyAddressOfTransform( const EnumeratorType &enumerator ) + { + return any( addressOfTransform( enumerator ) ); + } + + template<class EnumeratorType ,class Predicate> |