vzlogger/include/options.h

53 lines
700 B
C
Raw Permalink Normal View History

#ifndef _OPTIONS_H_
#define _OPTIONS_H_
#include "list.h"
2012-02-10 10:04:40 +01:00
class Option {
public:
Option(char *key, char *value);
Option(char *key, int value);
Option(char *key, double value);
Option(char *key, bool value);
virtual ~Option();
operator char *();
2012-02-10 10:04:40 +01:00
operator int();
operator double();
operator bool();
protected:
Option(char *key);
char *key;
2012-02-10 10:04:40 +01:00
union {
const char *string;
int integer;
double floating;
int boolean:1;
} value;
/* subset of json_type's */
enum {
type_boolean = 1,
type_double,
type_int,
type_string = 6
} type;
};
2012-02-10 10:04:40 +01:00
class OptionList : public List<Option> {
public:
Option& lookup(char *key);
void parse();
protected:
};
#endif /* _OPTIONS_H_ */