3#include "reflection_handler.h"
16 virtual std::vector<cgv::utils::token>& ref_names() = 0;
17 virtual std::vector<int>& ref_values() = 0;
18 virtual std::string& declarations()
const = 0;
20 void parse_declarations();
23 void get_to_string(
const void* member_ptr, std::string& str_val);
35 std::vector<cgv::utils::token>& ref_names() {
static std::vector<cgv::utils::token> names;
return names; }
36 std::vector<int>& ref_values() {
static std::vector<int> values;
return values; }
37 std::string& declarations()
const {
static std::string decs;
return decs; }
42 if (!_declarations.empty()) {
43 declarations() = _declarations;
44 this->parse_declarations();
46#ifdef REFLECT_TRAITS_WITH_DECLTYPE
47 if (declarations().empty())
48 get_reflection_traits(T());
58#include <cgv/config/lib_end.h>
in this namespace reflection of types is implemented
ReflectionTraitsKind
different types of reflection traits
this header is dependency free
type independent functionality for all enum fallback implementations
std::string get_enum_name(unsigned i) const
return the name of the i-th enum item
void get_to_string(const void *member_ptr, std::string &str_val)
convert given instance into a string value
static const bool has_enum
compile information about enum interface
bool set_from_string(void *member_ptr, const std::string &str_val)
convert a given string value to the reflected type and store in the instance pointer
unsigned get_nr_enum_items() const
return the number of enum items
bool has_string_conversions() const
whether type can be converted to string, defaults to false
int get_enum_value(unsigned i) const
return the value of the i-th enum item
bool has_enum_interface() const
return whether the traits class implements the enum interface
abstract interface for type reflection with basic type management and optional string conversion
enum_reflection_traits(const std::string &_declarations="")
construct from declaration string which is of the same syntax as the C++ enum item declaration.
abst_reflection_traits * clone()
clone function
implementation of the reflection traits providing type specific interface for variable base class