aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/types
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/types')
-rw-r--r--host/lib/types/device_addr.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/host/lib/types/device_addr.cpp b/host/lib/types/device_addr.cpp
index d5e9ce0d4..3a7f80ed9 100644
--- a/host/lib/types/device_addr.cpp
+++ b/host/lib/types/device_addr.cpp
@@ -9,6 +9,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
#include <boost/tokenizer.hpp>
+#include <algorithm>
#include <regex>
#include <sstream>
#include <stdexcept>
@@ -51,6 +52,14 @@ device_addr_t::device_addr_t(const std::map<std::string, std::string>& info)
}
}
+bool device_addr_t::has_key_with_prefix(const std::string& prefix) const
+{
+ auto dev_keys = this->keys();
+ return std::any_of(dev_keys.begin(), dev_keys.end(), [prefix](const auto& key) {
+ return key.substr(0, prefix.size()) == prefix;
+ });
+}
+
std::string device_addr_t::to_pp_string(void) const
{
if (this->size() == 0)