Make audio backend "file" configurable

This commit is contained in:
badaix 2020-10-05 22:42:56 +02:00
parent db5482b0fb
commit 541d803452
14 changed files with 112 additions and 15 deletions

View file

@ -20,6 +20,7 @@
#define STRING_UTILS_H
#include <algorithm>
#include <map>
#include <sstream>
#include <stdio.h>
#include <string>
@ -142,6 +143,25 @@ static std::vector<std::string> split(const std::string& s, char delim)
return elems;
}
static std::map<std::string, std::string> split_pairs(const std::string& s, char pair_delim, char key_value_delim)
{
std::map<std::string, std::string> result;
auto keyValueList = split(s, pair_delim);
for (auto& kv : keyValueList)
{
auto pos = kv.find(key_value_delim);
if (pos != std::string::npos)
{
std::string key = trim_copy(kv.substr(0, pos));
std::string value = trim_copy(kv.substr(pos + 1));
result[key] = value;
}
}
return result;
}
} // namespace string
} // namespace utils