ROSE  0.11.51.0
Demangler.h
1 #ifndef ROSE_BinaryAnalysis_Demangler_H
2 #define ROSE_BinaryAnalysis_Demangler_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
5 
6 namespace Rose {
7 namespace BinaryAnalysis {
8 
9 class Demangler {
10 public:
11  typedef Sawyer::Container::Map<std::string /*mangled*/, std::string /*non-mangled*/> NameMap;
12 
13 private:
14  boost::filesystem::path cxxFiltExe_; // name or path of the c++filt command ($PATH is used to search)
15  NameMap nameMap_; // cache of de-mangled names
16  std::string compiler_; // format of mangled names
17 
18 public:
25  const boost::filesystem::path& cxxFiltExe() const { return cxxFiltExe_; }
26  void cxxFiltExe(const boost::filesystem::path &p) { cxxFiltExe_ = p; }
47  const std::string& compiler() const { return compiler_; }
48  void compiler(const std::string &s) { compiler_ = s; }
55  void fillCache(const std::vector<std::string> &mangledNames);
56 
64  std::string demangle(const std::string &mangledName);
65 
67  void clear() { nameMap_.clear(); }
68 
70  size_t size() const { return nameMap_.size(); }
71 
73  const NameMap& allNames() const { return nameMap_; }
74 
78  void insert(const std::string &mangledName, const std::string &demangledName);
79 };
80 
81 } // namespace
82 } // namespace
83 
84 #endif
85 #endif
void insert(const std::string &mangledName, const std::string &demangledName)
Insert a mangled/demangled pair.
void fillCache(const std::vector< std::string > &mangledNames)
Demangle lots of names.
Main namespace for the ROSE library.
Map & clear()
Remove all nodes.
Definition: Sawyer/Map.h:680
void clear()
Clear the cache.
Definition: Demangler.h:67
std::string demangle(const std::string &mangledName)
Demangle one name.
const boost::filesystem::path & cxxFiltExe() const
Property: Name of c++filt program.
Definition: Demangler.h:25
const NameMap & allNames() const
Map of all cached names.
Definition: Demangler.h:73
void cxxFiltExe(const boost::filesystem::path &p)
Property: Name of c++filt program.
Definition: Demangler.h:26
size_t size() const
Number of items in the cache.
Definition: Demangler.h:70
const std::string & compiler() const
Property: Format of mangled names.
Definition: Demangler.h:47
void compiler(const std::string &s)
Property: Format of mangled names.
Definition: Demangler.h:48
size_t size() const
Number of nodes, keys, or values in this container.
Definition: Sawyer/Map.h:386
Container associating values with keys.
Definition: Sawyer/Map.h:66