ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
dbgtypedemangler.hpp
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header file is part of the \aliblong. It does not belong to an \alibmod and is
4/// included in any \alibdist.
5///
6/// \emoji :copyright: 2013-2024 A-Worx GmbH, Germany.
7/// Published under \ref mainpage_license "Boost Software License".
8///
9/// \note
10/// To reduce complexity, this header is not shown in inclusion graphs of this documentation.
11//==================================================================================================
12#ifndef HPP_ALIB_LANG_DBGTYPEDEMANGLER
13#define HPP_ALIB_LANG_DBGTYPEDEMANGLER 1
14#pragma once
15#if !defined(DOXYGEN)
16# include "alib/alib.hpp"
17#endif
18
19#if ALIB_DEBUG
20
21#if ALIB_STRINGS
22# include "alib/strings/fwds.hpp"
23#endif
24
25namespace alib::lang {
26
27//==================================================================================================
28/// Retrieves human-readable names from C++ run-time type information.<br>
29/// This class is available only with debug-builds of \alib.
30///
31/// Module \alib_strings functor
32/// \alib{strings::APPENDABLES;T_Append<std::type_info,TChar,TAllocator>} in debug-compilations,
33/// which internally makes use of this type. This allows appending the result of keyword \c typeid
34/// directly to \b AString instances.
35//==================================================================================================
37{
38 protected:
39 const char* name; ///< The translated name.
40 bool failed; ///< If \c true, demangling failed.
41
42 public:
43 //==========================================================================================
44 /// Constructor
45 /// @param typeInfo The information struct on the C++ type.
46 //==========================================================================================
48 DbgTypeDemangler( const std::type_info& typeInfo );
49
50 #if defined(__GNUC__) || defined(__clang__)
51 //==========================================================================================
52 /// Destructor
53 //==========================================================================================
56 #endif
57
58 //==========================================================================================
59 /// Returns the demangled, human-readable name of the type which was provided in the
60 /// constructor.
61 /// @return The demangled type name.
62 //==========================================================================================
64 const char* Get();
65
66 #if ALIB_STRINGS
67 //======================================================================================
68 /// Removes all namespaces from the type receivable with #Get, including those of its
69 /// nested templates, and writes the result to \p{target}.
70 /// \par Availability
71 /// This method is available only if the module \alib_strings is included in the
72 /// \alibdist. Note that while method #Get always returns a narrow character
73 /// array, this method accepts the string-type chosen with the \alibdist_nl.
74 /// @param target The target string to write to.
75 /// @return The given \p{target} to allow concatenated operations.
76 //======================================================================================
79 #endif
80}; // class DbgTypeDemangler
81
82} // namespace [alib::lang]
83
84#endif // ALIB_DEBUG
85
86#endif // HPP_ALIB_LANG_DBGTYPEDEMANGLER
87
bool failed
If true, demangling failed.
ALIB_API NAString & GetShort(NAString &target)
ALIB_API const char * Get()
ALIB_API ~DbgTypeDemangler()
Destructor.
const char * name
The translated name.
ALIB_API DbgTypeDemangler(const std::type_info &typeInfo)
#define ALIB_API
Definition alib.hpp:639