-
Notifications
You must be signed in to change notification settings - Fork 21
Create custom properties
Julien SOYSOUVANH edited this page Oct 24, 2021
·
2 revisions
To define a new property, you just need to create a new reflected struct or class and inherit from rfk::Property. You can optionally use the PropertySettings property.
#include <string>
#include <Refureku/Properties/PropertySettings.h>
class CLASS(PropertySettings(rfk::EEntityKind::Method | rfk::EEntityKind::Function, false, true))
Tooltip : public rfk::Property
{
std::string _message;
public:
Tooltip(char const* message) noexcept:
_message(message)
{}
std::string const& getMessage() const { return _message; }
Tooltip_GENERATED
};
Property usage:
#include "Tooltip.h"
FUNCTION(Tooltip("It is working!"))
inline void testTooltipFunction() {}
#include <iostream>
#include <Refureku/Refureku.h>
//...
std::cout << rfk::getDatabase().getFileLevelFunctionByName("testTooltipFunction")->getProperty<Tooltip>()->getMessage() << std::endl; //prints "It is working!"