31#ifndef FENNEC_RTTI_TYPE_H
32#define FENNEC_RTTI_TYPE_H
44 const string& name()
const {
45 static const string nullname = string(
"[none]");
46 return _data ? _data->name : nullname;
52 return _data ? _data->uuid : 0;
57 dynarray<type> supertypes()
const {
58 return _data ? _data->supers : dynarray<type_data*>{};
63 dynarray<type> subtypes()
const {
64 return _data ? _data->subs : dynarray<type_data*>{};
69 bool is_complete()
const {
70 return _data ? _data->properties.test(type_data::property_complete) :
false;
75 bool is_iterable()
const {
76 return _data ? _data->properties.test(type_data::property_iterable) :
false;
81 bool is_indexable()
const {
82 return _data ? _data->properties.test(type_data::property_indexable) :
false;
87 bool is_mappable()
const {
88 return _data ? _data->properties.test(type_data::property_mappable) :
false;
93 type key_type()
const {
94 return _data ? _data->key_type :
nullptr;
101 bool operator==(
const type& c)
const {
102 return _data == c._data;
109 template<
typename TypeT>
110 static type get() {
return type(
static_cast<TypeT*
>(
nullptr)); }
117 template<
typename TypeT>
118 static type get_from_instance(TypeT* t) {
return type(t); }
125 template<
typename TypeT>
126 static type get_from_instance(
const TypeT*) {
return type(
static_cast<TypeT*
>(
nullptr)); }
129 const type_data* _data;
131 template<
typename TypeT>
132 type(TypeT*) : _data(type_storage::get_data<TypeT>()) {
136 type(type_data* d) : _data(d) { }
138 type(
const type& t) =
default;
139 type(type&& t)
noexcept =
default;
141 type& operator=(
const type&) =
default;
142 type& operator=(type&&) noexcept = default;
::uint64_t uint64_t
Unsigned 64-bit integer.
Definition types.h:275