g2o
Loading...
Searching...
No Matches
Functions
viewer_properties_widget.cpp File Reference
#include "viewer_properties_widget.h"
#include <QLineEdit>
#include <cassert>
#include <iostream>
#include "g2o/stuff/property.h"
#include "g2o_qglviewer.h"
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

◆ demangleName()

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

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

Definition at line 39 of file viewer_properties_widget.cpp.

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

Referenced by ViewerPropertiesWidget::humanReadablePropName().