|
@@ -2,8 +2,8 @@
|
|
|
#define ENTT_CORE_TYPE_INFO_HPP
|
|
#define ENTT_CORE_TYPE_INFO_HPP
|
|
|
|
|
|
|
|
#include <compare>
|
|
#include <compare>
|
|
|
-#include <string_view>
|
|
|
|
|
#include "../config/config.h"
|
|
#include "../config/config.h"
|
|
|
|
|
+#include "../stl/string_view.hpp"
|
|
|
#include "../stl/type_traits.hpp"
|
|
#include "../stl/type_traits.hpp"
|
|
|
#include "../stl/utility.hpp"
|
|
#include "../stl/utility.hpp"
|
|
|
#include "fwd.hpp"
|
|
#include "fwd.hpp"
|
|
@@ -33,23 +33,23 @@ template<typename Type>
|
|
|
template<typename Type>
|
|
template<typename Type>
|
|
|
[[nodiscard]] constexpr auto stripped_type_name() noexcept {
|
|
[[nodiscard]] constexpr auto stripped_type_name() noexcept {
|
|
|
#if defined ENTT_PRETTY_FUNCTION
|
|
#if defined ENTT_PRETTY_FUNCTION
|
|
|
- const std::string_view full_name{pretty_function<Type>()};
|
|
|
|
|
|
|
+ const stl::string_view full_name{pretty_function<Type>()};
|
|
|
auto first = full_name.find_first_not_of(' ', full_name.find_first_of(ENTT_PRETTY_FUNCTION_PREFIX) + 1);
|
|
auto first = full_name.find_first_not_of(' ', full_name.find_first_of(ENTT_PRETTY_FUNCTION_PREFIX) + 1);
|
|
|
auto value = full_name.substr(first, full_name.find_last_of(ENTT_PRETTY_FUNCTION_SUFFIX) - first);
|
|
auto value = full_name.substr(first, full_name.find_last_of(ENTT_PRETTY_FUNCTION_SUFFIX) - first);
|
|
|
return value;
|
|
return value;
|
|
|
#else
|
|
#else
|
|
|
- return std::string_view{};
|
|
|
|
|
|
|
+ return stl::string_view{};
|
|
|
#endif
|
|
#endif
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
template<typename Type, auto = stripped_type_name<Type>().find_first_of('.')>
|
|
template<typename Type, auto = stripped_type_name<Type>().find_first_of('.')>
|
|
|
-[[nodiscard]] ENTT_CONSTEVAL std::string_view type_name(int) noexcept {
|
|
|
|
|
|
|
+[[nodiscard]] ENTT_CONSTEVAL stl::string_view type_name(int) noexcept {
|
|
|
constexpr auto value = stripped_type_name<Type>();
|
|
constexpr auto value = stripped_type_name<Type>();
|
|
|
return value;
|
|
return value;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
template<typename Type>
|
|
template<typename Type>
|
|
|
-[[nodiscard]] std::string_view type_name(char) noexcept {
|
|
|
|
|
|
|
+[[nodiscard]] stl::string_view type_name(char) noexcept {
|
|
|
static const auto value = stripped_type_name<Type>();
|
|
static const auto value = stripped_type_name<Type>();
|
|
|
return value;
|
|
return value;
|
|
|
}
|
|
}
|
|
@@ -128,12 +128,12 @@ struct type_name final {
|
|
|
* @brief Returns the name of a given type.
|
|
* @brief Returns the name of a given type.
|
|
|
* @return The name of the given type.
|
|
* @return The name of the given type.
|
|
|
*/
|
|
*/
|
|
|
- [[nodiscard]] static constexpr std::string_view value() noexcept {
|
|
|
|
|
|
|
+ [[nodiscard]] static constexpr stl::string_view value() noexcept {
|
|
|
return internal::type_name<Type>(0);
|
|
return internal::type_name<Type>(0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/*! @copydoc value */
|
|
/*! @copydoc value */
|
|
|
- [[nodiscard]] constexpr operator std::string_view() const noexcept {
|
|
|
|
|
|
|
+ [[nodiscard]] constexpr operator stl::string_view() const noexcept {
|
|
|
return value();
|
|
return value();
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -172,7 +172,7 @@ struct type_info final {
|
|
|
* @brief Type name.
|
|
* @brief Type name.
|
|
|
* @return Type name.
|
|
* @return Type name.
|
|
|
*/
|
|
*/
|
|
|
- [[nodiscard]] constexpr std::string_view name() const noexcept {
|
|
|
|
|
|
|
+ [[nodiscard]] constexpr stl::string_view name() const noexcept {
|
|
|
return alias;
|
|
return alias;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -197,7 +197,7 @@ struct type_info final {
|
|
|
private:
|
|
private:
|
|
|
id_type seq;
|
|
id_type seq;
|
|
|
id_type identifier;
|
|
id_type identifier;
|
|
|
- std::string_view alias;
|
|
|
|
|
|
|
+ stl::string_view alias;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
/**
|