ROSE 0.11.145.192
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#include <Sawyer/Map.h>
7#include <boost/filesystem.hpp>
8#include <string>
9#include <vector>
10
11namespace Rose {
12namespace BinaryAnalysis {
13
15class Demangler {
16public:
17 typedef Sawyer::Container::Map<std::string /*mangled*/, std::string /*non-mangled*/> NameMap;
18
19private:
20 boost::filesystem::path cxxFiltExe_; // name or path of the c++filt command ($PATH is used to search)
21 NameMap nameMap_; // cache of de-mangled names
22 std::string compiler_; // format of mangled names
23
24public:
31 const boost::filesystem::path& cxxFiltExe() const { return cxxFiltExe_; }
32 void cxxFiltExe(const boost::filesystem::path &p) { cxxFiltExe_ = p; }
53 const std::string& compiler() const { return compiler_; }
54 void compiler(const std::string &s) { compiler_ = s; }
61 void fillCache(const std::vector<std::string> &mangledNames);
62
70 std::string demangle(const std::string &mangledName);
71
73 void clear() { nameMap_.clear(); }
74
76 size_t size() const { return nameMap_.size(); }
77
79 const NameMap& allNames() const { return nameMap_; }
80
84 void insert(const std::string &mangledName, const std::string &demangledName);
85};
86
87} // namespace
88} // namespace
89
90#endif
91#endif
Demangle mangled names.
Definition Demangler.h:15
const NameMap & allNames() const
Map of all cached names.
Definition Demangler.h:79
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.
void compiler(const std::string &s)
Property: Format of mangled names.
Definition Demangler.h:54
void cxxFiltExe(const boost::filesystem::path &p)
Property: Name of c++filt program.
Definition Demangler.h:32
const std::string & compiler() const
Property: Format of mangled names.
Definition Demangler.h:53
std::string demangle(const std::string &mangledName)
Demangle one name.
size_t size() const
Number of items in the cache.
Definition Demangler.h:76
void clear()
Clear the cache.
Definition Demangler.h:73
const boost::filesystem::path & cxxFiltExe() const
Property: Name of c++filt program.
Definition Demangler.h:31
Container associating values with keys.
Definition Sawyer/Map.h:72
size_t size() const
Number of nodes, keys, or values in this container.
Definition Sawyer/Map.h:438
Map & clear()
Remove all nodes.
Definition Sawyer/Map.h:732
The ROSE library.