NOTE: This is still a major work in progress. Right now the tool mostly works, but is ugly, generates crappy code, and has bugs. Use at your own risk.
Pull requests welcomed and encouraged and begged for!
Reflector is a tool similar to the Unreal Header Tool. It will scan the headers in you codebase for types/methods/fields annotated with a special reflection syntax. It will then create files containing reflection information about those entities. The main type of file it will create is the *.mirror
file, which you are meant to include in the files Reflector is scanning. This will inject reflection information straight into your files, allowing for compile-time reflection of these entities.
#include "Component.h.mirror"
RClass()
class Component : public Reflector::Reflectable
{
RBody()
RField({"ReadOnly": true, "Required": true, "Setter": false})
std::string Name;
RMethod()
void SetName(std::string_view name) { Name = name; }
protected:
RField({"ParentPointer": true})
class Object* mParentObject = nullptr;
};
REnum()
enum class TestEnum
{
A = 5,
B,
C
};
See Usage in the wiki.
See the example in the wiki.
- C++17 (C++20 even)
- nlohmann/json
- args
- my personal baselib