WPILibC++
2024.3.2
Demangle.h
Go to the documentation of this file.
1
// Copyright (c) FIRST and other WPILib contributors.
2
// Open Source Software; you can modify and/or share it under the terms of
3
// the WPILib BSD license file in the root directory of this project.
4
5
#ifndef WPIUTIL_WPI_DEMANGLE_H_
6
#define WPIUTIL_WPI_DEMANGLE_H_
7
8
#include <string>
9
#include <string_view>
10
#include <typeinfo>
11
12
namespace
wpi
{
13
14
/**
15
* Demangle a C++ symbol.
16
*
17
* @param mangledSymbol the mangled symbol.
18
* @return The demangled symbol, or mangledSymbol if demangling fails.
19
*/
20
std::string
Demangle
(
std::string_view
mangledSymbol);
21
22
/**
23
* Returns the type name of an object
24
* @param type The object
25
*/
26
template
<
typename
T>
27
std::string
GetTypeName
(
const
T&
type
) {
28
return
Demangle
(
typeid
(
type
).name());
29
}
30
31
}
// namespace wpi
32
33
#endif
// WPIUTIL_WPI_DEMANGLE_H_
string_view
basic_string_view< char > string_view
Definition:
core.h:501
detail::type
type
Definition:
core.h:556
wpi
Definition:
ntcore_cpp.h:26
wpi::Demangle
std::string Demangle(std::string_view mangledSymbol)
Demangle a C++ symbol.
wpi::GetTypeName
std::string GetTypeName(const T &type)
Returns the type name of an object.
Definition:
Demangle.h:27
wpi
Demangle.h
Generated on Wed Mar 13 2024 05:20:41 for WPILibC++ by
1.9.4