Adds method getVariableNames to variables

This commit is contained in:
Felipe Zimmerle 2019-04-08 15:50:42 -03:00
parent 7ac2fd5fb0
commit 2bc522431f
No known key found for this signature in database
GPG Key ID: E6DFB08CE8B11277

View File

@ -610,6 +610,7 @@ class Variables : public std::vector<Variable *> {
return std::find_if(begin(), end(),
[v](Variable *m) -> bool { return *v == *m; }) != end();
};
bool contains(const VariableValue *v) {
return std::find_if(begin(), end(),
[v](Variable *m) -> bool {
@ -620,6 +621,19 @@ class Variables : public std::vector<Variable *> {
return v->getKeyWithCollection() == *m->m_fullName.get();
}) != end();
};
std::string getVariableNames(const std::string &sep = ",") {
std::string names;
for (auto a : *this) {
if (names.length() > 0) {
names = names + sep + *a->m_fullName;
} else {
names = *a->m_fullName;
}
}
return names;
}
};