summaryrefslogtreecommitdiffstats
path: root/trace/record/client.h
diff options
context:
space:
mode:
Diffstat (limited to 'trace/record/client.h')
-rw-r--r--trace/record/client.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/trace/record/client.h b/trace/record/client.h
index fc240ca..2fe8d51 100644
--- a/trace/record/client.h
+++ b/trace/record/client.h
@@ -37,8 +37,10 @@
#include <csignal>
#include <cstring>
#include <iostream>
+#include <map>
#include <stdexcept>
#include <string>
+#include <utility>
class ErrnoException : public std::runtime_error {
public:
@@ -69,6 +71,33 @@ class FileDescriptor {
ssize_t (*reader_)(int fd, void* buf, size_t n) = nullptr;
};
+class ConfigFile {
+ public:
+ static const std::string kNoError;
+
+ ConfigFile() = default;
+
+ ConfigFile(const ConfigFile&) = delete;
+
+ ConfigFile& operator=(const ConfigFile&) = delete;
+
+ typedef std::string (*Parser)(void* arg, const char* name, const char* value);
+
+ void AddParser(const char* section, Parser parser, void* arg);
+
+ void Parse(const char* file);
+
+ private:
+ std::map<std::string, std::pair<Parser, void*> > parser_;
+
+ std::string error_;
+
+ static int INIHandler(void* user,
+ const char* section,
+ const char* name,
+ const char* value);
+};
+
class Client {
public:
Client() = default;