pppc/Config.h

40 lines
875 B
C++

#ifndef CONFIG_H
#define CONFIG_H
#include <string>
#include <vector>
#include <utility> /* pair */
class Config
{
public:
enum Action { NONE, ON, OFF, PREVIOUS };
class Entry
{
public:
Entry(const std::string & name);
std::string name;
int pin;
Action on_start;
Action on_exit;
Action on_lock;
Action on_unlock;
protected:
};
std::string port;
std::vector<Entry> entries;
Config();
void read(const char * file);
protected:
void reset();
std::pair<std::string, std::string> split(const std::string & line);
Action parseAction(const std::string & str);
};
#endif