From f06ce3b39496ca632a98ba06ad2eab14b6ccd6f7 Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Mon, 8 Apr 2019 15:50:42 -0300 Subject: [PATCH] Adds method getVariableNames to variables --- src/variables/variable.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/variables/variable.h b/src/variables/variable.h index 09dff6b8..d3ad71a2 100644 --- a/src/variables/variable.h +++ b/src/variables/variable.h @@ -610,6 +610,7 @@ class Variables : public std::vector { 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 { 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; + } };