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 Application : public BaseApplication
class Application final : public BaseApplication
{
Q_OBJECT
Q_DISABLE_COPY(Application)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -70,7 +70,7 @@ namespace BitTorrent
// *Basic* Bittorrent tracker implementation
// [BEP-3] The BitTorrent Protocol Specification
// 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_DISABLE_COPY(Tracker)

View file

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

View file

@ -52,7 +52,7 @@ namespace
// 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";
class NetworkCookieJar : public QNetworkCookieJar
class NetworkCookieJar final : public QNetworkCookieJar
{
public:
explicit NetworkCookieJar(QObject *parent = nullptr)

View file

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

View file

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

View file

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

View file

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

View file

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