cgv
Loading...
Searching...
No Matches
cgv::reflect::enum_reflection_traits< T > Struct Template Reference

this type specific reflection traits class is used by the reflect_enum function to reflect enum types More...

#include <reflect_enum.h>

Inheritance diagram for cgv::reflect::enum_reflection_traits< T >:
cgv::reflect::reflection_traits_impl< T, abst_enum_reflection_traits > cgv::reflect::abst_enum_reflection_traits cgv::reflect::abst_reflection_traits

Public Member Functions

std::vector< cgv::utils::token > & ref_names ()
 
std::vector< int > & ref_values ()
 
std::string & declarations () const
 
 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_traitsclone ()
 clone function
 
- Public Member Functions inherited from cgv::reflect::reflection_traits_impl< T, abst_enum_reflection_traits >
unsigned size () const
 return the size of the type
 
void * new_instance () const
 construct an instance on the heap with the new operator
 
void delete_instance (void *instance_ptr) const
 delete an instance with the delete operator
 
void * new_instances (unsigned n) const
 construct n instances on the heap with the new operator
 
void delete_instances (void *instance_array) const
 delete instances with the delete [] operator
 
cgv::type::info::TypeId get_type_id () const
 return the type id
 
const char * get_type_name () const
 return the type name
 
bool is_enum_type () const
 return whether type is an enum type - this is independent of whether enum interface is implemented
 
- Public Member Functions inherited from cgv::reflect::abst_enum_reflection_traits
void parse_declarations ()
 
bool has_string_conversions () const
 whether type can be converted to string, defaults to false
 
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
 
void get_to_string (const void *member_ptr, std::string &str_val)
 convert given instance into a string value
 
bool has_enum_interface () const
 return whether the traits class implements the enum interface
 
unsigned get_nr_enum_items () const
 return the number of enum items
 
std::string get_enum_name (unsigned i) const
 return the name of the i-th enum item
 
int get_enum_value (unsigned i) const
 return the value of the i-th enum item
 
- Public Member Functions inherited from cgv::reflect::abst_reflection_traits
virtual ~abst_reflection_traits ()
 provide virtual destructor to allow generation of copies
 
virtual bool has_external_implementation () const
 whether type can be converted to string, defaults to false
 
virtual bool external_implementation (reflection_handler &rh, void *member_ptr)
 call the external implementation
 

Additional Inherited Members

- Static Public Attributes inherited from cgv::reflect::abst_enum_reflection_traits
static const bool has_enum = true
 compile information about enum interface
 
static const ReflectionTraitsKind kind = RTK_STRING
 
- Static Public Attributes inherited from cgv::reflect::abst_reflection_traits
static const bool has_external = false
 compile information about external implementation
 
static const bool has_string = false
 compile information about string conversions
 
static const bool has_enum = false
 compile information about enum interface
 

Detailed Description

template<typename T>
struct cgv::reflect::enum_reflection_traits< T >

this type specific reflection traits class is used by the reflect_enum function to reflect enum types

Definition at line 33 of file reflect_enum.h.

Constructor & Destructor Documentation

◆ enum_reflection_traits()

template<typename T >
cgv::reflect::enum_reflection_traits< T >::enum_reflection_traits ( const std::string &  _declarations = "")
inline

construct from declaration string which is of the same syntax as the C++ enum item declaration.

A typical example for a declaration string is "ITEM1 = 1, ITEM3 = 3, ITEM4".

Definition at line 40 of file reflect_enum.h.

Member Function Documentation

◆ clone()

template<typename T >
abst_reflection_traits * cgv::reflect::enum_reflection_traits< T >::clone ( )
inlinevirtual

clone function

Implements cgv::reflect::abst_reflection_traits.

Definition at line 52 of file reflect_enum.h.

◆ declarations()

template<typename T >
std::string & cgv::reflect::enum_reflection_traits< T >::declarations ( ) const
inlinevirtual

Implements cgv::reflect::abst_enum_reflection_traits.

Definition at line 37 of file reflect_enum.h.

◆ ref_names()

template<typename T >
std::vector< cgv::utils::token > & cgv::reflect::enum_reflection_traits< T >::ref_names ( )
inlinevirtual

Implements cgv::reflect::abst_enum_reflection_traits.

Definition at line 35 of file reflect_enum.h.

◆ ref_values()

template<typename T >
std::vector< int > & cgv::reflect::enum_reflection_traits< T >::ref_values ( )
inlinevirtual

Implements cgv::reflect::abst_enum_reflection_traits.

Definition at line 36 of file reflect_enum.h.


The documentation for this struct was generated from the following file: