InspIRCd  4.0
configparser.h
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  * Copyright (C) 2014 Attila Molnar <[email protected]>
5  * Copyright (C) 2013, 2016, 2021 Sadie Powell <[email protected]>
6  * Copyright (C) 2012 Robby <[email protected]>
7  * Copyright (C) 2009-2010 Daniel De Graaf <[email protected]>
8  *
9  * This file is part of InspIRCd. InspIRCd is free software: you can
10  * redistribute it and/or modify it under the terms of the GNU General Public
11  * License as published by the Free Software Foundation, version 2.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 
23 #pragma once
24 
25 struct ParseStack
26 {
27  std::vector<std::string> reading;
29  ServerConfig::TagMap& output;
30  ConfigFileCache& FilesOutput;
31  std::stringstream& errstr;
32 
34  : output(conf->config_data), FilesOutput(conf->Files), errstr(conf->errstr)
35  {
36  vars = {
37  // Special character escapes.
38  { "newline", "\n" },
39  { "nl", "\n" },
40 
41  // XML escapes.
42  { "amp", "&" },
43  { "apos", "'" },
44  { "gt", ">" },
45  { "lt", "<" },
46  { "quot", "\"" },
47 
48  // IRC formatting codes.
49  { "irc.bold", "\x02" },
50  { "irc.color", "\x03" },
51  { "irc.colour", "\x03" },
52  { "irc.italic", "\x1D" },
53  { "irc.monospace", "\x11" },
54  { "irc.reset", "\x0F" },
55  { "irc.reverse", "\x16" },
56  { "irc.strikethrough", "\x1E" },
57  { "irc.underline", "\x1F" },
58  };
59  }
60  bool ParseFile(const std::string& name, int flags, const std::string& mandatory_tag = std::string(), bool isexec = false);
61  void DoInclude(std::shared_ptr<ConfigTag> includeTag, int flags);
62  void DoReadFile(const std::string& key, const std::string& file, int flags, bool exec);
63 };
Definition: configreader.h:239
TagMap config_data
Definition: configreader.h:331
std::stringstream errstr
Definition: configreader.h:320
ConfigFileCache Files
Definition: configreader.h:336
std::multimap< std::string, std::shared_ptr< ConfigTag >, irc::insensitive_swo > TagMap
Definition: configreader.h:296
Definition: configparser.h:26