HasProperty config parameter recursion is now a thing, allowing for subproperties to be checked via the . syntax.
This commit is contained in:
@@ -136,9 +136,20 @@ namespace olc::utils
|
||||
|
||||
// Checks if a property exists - useful to avoid creating properties
|
||||
// via reading them, though non-essential
|
||||
inline bool HasProperty(const std::string& sName) const
|
||||
inline bool HasProperty(const std::string& sName)
|
||||
{
|
||||
return m_mapObjects.count(sName) > 0;
|
||||
size_t x = sName.find_first_of('.');
|
||||
if (x != std::string::npos)
|
||||
{
|
||||
std::string sProperty = sName.substr(0, x);
|
||||
if(HasProperty(sProperty)){
|
||||
return GetProperty(sName.substr(0, x)).HasProperty(sName.substr(x + 1, sName.size()));
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
return m_mapObjects.count(sName) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Access a datafile via a convenient name - "root.node.something.property"
|
||||
|
||||
Reference in New Issue
Block a user