summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--context.h36
-rw-r--r--include/pso/macros.h36
2 files changed, 72 insertions, 0 deletions
diff --git a/context.h b/context.h
index def7359..1e0952b 100644
--- a/context.h
+++ b/context.h
@@ -87,6 +87,42 @@ typedef long ptrdiff_t;
#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__)
+
// pso/TMainTask.h
#define X_OR_Y_CHILD(flags, old_flags, one_prefix, zero_prefix, suffix) \
if (flags != old_flags) { \
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