diff options
author | Sadie Powell <sadie@witchery.services> | 2023-06-03 21:42:06 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2023-06-03 21:51:07 +0100 |
commit | 9d0a6ddc67b1e7bd0c32603b6fa90b702c13447d (patch) | |
tree | 1e4d019535c89f67e7cf54a76afabe188947c668 /include/config.h | |
parent | 29db25dac7aff36b4f7239a9fabd57230534cf35 (diff) | |
parent | fbf3b344740f6bd4f9337e485e35e9e8103428bc (diff) |
Merge branch '2.0' into 2.1.
Diffstat (limited to 'include/config.h')
-rw-r--r-- | include/config.h | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/include/config.h b/include/config.h index 0cf9fe52d..bcd792adb 100644 --- a/include/config.h +++ b/include/config.h @@ -19,9 +19,11 @@ namespace Configuration { + namespace Internal + { class CoreExport Block { - friend struct Conf; + friend struct Configuration::Conf; public: typedef Anope::map<Anope::string> item_map; @@ -33,13 +35,17 @@ namespace Configuration block_map blocks; int linenum; + /* Represents a missing tag. */ + static Block EmptyBlock; + public: Block(const Anope::string &); const Anope::string &GetName() const; - int CountBlock(const Anope::string &name); - Block* GetBlock(const Anope::string &name, int num = 0); + int CountBlock(const Anope::string &name) const; + const Block* GetBlock(const Anope::string &name, int num = 0) const; + Block* GetMutableBlock(const Anope::string &name, int num = 0); - template<typename T> inline T Get(const Anope::string &tag) + template<typename T> inline T Get(const Anope::string &tag) const { return this->Get<T>(tag, ""); } @@ -65,6 +71,10 @@ namespace Configuration template<> CoreExport const Anope::string Block::Get(const Anope::string &tag, const Anope::string& def) const; template<> CoreExport time_t Block::Get(const Anope::string &tag, const Anope::string &def) const; template<> CoreExport bool Block::Get(const Anope::string &tag, const Anope::string &def) const; + } // namespace Internal + + typedef const Internal::Block Block; + typedef Internal::Block MutableBlock; /** Represents a configuration file */ @@ -128,9 +138,6 @@ namespace Configuration std::map<Anope::string, Block *> modules; Anope::map<Anope::string> bots; - /* Represents a missing tag. */ - Block EmptyBlock; - Conf(); ~Conf(); @@ -142,7 +149,7 @@ namespace Configuration BotInfo *GetClient(const Anope::string &name); - Block *GetCommand(CommandSource &); + const Block *GetCommand(CommandSource &); }; struct Uplink |