PropertyRegistry use string ref args

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2025-06-20 10:29:12 -07:00
parent e9ecb6cefb
commit b431135550
2 changed files with 8 additions and 10 deletions

View File

@ -46,17 +46,16 @@ template<class TYPE>
class PropertyRegistry
{
public:
void defineProperty(const std::string property,
std::function<PropertyValue (TYPE object,
Sta *sta)> handler);
typedef std::function<PropertyValue (TYPE object, Sta *sta)> PropertyHandler;
void defineProperty(const std::string &property,
PropertyHandler handler);
PropertyValue getProperty(TYPE object,
const std::string property,
const std::string &property,
const char *type_name,
Sta *sta);
private:
std::map<const std::string, std::function<PropertyValue (TYPE object,
Sta *sta)>> registry_;
std::map<std::string, PropertyHandler> registry_;
};
class Properties

View File

@ -1384,7 +1384,7 @@ Properties::defineProperty(std::string property,
template<class TYPE>
PropertyValue
PropertyRegistry<TYPE>::getProperty(TYPE object,
const std::string property,
const std::string &property,
const char *type_name,
Sta *sta)
@ -1398,9 +1398,8 @@ PropertyRegistry<TYPE>::getProperty(TYPE object,
template<class TYPE>
void
PropertyRegistry<TYPE>::defineProperty(const std::string property,
std::function<PropertyValue (TYPE object,
Sta *sta)> handler)
PropertyRegistry<TYPE>::defineProperty(const std::string &property,
PropertyHandler handler)
{
registry_[property] = handler;
}