diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2023-02-26 19:10:51 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2023-02-26 19:10:51 -0400 |
commit | e140c56525cca0eb490bdd77eac4701f4748d34f (patch) | |
tree | 63138f5a96c273e30241b5f7abaf109d4663cec7 /include | |
parent | 25e3c303b8f47785a0056077a66b7a77449ff827 (diff) |
pso/macros: Add getters/setters macros
This'll come in handy later.
Diffstat (limited to 'include')
-rw-r--r-- | include/pso/macros.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/pso/macros.h b/include/pso/macros.h index 1434e16..a341b7f 100644 --- a/include/pso/macros.h +++ b/include/pso/macros.h @@ -57,4 +57,40 @@ #define __packed__ +#define PRIVATE_MEMBER_GETTER(type, name) \ + type name() { \ + return m_##name; \ + } + +#define PRIVATE_MEMBER_SETTER(type, name) \ + void set_##name(type val) { \ + m_##name = val; \ + } + +#define PRIVATE_MEMBER_GETTER_ARRAY(type, name, size) \ + TArray<type, size> &name() { \ + return m_##name; \ + } + +#define PRIVATE_MEMBER_GETTER_FUNC(ret_type, name, ...) \ + ret_type (*name())(__VA_ARGS__) { \ + return m_##name; \ + } + +#define PRIVATE_MEMBER_SETTER_FUNC(ret_type, name, ...) \ + void set_##name(ret_type (*val)(__VA_ARGS__)) { \ + m_##name = val; \ + } + +#define PRIVATE_MEMBER_ACCESSORS(type, name) \ + PRIVATE_MEMBER_GETTER(type, name); \ + PRIVATE_MEMBER_SETTER(type, name) + +#define PRIVATE_MEMBER_ACCESSORS_ARRAY(type, name, size) \ + PRIVATE_MEMBER_GETTER_ARRAY(type, name, size) + +#define PRIVATE_MEMBER_ACCESSORS_FUNC(ret_type, name, ...) \ + PRIVATE_MEMBER_GETTER_FUNC(ret_type, name, __VA_ARGS__); \ + PRIVATE_MEMBER_SETTER_FUNC(ret_type, name, __VA_ARGS__) + #endif |