|
| template<typename TypeT > |
| constexpr bool | vlink::NameDetector::is_support () noexcept |
| | Reports whether the current toolchain can extract a textual name for TypeT. 更多...
|
| |
| template<typename TypeT > |
| constexpr std::string_view | vlink::NameDetector::get () noexcept |
| | Returns the trimmed compile-time identifier for TypeT. 更多...
|
| |
| template<typename EnumT > |
| constexpr std::string_view | vlink::NameDetector::get_enum (EnumT value) noexcept |
| | Resolves the source identifier of an enumerator literal at compile time. 更多...
|
| |
| constexpr std::string_view | vlink::NameDetector::detail::pretty_name (std::string_view name, bool remove_suffix=true) noexcept |
| |
| template<typename TypeT , size_t SizeT, size_t... IndexT> |
| constexpr std::array< std::remove_cv_t< TypeT >, SizeT > | vlink::NameDetector::detail::to_array (TypeT(&a)[SizeT], std::index_sequence< IndexT... >) noexcept |
| |
| template<typename LeftT , typename RightT > |
| constexpr bool | vlink::NameDetector::detail::cmp_less (LeftT lhs, RightT rhs) noexcept |
| |
| template<typename EnumT , EnumT ValueV> |
| constexpr auto | vlink::NameDetector::detail::raw_enum_name () noexcept |
| |
| template<typename EnumT , EnumT ValueV> |
| constexpr auto | vlink::NameDetector::detail::enum_name () noexcept |
| |
| template<typename EnumT , auto ValueV> |
| constexpr bool | vlink::NameDetector::detail::is_valid () noexcept |
| |
| template<typename EnumT , int OffsetT, typename UnderlyingT = std::underlying_type_t<EnumT>> |
| constexpr UnderlyingT | vlink::NameDetector::detail::ualue (size_t i) noexcept |
| |
| template<typename EnumT , int OffsetT, typename UnderlyingT = std::underlying_type_t<EnumT>> |
| constexpr EnumT | vlink::NameDetector::detail::enum_value_at (size_t i) noexcept |
| |
| template<typename EnumT , typename UnderlyingT = std::underlying_type_t<EnumT>> |
| constexpr int | vlink::NameDetector::detail::reflected_min () noexcept |
| |
| template<typename EnumT , typename UnderlyingT = std::underlying_type_t<EnumT>> |
| constexpr int | vlink::NameDetector::detail::reflected_max () noexcept |
| |
| template<typename EnumT , size_t SizeT, int MinT, size_t IndexT> |
| constexpr void | vlink::NameDetector::detail::valid_count_step (bool *valid, size_t &count) noexcept |
| |
| template<typename EnumT , size_t SizeT, int MinT> |
| constexpr auto | vlink::NameDetector::detail::valid_count () noexcept |
| |
| template<typename EnumT , size_t SizeT, int MinT> |
| constexpr auto | vlink::NameDetector::detail::values_in_range () noexcept |
| |
| template<typename EnumT , typename UnderlyingT = std::underlying_type_t<EnumT>> |
| constexpr auto | vlink::NameDetector::detail::values () noexcept |
| |
| template<typename EnumT , size_t... IndexT> |
| constexpr auto | vlink::NameDetector::detail::names_impl (std::index_sequence< IndexT... >) noexcept |
| |
| template<typename EnumT , typename UnderlyingT = std::underlying_type_t<EnumT>> |
| constexpr bool | vlink::NameDetector::detail::is_sparse () noexcept |
| |
| template<typename EnumT , typename UnderlyingT = std::underlying_type_t<EnumT>> |
| constexpr EnumT | vlink::NameDetector::detail::enum_value (size_t i) noexcept |
| |
| template<typename TypeT > |
| constexpr auto | vlink::NameDetector::detail::raw_type_name () noexcept |
| |
Header-only compile-time introspection of type names and enumerator labels.
vlink::NameDetector exposes two primitives that resolve human-readable identifiers at compile time without RTTI or any third-party dependency. The implementation walks the textual content of PRETTY_FUNCTION on Clang/GCC and FUNCSIG on MSVC, then trims compiler-specific noise so the result is identical across toolchains.
Validation rules applied by the internal pretty_name() pass:
| Rule | Result |
| Begins with a character literal quote | Returns an empty view (not a valid name) |
| Begins with a digit | Returns an empty view (numeric literal) |
| Contains a trailing parenthesised arg | Strips the argument list before the name |
| Contains a trailing template list | Strips the "<...>" suffix from the name |
| Final character is not alnum/under | Trims back to the last identifier character |
| First character is not letter/under | Returns an empty view (rejects the result) |
- Example
static_assert(vlink::NameDetector::is_support<MyPlugin>());
constexpr std::string_view kName = vlink::NameDetector::get<MyPlugin>();
enum class Color { Red, Green, Blue };
constexpr std::string_view get_enum(EnumT value) noexcept
Resolves the source identifier of an enumerator literal at compile time.
Definition: name_detector.h:630