mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-22 21:46:15 +02:00
Make audio backend "file" configurable
This commit is contained in:
parent
db5482b0fb
commit
541d803452
14 changed files with 112 additions and 15 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue