Add final specifier to classes

This allow compilers to generate more efficient code.
This commit is contained in:
Chocobo1 2020-04-17 12:37:53 +08:00
parent 2681093d27
commit d3d3f7dbb3
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
15 changed files with 19 additions and 19 deletions

View File

@ -68,7 +68,7 @@ namespace RSS
class AutoDownloader; class AutoDownloader;
} }
class Application : public BaseApplication class Application final : public BaseApplication
{ {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(Application) Q_DISABLE_COPY(Application)

View File

@ -77,7 +77,7 @@
namespace QtLP_Private namespace QtLP_Private
{ {
class QtLockedFile : public QFile class QtLockedFile final : public QFile
{ {
public: public:
enum LockMode enum LockMode

View File

@ -35,7 +35,7 @@
class QDataStream; class QDataStream;
class FilterParserThread : public QThread class FilterParserThread final : public QThread
{ {
Q_OBJECT Q_OBJECT

View File

@ -31,7 +31,7 @@
#include <libtorrent/extensions.hpp> #include <libtorrent/extensions.hpp>
#include <libtorrent/version.hpp> #include <libtorrent/version.hpp>
class NativeSessionExtension : public lt::plugin class NativeSessionExtension final : public lt::plugin
{ {
#if (LIBTORRENT_VERSION_NUM >= 10200) #if (LIBTORRENT_VERSION_NUM >= 10200)
lt::feature_flags_t implemented_features() override; lt::feature_flags_t implemented_features() override;

View File

@ -32,7 +32,7 @@
#include <libtorrent/torrent_handle.hpp> #include <libtorrent/torrent_handle.hpp>
#include <libtorrent/version.hpp> #include <libtorrent/version.hpp>
class NativeTorrentExtension : public lt::torrent_plugin class NativeTorrentExtension final : public lt::torrent_plugin
{ {
public: public:
explicit NativeTorrentExtension(const lt::torrent_handle &torrentHandle); explicit NativeTorrentExtension(const lt::torrent_handle &torrentHandle);

View File

@ -44,7 +44,7 @@ using LTPortMapping = int;
using LTPortMapping = lt::port_mapping_t; using LTPortMapping = lt::port_mapping_t;
#endif #endif
class PortForwarderImpl : public Net::PortForwarder class PortForwarderImpl final : public Net::PortForwarder
{ {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(PortForwarderImpl) Q_DISABLE_COPY(PortForwarderImpl)

View File

@ -48,7 +48,7 @@ namespace BitTorrent
QStringList urlSeeds; QStringList urlSeeds;
}; };
class TorrentCreatorThread : public QThread class TorrentCreatorThread final : public QThread
{ {
Q_OBJECT Q_OBJECT

View File

@ -70,7 +70,7 @@ namespace BitTorrent
// *Basic* Bittorrent tracker implementation // *Basic* Bittorrent tracker implementation
// [BEP-3] The BitTorrent Protocol Specification // [BEP-3] The BitTorrent Protocol Specification
// also see: https://wiki.theory.org/index.php/BitTorrentSpecification#Tracker_HTTP.2FHTTPS_Protocol // also see: https://wiki.theory.org/index.php/BitTorrentSpecification#Tracker_HTTP.2FHTTPS_Protocol
class Tracker : public QObject, public Http::IRequestHandler, private Http::ResponseBuilder class Tracker final : public QObject, public Http::IRequestHandler, private Http::ResponseBuilder
{ {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(Tracker) Q_DISABLE_COPY(Tracker)

View File

@ -41,7 +41,7 @@ namespace Http
class IRequestHandler; class IRequestHandler;
class Connection; class Connection;
class Server : public QTcpServer class Server final : public QTcpServer
{ {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(Server) Q_DISABLE_COPY(Server)

View File

@ -52,7 +52,7 @@ namespace
// Disguise as Firefox to avoid web server banning // Disguise as Firefox to avoid web server banning
const char DEFAULT_USER_AGENT[] = "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"; const char DEFAULT_USER_AGENT[] = "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0";
class NetworkCookieJar : public QNetworkCookieJar class NetworkCookieJar final : public QNetworkCookieJar
{ {
public: public:
explicit NetworkCookieJar(QObject *parent = nullptr) explicit NetworkCookieJar(QObject *parent = nullptr)

View File

@ -36,7 +36,7 @@
class QObject; class QObject;
class QUrl; class QUrl;
class DownloadHandlerImpl : public Net::DownloadHandler class DownloadHandlerImpl final : public Net::DownloadHandler
{ {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(DownloadHandlerImpl) Q_DISABLE_COPY(DownloadHandlerImpl)

View File

@ -63,7 +63,7 @@ namespace Private
}; };
/// Default implementation. Takes paths from system /// Default implementation. Takes paths from system
class DefaultProfile : public Profile class DefaultProfile final : public Profile
{ {
public: public:
explicit DefaultProfile(const QString &configurationName); explicit DefaultProfile(const QString &configurationName);
@ -86,7 +86,7 @@ namespace Private
}; };
/// Custom tree: creates directories under the specified root directory /// Custom tree: creates directories under the specified root directory
class CustomProfile : public Profile class CustomProfile final : public Profile
{ {
public: public:
CustomProfile(const QString &rootPath, const QString &configurationName); CustomProfile(const QString &rootPath, const QString &configurationName);
@ -114,14 +114,14 @@ namespace Private
virtual ~PathConverter() = default; virtual ~PathConverter() = default;
}; };
class NoConvertConverter : public PathConverter class NoConvertConverter final : public PathConverter
{ {
public: public:
QString toPortablePath(const QString &path) const override; QString toPortablePath(const QString &path) const override;
QString fromPortablePath(const QString &portablePath) const override; QString fromPortablePath(const QString &portablePath) const override;
}; };
class Converter : public PathConverter class Converter final : public PathConverter
{ {
public: public:
explicit Converter(const QString &basePath); explicit Converter(const QString &basePath);

View File

@ -44,7 +44,7 @@
namespace namespace
{ {
class XmlStreamEntityResolver : public QXmlStreamEntityResolver class XmlStreamEntityResolver final : public QXmlStreamEntityResolver
{ {
public: public:
QString resolveUndeclaredEntity(const QString &name) override QString resolveUndeclaredEntity(const QString &name) override

View File

@ -36,7 +36,7 @@ class QStringList;
class FileSystemWatcher; class FileSystemWatcher;
class ScanFoldersModel : public QAbstractListModel class ScanFoldersModel final : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(ScanFoldersModel) Q_DISABLE_COPY(ScanFoldersModel)

View File

@ -50,7 +50,7 @@ class WebApplication;
constexpr char C_SID[] = "SID"; // name of session id cookie constexpr char C_SID[] = "SID"; // name of session id cookie
class WebSession : public ISession class WebSession final : public ISession
{ {
public: public:
explicit WebSession(const QString &sid); explicit WebSession(const QString &sid);
@ -69,7 +69,7 @@ private:
QVariantHash m_data; QVariantHash m_data;
}; };
class WebApplication class WebApplication final
: public QObject, public Http::IRequestHandler, public ISessionManager : public QObject, public Http::IRequestHandler, public ISessionManager
, private Http::ResponseBuilder , private Http::ResponseBuilder
{ {