summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/CMakeLists.txt48
-rw-r--r--include/access.h7
-rw-r--r--include/account.h15
-rw-r--r--include/anope.h33
-rw-r--r--include/base.h20
-rw-r--r--include/bots.h5
-rw-r--r--include/channels.h5
-rw-r--r--include/commands.h15
-rw-r--r--include/config.h14
-rw-r--r--include/defs.h2
-rw-r--r--include/extensible.h21
-rw-r--r--include/hashcomp.h26
-rw-r--r--include/language.h13
-rw-r--r--include/lists.h11
-rw-r--r--include/logger.h27
-rw-r--r--include/mail.h9
-rw-r--r--include/memo.h9
-rw-r--r--include/messages.h42
-rw-r--r--include/modes.h31
-rw-r--r--include/module.h5
-rw-r--r--include/modules.h10
-rw-r--r--include/modules/bs_badwords.h8
-rw-r--r--include/modules/bs_kick.h6
-rw-r--r--include/modules/cs_entrymsg.h6
-rw-r--r--include/modules/cs_log.h8
-rw-r--r--include/modules/cs_mode.h8
-rw-r--r--include/modules/dns.h25
-rw-r--r--include/modules/encryption.h6
-rw-r--r--include/modules/httpd.h14
-rw-r--r--include/modules/ldap.h9
-rw-r--r--include/modules/ns_cert.h6
-rw-r--r--include/modules/os_forbid.h13
-rw-r--r--include/modules/os_ignore.h8
-rw-r--r--include/modules/os_news.h5
-rw-r--r--include/modules/os_session.h15
-rw-r--r--include/modules/pseudoclients/chanserv.h5
-rw-r--r--include/modules/pseudoclients/global.h5
-rw-r--r--include/modules/pseudoclients/memoserv.h5
-rw-r--r--include/modules/pseudoclients/nickserv.h5
-rw-r--r--include/modules/redis.h4
-rw-r--r--include/modules/sasl.h6
-rw-r--r--include/modules/set_misc.h7
-rw-r--r--include/modules/sql.h20
-rw-r--r--include/modules/ssl.h2
-rw-r--r--include/modules/suspend.h6
-rw-r--r--include/modules/xmlrpc.h4
-rw-r--r--include/opertype.h7
-rw-r--r--include/protocol.h24
-rw-r--r--include/pstdint.h800
-rw-r--r--include/regchannel.h10
-rw-r--r--include/regexpr.h9
-rw-r--r--include/serialize.h27
-rw-r--r--include/servers.h7
-rw-r--r--include/service.h11
-rw-r--r--include/services.h25
-rw-r--r--include/socketengine.h5
-rw-r--r--include/sockets.h35
-rw-r--r--include/sysconf.h.cmake56
-rw-r--r--include/threadengine.h13
-rw-r--r--include/timers.h5
-rw-r--r--include/uplink.h11
-rw-r--r--include/users.h12
-rw-r--r--include/version.cpp6
-rw-r--r--include/xline.h11
64 files changed, 335 insertions, 1313 deletions
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 73e57f59e..448e7fdac 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -3,7 +3,7 @@ set_source_files_properties(version.cpp PROPERTIES LANGUAGE CXX COMPILE_FLAGS "$
# Generate version-bin executable to modify version.h, setting it's linker flags as well
add_executable(version-bin version.cpp)
set_target_properties(version-bin PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${LDFLAGS}")
-get_target_property(version_BINARY version-bin LOCATION)
+set(version_BINARY "$<TARGET_FILE:version-bin>")
# Modify version.h from the above executable, with dependencies to version.cpp
# and all of the source files in the main build
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version_build
@@ -16,49 +16,7 @@ add_to_cpack_ignored_files("${version_BINARY}$" TRUE)
if(NOT WIN32)
add_to_cpack_ignored_files("version.h$" TRUE)
add_to_cpack_ignored_files("build.h$" TRUE)
-endif(NOT WIN32)
-
-set(PCH_SOURCES_GCH "")
-if(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)
- string(REPLACE " " ";" PCH_CXXFLAGS "${CXXFLAGS} ${CMAKE_CXX_FLAGS}")
-
- file(GLOB PCH_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
- sort_list(PCH_SOURCES)
-
- foreach(PCH_SOURCE ${PCH_SOURCES})
- find_includes(${PCH_SOURCE} INCLUDES)
- set(INCLUDES_LIST)
- append_to_list(INCLUDES_LIST ${PCH_SOURCE})
- foreach(INCLUDE ${INCLUDES})
- # Extract the filename from the #include line
- extract_include_filename(${INCLUDE} FILENAME QUOTE_TYPE)
- if(QUOTE_TYPE STREQUAL "quotes")
- find_in_list(PCH_SOURCES "${FILENAME}" FOUND)
- if(NOT FOUND EQUAL -1)
- append_to_list(INCLUDES_LIST ${FILENAME})
- endif(NOT FOUND EQUAL -1)
- endif(QUOTE_TYPE STREQUAL "quotes")
- endforeach(INCLUDE)
-
- set(PCH_EXTRAFLAGS "")
- if(DEBUG_BUILD)
- set(PCH_EXTRAFLAGS "-g")
- endif(DEBUG_BUILD)
- if(PCH_SOURCE STREQUAL "module.h")
- set(PCH_EXTRAFLAGS ${PCH_EXTRAFLAGS} -fPIC)
- endif(PCH_SOURCE STREQUAL "module.h")
- if(GETTEXT_INCLUDE)
- set(PCH_GETTEXT_INCLUDE "-I${GETTEXT_INCLUDE}")
- endif(GETTEXT_INCLUDE)
-
- set(PCH_SOURCES_GCH "${PCH_SOURCES_GCH};${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch")
- add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch
- COMMAND ${CMAKE_CXX_COMPILER} ARGS ${PCH_CXXFLAGS} ${PCH_EXTRAFLAGS}
- ${PCH_GETTEXT_INCLUDE} -I${CMAKE_CURRENT_BINARY_DIR} -I${Anope_SOURCE_DIR}/modules/pseudoclients ${CMAKE_CURRENT_SOURCE_DIR}/${PCH_SOURCE} -o ${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch
- DEPENDS ${INCLUDES_LIST} VERBATIM
- )
- endforeach(PCH_SOURCE ${PCH_SOURCES})
-endif(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)
+endif()
# Add a custom target to the above file
-add_custom_target(headers DEPENDS version-bin ${CMAKE_CURRENT_BINARY_DIR}/version_build ${PCH_SOURCES_GCH})
+add_custom_target(headers DEPENDS version-bin ${CMAKE_CURRENT_BINARY_DIR}/version_build)
diff --git a/include/access.h b/include/access.h
index 23beac400..63b20955d 100644
--- a/include/access.h
+++ b/include/access.h
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church.
*/
-#ifndef ACCESS_H
-#define ACCESS_H
+#pragma once
#include "services.h"
#include "anope.h"
@@ -95,7 +94,7 @@ class CoreExport ChanAccess : public Serializable
const Anope::string &Mask() const;
NickCore *GetAccount() const;
- void Serialize(Serialize::Data &data) const anope_override;
+ void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
static const unsigned int MAX_DEPTH = 4;
@@ -170,5 +169,3 @@ class CoreExport AccessGroup
inline bool empty() const { return paths.empty(); }
};
-
-#endif
diff --git a/include/account.h b/include/account.h
index cffd196a1..eb1b6a81f 100644
--- a/include/account.h
+++ b/include/account.h
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church.
*/
-#ifndef ACCOUNT_H
-#define ACCOUNT_H
+#pragma once
#include "extensible.h"
#include "serialize.h"
@@ -20,7 +19,7 @@
typedef Anope::hash_map<NickAlias *> nickalias_map;
typedef Anope::hash_map<NickCore *> nickcore_map;
-typedef TR1NS::unordered_map<uint64_t, NickCore *> nickcoreid_map;
+typedef std::unordered_map<uint64_t, NickCore *> nickcoreid_map;
extern CoreExport Serialize::Checker<nickalias_map> NickAliasList;
extern CoreExport Serialize::Checker<nickcore_map> NickCoreList;
@@ -54,7 +53,7 @@ class CoreExport NickAlias : public Serializable, public Extensible
NickAlias(const Anope::string &nickname, NickCore *nickcore);
~NickAlias();
- void Serialize(Serialize::Data &data) const anope_override;
+ void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
/** Set a vhost for the user
@@ -149,7 +148,7 @@ class CoreExport NickCore : public Serializable, public Extensible
NickCore(const Anope::string &nickdisplay, uint64_t nickid = 0);
~NickCore();
- void Serialize(Serialize::Data &data) const anope_override;
+ void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
/** Changes the display for this account
@@ -240,8 +239,8 @@ class CoreExport IdentifyRequest
Anope::string password;
std::set<Module *> holds;
- bool dispatched;
- bool success;
+ bool dispatched = false;
+ bool success = false;
static std::set<IdentifyRequest *> Requests;
@@ -286,5 +285,3 @@ class CoreExport IdentifyRequest
static void ModuleUnload(Module *m);
};
-
-#endif // ACCOUNT_H
diff --git a/include/anope.h b/include/anope.h
index 40558f05a..59f7c1684 100644
--- a/include/anope.h
+++ b/include/anope.h
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church.
*/
-#ifndef ANOPE_H
-#define ANOPE_H
+#pragma once
#include <signal.h>
@@ -54,9 +53,7 @@ namespace Anope
string(const ci::string &_str) : _string(_str.c_str()) { }
string(const string &_str, size_type pos, size_type n = npos) : _string(_str._string, pos, n) { }
template <class InputIterator> string(InputIterator first, InputIterator last) : _string(first, last) { }
-#if __cplusplus >= 201103L
string(const string &) = default;
-#endif
/**
* Assignment operators, so any type of string can be assigned to this class.
@@ -315,7 +312,7 @@ namespace Anope
{
inline size_t operator()(const string &s) const
{
- return TR1NS::hash<std::string>()(s.lower().str());
+ return std::hash<std::string>()(s.lower().str());
}
};
@@ -323,7 +320,7 @@ namespace Anope
{
inline size_t operator()(const string &s) const
{
- return TR1NS::hash<std::string>()(s.str());
+ return std::hash<std::string>()(s.str());
}
};
@@ -337,7 +334,7 @@ namespace Anope
template<typename T> class map : public std::map<string, T, ci::less> { };
template<typename T> class multimap : public std::multimap<string, T, ci::less> { };
- template<typename T> class hash_map : public TR1NS::unordered_map<string, T, hash_ci, compare> { };
+ template<typename T> class hash_map : public std::unordered_map<string, T, hash_ci, compare> { };
#ifndef REPRODUCIBLE_BUILD
static const char *const compiled = __TIME__ " " __DATE__;
@@ -369,11 +366,11 @@ namespace Anope
*/
extern CoreExport bool ReadOnly, NoFork, NoThird, NoExpire, ProtocolDebug;
- /** The root of the services installation. Usually ~/services
+ /** The root of the Anope installation. Usually ~/anope
*/
extern CoreExport Anope::string ServicesDir;
- /** Services binary name (eg services)
+ /** Anope binary name (eg anope)
*/
extern CoreExport Anope::string ServicesBin;
@@ -465,14 +462,6 @@ namespace Anope
*/
extern CoreExport void Encrypt(const Anope::string &src, Anope::string &dest);
- /** Decrypts what is in 'src' to 'dest'.
- * @param src The source string to decrypt
- * @param dest The destination where the decrypted string is placed
- * @return true if decryption was successful. This is usually not the case
- * as most encryption methods we use are one way.
- */
- extern CoreExport bool Decrypt(const Anope::string &src, Anope::string &dest);
-
/** Hashes a buffer with SipHash-2-4
* @param src The start of the buffer to hash
* @param src_sz The total number of bytes in the buffer
@@ -570,7 +559,7 @@ class CoreExport sepstream
char sep;
/** Current string position
*/
- size_t pos;
+ size_t pos = 0;
/** If set then GetToken() can return an empty string
*/
bool allow_empty;
@@ -676,7 +665,7 @@ class CoreException : public std::exception
* Actually no, it does nothing. Never mind.
* @throws Nothing!
*/
- virtual ~CoreException() throw() { }
+ virtual ~CoreException() noexcept = default;
/** Returns the reason for the exception.
* The module should probably put something informative here as the user will see this upon failure.
*/
@@ -705,7 +694,7 @@ class ModuleException : public CoreException
* Actually no, it does nothing. Never mind.
* @throws Nothing!
*/
- virtual ~ModuleException() throw() { }
+ virtual ~ModuleException() noexcept = default;
};
class ConvertException : public CoreException
@@ -713,7 +702,7 @@ class ConvertException : public CoreException
public:
ConvertException(const Anope::string &reason = "") : CoreException(reason) { }
- virtual ~ConvertException() throw() { }
+ virtual ~ConvertException() noexcept = default;
};
/** Convert something to a string
@@ -787,5 +776,3 @@ template<typename T, typename O> inline T anope_dynamic_static_cast(O ptr)
return static_cast<T>(ptr);
}
#endif
-
-#endif // ANOPE_H
diff --git a/include/base.h b/include/base.h
index e988f1656..cb852d37d 100644
--- a/include/base.h
+++ b/include/base.h
@@ -6,8 +6,7 @@
* Please read COPYING and README for further details.
*/
-#ifndef BASE_H
-#define BASE_H
+#pragma once
#include "services.h"
@@ -16,9 +15,8 @@
class CoreExport Base
{
/* References to this base class */
- std::set<ReferenceBase *> *references;
+ std::set<ReferenceBase *> *references = nullptr;
public:
- Base();
virtual ~Base();
/** Adds a reference to this object. Eg, when a Reference
@@ -33,11 +31,11 @@ class CoreExport Base
class ReferenceBase
{
protected:
- bool invalid;
+ bool invalid = false;
public:
- ReferenceBase() : invalid(false) { }
+ ReferenceBase() = default;
ReferenceBase(const ReferenceBase &other) : invalid(other.invalid) { }
- virtual ~ReferenceBase() { }
+ virtual ~ReferenceBase() = default;
inline void Invalidate() { this->invalid = true; }
};
@@ -48,11 +46,9 @@ template<typename T>
class Reference : public ReferenceBase
{
protected:
- T *ref;
+ T *ref = nullptr;
public:
- Reference() : ref(NULL)
- {
- }
+ Reference() = default;
Reference(T *obj) : ref(obj)
{
@@ -139,5 +135,3 @@ class Reference : public ReferenceBase
return false;
}
};
-
-#endif // BASE_H
diff --git a/include/bots.h b/include/bots.h
index a8b062489..d407de835 100644
--- a/include/bots.h
+++ b/include/bots.h
@@ -6,8 +6,7 @@
* Please read COPYING and README for further details.
*/
-#ifndef BOTS_H
-#define BOTS_H
+#pragma once
#include "users.h"
#include "anope.h"
@@ -131,5 +130,3 @@ class CoreExport BotInfo : public User, public Serializable
*/
static BotInfo* Find(const Anope::string &nick, bool nick_only = false);
};
-
-#endif // BOTS_H
diff --git a/include/channels.h b/include/channels.h
index 79ea73887..aed970adf 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -6,8 +6,7 @@
* Please read COPYING and README for further details.
*/
-#ifndef CHANNELS_H
-#define CHANNELS_H
+#pragma once
#include "anope.h"
#include "extensible.h"
@@ -306,5 +305,3 @@ class CoreExport Channel : public Base, public Extensible
static void DeleteChannels();
};
-
-#endif // CHANNELS_H
diff --git a/include/commands.h b/include/commands.h
index 0a01e74c9..158bb4743 100644
--- a/include/commands.h
+++ b/include/commands.h
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church.
*/
-#ifndef COMMAND_H
-#define COMMAND_H
+#pragma once
#include "service.h"
#include "anope.h"
@@ -26,8 +25,6 @@ struct CommandInfo
{
typedef Anope::map<CommandInfo> map;
- CommandInfo() : hide(false), prepend_channel(false) { }
-
/* Service name of the command */
Anope::string name;
/* Permission required to execute the command */
@@ -35,9 +32,9 @@ struct CommandInfo
/* Group this command is in */
Anope::string group;
/* whether or not to hide this command in help output */
- bool hide;
+ bool hide = false;
/* Only used with fantasy */
- bool prepend_channel;
+ bool prepend_channel = false;
};
/* Where the replies from commands go to. User inherits from this and is the normal
@@ -45,7 +42,7 @@ struct CommandInfo
*/
struct CoreExport CommandReply
{
- virtual ~CommandReply() { }
+ virtual ~CommandReply() = default;
virtual void SendMessage(BotInfo *source, const Anope::string &msg) = 0;
};
@@ -120,7 +117,7 @@ class CoreExport Command : public Service
Command(Module *owner, const Anope::string &sname, size_t min_params, size_t max_params = 0);
public:
- virtual ~Command();
+ virtual ~Command() = default;
protected:
void SetDesc(const Anope::string &d);
@@ -183,5 +180,3 @@ class CoreExport Command : public Service
*/
static bool FindCommandFromService(const Anope::string &command_service, BotInfo* &bi, Anope::string &name);
};
-
-#endif // COMMANDS_H
diff --git a/include/config.h b/include/config.h
index 877cbabd2..8b8cb65ca 100644
--- a/include/config.h
+++ b/include/config.h
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church.
*/
-#ifndef CONFIG_H
-#define CONFIG_H
+#pragma once
#include "account.h"
#include "regchannel.h"
@@ -60,7 +59,7 @@ namespace Configuration
}
bool Set(const Anope::string &tag, const Anope::string &value);
- const item_map* GetItems() const;
+ const item_map &GetItems() const;
};
template<> CoreExport const Anope::string Block::Get(const Anope::string &tag, const Anope::string& def) const;
@@ -73,7 +72,7 @@ namespace Configuration
{
Anope::string name;
bool executable;
- FILE *fp;
+ FILE *fp = nullptr;
public:
File(const Anope::string &, bool);
~File();
@@ -129,6 +128,9 @@ namespace Configuration
std::map<Anope::string, Block *> modules;
Anope::map<Anope::string> bots;
+ /* Represents a missing tag. */
+ Block EmptyBlock;
+
Conf();
~Conf();
@@ -175,10 +177,8 @@ class ConfigException : public CoreException
* Actually no, it does nothing. Never mind.
* @throws Nothing!
*/
- virtual ~ConfigException() throw() { }
+ virtual ~ConfigException() noexcept = default;
};
extern Configuration::File ServicesConf;
extern CoreExport Configuration::Conf *Config;
-
-#endif // CONFIG_H
diff --git a/include/defs.h b/include/defs.h
index 3bc21656d..9778a0c7e 100644
--- a/include/defs.h
+++ b/include/defs.h
@@ -9,6 +9,8 @@
* Based on the original code of Services by Andy Church.
*/
+#pragma once
+
class AccessGroup;
class AutoKick;
class BotInfo;
diff --git a/include/extensible.h b/include/extensible.h
index f911d6814..286c0d490 100644
--- a/include/extensible.h
+++ b/include/extensible.h
@@ -6,8 +6,7 @@
* Please read COPYING and README for further details.
*/
-#ifndef EXTENSIBLE_H
-#define EXTENSIBLE_H
+#pragma once
#include "anope.h"
#include "serialize.h"
@@ -93,7 +92,7 @@ class BaseExtensibleItem : public ExtensibleBase
return t;
}
- void Unset(Extensible *obj) anope_override
+ void Unset(Extensible *obj) override
{
T *value = Get(obj);
items.erase(obj);
@@ -128,7 +127,7 @@ template<