Fixed DefinitionNode::findChildByName
This commit is contained in:
parent
62a7f746ea
commit
990d28d09d
2 changed files with 3 additions and 4 deletions
|
@ -91,8 +91,7 @@ DefinitionNode *DefinitionNode::findByPath(const string &path) const {
|
|||
} else {
|
||||
size_t seppos = path.find("/");
|
||||
string child_name = (seppos == string::npos) ? path : path.substr(0, seppos);
|
||||
DefinitionNode *child =
|
||||
((DefinitionNode *)this)->findChildByName(child_name); // FIXME findChildByName should be const
|
||||
DefinitionNode *child = findChildByName(child_name);
|
||||
if (child) {
|
||||
if (seppos == string::npos) {
|
||||
return child;
|
||||
|
@ -231,7 +230,7 @@ void DefinitionNode::removeChild(DefinitionNode *child) {
|
|||
}
|
||||
}
|
||||
|
||||
DefinitionNode *DefinitionNode::findChildByName(const string name) {
|
||||
DefinitionNode *DefinitionNode::findChildByName(const string &name) const {
|
||||
for (auto child : children) {
|
||||
if (child->name == name) {
|
||||
return child;
|
||||
|
|
|
@ -98,7 +98,7 @@ class DEFINITIONSHARED_EXPORT DefinitionNode {
|
|||
protected:
|
||||
void addChild(DefinitionNode *child);
|
||||
void removeChild(DefinitionNode *child);
|
||||
virtual DefinitionNode *findChildByName(const string name);
|
||||
virtual DefinitionNode *findChildByName(const string &name) const;
|
||||
|
||||
/**
|
||||
* Get the size in bytes this child will consume when serialized to a stream.
|
||||
|
|
Loading…
Reference in a new issue