diff options
Diffstat (limited to 'lib/parameters.h')
-rw-r--r-- | lib/parameters.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/lib/parameters.h b/lib/parameters.h new file mode 100644 index 0000000..df7994b --- /dev/null +++ b/lib/parameters.h @@ -0,0 +1,59 @@ +/* + * parameters.h + * + * See the README file for copyright information and how to reach the author. + * + */ + +#ifndef __PARAMETERS_H +#define __PARAMETERS_H + +#include "db.h" + +//*************************************************************************** +// Parameters +//*************************************************************************** + +class cParameters +{ + public: + + enum Type + { + ptNum, + ptTime, // unix time + ptBool, + ptAscii + }; + + struct Parameter + { + const char* owner; + const char* name; + int type; + const char* def; + const char* regexp; + int readonly; + int visible; + }; + + cParameters(); + + int initDb(cDbConnection* connection); + int exitDb(); + + int getParameter(const char* owner, const char* name, char* value = 0); + int getParameter(const char* owner, const char* name, long int& value); + int setParameter(const char* owner, const char* name, const char* value); + int setParameter(const char* owner, const char* name, long int value); + + protected: + + cDbTable* parametersDb; + cDbStatement* selectParameters; + + static Parameter parameters[]; + static Parameter* getDefinition(const char* owner, const char* name); +}; + +#endif // __PARAMETERS_H |