summaryrefslogtreecommitdiff
path: root/include/configreader.h
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-14 22:38:43 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-14 22:38:43 +0000
commit004217daed4e60162bcb3f99c85e2efe41c21a03 (patch)
treebece4451184b827e623226c0d7117ead5ff37090 /include/configreader.h
parent4482876dd3d7d4e6f06ac43dcdbe98db04512ab2 (diff)
Tons of tweaks to the config stuff for the core
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5744 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include/configreader.h')
-rw-r--r--include/configreader.h47
1 files changed, 43 insertions, 4 deletions
diff --git a/include/configreader.h b/include/configreader.h
index 516c6a6ed..023121ffc 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -31,19 +31,52 @@
class ServerConfig;
class InspIRCd;
+/** Types of data in the core config
+ */
+enum ConfigDataType { DT_NOTHING, DT_INTEGER, DT_CHARPTR, DT_BOOLEAN };
+
+class ValueItem
+{
+ std::string v;
+ public:
+ ValueItem(int value)
+ {
+ std::stringstream n;
+ n << value;
+ v = n.str();
+ }
+
+ ValueItem(bool value)
+ {
+ std::stringstream n;
+ n << value;
+ v = n.str();
+ }
+
+ ValueItem(char* value)
+ {
+ v = value;
+ }
+
+ int GetInteger() { return atoi(v.c_str()); };
+
+ const char* GetString() { return v.c_str(); };
+
+ bool GetBool() { return GetInteger(); };
+};
+
+typedef std::deque<ValueItem> ValueList;
+
/** A callback for validating a single value
*/
typedef bool (*Validator)(ServerConfig* conf, const char*, const char*, void*);
/** A callback for validating multiple value entries
*/
-typedef bool (*MultiValidator)(ServerConfig* conf, const char*, char**, void**, int*);
+typedef bool (*MultiValidator)(ServerConfig* conf, const char*, char**, ValueList&, int*);
/** A callback indicating the end of a group of entries
*/
typedef bool (*MultiNotify)(ServerConfig* conf, const char*);
-/** Types of data in the core config
- */
-enum ConfigDataType { DT_NOTHING, DT_INTEGER, DT_CHARPTR, DT_BOOLEAN };
/** Holds a core configuration item and its callbacks
*/
@@ -498,4 +531,10 @@ class ServerConfig : public Extensible
bool InitializeDisabledCommands(const char* data, InspIRCd* ServerInstance);
+bool InitTypes(ServerConfig* conf, const char* tag);
+bool InitClasses(ServerConfig* conf, const char* tag);
+bool DoType(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
+bool DoClass(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
+bool DoneClassesAndTypes(ServerConfig* conf, const char* tag);
+
#endif