31 #include "rttr/detail/base/core_prerequisites.h"
36 #include <type_traits>
55 template<
typename Target_Type,
typename Source_Type>
56 Target_Type
rttr_cast(Source_Type
object) RTTR_NOEXCEPT;
61 struct base_class_info;
62 struct type_converter_base;
64 class type_register_private;
66 static type get_invalid_type() RTTR_NOEXCEPT;
67 struct invalid_type{};
69 class destructor_wrapper_base;
70 class property_wrapper_base;
71 RTTR_LOCAL RTTR_INLINE type create_type(type_data*) RTTR_NOEXCEPT;
74 RTTR_LOCAL std::unique_ptr<type_data> make_type_data();
76 template<
typename T,
typename Tp,
typename Converter>
77 struct variant_data_base_policy;
79 struct type_comparator_base;
81 RTTR_API
bool compare_types_less_than(
const void*,
const void*,
const type&,
int&);
82 RTTR_API
bool compare_types_equal(
const void*,
const void*,
const type&,
bool&);
173 typedef uintptr_t type_id;
179 RTTR_INLINE type(
const type& other) RTTR_NOEXCEPT;
186 RTTR_INLINE type& operator=(
const type& other) RTTR_NOEXCEPT;
193 RTTR_INLINE
bool operator<(
const type& other)
const RTTR_NOEXCEPT;
200 RTTR_INLINE
bool operator>(
const type& other)
const RTTR_NOEXCEPT;
207 RTTR_INLINE
bool operator>=(
const type& other)
const RTTR_NOEXCEPT;
214 RTTR_INLINE
bool operator<=(
const type& other)
const RTTR_NOEXCEPT;
222 RTTR_INLINE
bool operator==(
const type& other)
const RTTR_NOEXCEPT;
230 RTTR_INLINE
bool operator!=(
const type& other)
const RTTR_NOEXCEPT;
240 RTTR_INLINE type_id get_id() const RTTR_NOEXCEPT;
249 RTTR_INLINE
string_view get_name() const RTTR_NOEXCEPT;
256 RTTR_INLINE
bool is_valid() const RTTR_NOEXCEPT;
263 RTTR_INLINE explicit operator
bool() const RTTR_NOEXCEPT;
273 RTTR_INLINE type get_raw_type() const RTTR_NOEXCEPT;
295 RTTR_INLINE type get_wrapped_type() const RTTR_NOEXCEPT;
303 RTTR_LOCAL static type get() RTTR_NOEXCEPT;
316 RTTR_LOCAL static type get(T&&
object) RTTR_NOEXCEPT;
328 static type get_by_name(
string_view name) RTTR_NOEXCEPT;
337 static array_range<type> get_types() RTTR_NOEXCEPT;
344 RTTR_INLINE std::
size_t get_sizeof() const RTTR_NOEXCEPT;
351 RTTR_INLINE
bool is_class() const RTTR_NOEXCEPT;
371 RTTR_INLINE
bool is_template_instantiation() const RTTR_NOEXCEPT;
394 array_range<type> get_template_arguments() const RTTR_NOEXCEPT;
401 RTTR_INLINE
bool is_enumeration() const RTTR_NOEXCEPT;
411 enumeration get_enumeration() const RTTR_NOEXCEPT;
430 RTTR_INLINE
bool is_wrapper() const RTTR_NOEXCEPT;
447 RTTR_INLINE
bool is_array() const RTTR_NOEXCEPT;
457 RTTR_INLINE
bool is_associative_container() const RTTR_NOEXCEPT;
467 RTTR_INLINE
bool is_sequential_container() const RTTR_NOEXCEPT;
475 RTTR_INLINE
bool is_pointer() const RTTR_NOEXCEPT;
484 RTTR_INLINE
bool is_arithmetic() const RTTR_NOEXCEPT;
492 RTTR_INLINE
bool is_function_pointer() const RTTR_NOEXCEPT;
500 RTTR_INLINE
bool is_member_object_pointer() const RTTR_NOEXCEPT;
508 RTTR_INLINE
bool is_member_function_pointer() const RTTR_NOEXCEPT;
519 bool is_derived_from(const type& other) const RTTR_NOEXCEPT;
531 bool is_derived_from() const RTTR_NOEXCEPT;
542 bool is_base_of(const type& other) const RTTR_NOEXCEPT;
554 bool is_base_of() const RTTR_NOEXCEPT;
567 array_range<type> get_base_classes() const RTTR_NOEXCEPT;
579 array_range<type> get_derived_classes() const RTTR_NOEXCEPT;
593 variant get_metadata(const variant& key) const;
603 constructor get_constructor(const std::vector<type>& params = std::vector<type>() ) const RTTR_NOEXCEPT;
614 array_range<constructor> get_constructors() const RTTR_NOEXCEPT;
665 array_range<constructor> get_constructors(filter_items filter) const RTTR_NOEXCEPT;
675 variant create(std::vector<argument> args = std::vector<argument>()) const;
685 destructor get_destructor() const RTTR_NOEXCEPT;
695 bool destroy(variant& obj) const RTTR_NOEXCEPT;
705 property get_property(
string_view name) const RTTR_NOEXCEPT;
717 array_range<property> get_properties() const RTTR_NOEXCEPT;
772 array_range<property> get_properties(filter_items filter) const RTTR_NOEXCEPT;
781 static property get_global_property(
string_view name) RTTR_NOEXCEPT;
792 static array_range<property> get_global_properties() RTTR_NOEXCEPT;
802 variant get_property_value(
string_view name, instance obj) const;
809 static variant get_property_value(
string_view name);
818 bool set_property_value(
string_view name, instance obj, argument arg) const;
825 static
bool set_property_value(
string_view name, argument arg);
835 method get_method(
string_view name) const RTTR_NOEXCEPT;
845 method get_method(
string_view name, const std::vector<type>& type_list) const RTTR_NOEXCEPT;
857 array_range<method> get_methods() const RTTR_NOEXCEPT;
912 array_range<method> get_methods(filter_items filter) const RTTR_NOEXCEPT;
921 static method get_global_method(
string_view name) RTTR_NOEXCEPT;
931 static method get_global_method(
string_view name, const std::vector<type>& params) RTTR_NOEXCEPT;
942 static array_range<method> get_global_methods() RTTR_NOEXCEPT;
956 variant invoke(
string_view name, instance obj, std::vector<argument> args) const;
965 static variant invoke(
string_view name, std::vector<argument> args);
989 static
void register_converter_func(F func);
1015 template<typename T>
1016 static
void register_wrapper_converter_for_base_classes();
1040 template<typename T>
1041 static
void register_comparators();
1065 template<typename T>
1066 static
void register_equal_comparator();
1097 template<typename T>
1098 static
void register_less_than_comparator();
1105 type() RTTR_NOEXCEPT;
1112 RTTR_INLINE explicit type(detail::type_data* data) RTTR_NOEXCEPT;
1122 static
void* apply_offset(
void* ptr, const type& source_type, const type& target_type) RTTR_NOEXCEPT;
1129 static type get_derived_type(
void* ptr, const type& source_type) RTTR_NOEXCEPT;
1138 const detail::type_converter_base* get_type_converter(const type& target_type) const RTTR_NOEXCEPT;
1147 const detail::type_comparator_base* get_equal_comparator() const RTTR_NOEXCEPT;
1156 const detail::type_comparator_base* get_less_than_comparator() const RTTR_NOEXCEPT;
1164 RTTR_INLINE std::
size_t get_pointer_dimension() const RTTR_NOEXCEPT;
1173 RTTR_INLINE type get_raw_array_type() const RTTR_NOEXCEPT;
1180 RTTR_INLINE
string_view get_full_name() const RTTR_NOEXCEPT;
1186 void create_wrapped_value(const argument& arg, variant& var) const;
1194 RTTR_INLINE variant create_variant(const argument& data) const;
1196 friend class variant;
1197 template<typename Target_Type, typename Source_Type>
1198 friend Target_Type
rttr_cast(Source_Type
object) RTTR_NOEXCEPT;
1200 friend class instance;
1201 friend class detail::type_register;
1202 friend class detail::type_register_private;
1204 friend type detail::create_type(detail::type_data*) RTTR_NOEXCEPT;
1206 template<typename T>
1207 friend std::unique_ptr<detail::type_data> detail::make_type_data();
1209 template<typename T, typename Tp, typename Converter>
1210 friend struct detail::variant_data_base_policy;
1212 friend RTTR_API
bool detail::compare_types_less_than(const
void*, const
void*, const type&,
int&);
1213 friend RTTR_API
bool detail::compare_types_equal(const
void*, const
void*, const type&,
bool&);
1216 detail::type_data* m_type_data;
1221 #include "rttr/detail/type/type_impl.h"
1223 #endif // RTTR_TYPE_H_