Minor code improvements

Added final specifier to all structs and classes
This commit is contained in:
Valentino Orlandi 2024-01-21 16:35:00 +01:00
parent d910069a1b
commit e88625b5bf
Signed by: elB4RTO
GPG key ID: 1719E976DB2D4E71
31 changed files with 43 additions and 43 deletions

View file

@ -5,7 +5,7 @@
#include <QTreeWidgetItem>
class LogFileTreeWidgetItem : public QTreeWidgetItem {
class LogFileTreeWidgetItem final : public QTreeWidgetItem {
public:
LogFileTreeWidgetItem(QTreeWidget*parent=nullptr):QTreeWidgetItem(parent){}
bool operator < (const QTreeWidgetItem& other) const {

View file

@ -17,7 +17,7 @@ namespace Ui {
/*!
Player vs AI criss-cross game
*/
class CrissCross : public QWidget
class CrissCross final : public QWidget
{
Q_OBJECT

View file

@ -14,7 +14,7 @@ namespace Ui {
/*!
A dialog message to provide informations to the user
*/
class GameDialog : public QDialog
class GameDialog final : public QDialog
{
Q_OBJECT

View file

@ -8,7 +8,7 @@ class Snake;
class QGraphicsPixmapItem;
class Food
class Food final
{
public:
explicit Food( const bool can_move=false );

View file

@ -23,7 +23,7 @@ namespace Ui {
/*!
A reproduction of the timeless classic game
*/
class SnakeGame : public QWidget
class SnakeGame final : public QWidget
{
Q_OBJECT

View file

@ -21,7 +21,7 @@ enum Direction {
//! Instance of a part of the body of the snake
struct BodyPart {
struct BodyPart final {
unsigned x; //!< The position on the X-axis
unsigned y; //!< The position on the Y-axis
Direction direction; //!< The current direction of the part
@ -32,7 +32,7 @@ struct BodyPart {
};
class Snake : public std::vector<BodyPart>
class Snake final : public std::vector<BodyPart>
{
public:
explicit Snake( const bool is_adversary=false );
@ -90,7 +90,7 @@ private:
F, // food
};
struct Tile {
struct Tile final {
Entity entity;
unsigned s_index;
};

View file

@ -33,7 +33,7 @@ namespace Ui {
/*!
The parent window
*/
class MainWindow : public QMainWindow
class MainWindow final : public QMainWindow
{
Q_OBJECT

View file

@ -16,7 +16,7 @@ namespace Ui {
/*!
Displays an help window
*/
class Craphelp : public QWidget
class Craphelp final : public QWidget
{
Q_OBJECT

View file

@ -14,7 +14,7 @@ namespace Ui {
/*!
Displays informations
*/
class Crapinfo : public QWidget
class Crapinfo final : public QWidget
{
Q_OBJECT

View file

@ -17,7 +17,7 @@
/*!
Performs operations related to the logs
*/
class Craplog : public QObject
class Craplog final : public QObject
{
Q_OBJECT
@ -549,7 +549,7 @@ private:
The rules to be used to decide whether a file name is valid or not
\see isFileNameValid()
*/
struct LogName {
struct LogName final {
std::string starts; //!< What should be the initial part of the name
std::string contains; //!< What should be contained in the middle of the name
std::string ends; //!< What should be the final part of the name

View file

@ -13,7 +13,7 @@
/*!
Builds the donut chart to be displayed
*/
class DonutBreakdown : public QChart
class DonutBreakdown final : public QChart
{
public:
@ -47,7 +47,7 @@ private:
/*!
A slice to be added at the donut
*/
class MainSlice : public QPieSlice
class MainSlice final : public QPieSlice
{
Q_OBJECT

View file

@ -13,7 +13,7 @@ struct LogsFormat;
/*!
Operations for the logs formats
*/
class FormatOps
class FormatOps final
{
public:

View file

@ -16,7 +16,7 @@ class QSqlQuery;
/*!
Operations for the hashes
*/
class HashOps
class HashOps final
{
public:

View file

@ -26,7 +26,7 @@ enum class LogType
//! Holds informations about a log file
struct LogFile {
struct LogFile final {
explicit LogFile() = default;
explicit LogFile
(const bool sel,const bool used,const size_t sz,const QString& nm,const std::string& hs,const std::string& pt)
@ -67,7 +67,7 @@ Q_DECLARE_METATYPE( LogFile )
//! Holds informations about a log format
struct LogsFormat {
struct LogsFormat final {
explicit LogsFormat() = default;
explicit LogsFormat
(const std::string& str,const std::string& itl,const std::string& fnl,const std::vector<std::string>& seps,const std::vector<std::string>& flds,const unsigned nl)
@ -82,7 +82,7 @@ struct LogsFormat {
//! Hold the items of a blacklist/warnlist
struct BWlist {
struct BWlist final {
bool used; //!< Whether the list is set to be used or not
std::vector<std::string> list; //!< The list of items
};

View file

@ -29,7 +29,7 @@ Q_DECLARE_METATYPE(WorkerDialog)
Holds the data of a single field from a log line
\see LogLineData
*/
struct FieldData
struct FieldData final
{
FieldData() noexcept
: is_set{false} {}
@ -65,7 +65,7 @@ inline size_t operator +(const size_t lhs, const FieldData& rhs)
/*!
Holds the data of a single log line
*/
struct LogLineData
struct LogLineData final
{
LogLineData(const std::string& line, const LogsFormat& logs_format);
~LogLineData() noexcept = default;

View file

@ -11,7 +11,7 @@ class HashOps;
enum class WorkerDialog;
class CraplogLister : public QObject
class CraplogLister final : public QObject
{
Q_OBJECT

View file

@ -17,7 +17,7 @@ enum class WorkerDialog;
class QSqlDatabase;
class CraplogParser : public QObject
class CraplogParser final : public QObject
{
Q_OBJECT

View file

@ -18,7 +18,7 @@ namespace Ui {
/*!
*/
class Crapup : public QWidget
class Crapup final : public QWidget
{
Q_OBJECT

View file

@ -16,7 +16,7 @@ class QTableWidget;
/*!
Performs operations related to the visualization of the statistics
*/
class Crapview : public QObject
class Crapview final : public QObject
{
Q_OBJECT
DATA_TYPEDEFS

View file

@ -16,7 +16,7 @@
using stats_count_items_t = std::multimap<unsigned, QString>;
class DbQuery
class DbQuery final
{
DATA_TYPEDEFS

View file

@ -10,7 +10,7 @@
Implements various dialog models
\see DialogMsg, DialogBool, DialogDia
*/
class DialogSec : public QObject
class DialogSec final : public QObject
{
Q_OBJECT

View file

@ -13,7 +13,7 @@ namespace Ui {
/*!
YES/NO choice dialog
*/
class DialogBool : public QDialog
class DialogBool final : public QDialog
{
Q_OBJECT

View file

@ -14,7 +14,7 @@ namespace Ui {
/*!
IGNORE/DISCARD/ABORT choice dialog
*/
class DialogIda : public QDialog
class DialogIda final : public QDialog
{
Q_OBJECT

View file

@ -21,7 +21,7 @@ namespace Ui {
/*!
A dialog message to provide informations to the user
*/
class DialogMsg : public QDialog
class DialogMsg final : public QDialog
{
Q_OBJECT

View file

@ -11,7 +11,7 @@
/*!
Generic exception for general purposes
*/
class GenericException : public std::exception {
class GenericException final : public std::exception {
public:
explicit GenericException( const std::string& msg, const bool to_sys=false );
const QString& what();
@ -26,7 +26,7 @@ private:
/*!
Exception related to a Web Server
*/
class WebServerException : public std::exception {
class WebServerException final : public std::exception {
public:
explicit WebServerException( const std::string& msg );
/*const QString& what();
@ -41,7 +41,7 @@ private:
/*!
Exception related to a Logs Format
*/
class LogFormatException : public std::exception {
class LogFormatException final : public std::exception {
public:
explicit LogFormatException( const std::string& msg );
const QString& what();
@ -56,7 +56,7 @@ private:
/*!
Exception related to the logs parser
*/
class LogParserException : public std::exception {
class LogParserException final : public std::exception {
public:
explicit LogParserException( const std::string& txt, const std::string& val );
const QString& what();
@ -71,7 +71,7 @@ private:
/*!
Exception related to a date/time
*/
class DateTimeException : public std::exception {
class DateTimeException final : public std::exception {
public:
explicit DateTimeException( const std::string& msg );
/*const QString& what();
@ -86,7 +86,7 @@ private:
/*!
Exception related to a blacklist/warnlist
*/
class BWlistException : public std::exception {
class BWlistException final : public std::exception {
public:
explicit BWlistException( const std::string& msg );
/*const QString& what();

View file

@ -9,7 +9,7 @@
/*!
Fictitious class for the translations
*/
class TR : public QObject
class TR final : public QObject
{
Q_OBJECT
public:

View file

@ -12,7 +12,7 @@
/*!
Perform operations for files visualization
*/
class TextBrowser
class TextBrowser final
{
public:

View file

@ -14,7 +14,7 @@ namespace Ui {
/*!
A simple block-note like widget
*/
class Crapnote : public QWidget
class Crapnote final : public QWidget
{
Q_OBJECT

View file

@ -25,7 +25,7 @@
//! RAII class to handle s file resource
class FileHandler
class FileHandler final
{
FILE* file;

View file

@ -12,7 +12,7 @@
//! RAII class to handle a file stream resource
template<typename Stream>
class FileHandler
class FileHandler final
{
Stream file;

View file

@ -15,7 +15,7 @@ class QString;
/*!
Utilities for the TextBrowser
*/
class RichText : public QObject
class RichText final : public QObject
{
Q_OBJECT