From efc75198ded220f6af88914252c3361f6a5664d9 Mon Sep 17 00:00:00 2001 From: danieldg Date: Thu, 22 Oct 2009 22:29:35 +0000 Subject: Make ConfigTag::items private git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11956 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/configparser.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/configparser.cpp') diff --git a/src/configparser.cpp b/src/configparser.cpp index 22c3679ab..44eb117a8 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -84,7 +84,7 @@ struct Parser unget(ch); } - bool kv() + bool kv(std::vector* items) { std::string key; nextword(key); @@ -138,7 +138,7 @@ struct Parser break; value.push_back(ch); } - tag->items.push_back(KeyVal(key, value)); + items->push_back(KeyVal(key, value)); return true; } @@ -157,9 +157,10 @@ struct Parser if (name.empty()) throw CoreException("Empty tag name"); - tag = new ConfigTag(name, current.filename, current.line); + std::vector* items; + tag = ConfigTag::create(name, current.filename, current.line, items); - while (kv()); + while (kv(items)); if (name == "include") { @@ -376,6 +377,18 @@ std::string ConfigTag::getTagLocation() return src_name + ":" + ConvToStr(src_line); } +ConfigTag* ConfigTag::create(const std::string& Tag, const std::string& file, int line, std::vector*&items) +{ + ConfigTag* rv = new ConfigTag(Tag, file, line); + items = &rv->items; + return rv; +} + +ConfigTag::ConfigTag(const std::string& Tag, const std::string& file, int line) + : tag(Tag), src_name(file), src_line(line) +{ +} + std::string OperInfo::getConfig(const std::string& key) { std::string rv; -- cgit v1.3.1-10-gc9f91