add convenience overloads for setting properties

This commit is contained in:
v4hn 2018-02-23 16:38:38 +01:00 committed by Robert Haschke
parent e9d1742337
commit 78b86bb65f
3 changed files with 14 additions and 0 deletions

View File

@ -230,6 +230,12 @@ public:
else else
it->second.setValue(value); it->second.setValue(value);
} }
/// overloading: const char* is stored as std::string
inline void set(const std::string& name, const char* value){
set<std::string>(name, value);
}
/// temporarily set the value of a property /// temporarily set the value of a property
void setCurrent(const std::string& name, const boost::any& value); void setCurrent(const std::string& name, const boost::any& value);

View File

@ -182,6 +182,10 @@ public:
} }
/// set a previously declared property to a new value /// set a previously declared property to a new value
void setProperty(const std::string& name, const boost::any& value); void setProperty(const std::string& name, const boost::any& value);
/// overload: const char* values are stored as std::string
inline void setProperty(const std::string& name, const char* value) {
setProperty(name, std::string(value));
}
/// analyze source of error and report accordingly /// analyze source of error and report accordingly
void reportPropertyError(const Property::error &e); void reportPropertyError(const Property::error &e);

View File

@ -115,6 +115,10 @@ public:
return const_cast<Task*>(this)->properties(); return const_cast<Task*>(this)->properties();
} }
void setProperty(const std::string& name, const boost::any& value); void setProperty(const std::string& name, const boost::any& value);
/// overload: const char* values are stored as std::string
inline void setProperty(const std::string& name, const char* value) {
setProperty(name, std::string(value));
}
protected: protected:
bool canCompute() const override; bool canCompute() const override;