summaryrefslogtreecommitdiff
path: root/include/configreader.h
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-22 22:29:35 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-22 22:29:35 +0000
commitefc75198ded220f6af88914252c3361f6a5664d9 (patch)
tree0fedc5d95a50b8ce96fe18fede8e63af83c82e4e /include/configreader.h
parent4663fd393f925e0ff976dddd8df42cab3e5d2893 (diff)
Make ConfigTag::items private
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11956 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include/configreader.h')
-rw-r--r--include/configreader.h25
1 files changed, 20 insertions, 5 deletions
diff --git a/include/configreader.h b/include/configreader.h
index b0985f1b5..54d9f7053 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -37,24 +37,39 @@ typedef std::vector<std::string> file_cache;
*/
typedef std::pair<std::string, std::string> KeyVal;
-struct CoreExport ConfigTag : public refcountbase
+/** Structure representing a single <tag> in config */
+class CoreExport ConfigTag : public refcountbase
{
+ std::vector<KeyVal> items;
+ public:
const std::string tag;
const std::string src_name;
const int src_line;
- std::vector<KeyVal> items;
-
- ConfigTag(const std::string& Tag, const std::string& file, int line)
- : tag(Tag), src_name(file), src_line(line) {}
+ /** Get the value of an option, using def if it does not exist */
std::string getString(const std::string& key, const std::string& def = "");
+ /** Get the value of an option, using def if it does not exist */
long getInt(const std::string& key, long def = 0);
+ /** Get the value of an option, using def if it does not exist */
double getFloat(const std::string& key, double def = 0);
+ /** Get the value of an option, using def if it does not exist */
bool getBool(const std::string& key, bool def = false);
+ /** Get the value of an option
+ * @param key The option to get
+ * @param value The location to store the value (unmodified if does not exist)
+ * @param allow_newline Allow newlines in the option (normally replaced with spaces)
+ * @return true if the option exists
+ */
bool readString(const std::string& key, std::string& value, bool allow_newline = false);
std::string getTagLocation();
+
+ /** Create a new ConfigTag, giving access to the private KeyVal item list */
+ static ConfigTag* create(const std::string& Tag, const std::string& file, int line,
+ std::vector<KeyVal>*&items);
+ private:
+ ConfigTag(const std::string& Tag, const std::string& file, int line);
};
/** An entire config file, built up of KeyValLists