2024-06-15 16:38:37 -04:00
|
|
|
#pragma once
|
|
|
|
|
2024-06-15 16:57:16 -04:00
|
|
|
/**
|
|
|
|
* @brief Allows for rust-style function definitions
|
|
|
|
*/
|
2024-06-14 01:41:59 -04:00
|
|
|
#define fn auto
|
2024-06-15 16:38:37 -04:00
|
|
|
|
2024-06-15 16:57:16 -04:00
|
|
|
/**
|
|
|
|
* @brief Allows for easy getter creation
|
|
|
|
*
|
|
|
|
* @param class_name The class to use
|
2024-06-16 00:13:15 -04:00
|
|
|
* @param type Type of the getter
|
|
|
|
* @param name Name of the getter
|
2024-06-15 16:57:16 -04:00
|
|
|
*/
|
2024-06-14 01:41:59 -04:00
|
|
|
#define DEFINE_GETTER(class_name, type, name) \
|
2024-06-16 00:13:15 -04:00
|
|
|
fn class_name::get##name() const->type { return m_##name; }
|
2024-06-15 16:38:37 -04:00
|
|
|
|
2024-06-15 16:57:16 -04:00
|
|
|
/**
|
|
|
|
* @brief Helper for making reflect-cpp impls
|
|
|
|
*
|
|
|
|
* @param struct_name The struct name
|
2024-06-16 00:13:15 -04:00
|
|
|
* @param lower_name The arg name
|
|
|
|
* @param ... Values of the class to convert
|
2024-06-15 16:57:16 -04:00
|
|
|
*/
|
2024-06-16 00:13:15 -04:00
|
|
|
#define DEF_IMPL(struct_name, ...) \
|
|
|
|
struct struct_name##Impl { \
|
|
|
|
__VA_ARGS__; \
|
|
|
|
\
|
|
|
|
static fn from_class(const struct_name& instance) noexcept -> struct_name##Impl; \
|
|
|
|
\
|
|
|
|
[[nodiscard]] fn to_class() const -> struct_name; \
|
2024-06-15 16:38:37 -04:00
|
|
|
};
|