cgv
Loading...
Searching...
No Matches
find_reflection_handler.h
1#pragma once
2
3#include "reflection_handler.h"
4#include <cgv/utils/token.h>
5
6#include "lib_begin.h"
7
8namespace cgv {
9 namespace reflect {
10
19{
20private:
21 std::vector<cgv::utils::token> tokens;
22 unsigned token_idx;
23 bool at_end() const;
24 bool step_if_matches(const std::string& name);
25
26protected:
27 const std::string* target;
28 const void* target_ptr;
29 struct group_info {
30 std::string group_name;
31 void* group_ptr;
33 GroupKind group_kind;
34 unsigned group_size;
35 };
36 bool traverse_matched_groups;
37 std::vector<group_info> traversed_groups;
38 void push_group(const std::string& _group_name, void* _group_ptr, abst_reflection_traits* _rt, GroupKind _group_kind, unsigned _group_size = -1);
39 void check_for_index_increment();
40 std::vector<std::string> target_tokens;
41 bool found;
42 bool valid;
43 std::string member_name;
45 void* member_ptr;
46 GroupKind group_kind;
47 unsigned grp_size;
48
49public:
51 find_reflection_handler(const std::string& _target);
53 find_reflection_handler(const void* _target_ptr, bool _traverse_matched_groups);
57 bool found_target() const;
59 bool found_valid_target() const;
61 void* get_member_ptr() const;
63 const std::string& get_member_name() const;
65 abst_reflection_traits* get_reflection_traits() const;
67 virtual void process_member_void(const std::string& member_name, void* member_ptr,
68 abst_reflection_traits* rt, GroupKind group_kind = GK_NO_GROUP, unsigned grp_size = -1);
70 int reflect_group_begin(GroupKind group_kind, const std::string& group_name, void* group_ptr,
71 abst_reflection_traits* rt, unsigned grp_size);
72
74 void reflect_group_end(GroupKind group_kind);
76 bool reflect_member_void(const std::string& member_name, void* member_ptr, abst_reflection_traits* rt);
78 bool reflect_method_void(const std::string& method_name, method_interface* mi_ptr,
79 abst_reflection_traits* return_traits, const std::vector<abst_reflection_traits*>& param_value_traits);
80};
81 }
82}
83
84#include <cgv/config/lib_end.h>
The cgv::reflect::find_reflection_hander steers traversal to a specific member and calls the virtual ...
the self reflection handler is passed to the virtual self_reflect() method of cgv::base::base.
GroupKind
different support group types
the cgv namespace
Definition print.h:11
abstract interface for type reflection with basic type management and optional string conversion
abstract interface to call a method of a given instance.