g2o
Functions
viewer_properties_widget.cpp File Reference
#include "viewer_properties_widget.h"
#include "g2o_qglviewer.h"
#include "g2o/stuff/property.h"
#include <QLineEdit>
#include <iostream>
#include <cassert>
Include dependency graph for viewer_properties_widget.cpp:

Go to the source code of this file.

Functions

static std::string demangleName (const std::string &fullPropName)
 

Function Documentation

static std::string demangleName ( const std::string &  fullPropName)
static

demangle the name of a type, depends on the used compiler

Definition at line 40 of file viewer_properties_widget.cpp.

Referenced by ViewerPropertiesWidget::humanReadablePropName().

41 {
42 #ifdef __GNUC__
43  // find :: and extract the mangled class name from the whole string
44  string mangledName;
45  string propName;
46  string::size_type found = fullPropName.rfind("::");
47  if (found != string::npos) {
48  mangledName = fullPropName.substr(0, found);
49  propName = fullPropName.substr(found);
50  } else {
51  mangledName = propName;
52  }
53 
54  int status;
55  char* s = abi::__cxa_demangle(mangledName.c_str(), 0, 0, &status);
56  if (status != 0) {
57  free(s);
58  return fullPropName;
59  } else {
60  std::string demangled(s);
61  free(s);
62  return demangled + propName;
63  }
64 #else
65  // TODO for other compilers
66  return fullPropName;
67 #endif
68 }