[Cppunit-cvs] cppunit2/include/cpptl typename.h,NONE,1.1 config.h,1.8,1.9
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2005-02-28 21:36:33
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19549/cpptl Modified Files: config.h Added Files: typename.h Log Message: * moved cpput/typehelper.h to cpptl/typename.h * renamed helper functions: getObjectTypeName(), getTypeName() and demangleTypeInfoName() * With mingw, typeinfo name is correctly extracted (skip initial digits) * added automatic detection of the presence of RTTI with msvc. Index: config.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/config.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** config.h 27 Feb 2005 09:56:18 -0000 1.8 --- config.h 28 Feb 2005 21:36:19 -0000 1.9 *************** *** 39,42 **** --- 39,47 ---- # pragma warning( disable : 4180 ) // qualifier applied to function type has no meaning # endif + + # ifndef _CPPRTTI // RTTI is not enabled + # define CPPTL_NO_RTTI + # endif + # endif --- NEW FILE: typename.h --- #ifndef CPPTL_TYPENAME_H_INCLUDED # define CPPTL_TYPENAME_H_INCLUDED # include <cpptl/forwards.h> # include <cpptl/conststring.h> # ifndef CPPTL_NO_RTTI # include <cpptl/stringtools.h> # include <typeinfo> # endif namespace CppTL { # ifndef CPPTL_NO_RTTI inline CppTL::ConstString CPPUT_API demangleTypeInfoName( const std::type_info &type ) { CppTL::ConstString typeName( type.name() ); const int classKeywordLength = 6; size_type startIndex = 0; if ( typeName.substr( 0, classKeywordLength ) == "class " ) startIndex = classKeywordLength; while ( startIndex < typeName.length() && isDigit( typeName[startIndex] ) ) ++startIndex; return typeName.substr(startIndex); } #endif template<class AType> CppTL::ConstString getTypeName( CppTL::Type<AType>, const char *hint ) { # ifndef CPPTL_NO_RTTI return demangleTypeInfoName( typeid( AType ) ); # else return hint; # endif } template<typename Object> CppTL::ConstString getObjectTypeName( const Object &object, const char *hint ) { # ifndef CPPTL_NO_RTTI return demangleTypeInfoName( typeid(object) ); # else return hint; # endif } } // namespace CppUT #endif // CPPTL_TYPENAME_H_INCLUDED |