git-svn-id: http://apu.dw.local/svnusers/JoshHoltrop/pppc/trunk@58 8131a0b2-b21c-1c47-bd6a-f003126495bd
41 lines
938 B
C++
41 lines
938 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);
|
|
size_t num_entries() const { return entries.size(); }
|
|
|
|
protected:
|
|
void reset();
|
|
std::pair<std::string, std::string> split(const std::string & line);
|
|
Action parseAction(const std::string & str);
|
|
};
|
|
|
|
#endif
|