demangle.cc
Go to the documentation of this file.
00001 /* -*- C++ -*-
00002  * $Id$
00003  */
00004 #include "utilmm/demangle/demangle.hh"
00005 
00006 #if 1 // This will be replaced by a test checking <cxxabi.h>
00007 # include <cxxabi.h> 
00008 #include <cstdlib>
00009 
00010 std::string utilmm::demangle(char const *name) {
00011   int status;
00012   char *real_name;
00013 
00014   real_name = abi::__cxa_demangle(name, 0, 0, &status);
00015   /*
00016    * I have to know exactly the meaning of status (The only thing I know is
00017    * that 0 => OK)
00018    *
00019    * Currently we will consider that the name is OK
00020    */
00021   std::string result(real_name);
00022   free(real_name); // CXX abi is in C
00023                    // so we use C functions for memory
00024   return result;
00025 }
00026 
00027 #else 
00028 
00029 # warning "Name demangling is not supported here"
00030 
00031 std::string utilmm::demangle(char const *name) {
00032   std::string result(name);
00033   return result;
00034 }
00035 
00036 #endif // if 1 


utilmm
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Mon Oct 6 2014 03:17:01