aboutsummaryrefslogtreecommitdiffstats
path: root/lang/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'lang/cpp/src')
-rw-r--r--lang/cpp/src/util.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/lang/cpp/src/util.h b/lang/cpp/src/util.h
index b6f9ca50..423973a8 100644
--- a/lang/cpp/src/util.h
+++ b/lang/cpp/src/util.h
@@ -177,6 +177,19 @@ static inline gpgme_sig_notation_flags_t add_to_gpgme_sig_notation_flags_t(unsi
return static_cast<gpgme_sig_notation_flags_t>(result);
}
+static inline std::vector<std::string> split(const std::string &text, char delimiter)
+{
+ std::vector<std::string> result;
+ if (!text.empty()) {
+ std::istringstream stream{text};
+ std::string line;
+ while (std::getline(stream, line, delimiter)) {
+ result.push_back(line);
+ }
+ }
+ return result;
+}
+
/**
* Adapter for passing a vector of strings as NULL-terminated array of
* const char* to the C-interface of gpgme.