diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-11-15 21:51:11 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-11-15 21:51:11 +0000 |
commit | 28bd852c8508414de24a1d29ea91121ef0b50504 (patch) | |
tree | 2f9b42d9fe0d8c1daaa569f129f7b035b9c5b29d /include | |
parent | 893242cff9a2efc3d7d6553a0b96c83c1033b638 (diff) |
Comments, woo and yay
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5751 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r-- | include/configreader.h | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/include/configreader.h b/include/configreader.h index 069e6321d..e7047b569 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -35,6 +35,12 @@ class InspIRCd; */ enum ConfigDataType { DT_NOTHING, DT_INTEGER, DT_CHARPTR, DT_BOOLEAN }; +/** Holds a config value, either string, integer or boolean. + * Callback functions receive one or more of these, either on + * their own as a reference, or in a reference to a deque of them. + * The callback function can then alter the values of the ValueItem + * classes to validate the settings. + */ class ValueItem { std::string v; @@ -91,6 +97,9 @@ class ValueItem } }; +/** The base class of the container 'ValueContainer' + * used internally by the core to hold core values. + */ class ValueContainerBase { public: @@ -103,6 +112,14 @@ class ValueContainerBase } }; +/** ValueContainer is used to contain pointers to different + * core values such as the server name, maximum number of + * clients etc. + * It is specialized to hold a data type, then pointed at + * a value in the ServerConfig class. When the value has been + * read and validated, the Set method is called to write the + * value safely in a type-safe manner. + */ template<typename T> class ValueContainer : public ValueContainerBase { T val; @@ -125,11 +142,27 @@ template<typename T> class ValueContainer : public ValueContainerBase } }; +/** A specialization of ValueContainer to hold a pointer to a bool + */ typedef ValueContainer<bool*> ValueContainerBool; + +/** A specialization of ValueContainer to hold a pointer to + * an unsigned int + */ typedef ValueContainer<unsigned int*> ValueContainerUInt; + +/** A specialization of ValueContainer to hold a pointer to + * a char array. + */ typedef ValueContainer<char*> ValueContainerChar; + +/** A specialization of ValueContainer to hold a pointer to + * an int + */ typedef ValueContainer<int*> ValueContainerInt; +/** A set of ValueItems used by multi-value validator functions + */ typedef std::deque<ValueItem> ValueList; /** A callback for validating a single value @@ -142,7 +175,6 @@ typedef bool (*MultiValidator)(ServerConfig* conf, const char*, char**, ValueLis */ typedef bool (*MultiNotify)(ServerConfig* conf, const char*); - /** Holds a core configuration item and its callbacks */ struct InitialConfig @@ -159,9 +191,9 @@ struct InitialConfig */ struct MultiConfig { - const char* tag; - char* items[12]; - int datatype[12]; + const char* tag; + char* items[12]; + int datatype[12]; MultiNotify init_function; MultiValidator validation_function; MultiNotify finish_function; |