#pragma once #include "reflection_traits.h" #include "lib_begin.h" namespace cgv { namespace reflect { /// this reflection traits implementation is used by the reflect_string function template struct extern_reflection_traits_impl : public B { static const ReflectionTraitsKind kind = RTK_EXTERNAL_SELF_REFLECT; /// compile information about external implementation static const bool has_external = true; /// compile time information about external type with self_reflect implementation typedef D external_self_reflect_type; /// whether type can be converted to string, defaults to false bool has_external_implementation() const { return true; } /// call the external implementation bool external_implementation(reflection_handler& rh, void* member_ptr) { return static_cast(member_ptr)->self_reflect(rh); } }; /// this reflection traits implementation is used for external self_reflect implementations of instances of type T where the external implementation is a self_reflect function in type D template struct extern_reflection_traits : public extern_reflection_traits_impl > { /// clone function abst_reflection_traits* clone() { return new extern_reflection_traits(); } }; /// this reflection traits implementation is used for external self_reflect implementations together with string interface of instances of type T where the external implementation is a self_reflect function in type D template struct extern_string_reflection_traits : public extern_reflection_traits_impl > { /// clone function abst_reflection_traits* clone() { return new extern_string_reflection_traits(); } }; } } #include