cgv
Loading...
Searching...
No Matches
cgv::reflect::abst_enum_reflection_traits Struct Referenceabstract

type independent functionality for all enum fallback implementations More...

#include <reflect_enum.h>

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

Public Member Functions

virtual std::vector< cgv::utils::token > & ref_names ()=0
 
virtual std::vector< int > & ref_values ()=0
 
virtual std::string & declarations () const =0
 
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 abst_reflection_traitsclone ()=0
 clone function
 
virtual unsigned size () const =0
 return the size of the type
 
virtual void * new_instance () const =0
 construct an instance on the heap with the new operator
 
virtual void delete_instance (void *) const =0
 delete an instance with the delete operator
 
virtual void * new_instances (unsigned n) const =0
 construct n instances on the heap with the new operator
 
virtual void delete_instances (void *) const =0
 delete instances with the delete [] operator
 
virtual cgv::type::info::TypeId get_type_id () const =0
 return the type id
 
virtual const char * get_type_name () const =0
 return the type name
 
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
 
virtual bool is_enum_type () const
 return whether type is an enum type - this is independent of whether enum interface is implemented
 

Static Public Attributes

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

type independent functionality for all enum fallback implementations

Definition at line 10 of file reflect_enum.h.

Member Function Documentation

◆ get_enum_name()

std::string cgv::reflect::abst_enum_reflection_traits::get_enum_name ( unsigned  i) const
virtual

return the name of the i-th enum item

Reimplemented from cgv::reflect::abst_reflection_traits.

Definition at line 45 of file reflect_enum.cxx.

Referenced by enum_config_view::get_user_data().

◆ get_enum_value()

int cgv::reflect::abst_enum_reflection_traits::get_enum_value ( unsigned  i) const
virtual

return the value of the i-th enum item

Reimplemented from cgv::reflect::abst_reflection_traits.

Definition at line 49 of file reflect_enum.cxx.

◆ get_nr_enum_items()

unsigned cgv::reflect::abst_enum_reflection_traits::get_nr_enum_items ( ) const
virtual

return the number of enum items

Reimplemented from cgv::reflect::abst_reflection_traits.

Definition at line 41 of file reflect_enum.cxx.

◆ get_to_string()

void cgv::reflect::abst_enum_reflection_traits::get_to_string ( const void *  instance_ptr,
std::string &  str_val 
)
virtual

convert given instance into a string value

Reimplemented from cgv::reflect::abst_reflection_traits.

Definition at line 28 of file reflect_enum.cxx.

References cgv::utils::find_enum_index().

◆ has_enum_interface()

bool cgv::reflect::abst_enum_reflection_traits::has_enum_interface ( ) const
virtual

return whether the traits class implements the enum interface

Reimplemented from cgv::reflect::abst_reflection_traits.

Definition at line 37 of file reflect_enum.cxx.

◆ has_string_conversions()

bool cgv::reflect::abst_enum_reflection_traits::has_string_conversions ( ) const
virtual

whether type can be converted to string, defaults to false

Reimplemented from cgv::reflect::abst_reflection_traits.

Definition at line 14 of file reflect_enum.cxx.

◆ parse_declarations()

void cgv::reflect::abst_enum_reflection_traits::parse_declarations ( )

Definition at line 9 of file reflect_enum.cxx.

◆ set_from_string()

bool cgv::reflect::abst_enum_reflection_traits::set_from_string ( void *  instance_ptr,
const std::string &  str_val 
)
virtual

convert a given string value to the reflected type and store in the instance pointer

Reimplemented from cgv::reflect::abst_reflection_traits.

Definition at line 19 of file reflect_enum.cxx.

References cgv::utils::find_enum_index().

Member Data Documentation

◆ has_enum

const bool cgv::reflect::abst_enum_reflection_traits::has_enum = true
static

compile information about enum interface

Definition at line 13 of file reflect_enum.h.

◆ kind

const ReflectionTraitsKind cgv::reflect::abst_enum_reflection_traits::kind = RTK_STRING
static

Definition at line 14 of file reflect_enum.h.


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