MCPcopy Create free account
hub / github.com/FlightGear/flightgear / getClassName

Method getClassName

3rdparty/cppunit/src/cppunit/TypeInfoHelper.cpp:12–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10
11
12CPPUNIT_NS_BEGIN
13
14std::string
15TypeInfoHelper::getClassName( const std::type_info &info )
16{
17#if defined(CPPUNIT_HAVE_GCC_ABI_DEMANGLE) && CPPUNIT_HAVE_GCC_ABI_DEMANGLE
18
19 int status = 0;
20 char* c_name = 0;
21
22 const char* c_origName = info.name();
23 if(c_origName[0] == '*')
24 ++c_origName;
25 c_name = abi::__cxa_demangle( c_origName, 0, 0, &status );
26
27 std::string name;
28 if(c_name)
29 {
30 name = std::string( c_name );
31 free( c_name );
32 }
33 else
34 {
35 name = std::string( c_origName );
36 }
37
38#else // CPPUNIT_HAVE_GCC_ABI_DEMANGLE
39
40 static std::string classPrefix( "class " );
41 std::string name( info.name() );
42
43 // Work around gcc 3.0 bug: strip number before type name.
44 unsigned int firstNotDigitIndex = 0;
45 while ( firstNotDigitIndex < name.length() &&
46 name[firstNotDigitIndex] >= '0' &&
47 name[firstNotDigitIndex] <= '9' )
48 ++firstNotDigitIndex;
49 name = name.substr( firstNotDigitIndex );
50
51 if ( name.substr( 0, classPrefix.length() ) == classPrefix )
52 return name.substr( classPrefix.length() );
53
54#endif // CPPUNIT_HAVE_GCC_ABI_DEMANGLE
55
56 return name;
57}
58
59CPPUNIT_NS_END

Callers

nothing calls this directly

Calls 1

nameMethod · 0.45

Tested by

no test coverage detected