From da52dc2eba678a8de2f5a4f8e17f2c4e65ba7a20 Mon Sep 17 00:00:00 2001 From: John Date: Sat, 30 Apr 2022 15:38:05 +0200 Subject: [PATCH] add keys() --- src/lib/ebus/stringhelper.cpp | 11 +++++++++++ src/lib/ebus/stringhelper.h | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/src/lib/ebus/stringhelper.cpp b/src/lib/ebus/stringhelper.cpp index 6ca6163e..cfc86cc9 100644 --- a/src/lib/ebus/stringhelper.cpp +++ b/src/lib/ebus/stringhelper.cpp @@ -521,4 +521,15 @@ void StringReplacers::reduce(bool compress) { } while (reduced); } +vector StringReplacers::keys() const { + vector ret; + for (auto& it : m_constants) { + ret.push_back(it.first); + } + for (auto& it : m_replacers) { + ret.push_back(it.first); + } + return ret; +} + } // namespace ebusd diff --git a/src/lib/ebus/stringhelper.h b/src/lib/ebus/stringhelper.h index 447c33ef..57938967 100644 --- a/src/lib/ebus/stringhelper.h +++ b/src/lib/ebus/stringhelper.h @@ -263,6 +263,12 @@ class StringReplacers { */ void reduce(bool compress = false); + /** + * Get all set keys. + * @return the set keys. + */ + vector keys() const; + private: /** constant values from the integration file. */ map m_constants;