2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2017 Peter Powell <petpow@saberuk.com>
6 * This file is part of InspIRCd. InspIRCd is free software: you can
7 * redistribute it and/or modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation, version 2.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 class CoreExport TokenList
27 /** Whether this list includes all tokens by default. */
30 /** Either the tokens to exclude if in permissive mode or the tokens to include if in strict mode. */
31 insp::flat_set<std::string, irc::insensitive_swo> tokens;
34 /** Adds a space-delimited list of tokens to the token list.
35 * @param tokenlist The list of space-delimited tokens to add.
37 void AddList(const std::string& tokenlist);
39 /** Adds a single token to the token list.
40 * @param token The token to add.
42 void Add(const std::string& token);
44 /** Removes all tokens from the token list. */
47 /** Determines whether the specified token exists in the token list.
48 * @param token The token to search for.
50 bool Contains(const std::string& token) const;
52 /** Removes the specified token from the token list.
53 * @param token The token to remove.
55 void Remove(const std::string& token);
57 /** Retrieves a string which represents the contents of this token list. */
58 std::string ToString() const;
60 /** Determines whether the specified token list contains the same tokens as this instance.
61 * @param other The tokenlist to compare against.
62 * @return True if the token lists are equal; otherwise, false.
64 bool operator==(const TokenList& other) const;