Adds method resolveFirstCopy to collections

Using the copy whenever it is necessary to avoid memory leak.
This commit is contained in:
Felipe Zimmerle
2016-07-08 10:22:37 -03:00
parent 6e4226ee4d
commit 833089eb70
8 changed files with 131 additions and 7 deletions

View File

@@ -51,6 +51,7 @@ class Collection {
virtual void del(const std::string& key) = 0;
virtual std::string* resolveFirst(const std::string& var) = 0;
virtual std::string resolveFirstCopy(const std::string& var) = 0;
virtual void resolveSingleMatch(const std::string& var,
std::vector<const Variable *> *l) = 0;
@@ -89,6 +90,12 @@ class Collection {
return resolveFirst(nkey);
}
virtual std::string resolveFirstCopy(const std::string& var,
std::string compartment) {
std::string nkey = compartment + "::" + var;
return resolveFirstCopy(nkey);
}
virtual void resolveSingleMatch(const std::string& var,
std::string compartment, std::vector<const Variable *> *l) {
std::string nkey = compartment + "::" + var;
@@ -102,12 +109,10 @@ class Collection {
}
virtual void resolveRegularExpression(const std::string& var,
std::string compartment,
std::vector<const Variable *> *l) {
std::string compartment, std::vector<const Variable *> *l) {
std::string nkey = compartment + "::" + var;
resolveRegularExpression(nkey, l);
}
};
} // namespace collection