From 3075cc7bd0aa6db5752e76183c267d091584705f Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 3 Nov 2020 22:30:58 +0000 Subject: Move config typedefs to ServerConfig and use auto in more places. --- include/configparser.h | 2 +- include/configreader.h | 12 +++++++++--- include/typedefs.h | 10 ---------- 3 files changed, 10 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/include/configparser.h b/include/configparser.h index 87f4cdf5f..6a5428b13 100644 --- a/include/configparser.h +++ b/include/configparser.h @@ -26,7 +26,7 @@ struct ParseStack { std::vector reading; insp::flat_map vars; - ConfigDataHash& output; + ServerConfig::TagMap& output; ConfigFileCache& FilesOutput; std::stringstream& errstr; diff --git a/include/configreader.h b/include/configreader.h index 521c0726f..f66d61080 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -292,6 +292,12 @@ class CoreExport ServerConfig */ typedef insp::flat_map> OperIndex; + /** Holds the server config. */ + typedef std::multimap, irc::insensitive_swo> TagMap; + + /** Holds iterators to a subsection of the server config map. */ + typedef stdalgo::iterator_range TagList; + /** Get a configuration tag by name. If one or more tags are present then the first is returned. * @param tag The name of the tag to get. * @returns Either a tag from the config or EmptyTag. @@ -300,9 +306,9 @@ class CoreExport ServerConfig /** Get a list of configuration tags by name. * @param tag The name of the tags to get. - * @returns Either a list of tags from the config or an empty ConfigTagList. + * @returns Either a list of tags from the config or an empty TagList. */ - ConfigTagList ConfTags(const std::string& tag); + TagList ConfTags(const std::string& tag); /** An empty configuration tag. */ std::shared_ptr EmptyTag; @@ -320,7 +326,7 @@ class CoreExport ServerConfig /** This holds all the information in the config file, * it's indexed by tag name to a vector of key/values. */ - ConfigDataHash config_data; + TagMap config_data; /** This holds all extra files that have been read in the configuration * (for example, MOTD and RULES files are stored here) diff --git a/include/typedefs.h b/include/typedefs.h index 90d2d93db..7907ea035 100644 --- a/include/typedefs.h +++ b/include/typedefs.h @@ -95,16 +95,6 @@ typedef std::vector IncludeChanList; */ typedef std::vector file_cache; -/** The entire configuration - */ -typedef std::multimap, irc::insensitive_swo> ConfigDataHash; - -/** Iterator of ConfigDataHash */ -typedef ConfigDataHash::const_iterator ConfigIter; - -/** Iterator pair, used for tag-name ranges */ -typedef stdalgo::iterator_range ConfigTagList; - /** Files read by the configuration */ typedef std::map ConfigFileCache; -- cgit v1.3.1-10-gc9f91