7#include "acme/template/safe_bool.h"
14constexpr ::std::strong_ordering order(
bool b1,
bool b2)
23 return ::std::strong_ordering::equal;
29 return ::std::strong_ordering::greater;
37 return ::std::strong_ordering::less;
41 return ::std::strong_ordering::equal;
59 inline type_id(const ::type_id &type_id);
60 inline type_id(const ::std::type_info &info);
63 inline bool is_set()
const;
64 inline bool is_empty()
const {
return !this->is_set();}
66 inline bool operator == (const ::type_id &
type_id)
const;
67 inline ::std::strong_ordering operator <=> (const ::type_id &
type_id)
const;
69 ::string as_string()
const;
74template <
typename TYPE >
75constexpr TYPE minus_one_or_greater(
const TYPE & t)
77 return t <= -1 ? -1 : t;
81 public ::pair<::iptr, ::iptr>
86 type_iptr_pair(::iptr i1 = -1, ::iptr i2 = -1):
93 template <
typename ENUM>
94 requires(::std::is_enum_v<ENUM>)
95 type_iptr_pair(::atom::enum_type etype,
const ENUM & eenum) :
96 type_iptr_pair((::iptr) etype,(::iptr) eenum)
102 type_iptr_pair(enum_task_tool etasktool) :
103 type_iptr_pair(::atom::e_type_task_tool, etasktool)
110 constexpr bool is_empty()
const {
return this->m_element1 < 0; }
111 constexpr bool is_set()
const {
return !this->is_empty(); }
113 constexpr iptr normal1()
const {
return (::iptr)::minus_one_or_greater(this->m_element1); }
114 constexpr iptr normal2()
const {
return (::iptr)::minus_one_or_greater(this->m_element2); }
117 constexpr inline bool operator == (const ::type_iptr_pair & ipair)
const
120 return this->normal1() == ipair.normal1() && this->normal2() == ipair.normal2();
125 constexpr ::std::strong_ordering operator <=> (const ::type_iptr_pair & ipair)
const
128 auto order = this->normal1() <=> ipair.normal1();
137 order = this->normal2() <=> ipair.normal2();
144 ::string as_string()
const;
168 type_custom_id(const_char_pointer pszNameId);
169 type_custom_id(const ::string_literal & strliteralNameId);
170 type_custom_id(const ::scoped_string & scopedstrNameId);
171 type_custom_id(const ::type_iptr_pair & ipairId);
172 type_custom_id(const ::scoped_string & scopedstrNameId, const ::type_iptr_pair & ipairId);
173 type_custom_id(const ::atom &
atom);
174 type_custom_id(enum_task_tool etasktool);
177 constexpr bool is_set()
const;
178 constexpr bool is_empty()
const{
return !this->is_set();}
181 inline bool operator == (const ::type_custom_id & typecustomid)
const;
182 inline ::std::strong_ordering operator <=> (const ::type_custom_id & typecustomid)
const;
184 ::string as_string()
const;
187CLASS_DECL_ACME
string type_name(const ::std::type_info& typeinfo);
189template<
typename TYPE>
190inline ::std::type_index type_index() {
return typeid(TYPE); }
193template<
typename TYPE>
194inline ::string type_name()
196 return type_name(
typeid(TYPE));
199inline ::std::type_index void_type_index()
207inline bool is_type_index_empty(const ::std::type_index & typeindex)
210 return typeindex == ::void_type_index();
215inline bool is_type_index_set(const ::std::type_index & typeindex)
218 return !is_type_index_empty(typeindex);
223inline ::std::type_index type_index(const ::std::type_info &typeinfo) {
return typeinfo; }
229#define __c_type_name(t) (c_demangle(::type<t>().name()))
232inline const_char_pointer c_demangle(const_char_pointer psz)
246 else if (psz[0] ==
's' &&
474 constexpr pointer_key() { m_uptr = 0; }
475 constexpr pointer_key(
const pointer_key& pointer) :m_uptr(pointer.m_uptr) {}
476 template <
typename TYPE >
477 constexpr pointer_key(
const TYPE* p) : m_uptr((::uptr)(
void*)p) {}
480 constexpr bool operator ==(
const pointer_key& pointer)
const
483 return this->m_uptr == pointer.m_uptr;
488 constexpr ::std::strong_ordering operator <=>(
const pointer_key& pointer)
const
491 return this->m_uptr <=> pointer.m_uptr;
501inline ::hash32 as_hash32 < pointer_key >(
const pointer_key& key)
504 return ::as_hash32(key.m_uptr);
509inline ::string type_raw_name(const ::std::type_info & typeinfo)
514 return (::string_literal) typeinfo.raw_name();
518 return (::string_literal) typeinfo.name();
525template <
typename TYPE >
526inline ::string type_raw_name()
529 return type_raw_name(
typeid(TYPE));
534template <
typename TYPE >
535inline ::string type_raw_name(
const TYPE* p)
538 return type_raw_name(
typeid(*(TYPE*)p));
543template <
typename TYPE >
544inline ::string type_raw_name(
const TYPE& t)
547 return type_raw_name(
typeid(t));
552template <
typename BASE >
553inline ::string type_raw_name(const ::pointer<BASE>& p)
556 return type_name(
typeid(*p.m_p));
583 class CLASS_DECL_ACME type
604 type(const ::platform::type &type);
605 type(const ::std::type_info &info);
606 type(const ::scoped_string &scopedstrTypeName);
607 type(const ::type_iptr_pair &ipair);
608 type(const ::atom &
atom);
611 template<
typename TYPE>
613 template<
typename TYPE>
615 requires (!is_raw_pointer <TYPE>);
616 template<
typename BASE>
617 type(const ::pointer<BASE> &p);
620 const ::string &raw_name()
const;
621 const ::string &name()
const;
622 const_char_pointer c_str()
const;
623 const ::string & text()
const;
625 bool is_empty()
const;
626 explicit operator bool()
const;
628 bool operator==(const ::platform::type &type)
const;
630 ::std::strong_ordering operator<=>(const ::platform::type &type)
const;
632 ::string as_string()
const;
641template<
typename TYPE>
642inline ::platform::type type();
643inline ::platform::type type(const ::std::type_info &info);
644inline ::platform::type type(const ::scoped_string &scopedstrTypeName);
647template<
typename TYPE>
648inline ::platform::type type(
const TYPE *p);
650template<
typename TYPE>
651inline ::platform::type type(
const TYPE &t);
653template<
typename BASE>
654inline ::platform::type type(const ::pointer<BASE> &p);
Definition _template_forward_declaration.h:327
::string m_strNameId
Definition type.h:163
::type_iptr_pair m_ipairId
m_ipair isn't empty it can be used as a key
Definition type.h:165
::string m_strTypeName
type name as obtained from demangle(typeid().name())
Definition type.h:55
::std::type_index m_typeindex
type index as obtained from std::type_index(typeid())
Definition type.h:51
::string m_strRawTypeName
raw type name as obtained from typeid().raw_name()
Definition type.h:53