From cd2d667ca7d3d31dbcf1f3bf0717b744b11ec776 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 26 Mar 2026 22:24:16 +0000 Subject: Switch typedefs to using statements. --- include/bancache.h | 2 +- include/channels.h | 2 +- include/clientprotocol.h | 4 +-- include/configparser.h | 2 +- include/configreader.h | 8 +++--- include/event.h | 2 +- include/extensible.h | 2 +- include/extension.h | 2 +- include/flat_map.h | 60 +++++++++++++++++++++---------------------- include/intrusive_list_impl.h | 2 +- include/listmode.h | 4 +-- include/logging.h | 2 +- include/membership.h | 2 +- include/mode.h | 14 +++++----- include/modechange.h | 2 +- include/modules.h | 2 +- include/modules/cap.h | 4 +-- include/modules/cloak.h | 4 +-- include/modules/dns.h | 2 +- include/modules/extban.h | 2 +- include/modules/invite.h | 2 +- include/modules/ircv3_batch.h | 2 +- include/modules/ldap.h | 4 +-- include/modules/regex.h | 6 ++--- include/modules/reload.h | 2 +- include/modules/sql.h | 8 +++--- include/protocol.h | 2 +- include/socket.h | 8 +++--- include/socketengine.h | 4 +-- include/streamsocket.h | 6 ++--- include/stringutils.h | 2 +- include/timer.h | 2 +- include/typedefs.h | 12 ++++----- include/usermanager.h | 8 +++--- include/users.h | 6 ++--- include/xline.h | 10 ++++---- 36 files changed, 104 insertions(+), 104 deletions(-) (limited to 'include') diff --git a/include/bancache.h b/include/bancache.h index faee0bf58..d9c26e70e 100644 --- a/include/bancache.h +++ b/include/bancache.h @@ -56,7 +56,7 @@ class CoreExport BanCacheManager final { /** A container of ban cache items. */ - typedef std::unordered_map BanCacheHash; + using BanCacheHash = std::unordered_map; BanCacheHash BanHash; bool RemoveIfExpired(BanCacheHash::iterator& it); diff --git a/include/channels.h b/include/channels.h index bff93581a..bec71ecd1 100644 --- a/include/channels.h +++ b/include/channels.h @@ -44,7 +44,7 @@ class CoreExport Channel final public: /** A map of Memberships on a channel keyed by User pointers */ - typedef std::unordered_map> MemberMap; + using MemberMap = std::unordered_map>; private: /** Modes for the channel. diff --git a/include/clientprotocol.h b/include/clientprotocol.h index 7be110f07..7c2ed6365 100644 --- a/include/clientprotocol.h +++ b/include/clientprotocol.h @@ -290,7 +290,7 @@ public: bool IsOwned() const { return owned; } }; - typedef std::vector ParamList; + using ParamList = std::vector; /** Escapes a value to the tag format. * @param value The value to escape. @@ -303,7 +303,7 @@ public: static std::string UnescapeTag(const std::string& value); private: - typedef std::vector> SerializedList; + using SerializedList = std::vector>; ParamList params; TagMap tags; diff --git a/include/configparser.h b/include/configparser.h index adcc880f6..67c1b3579 100644 --- a/include/configparser.h +++ b/include/configparser.h @@ -22,7 +22,7 @@ #pragma once -typedef std::unique_ptr FilePtr; +using FilePtr = std::unique_ptr; struct ParseStack final { diff --git a/include/configreader.h b/include/configreader.h index ee085185a..69d30a253 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -404,16 +404,16 @@ public: }; /** Holds the connect classes from the server config. */ - typedef std::vector> ClassVector; + using ClassVector = std::vector>; /** Holds the oper accounts from the server config. */ - typedef insp::flat_map> OperAccountMap; + using OperAccountMap = insp::flat_map>; /** Holds the oper types from the server config. */ - typedef insp::flat_map> OperTypeMap; + using OperTypeMap = insp::flat_map>; /** Holds iterators to a subsection of the server config map. */ - typedef insp::iterator_range TagList; + using TagList = insp::iterator_range; /** The connect classes from the server config. */ ClassVector Classes; diff --git a/include/event.h b/include/event.h index 887f73221..2da3e509c 100644 --- a/include/event.h +++ b/include/event.h @@ -49,7 +49,7 @@ public: bool operator()(ModuleEventListener* lhs, ModuleEventListener* rhs) const; }; - typedef insp::flat_multiset SubscriberList; + using SubscriberList = insp::flat_multiset; /** Constructor * @param mod Module providing the event(s) diff --git a/include/extensible.h b/include/extensible.h index 10ccbd3de..4e299d7dc 100644 --- a/include/extensible.h +++ b/include/extensible.h @@ -44,7 +44,7 @@ class CoreExport Extensible { public: /** The container which extension values are stored in. */ - typedef insp::flat_map ExtensibleStore; + using ExtensibleStore = insp::flat_map; /** Allows extensions to access the extension store. */ friend class ExtensionItem; diff --git a/include/extension.h b/include/extension.h index 1437a7b7d..cff6ab878 100644 --- a/include/extension.h +++ b/include/extension.h @@ -299,7 +299,7 @@ class ListExtItem { public: /** The underlying list type. */ - typedef Container List; + using List = Container; /** Initializes an instance of the ListExtItem class. * @param owner The module which created the extension. diff --git a/include/flat_map.h b/include/flat_map.h index 9dd394f12..1b4cfd36a 100644 --- a/include/flat_map.h +++ b/include/flat_map.h @@ -30,8 +30,8 @@ template class map_pair_compare final : public Comp { - typedef T value_type; - typedef typename value_type::first_type key_type; + using value_type = T; + using key_type = typename value_type::first_type; public: bool operator()(const value_type& x, const value_type& y) const @@ -65,22 +65,22 @@ template storage_type; + using storage_type = std::vector; storage_type vect; public: - typedef typename storage_type::iterator iterator; - typedef typename storage_type::const_iterator const_iterator; - typedef typename storage_type::reverse_iterator reverse_iterator; - typedef typename storage_type::const_reverse_iterator const_reverse_iterator; + using iterator = typename storage_type::iterator; + using const_iterator = typename storage_type::const_iterator; + using reverse_iterator = typename storage_type::reverse_iterator; + using const_reverse_iterator = typename storage_type::const_reverse_iterator; - typedef typename storage_type::size_type size_type; - typedef typename storage_type::difference_type difference_type; - typedef Key key_type; - typedef T value_type; + using size_type = typename storage_type::size_type; + using difference_type = typename storage_type::difference_type; + using key_type = Key; + using value_type = T; - typedef Comp key_compare; - typedef ElementComp value_compare; + using key_compare = Comp; + using value_compare = ElementComp; flat_map_base() = default; @@ -205,11 +205,11 @@ template , typename ElementComp = Comp> class flat_set : public detail::flat_map_base { - typedef detail::flat_map_base base_type; + using base_type = detail::flat_map_base; public: - typedef typename base_type::iterator iterator; - typedef typename base_type::value_type value_type; + using iterator = typename base_type::iterator; + using value_type = typename base_type::value_type; flat_set() = default; @@ -260,11 +260,11 @@ template , typename ElementComp = Comp> class flat_multiset : public detail::flat_map_base { - typedef detail::flat_map_base base_type; + using base_type = detail::flat_map_base; public: - typedef typename base_type::iterator iterator; - typedef typename base_type::value_type value_type; + using iterator = typename base_type::iterator; + using value_type = typename base_type::value_type; flat_multiset() = default; @@ -315,14 +315,14 @@ template , typename Element class flat_map : public detail::flat_map_base, Comp, T, detail::map_pair_compare, ElementComp>> { - typedef detail::flat_map_base, Comp, T, detail::map_pair_compare, ElementComp>> base_type; + using base_type = detail::flat_map_base, Comp, T, detail::map_pair_compare, ElementComp>>; public: - typedef typename base_type::iterator iterator; - typedef typename base_type::key_type key_type; - typedef typename base_type::value_type value_type; - typedef U mapped_type; - typedef typename base_type::value_compare value_compare; + using iterator = typename base_type::iterator; + using key_type = typename base_type::key_type; + using value_type = typename base_type::value_type; + using mapped_type = U; + using value_compare = typename base_type::value_compare; flat_map() = default; @@ -383,13 +383,13 @@ template , typename Element class flat_multimap : public detail::flat_map_base, Comp, T, detail::map_pair_compare, ElementComp>> { - typedef detail::flat_map_base, Comp, T, detail::map_pair_compare, ElementComp>> base_type; + using base_type = detail::flat_map_base, Comp, T, detail::map_pair_compare, ElementComp>>; public: - typedef typename base_type::iterator iterator; - typedef typename base_type::value_type value_type; - typedef U mapped_type; - typedef typename base_type::value_compare value_compare; + using iterator = typename base_type::iterator; + using value_type = typename base_type::value_type; + using mapped_type = U; + using value_compare = typename base_type::value_compare; flat_multimap() = default; diff --git a/include/intrusive_list_impl.h b/include/intrusive_list_impl.h index 940626ddf..4aa20817e 100644 --- a/include/intrusive_list_impl.h +++ b/include/intrusive_list_impl.h @@ -72,7 +72,7 @@ public: T* operator*() const { return curr; } }; - typedef iterator const_iterator; + using const_iterator = iterator; bool empty() const { diff --git a/include/listmode.h b/include/listmode.h index 6a7ebe913..cc8d4d03e 100644 --- a/include/listmode.h +++ b/include/listmode.h @@ -46,7 +46,7 @@ public: /** Items stored in the channel's list */ - typedef std::vector ModeList; + using ModeList = std::vector; private: class ChanData final @@ -73,7 +73,7 @@ private: /** Max items per channel by name */ - typedef std::vector limitlist; + using limitlist = std::vector; /** The default maximum list size. */ static constexpr unsigned int DEFAULT_LIST_SIZE = 100; diff --git a/include/logging.h b/include/logging.h index c53bf8c82..69d13a111 100644 --- a/include/logging.h +++ b/include/logging.h @@ -31,7 +31,7 @@ namespace Log class Manager; /** A shared pointer to a log method. */ - typedef std::shared_ptr MethodPtr; + using MethodPtr = std::shared_ptr; /** Levels at which messages can be logged. */ enum class Level diff --git a/include/membership.h b/include/membership.h index 7153f2d00..8926430e1 100644 --- a/include/membership.h +++ b/include/membership.h @@ -38,7 +38,7 @@ class CoreExport Membership final public: /** Type of the Membership id */ - typedef uint64_t Id; + using Id = uint64_t; /** User on the channel */ diff --git a/include/mode.h b/include/mode.h index 71a590625..d2732629c 100644 --- a/include/mode.h +++ b/include/mode.h @@ -92,10 +92,10 @@ class CoreExport ModeHandler { public: /** The underlying type of a mode rank. */ - typedef unsigned long Rank; + using Rank = unsigned long; /** The underlying type of a mode id. */ - typedef size_t Id; + using Id = size_t; enum Class { @@ -569,12 +569,12 @@ public: using ModeHandlerMap = insp::casemapped_unordered_map; /** Type of the container that contains whether a mode is set. */ - typedef std::bitset ModeStatus; + using ModeStatus = std::bitset; private: /** Type of the container that maps mode names to ModeWatchers */ - typedef insp::flat_multimap ModeWatcherMap; + using ModeWatcherMap = insp::flat_multimap; /** Last item in the ModeType enum */ @@ -629,10 +629,10 @@ private: ModeHandler::Id AllocateModeId(ModeHandler* mh); public: - typedef std::vector ListModeList; - typedef std::vector PrefixModeList; + using ListModeList = std::vector; + using PrefixModeList = std::vector; - typedef unsigned int ModeProcessFlag; + using ModeProcessFlag = unsigned int; enum ModeProcessFlags { /** If only this flag is specified, the mode change will be global diff --git a/include/modechange.h b/include/modechange.h index 561912c56..753c241cb 100644 --- a/include/modechange.h +++ b/include/modechange.h @@ -70,7 +70,7 @@ struct Modes::Change final class Modes::ChangeList final { public: - typedef std::vector List; + using List = std::vector; /** Add a new mode to be changed to this ChangeList * @param change Mode change to add diff --git a/include/modules.h b/include/modules.h index a3973705c..17011011b 100644 --- a/include/modules.h +++ b/include/modules.h @@ -243,7 +243,7 @@ public: using LinkDataDiff = insp::casemapped_map, std::optional>>; /** A list of modules. */ - typedef std::vector List; + using List = std::vector; /** Reference to the dynamic library. */ DLLManager* ModuleDLL = nullptr; diff --git a/include/modules/cap.h b/include/modules/cap.h index dbeedc27f..63d5f8c0b 100644 --- a/include/modules/cap.h +++ b/include/modules/cap.h @@ -28,7 +28,7 @@ namespace Cap static constexpr intptr_t CAP_302_BIT = (intptr_t)1 << MAX_CAPS; static constexpr unsigned int MAX_VALUE_LENGTH = 100; - typedef intptr_t Ext; + using Ext = intptr_t; class ExtItem : public IntExtItem { public: @@ -118,7 +118,7 @@ namespace Cap */ class Capability : public ServiceProvider, private dynamic_reference_base::CaptureHook { - typedef size_t Bit; + using Bit = size_t; /** Bit allocated to this cap, undefined if the cap is unregistered */ diff --git a/include/modules/cloak.h b/include/modules/cloak.h index 882fc6701..38381a25a 100644 --- a/include/modules/cloak.h +++ b/include/modules/cloak.h @@ -31,10 +31,10 @@ namespace Cloak struct Info; /** Encapsulates a list of cloaks. */ - typedef std::vector List; + using List = std::vector; /** A shared pointer to a cloak method. */ - typedef std::shared_ptr MethodPtr; + using MethodPtr = std::shared_ptr; /** Takes a hostname and retrieves the part which should be visible. * diff --git a/include/modules/dns.h b/include/modules/dns.h index 8e8ac23ea..da700f50d 100644 --- a/include/modules/dns.h +++ b/include/modules/dns.h @@ -76,7 +76,7 @@ namespace DNS ERROR_INVALIDTYPE }; - typedef uint16_t RequestId; + using RequestId = uint16_t; const int PORT = 53; diff --git a/include/modules/extban.h b/include/modules/extban.h index 944974ace..4f807d844 100644 --- a/include/modules/extban.h +++ b/include/modules/extban.h @@ -128,7 +128,7 @@ protected: public: /** A mapping of extban letters to their associated object. */ - typedef std::unordered_map LetterMap; + using LetterMap = std::unordered_map; /** A mapping of extban names to their associated objects. */ using NameMap = insp::casemapped_unordered_map; diff --git a/include/modules/invite.h b/include/modules/invite.h index 7b492201a..15fac9c0b 100644 --- a/include/modules/invite.h +++ b/include/modules/invite.h @@ -43,7 +43,7 @@ namespace Invite ANNOUNCE_DYNAMIC }; - typedef insp::intrusive_list List; + using List = insp::intrusive_list; } class Invite::APIBase diff --git a/include/modules/ircv3_batch.h b/include/modules/ircv3_batch.h index 3b8796912..bff4a25f3 100644 --- a/include/modules/ircv3_batch.h +++ b/include/modules/ircv3_batch.h @@ -26,7 +26,7 @@ namespace IRCv3 { namespace Batch { - typedef uint64_t RefTag; + using RefTag = uint64_t; class Manager; class ManagerImpl; class Batch; diff --git a/include/modules/ldap.h b/include/modules/ldap.h index 9563eabd1..d7399eb03 100644 --- a/include/modules/ldap.h +++ b/include/modules/ldap.h @@ -19,7 +19,7 @@ #pragma once -typedef int LDAPQuery; +using LDAPQuery = int; // XXX: This should be using ModuleException. class LDAPException final @@ -46,7 +46,7 @@ struct LDAPModification final std::vector values; }; -typedef std::vector LDAPMods; +using LDAPMods = std::vector; struct LDAPAttributes final : public std::map> diff --git a/include/modules/regex.h b/include/modules/regex.h index 793bb2c5d..94cee3070 100644 --- a/include/modules/regex.h +++ b/include/modules/regex.h @@ -31,13 +31,13 @@ namespace Regex template class SimpleEngine; /** A list of matches that were captured by index. */ - typedef std::vector Captures; + using Captures = std::vector; /** A list of matches that were captured by name. */ - typedef insp::flat_map NamedCaptures; + using NamedCaptures = insp::flat_map; /** A shared pointer to a regex pattern. */ - typedef std::shared_ptr PatternPtr; + using PatternPtr = std::shared_ptr; /** The options to use when matching a pattern. */ enum PatternOptions diff --git a/include/modules/reload.h b/include/modules/reload.h index 415f4d963..1670237dd 100644 --- a/include/modules/reload.h +++ b/include/modules/reload.h @@ -39,7 +39,7 @@ namespace ReloadModule { } }; - typedef std::vector List; + using List = std::vector; List list; public: diff --git a/include/modules/sql.h b/include/modules/sql.h index be2cf0005..beb37e233 100644 --- a/include/modules/sql.h +++ b/include/modules/sql.h @@ -30,16 +30,16 @@ namespace SQL class Result; /** A list of parameter replacement values. */ - typedef std::vector ParamList; + using ParamList = std::vector; /** A map of parameter replacement values. */ - typedef std::map ParamMap; + using ParamMap = std::map; /** A single SQL field. */ - typedef std::optional Field; + using Field = std::optional; /** A list of SQL fields from a specific row. */ - typedef std::vector Row; + using Row = std::vector; /** An enumeration of possible error codes. */ enum ErrorCode diff --git a/include/protocol.h b/include/protocol.h index 9520aaa4d..381e4bdc4 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -30,7 +30,7 @@ class User; class CoreExport ProtocolInterface { public: - typedef std::vector ServerList; + using ServerList = std::vector; virtual ~ProtocolInterface() = default; diff --git a/include/socket.h b/include/socket.h index 332bd6776..e869852b1 100644 --- a/include/socket.h +++ b/include/socket.h @@ -34,8 +34,8 @@ # include #else # include -typedef USHORT in_port_t; -typedef ADDRESS_FAMILY sa_family_t; +using in_port_t = USHORT; +using sa_family_t = ADDRESS_FAMILY; #endif #include @@ -185,7 +185,7 @@ struct CoreExport FailedPort final }; /** A list of failed port bindings, used for informational purposes on startup */ -typedef std::vector FailedPortList; +using FailedPortList = std::vector; #include "socketengine.h" @@ -210,7 +210,7 @@ public: } }; - typedef std::array IOHookProvList; + using IOHookProvList = std::array; /** IOHook providers for handling connections on this socket, * may be empty. diff --git a/include/socketengine.h b/include/socketengine.h index ee68def06..ff5876f45 100644 --- a/include/socketengine.h +++ b/include/socketengine.h @@ -297,9 +297,9 @@ private: public: #ifndef _WIN32 - typedef iovec IOVector; + using IOVector = iovec; #else - typedef WindowsIOVec IOVector; + using IOVector = WindowsIOVec; #endif /** Constructor. diff --git a/include/streamsocket.h b/include/streamsocket.h index 216c1c816..60f21e97e 100644 --- a/include/streamsocket.h +++ b/include/streamsocket.h @@ -123,15 +123,15 @@ public: public: /** One element of the queue, a continuous buffer */ - typedef std::string Element; + using Element = std::string; /** Sequence container of buffers in the queue */ - typedef std::deque Container; + using Container = std::deque; /** Container iterator */ - typedef Container::const_iterator const_iterator; + using const_iterator = Container::const_iterator; /** Return whether the queue is empty * @return True if the queue is empty, false otherwise diff --git a/include/stringutils.h b/include/stringutils.h index 55965ad7a..c2e79964d 100644 --- a/include/stringutils.h +++ b/include/stringutils.h @@ -162,7 +162,7 @@ namespace Percent namespace Template { /** A mapping of variable names to their values. */ - typedef insp::flat_map VariableMap; + using VariableMap = insp::flat_map; /** Replaces template variables like %foo% within a string. * @param str The string to template from. diff --git a/include/timer.h b/include/timer.h index 2b8e91eb8..ae9f5b272 100644 --- a/include/timer.h +++ b/include/timer.h @@ -120,7 +120,7 @@ public: */ class CoreExport TimerManager final { - typedef std::multimap TimerMap; + using TimerMap = std::multimap; /** A list of all pending timers */ diff --git a/include/typedefs.h b/include/typedefs.h index 8e6b6aa6d..1d1db99f5 100644 --- a/include/typedefs.h +++ b/include/typedefs.h @@ -52,9 +52,9 @@ namespace ClientProtocol class MessageTagProvider; class Serializer; - typedef std::vector MessageList; - typedef std::vector ParamList; - typedef std::string SerializedMessage; + using MessageList = std::vector; + using ParamList = std::vector; + using SerializedMessage = std::string; struct CoreExport MessageTagData final { @@ -69,13 +69,13 @@ namespace ClientProtocol * Sorted in descending order to ensure tag names beginning with symbols (such as '+') come later when iterating * the container than tags with a normal name. */ - typedef insp::flat_map> TagMap; + using TagMap = insp::flat_map>; } #include "base.h" /** Generic user list, used for exceptions */ -typedef std::set CUList; +using CUList = std::set; /** A bitset of characters which are enabled/set. */ -typedef std::bitset CharState; +using CharState = std::bitset; diff --git a/include/usermanager.h b/include/usermanager.h index ae9f16250..429c72ae8 100644 --- a/include/usermanager.h +++ b/include/usermanager.h @@ -40,18 +40,18 @@ public: /** Container that maps IP addresses to clone counts */ - typedef std::map CloneMap; + using CloneMap = std::map; /** Sequence container in which each element is a User* */ - typedef std::vector OperList; + using OperList = std::vector; /** A list containing users who are on a services server. */ - typedef std::vector ServiceList; + using ServiceList = std::vector; /** A list holding local users */ - typedef insp::intrusive_list LocalList; + using LocalList = insp::intrusive_list; private: /** Map of IP addresses for clone counting diff --git a/include/users.h b/include/users.h index 8d567df6b..ca3adb7bd 100644 --- a/include/users.h +++ b/include/users.h @@ -414,13 +414,13 @@ public: /** List of Memberships for this user */ - typedef insp::intrusive_list ChanList; + using ChanList = insp::intrusive_list; /** A list of memberships to consider when discovering the neighbors of a user. */ - typedef std::vector NeighborList; + using NeighborList = std::vector; /** A list of exceptions to the memberships that are considered when discovering the neighbours of a user. */ - typedef std::unordered_map NeighborExceptions; + using NeighborExceptions = std::unordered_map; /** The time at which this user's nickname was last changed. */ time_t nickchanged; diff --git a/include/xline.h b/include/xline.h index 22547bdaa..53c97da20 100644 --- a/include/xline.h +++ b/include/xline.h @@ -32,11 +32,11 @@ namespace Stats /** Contains a username and hostname split into two strings */ -typedef std::pair UserHostPair; +using UserHostPair = std::pair; /** A map of xline factories */ -typedef std::map XLineFactMap; +using XLineFactMap = std::map; /** A map of XLines indexed by string */ @@ -44,15 +44,15 @@ using XLineLookup = insp::casemapped_map; /** A map of XLineLookup maps indexed by string */ -typedef std::map XLineContainer; +using XLineContainer = std::map; /** An iterator in an XLineContainer */ -typedef XLineContainer::iterator ContainerIter; +using ContainerIter = XLineContainer::iterator; /** An iterator in an XLineLookup */ -typedef XLineLookup::iterator LookupIter; +using LookupIter = XLineLookup::iterator; /** XLine is the base class for ban lines such as G-lines and Z-lines. * Modules may derive from this, and their xlines will automatically be -- cgit v1.3.1-10-gc9f91