sandbox
Loading...
Searching...
No Matches
attribute.hpp
1// SPDX-License-Identifier: MIT
2#ifndef LIBSBX_SCRIPTING_MANAGED_ATRIBUTE_HPP_
3#define LIBSBX_SCRIPTING_MANAGED_ATRIBUTE_HPP_
4
5#include <libsbx/scripting/managed/core.hpp>
6#include <libsbx/scripting/managed/string.hpp>
7#include <libsbx/scripting/managed/type.hpp>
8
9namespace sbx::scripting::managed {
10
11class attribute {
12
13 friend class type;
14 friend class method_info;
15 friend class field_info;
16 friend class property_info;
17
18public:
19
20 auto get_type() -> type&;
21
22 template<typename Return>
23 auto get_field_value(std::string_view field_name) -> Return {
24 auto result = Return{};
25
26 _get_field_value_internal(field_name, &result);
27
28 return result;
29 }
30
31private:
32
33 auto _get_field_value_internal(std::string_view field_name, void* value) const -> void;
34
35 handle _handle = -1;
36 type* _type = nullptr;
37
38}; // class attribute
39
40template<>
41auto attribute::get_field_value<std::string>(std::string_view field_name) -> std::string;
42
43template<>
44auto attribute::get_field_value<bool>(std::string_view field_name) -> bool;
45
46}; // namespace sbx::scripting::managed
47
48#endif // LIBSBX_SCRIPTING_MANAGED_ATRIBUTE_HPP_
Definition: attribute.hpp:11
Definition: field_info.hpp:14
Definition: method_info.hpp:14
Definition: property_info.hpp:14
Definition: type.hpp:11