Allow dumping all options in a configuration

This commit is contained in:
Matias Fontanini
2016-06-18 08:23:25 -07:00
parent 2532a2d614
commit 84d98b38e5
6 changed files with 53 additions and 4 deletions

View File

@@ -31,6 +31,7 @@
#define CPPKAFKA_CONFIGURATION_BASE_H
#include <string>
#include <map>
namespace cppkafka {
@@ -59,6 +60,14 @@ public:
void set(const std::string& name, const char* value) {
proxy_set(name, value);
}
protected:
static std::map<std::string, std::string> parse_dump(const char** values, size_t count) {
std::map<std::string, std::string> output;
for (size_t i = 0; i < count; i += 2) {
output[values[i]] = values[i + 1];
}
return output;
}
private:
void proxy_set(const std::string& name, const std::string& value) {
static_cast<Concrete&>(*this).set(name, value);