All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
demangle.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_BASE_ARCH_DEMANGLE_H
25 #define PXR_BASE_ARCH_DEMANGLE_H
26 
27 #if !defined(__cplusplus)
28 #error This include file can only be included in C++ programs.
29 #endif
30 
34 
35 #include "pxr/pxr.h"
36 #include "pxr/base/arch/api.h"
37 #include <string>
38 #include <typeinfo>
39 #include <typeindex>
40 
41 PXR_NAMESPACE_OPEN_SCOPE
42 
45 
55 ARCH_API bool ArchDemangle(std::string* typeName);
56 
63 ARCH_API std::string
64 ArchGetDemangled(const std::string& typeName);
65 
70 ARCH_API std::string
71 ArchGetDemangled(const char *typeName);
72 
79 inline std::string
80 ArchGetDemangled(const std::type_info& typeInfo) {
81  return ArchGetDemangled(typeInfo.name());
82 }
83 
90 inline std::string
91 ArchGetDemangled(const std::type_index& typeIndex) {
92  return ArchGetDemangled(typeIndex.name());
93 }
94 
101 template <typename T>
102 inline std::string
104  return ArchGetDemangled(typeid(T).name());
105 }
106 
108 
110 ARCH_API
111 void Arch_DemangleFunctionName(std::string* functionName);
112 
113 PXR_NAMESPACE_CLOSE_SCOPE
114 
115 #endif // PXR_BASE_ARCH_DEMANGLE_H
ARCH_API std::string ArchGetDemangled(const std::string &typeName)
Return demangled RTTI-generated type name.
ARCH_API bool ArchDemangle(std::string *typeName)
Demangle RTTI-generated type name.