cxx_demangle.C

00001 /*
00002  * This file is part of the "Archon" framework.
00003  * (http://files3d.sourceforge.net)
00004  *
00005  * Copyright © 2002 by Kristian Spangsege and Brian Kristiansen.
00006  *
00007  * Permission to use, copy, modify, and distribute this software and
00008  * its documentation under the terms of the GNU General Public License is
00009  * hereby granted. No representations are made about the suitability of
00010  * this software for any purpose. It is provided "as is" without express
00011  * or implied warranty. See the GNU General Public License
00012  * (http://www.gnu.org/copyleft/gpl.html) for more details.
00013  *
00014  * The characters in this file are ISO8859-1 encoded.
00015  *
00016  * The documentation in this file is in "Doxygen" style
00017  * (http://www.doxygen.org).
00018  */
00019 
00020 #include <cxxabi.h>
00021 
00022 #include <archon/util/cxx_demangle.H>
00023 
00024 using namespace std;
00025 
00026 namespace Archon
00027 {
00028   namespace Utilities
00029   {
00030     string cxxDemangle(string mangledName)
00031     {
00032 #if __GNUC__ < 3 || __GNUC__ == 3 && __GNUC_MINOR__ < 2
00033       return mangledName;
00034 #else
00035       const size_t bufferSize = 256;
00036       char buffer[bufferSize];
00037       size_t size = bufferSize;
00038       int status = 0;
00039       abi::__cxa_demangle(mangledName.c_str(), buffer, &size, &status);
00040       return status ? mangledName : buffer;
00041 #endif
00042     }
00043   }
00044 }

Generated on Sun Jul 30 22:55:44 2006 for Archon by  doxygen 1.4.4