diff --git a/Dockerfile b/Dockerfile index b8fdee5e..a4fa8399 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,6 @@ RUN bash -c "scripts/DOCKER_private.sh" WORKDIR / RUN rm -rf /tmp/logdoctor -LABEL logdoctor.version=3.00 +LABEL logdoctor.version=4.00 ENTRYPOINT /usr/bin/logdoctor diff --git a/docs/html/annotated.html b/docs/html/annotated.html index 0eb16a99..6f4b4359 100644 --- a/docs/html/annotated.html +++ b/docs/html/annotated.html @@ -3,12 +3,14 @@ - + LogDoctor: Class List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -75,55 +77,82 @@ $(function() {
Here are the classes, structs, unions and interfaces with brief descriptions:
-
[detail level 12]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
[detail level 12]
 CBodyPartInstance of a part of the body of the snake
 CBWlistHold the items of a blacklist/warnlist
 CBWlistExceptionBWlistException
 CCraphelpCraphelp
 CCrapinfoCrapinfo
 CCraplogCraplog
 CLogNameWeb Server specific file names criterions
 CCraplogLister
 CCraplogParser
 CCraplogParserAsync
 CCraplogParserInterface
 CCrapnoteCrapnote
 CCrapupCrapup
 CCrapviewCrapview
 CCrissCrossCrissCross
 CDateTimeExceptionDateTimeException
 CDbQuery
 CDialogBoolDialogBool
 CDialogIdaDialogIda
 CDialogMsgDialogMsg
 CDialogSecDialogSec
 CDonutBreakdownDonutBreakdon
 CFood
 CFormatOpsFormatOps
 CGameDialogGameDialog
 CGenericExceptionGenericException
 CHashOpsHashOps
 CLogFileHolds informations about a log file
 CLogFileTreeWidgetItem
 CLogFormatExceptionLogFormatException
 CLogParserExceptionLogParserException
 CLogsFormatHolds informations about a log format
 CMainSliceRepresents a slice
 CMainWindowMainWindow
 CRichTextRichText
 CSHA256
 CSnake
 CTile
 CSnakeGameSnake
 CTextBrowserTextBrowser
 CTRTR
 CWebServerExceptionWebServerException
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 CBlacklist
 CBlacklistItem
 CBlacklists
 CBodyPartInstance of a part of the body of the snake
 CBWlistExceptionBWlistException
 CChangelogChangelog
 CCraphelpCraphelp
 CCrapinfoCrapinfo
 CCraplogCraplog
 CLogNameWeb Server specific file names criterions
 CCraplogLister
 CCraplogParser
 CCrapnoteCrapnote
 CCrappath
 CCrapupCrapup
 CCrapviewCrapview
 CCrissCrossCrissCross
 CDatabaseExceptionDatabaseException
 CDatabaseHandler
 CDatabaseWrapperDatabaseWrapper
 CDateTimeExceptionDateTimeException
 CDaytimeLogFieldsListModel
 CDbQuery
 CDialogBoolDialogBool
 CDialogIdaDialogIda
 CDialogMsgDialogMsg
 CDialogSecDialogSec
 CDoNotCatchExceptionDoNotCatchException
 CDonutBreakdownDonutBreakdon
 CEnumeratdArray
 CEnumerator
 CFieldDataFieldData
 CFileHandlerRAII class to handle s file resource
 CFood
 CFormatOpsFormatOps
 CGameDialogGameDialog
 CGenericExceptionGenericException
 CGlobalsData
 CHashOpsHashOps
 CLogDoctorExceptionLogDoctorException
 CLogFieldsListModel
 CLogFileHolds informations about a log file
 CLogFileTreeWidgetItem
 CLogFormatExceptionLogFormatException
 CLogLineDataLogLineData
 CLogParserExceptionLogParserException
 CLogsFormatHolds informations about a log format
 CMainSliceRepresents a slice
 CMainWindowMainWindow
 CMakeNewDatabase
 CPerformanceData
 CPerfs
 CQueryWrapperQueryWrapper
 CRecurrenceData
 CRelationslLogFieldsListModel
 CRichTextRichText
 CSHA256
 CSnake
 CTile
 CSnakeGameSnake
 CTextBrowserTextBrowser
 CTRTR
 CTrafficData
 CVoidExceptionVoidException
 CWarnlist
 CWarnlistItem
 CWarnlists
 CZippedArrays
 CZipperator
diff --git a/docs/html/classBWlistException-members.html b/docs/html/classBWlistException-members.html index 0505114d..867414c1 100644 --- a/docs/html/classBWlistException-members.html +++ b/docs/html/classBWlistException-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -79,7 +81,7 @@ $(function() { diff --git a/docs/html/classBWlistException.html b/docs/html/classBWlistException.html index e3a27fe7..11bcca41 100644 --- a/docs/html/classBWlistException.html +++ b/docs/html/classBWlistException.html @@ -3,12 +3,14 @@ - + LogDoctor: BWlistException Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -73,20 +75,23 @@ $(function() {
List of all members
-
BWlistException Class Reference
+
BWlistException Class Referencefinal

BWlistException. - More...

+ More...

#include <exceptions.h>

Inheritance diagram for BWlistException:
- -
+ + +LogDoctorException + +

Detailed Description

BWlistException.

Exception related to a blacklist/warnlist

@@ -97,7 +102,7 @@ Inheritance diagram for BWlistException:
diff --git a/docs/html/classBWlistException.png b/docs/html/classBWlistException.png index a67e1d43..3fb812ac 100644 Binary files a/docs/html/classBWlistException.png and b/docs/html/classBWlistException.png differ diff --git a/docs/html/structBWlist-members.html b/docs/html/classChangelog-members.html similarity index 79% rename from docs/html/structBWlist-members.html rename to docs/html/classChangelog-members.html index a9e82b63..ad2e0d48 100644 --- a/docs/html/structBWlist-members.html +++ b/docs/html/classChangelog-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -71,18 +73,17 @@ $(function() {
-
BWlist Member List
+
Changelog Member List
-

This is the complete list of members for BWlist, including all inherited members.

+

This is the complete list of members for Changelog, including all inherited members.

- - +
listBWlist
usedBWlist
setTextFont(const QFont &font) noexceptChangelog
diff --git a/docs/html/structBWlist.html b/docs/html/classChangelog.html similarity index 61% rename from docs/html/structBWlist.html rename to docs/html/classChangelog.html index 7b17469c..0795abe7 100644 --- a/docs/html/structBWlist.html +++ b/docs/html/classChangelog.html @@ -3,12 +3,14 @@ - + -LogDoctor: BWlist Struct Reference +LogDoctor: Changelog Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -72,37 +74,41 @@ $(function() {
-Public Attributes | -List of all members
-
BWlist Struct Reference
+Public Member Functions | +List of all members
+
Changelog Class Reference
-

Hold the items of a blacklist/warnlist. - More...

+

Changelog. + More...

-

#include <lib.h>

+

#include <changelog.h>

+
+Inheritance diagram for Changelog:
+
+
+ +
- - - - - - - + + + +

-Public Attributes

-bool used
 Whether the list is set to be used or not.
 
-std::vector< std::string > list
 The list of items.
 

+Public Member Functions

+void setTextFont (const QFont &font) noexcept
 Sets the given font for the changelog info.
 

Detailed Description

-

Hold the items of a blacklist/warnlist.

-

The documentation for this struct was generated from the following file:
diff --git a/docs/html/classChangelog.png b/docs/html/classChangelog.png new file mode 100644 index 00000000..bab1079e Binary files /dev/null and b/docs/html/classChangelog.png differ diff --git a/docs/html/classCraphelp-members.html b/docs/html/classCraphelp-members.html index 841c1df9..4644055c 100644 --- a/docs/html/classCraphelp-members.html +++ b/docs/html/classCraphelp-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -77,12 +79,12 @@ $(function() {

This is the complete list of members for Craphelp, including all inherited members.

- - + +
helpLogsFormat(const std::string &path, const QFont &font, const int color_scheme_id) constCraphelp
helpLogsFormatDefault(std::string_view file_name, const QFont &font, const int color_scheme_id) constCraphelp
helpLogsFormat(const std::string &path, const QFont &font, const ColorsScheme colors_scheme_id) const noexceptCraphelp
helpLogsFormatDefault(std::string_view file_name, const QFont &font, const ColorsScheme colors_scheme_id) const noexceptCraphelp
diff --git a/docs/html/classCraphelp.html b/docs/html/classCraphelp.html index 3b9075f6..7ab9c9f2 100644 --- a/docs/html/classCraphelp.html +++ b/docs/html/classCraphelp.html @@ -3,12 +3,14 @@ - + LogDoctor: Craphelp Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,12 +76,12 @@ $(function() {
Public Member Functions | List of all members
-
Craphelp Class Reference
+
Craphelp Class Referencefinal

Craphelp. - More...

+ More...

#include <craphelp.h>

@@ -91,47 +93,47 @@ Inheritance diagram for Craphelp:
- - - - - - + + + + + +

Public Member Functions

void helpLogsFormat (const std::string &path, const QFont &font, const int color_scheme_id) const
 Provides help about log formats.
 
void helpLogsFormatDefault (std::string_view file_name, const QFont &font, const int color_scheme_id) const
 Provides help about log formats.
 
void helpLogsFormat (const std::string &path, const QFont &font, const ColorsScheme colors_scheme_id) const noexcept
 Provides help about log formats.
 
void helpLogsFormatDefault (std::string_view file_name, const QFont &font, const ColorsScheme colors_scheme_id) const noexcept
 Provides help about log formats.
 

Detailed Description

Craphelp.

Displays an help window

Member Function Documentation

- -

◆ helpLogsFormat()

+ +

◆ helpLogsFormat()

+ + + + + +
- - + - - + - - - - - - - +
void Craphelp::helpLogsFormat (const std::string & path, const std::string & path,
const QFont & font, const QFont & font,
const int color_scheme_id 
) constconst ColorsScheme colors_scheme_id ) const
+
+noexcept

Provides help about log formats.

@@ -139,43 +141,49 @@ Public Member Functions - + +
pathThe path of the file resource to be displayed
fontThe font to be used
color_scheme_idThe ID of the color-scheme to be used
colors_scheme_idThe ID of the color-scheme to be used
+ + +
Exceptions
+ +
DoNotCatchException
- -

◆ helpLogsFormatDefault()

+ +

◆ helpLogsFormatDefault()

+ + + + + +
- - + - - + - - - - - - - +
void Craphelp::helpLogsFormatDefault (std::string_view file_name, std::string_view file_name,
const QFont & font, const QFont & font,
const int color_scheme_id 
) constconst ColorsScheme colors_scheme_id ) const
+
+noexcept

Provides help about log formats.

@@ -183,7 +191,13 @@ Public Member Functions - + +
file_nameThe file that was supposed to be shown
fontThe font to be used
color_scheme_idThe ID of the color-scheme to be used
colors_scheme_idThe ID of the color-scheme to be used
+ + +
Exceptions
+ +
DoNotCatchException
@@ -197,7 +211,7 @@ Public Member Functions
diff --git a/docs/html/classCraphelp.png b/docs/html/classCraphelp.png index 9c754a60..260c2d16 100644 Binary files a/docs/html/classCraphelp.png and b/docs/html/classCraphelp.png differ diff --git a/docs/html/classCrapinfo-members.html b/docs/html/classCrapinfo-members.html index be8b121e..094c0dde 100644 --- a/docs/html/classCrapinfo-members.html +++ b/docs/html/classCrapinfo-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -81,7 +83,7 @@ $(function() {
diff --git a/docs/html/classCrapinfo.html b/docs/html/classCrapinfo.html index 5b0192df..32566957 100644 --- a/docs/html/classCrapinfo.html +++ b/docs/html/classCrapinfo.html @@ -3,12 +3,14 @@ - + LogDoctor: Crapinfo Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,12 +76,12 @@ $(function() {
Public Member Functions | List of all members
-
Crapinfo Class Reference
+
Crapinfo Class Referencefinal

Crapinfo. - More...

+ More...

#include <crapinfo.h>

@@ -91,8 +93,7 @@ Inheritance diagram for Crapinfo:
- - +

Public Member Functions

 Crapinfo (const QString &version, const QString &exec_path, const QString &conf_path, const QString &logdoc_path, QWidget *parent=nullptr)
 Class constructor.
 Crapinfo (const QString &version, const QString &exec_path, const QString &conf_path, const QString &logdoc_path, QWidget *parent=nullptr)
 

Detailed Description

@@ -111,37 +112,27 @@ Public Member Functions Crapinfo::Crapinfo ( - const QString &  - version, + const QString & version, - const QString &  - exec_path, + const QString & exec_path, - const QString &  - conf_path, + const QString & conf_path, - const QString &  - logdoc_path, + const QString & logdoc_path, - QWidget *  - parent = nullptr  - - - - ) - + QWidget * parent = nullptr ) @@ -150,8 +141,6 @@ Public Member Functions
- -

Class constructor.

Parameters
@@ -172,7 +161,7 @@ Public Member Functions diff --git a/docs/html/classCrapinfo.png b/docs/html/classCrapinfo.png index beae91d9..40644501 100644 Binary files a/docs/html/classCrapinfo.png and b/docs/html/classCrapinfo.png differ diff --git a/docs/html/classCraplog-members.html b/docs/html/classCraplog-members.html index 33003802..13041f97 100644 --- a/docs/html/classCraplog-members.html +++ b/docs/html/classCraplog-members.html @@ -3,12 +3,14 @@ - +LogDoctor: Member List + + @@ -22,7 +24,7 @@ @@ -31,7 +33,7 @@
versionThe version of LogDoctor actually running
-
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
- + @@ -77,64 +79,46 @@ $(function() {

This is the complete list of members for Craplog, including all inherited members.

- - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + +
blacklistAdd(const unsigned &web_server_id, const int &log_field_id, const std::string &new_item)Craplog
blacklistMoveDown(const unsigned &web_server_id, const int &log_field_id, const std::string &item)Craplog
blacklistMoveUp(const unsigned &web_server_id, const int &log_field_id, const std::string &item)Craplog
blacklistRemove(const unsigned &web_server_id, const int &log_field_id, const std::string &item)Craplog
changeIisLogsBaseNames(const int module_id)Craplogprivate
checkStuff()Craplog
clearLogFilesSelection()Craplog
editedDatabase() constCraplog
getBlacklist(const unsigned &web_server_id, const int &log_field_id) constCraplog
getCurrentLogFormat() constCraplog
getCurrentWSID() constCraplog
getDialogsLevel() constCraplog
getHashesDatabasePath() constCraplog
changeIisLogsBaseNames(const IISLogsModule log_module)Craplogprivate
checkCurrentLogsFormat() const noexceptCraplog
checkStuff()Craplog
clearLogFilesSelection() noexceptCraplog
editedDatabase() const noexceptCraplog
getCurrentLogFormat() const noexceptCraplog
getCurrentWebServer() const noexceptCraplog
getDialogsLevel() const noexceptCraplog
getHashesDatabasePath() const noexceptCraplog
getLogFileItem(const QString &file_name) constCraplog
getLogsFormat(const unsigned &web_server_id) constCraplog
getLogsFormatSample(const unsigned &web_server_id) constCraplog
getLogsFormatString(const unsigned &web_server_id) constCraplog
getLogsList() constCraplog
getLogsListSize() constCraplog
getLogsPath(const unsigned &web_server) constCraplog
getParsedLines()Craplog
getParsedSize()Craplog
getParsingSpeed()Craplog
getStatsDatabasePath() constCraplog
getWarningSize() constCraplog
getWarnlist(const unsigned &web_server_id, const int &log_field_id) constCraplog
hireAsyncWorker() constCraplogprivate
hireWorker() constCraplogprivate
isBlacklistUsed(const unsigned &web_server_id, const int &log_field_id) constCraplog
isFileNameValid(const std::string &name) constCraplog
isParsing() constCraplog
isWarnlistUsed(const unsigned &web_server_id, const int &log_field_id) constCraplog
getLogsFormat(const WebServer &web_server) const noexceptCraplog
getLogsFormatSample(const WebServer &web_server) constCraplog
getLogsFormatString(const WebServer &web_server) const noexceptCraplog
getLogsList() const noexceptCraplog
getLogsListSize() const noexceptCraplog
getLogsPath(const WebServer &web_server) const noexceptCraplog
getParsedLines() noexceptCraplog
getParsedSize() noexceptCraplog
getParsingSpeed() noexceptCraplog
getStatsDatabasePath() const noexceptCraplog
getWarningSize() const noexceptCraplog
hireWorker(const Blacklists &blacklists) constCraplogprivate
isFileNameValid(const std::string &name) constCraplog
isParsing() const noexceptCraplog
makeChart(const QChart::ChartTheme &theme, const std::unordered_map< std::string, QFont > &fonts, QChartView *size_chart) constCraplog
sanitizeBWitem(const int &log_field_id, const std::string &new_item) constCraplogprivate
setApacheLogFormat(const std::string &format_string)Craplog
setBlacklist(const unsigned &web_server_id, const int &log_field_id, const std::vector< std::string > &new_list)Craplog
setBlacklistUsed(const unsigned &web_server_id, const int &log_field_id, const bool used)Craplog
setCurrentLogFormat()Craplog
setCurrentWSID(const unsigned web_server_id)Craplog
setDialogsLevel(const int new_level)Craplog
setHashesDatabasePath(const std::string &path)Craplog
setIisLogFormat(const std::string &format_string, const int log_module)Craplog
setLogFileSelected(const QString &file_name)Craplog
setLogsPath(const unsigned &web_server, const std::string &new_path)Craplog
setNginxLogFormat(const std::string &format_string)Craplog
setStatsDatabasePath(const std::string &path)Craplog
setWarningSize(const size_t new_size)Craplog
setWarnlist(const unsigned &web_server_id, const int &log_field_id, const std::vector< std::string > &new_list)Craplog
setWarnlistUsed(const unsigned &web_server_id, const int &log_field_id, const bool used)Craplog
shouldWorkAsync() constCraplogprivate
warnlistAdd(const unsigned &web_server_id, const int &log_field_id, const std::string &new_item)Craplog
warnlistMoveDown(const unsigned &web_server_id, const int &log_field_id, const std::string &item)Craplog
warnlistMoveUp(const unsigned &web_server_id, const int &log_field_id, const std::string &item)Craplog
warnlistRemove(const unsigned &web_server_id, const int &log_field_id, const std::string &item)Craplog
setApacheLogFormat(const std::string &format_string) noexceptCraplog
setCurrentLogFormat() noexceptCraplog
setCurrentWebServer(const WebServer web_server) noexceptCraplog
setDialogsLevel(const DialogsLevel new_level) noexceptCraplog
setHashesDatabasePath(const std::string &path) noexceptCraplog
setIisLogFormat(const std::string &format_string, const IISLogsModule log_module) noexceptCraplog
setLogFileSelected(const QString &file_name) noexceptCraplog
setLogsPath(const WebServer &web_server, const std::string &new_path) noexceptCraplog
setNginxLogFormat(const std::string &format_string) noexceptCraplog
setStatsDatabasePath(const std::string &path) noexceptCraplog
setWarningSize(const size_t new_size) noexceptCraplog
diff --git a/docs/html/classCraplog.html b/docs/html/classCraplog.html index a51b9e5f..2708b444 100644 --- a/docs/html/classCraplog.html +++ b/docs/html/classCraplog.html @@ -3,12 +3,14 @@ - + LogDoctor: Craplog Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -76,12 +78,12 @@ $(function() { Public Member Functions | Private Member Functions | List of all members -
Craplog Class Reference
+
Craplog Class Referencefinal

Craplog. - More...

+ More...

#include <craplog.h>

@@ -99,372 +101,137 @@ Classes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + +

Public Member Functions

-int getDialogsLevel () const
 Returns the Dialogs level.
 
-void setDialogsLevel (const int new_level)
 Sets the new Dialogs level.
 
-const std::string & getStatsDatabasePath () const
 Returns the path of the logs Collection database.
 
-const std::string & getHashesDatabasePath () const
 Returns the path of the log files' Hashes database.
 
void setStatsDatabasePath (const std::string &path)
 Sets the new path for the logs Collection database.
 
void setHashesDatabasePath (const std::string &path)
 Sets the new path for the log files' Hashes database.
 
void setCurrentWSID (const unsigned web_server_id)
 Sets the currently used Web Server ID.
 
unsigned getCurrentWSID () const
 Returns the currently used Web Server ID.
 
void setCurrentLogFormat ()
 Uses the current Web Server to set the relative logs format.
 
const LogsFormatgetCurrentLogFormat () const
 Returns the currently used LogsFormat.
 
const std::string & getLogsPath (const unsigned &web_server) const
 Returns the logs' path for the given web Server.
 
void setLogsPath (const unsigned &web_server, const std::string &new_path)
 Sets a new path for the given Web Server to search the logs in.
 
bool isFileNameValid (const std::string &name) const
+DialogsLevel getDialogsLevel () const noexcept
 Returns the Dialogs level.
 
+void setDialogsLevel (const DialogsLevel new_level) noexcept
 Sets the new Dialogs level.
 
+const std::string & getStatsDatabasePath () const noexcept
 Returns the path of the logs Collection database.
 
+const std::string & getHashesDatabasePath () const noexcept
 Returns the path of the log files' Hashes database.
 
void setStatsDatabasePath (const std::string &path) noexcept
 Sets the new path for the logs Collection database.
 
void setHashesDatabasePath (const std::string &path) noexcept
 Sets the new path for the log files' Hashes database.
 
void setCurrentWebServer (const WebServer web_server) noexcept
 Sets the currently used Web Server ID.
 
WebServer getCurrentWebServer () const noexcept
 Returns the currently used Web Server ID.
 
void setCurrentLogFormat () noexcept
 Uses the current Web Server to set the relative logs format.
 
const LogsFormatgetCurrentLogFormat () const noexcept
 Returns the currently used LogsFormat.
 
const std::string & getLogsPath (const WebServer &web_server) const noexcept
 Returns the logs' path for the given web Server.
 
void setLogsPath (const WebServer &web_server, const std::string &new_path) noexcept
 Sets a new path for the given Web Server to search the logs in.
 
bool isFileNameValid (const std::string &name) const
 Checks if a file name respects the relative criterions.
 
const std::vector< LogFile > & getLogsList () const
 Returns the list of log files for the current WebServer.
 
size_t getLogsListSize () const
 Returns the amount of log files in the list.
 
const LogFilegetLogFileItem (const QString &file_name) const
 Returns the LogFile instance of the given file.
const std::vector< LogFile > & getLogsList () const noexcept
 Returns the list of log files for the current WebServer.
 
size_t getLogsListSize () const noexcept
 Returns the amount of log files in the list.
 
const LogFilegetLogFileItem (const QString &file_name) const
 Returns the LogFile instance of the given file.
 
bool setLogFileSelected (const QString &file_name)
 Sets a file in the list as selected.
 
void clearLogFilesSelection ()
 Sets all files in the list as unselected.
 
bool setApacheLogFormat (const std::string &format_string)
 Sets the Apache2 LogsFormat from the given format string.
 
bool setNginxLogFormat (const std::string &format_string)
 Sets the Nginx LogsFormat from the given format string.
 
bool setIisLogFormat (const std::string &format_string, const int log_module)
 Sets the IIS LogsFormat from the given format string.
 
const std::string & getLogsFormatString (const unsigned &web_server_id) const
 Returns the logs format string for the given Web Server.
 
const LogsFormatgetLogsFormat (const unsigned &web_server_id) const
 Returns the LogsFormat currently set for the given Web Server.
 
QString getLogsFormatSample (const unsigned &web_server_id) const
 Returns a sample log line for the given Web Server using the relative LogsFormat.
 
-size_t getWarningSize () const
 Returns the currently set warning size for the log files.
 
-void setWarningSize (const size_t new_size)
 Sets the new warning size for the log files.
 
bool isBlacklistUsed (const unsigned &web_server_id, const int &log_field_id) const
 Returns whether the relative blacklist is set to be used or not.
 
bool isWarnlistUsed (const unsigned &web_server_id, const int &log_field_id) const
 Returns whether the relative warnlist is set to be used or not.
 
void setBlacklistUsed (const unsigned &web_server_id, const int &log_field_id, const bool used)
 Sets the relative blacklist to be used or not.
 
void setWarnlistUsed (const unsigned &web_server_id, const int &log_field_id, const bool used)
 Sets the relative warnlist to be used or not.
 
const std::vector< std::string > & getBlacklist (const unsigned &web_server_id, const int &log_field_id) const
 Returns the relative items list.
 
const std::vector< std::string > & getWarnlist (const unsigned &web_server_id, const int &log_field_id) const
 Returns the relative items list.
 
void setBlacklist (const unsigned &web_server_id, const int &log_field_id, const std::vector< std::string > &new_list)
 Sets the relative items list.
 
void setWarnlist (const unsigned &web_server_id, const int &log_field_id, const std::vector< std::string > &new_list)
 Sets the relative items list.
 
void blacklistAdd (const unsigned &web_server_id, const int &log_field_id, const std::string &new_item)
 Adds an item to the relative list.
 
void warnlistAdd (const unsigned &web_server_id, const int &log_field_id, const std::string &new_item)
 Adds an item to the relative list.
 
void blacklistRemove (const unsigned &web_server_id, const int &log_field_id, const std::string &item)
 Removes an item from the relative list.
 
void warnlistRemove (const unsigned &web_server_id, const int &log_field_id, const std::string &item)
 Removes an item from the relative list.
 
int blacklistMoveUp (const unsigned &web_server_id, const int &log_field_id, const std::string &item)
 Moves an item one position up in the relative list.
 
int warnlistMoveUp (const unsigned &web_server_id, const int &log_field_id, const std::string &item)
 Moves an item one position up in the relative list.
 
int blacklistMoveDown (const unsigned &web_server_id, const int &log_field_id, const std::string &item)
 Moves an item one position down in the relative list.
 
int warnlistMoveDown (const unsigned &web_server_id, const int &log_field_id, const std::string &item)
 Moves an item one position down in the relative list.
 
bool checkStuff ()
bool setLogFileSelected (const QString &file_name) noexcept
 Sets a file in the list as selected.
 
void clearLogFilesSelection () noexcept
 Sets all files in the list as unselected.
 
bool setApacheLogFormat (const std::string &format_string) noexcept
 Sets the Apache2 LogsFormat from the given format string.
 
bool setNginxLogFormat (const std::string &format_string) noexcept
 Sets the Nginx LogsFormat from the given format string.
 
bool setIisLogFormat (const std::string &format_string, const IISLogsModule log_module) noexcept
 Sets the IIS LogsFormat from the given format string.
 
const std::string & getLogsFormatString (const WebServer &web_server) const noexcept
 Returns the logs format string for the given Web Server.
 
const LogsFormatgetLogsFormat (const WebServer &web_server) const noexcept
 Returns the LogsFormat currently set for the given Web Server.
 
QString getLogsFormatSample (const WebServer &web_server) const
 Returns a sample log line for the given Web Server using the relative LogsFormat.
 
+bool checkCurrentLogsFormat () const noexcept
 Checks whether the current Logs Format is valid or not.
 
+size_t getWarningSize () const noexcept
 Returns the currently set warning size for the log files.
 
+void setWarningSize (const size_t new_size) noexcept
 Sets the new warning size for the log files.
 
bool checkStuff ()
 Various checks to be made before starting a new process.
 
-bool isParsing () const
 Returns whether the database has been edited or not during the process.
 
-bool editedDatabase () const
 Returns whether the database has been edited or not during the process.
 
-size_t getParsedSize ()
 Returns the total logs size.
 
-size_t getParsedLines ()
 Returns the parsed logs lines.
 
-QString getParsingSpeed ()
 Returns the speed on parsing logs.
 
void makeChart (const QChart::ChartTheme &theme, const std::unordered_map< std::string, QFont > &fonts, QChartView *size_chart) const
+bool isParsing () const noexcept
 Returns whether the database has been edited or not during the process.
 
+bool editedDatabase () const noexcept
 Returns whether the database has been edited or not during the process.
 
+size_t getParsedSize () noexcept
 Returns the total logs size.
 
+size_t getParsedLines () noexcept
 Returns the parsed logs lines.
 
+QString getParsingSpeed () noexcept
 Returns the speed on parsing logs.
 
void makeChart (const QChart::ChartTheme &theme, const std::unordered_map< std::string, QFont > &fonts, QChartView *size_chart) const
 Builds and draws the chart to be displayed in the main window.
 
- - - - - - - - - - - - - - - + + + + + +

Private Member Functions

-void hireWorker () const
 Hires a worker to parse the selected logs.
 
-void hireAsyncWorker () const
 Hires a worker to parse the selected logs, asynchronously.
 
-bool shouldWorkAsync () const
 Defines whether it's worth it working async or not.
 
std::string sanitizeBWitem (const int &log_field_id, const std::string &new_item) const
 Sanitizes an item removing the unwanted elements.
 
void changeIisLogsBaseNames (const int module_id)
 Changes the name criterions for IIS logs files names depending on the given module.
 
+void hireWorker (const Blacklists &blacklists) const
 Hires a worker to parse the selected logs.
 
void changeIisLogsBaseNames (const IISLogsModule log_module)
 Changes the name criterions for IIS logs files names depending on the given module.
 

Detailed Description

Craplog.

Performs operations related to the logs

Member Function Documentation

- -

◆ blacklistAdd()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
void Craplog::blacklistAdd (const unsigned & web_server_id,
const int & log_field_id,
const std::string & new_item 
)
-
- -

Adds an item to the relative list.

-
Parameters
- - - - -
web_server_idThe ID of the Web Server
log_field_idThe ID of the log field
new_listThe new items list
-
-
-
See also
BWlist
- -
-
- -

◆ blacklistMoveDown()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
int Craplog::blacklistMoveDown (const unsigned & web_server_id,
const int & log_field_id,
const std::string & item 
)
-
- -

Moves an item one position down in the relative list.

-
Parameters
- - - - -
web_server_idThe ID of the Web Server
log_field_idThe ID of the log field
itemThe item to move
-
-
-
See also
BWlist
- -
-
- -

◆ blacklistMoveUp()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
int Craplog::blacklistMoveUp (const unsigned & web_server_id,
const int & log_field_id,
const std::string & item 
)
-
- -

Moves an item one position up in the relative list.

-
Parameters
- - - - -
web_server_idThe ID of the Web Server
log_field_idThe ID of the log field
itemThe item to move
-
-
-
See also
BWlist
- -
-
- -

◆ blacklistRemove()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
void Craplog::blacklistRemove (const unsigned & web_server_id,
const int & log_field_id,
const std::string & item 
)
-
- -

Removes an item from the relative list.

-
Parameters
- - - - -
web_server_idThe ID of the Web Server
log_field_idThe ID of the log field
itemThe item to remove from the list
-
-
-
See also
BWlist
- -
-
- -

◆ changeIisLogsBaseNames()

+ +

◆ changeIisLogsBaseNames()

@@ -475,8 +242,7 @@ bool shouldWorkAsync ( void Craplog::changeIisLogsBaseNames ( - const int  - module_id) + const IISLogsModule log_module) @@ -490,13 +256,13 @@ bool shouldWorkAsync (

Changes the name criterions for IIS logs files names depending on the given module.

Parameters
- +
module_idThe ID of the module to use to set the criterions
log_moduleThe ID of the module to use to set the criterions
Exceptions
- +
GenericException
DoNotCatchException
@@ -513,7 +279,7 @@ bool shouldWorkAsync ( bool Craplog::checkStuff ( - ) + ) @@ -530,100 +296,85 @@ bool shouldWorkAsync (
- -

◆ clearLogFilesSelection()

+ +

◆ clearLogFilesSelection()

+ + + + + +
- +
void Craplog::clearLogFilesSelection ())
+
+noexcept

Sets all files in the list as unselected.

Returns
Wheter the given file name has been found in the list
-
See also
LogFile, logs_list
+
See also
LogFile, logs_list
- -

◆ getBlacklist()

+ +

◆ getCurrentLogFormat()

+ + + + + +
- + - - - - - - - - - - - - - - -
const std::vector< std::string > & Craplog::getBlacklist const LogsFormat & Craplog::getCurrentLogFormat (const unsigned & web_server_id,
const int & log_field_id 
) const
-
- -

Returns the relative items list.

-
Parameters
- - - -
web_server_idThe ID of the Web Server
log_field_idThe ID of the log field
-
-
-
Returns
The list of items in the given blacklist
-
See also
BWlist
- -
- - -

◆ getCurrentLogFormat()

- -
-
- - - - - +
const LogsFormat & Craplog::getCurrentLogFormat ()) const
+
+noexcept
-

Returns the currently used LogsFormat.

-
Returns
The LogsFormat
-
See also
LogsFormat
+

Returns the currently used LogsFormat.

+
Returns
The LogsFormat
+
See also
LogsFormat
- -

◆ getCurrentWSID()

+ +

◆ getCurrentWebServer()

+ + + + + +
- + - +
unsigned Craplog::getCurrentWSID WebServer Craplog::getCurrentWebServer ()) const
+
+noexcept

Returns the currently used Web Server ID.

@@ -638,63 +389,69 @@ bool shouldWorkAsync (
- + - - +
const LogFile & Craplog::getLogFileItem const LogFile & Craplog::getLogFileItem (const QString & file_name)const QString & file_name) const
-

Returns the LogFile instance of the given file.

+

Returns the LogFile instance of the given file.

Parameters
file_nameThe name of the file
-
Returns
The LogFile instance
+
Returns
The LogFile instance
Exceptions
GenericException
-
See also
LogFile, logs_list
+
See also
LogFile, logs_list
- -

◆ getLogsFormat()

+ +

◆ getLogsFormat()

+ + + + + +
- + - - +
const LogsFormat & Craplog::getLogsFormat const LogsFormat & Craplog::getLogsFormat (const unsigned & web_server_id)const WebServer & web_server) const
+
+noexcept
-

Returns the LogsFormat currently set for the given Web Server.

+

Returns the LogsFormat currently set for the given Web Server.

Parameters
- +
web_server_idID of the Web Server
web_serverID of the Web Server
-
Returns
The LogsFormat instance
-
See also
LogsFormat
+
Returns
The LogsFormat instance
+
See also
LogsFormat
- -

◆ getLogsFormatSample()

+ +

◆ getLogsFormatSample()

@@ -702,51 +459,57 @@ bool shouldWorkAsync ( QString Craplog::getLogsFormatSample ( - const unsigned &  - web_server_id) + const WebServer & web_server) const
-

Returns a sample log line for the given Web Server using the relative LogsFormat.

+

Returns a sample log line for the given Web Server using the relative LogsFormat.

Parameters
- +
web_server_idID of the Web Server
web_serverID of the Web Server
Returns
The sample of a log line
Exceptions
- +
WebServerException
DoNotCatchException
-
See also
FormatOps::getApacheLogSample(), FormatOps::getNginxLogSample(), FormatOps::getIisLogSample()
+
See also
FormatOps::getApacheLogSample(), FormatOps::getNginxLogSample(), FormatOps::getIisLogSample()
- -

◆ getLogsFormatString()

+ +

◆ getLogsFormatString()

+ + + + + +
- - +
const std::string & Craplog::getLogsFormatString (const unsigned & web_server_id)const WebServer & web_server) const
+
+noexcept

Returns the logs format string for the given Web Server.

Parameters
- +
web_server_idID of the Web Server
web_serverID of the Web Server
@@ -755,40 +518,56 @@ bool shouldWorkAsync (
- -

◆ getLogsList()

+ +

◆ getLogsList()

+ + + + + +
- + - +
const std::vector< LogFile > & Craplog::getLogsList const std::vector< LogFile > & Craplog::getLogsList ()) const
+
+noexcept

Returns the list of log files for the current WebServer.

Returns
The list of log files
-
See also
LogFile, logs_list
+
See also
LogFile, logs_list
- -

◆ getLogsListSize()

+ +

◆ getLogsListSize()

+ + + + + +
- +
size_t Craplog::getLogsListSize ()) const
+
+noexcept

Returns the amount of log files in the list.

@@ -797,109 +576,38 @@ bool shouldWorkAsync (
- -

◆ getLogsPath()

+ +

◆ getLogsPath()

+ + + + + +
- - +
const std::string & Craplog::getLogsPath (const unsigned & web_server)const WebServer & web_server) const
+
+noexcept

Returns the logs' path for the given web Server.

Parameters
- +
web_serverThe ID of the Web Server
web_serverThe Web Server
Returns
The path of the logs' folder
-
-
- -

◆ getWarnlist()

- -
-
- - - - - - - - - - - - - - - - - - -
const std::vector< std::string > & Craplog::getWarnlist (const unsigned & web_server_id,
const int & log_field_id 
) const
-
- -

Returns the relative items list.

-
Parameters
- - - -
web_server_idThe ID of the Web Server
log_field_idThe ID of the log field
-
-
-
Returns
The list of items in the givenwarnlist
-
See also
BWlist
- -
-
- -

◆ isBlacklistUsed()

- -
-
- - - - - - - - - - - - - - - - - - -
bool Craplog::isBlacklistUsed (const unsigned & web_server_id,
const int & log_field_id 
) const
-
- -

Returns whether the relative blacklist is set to be used or not.

-
Parameters
- - - -
web_server_idThe ID of the Web Server
log_field_idThe ID of the log field
-
-
-
Returns
Whether the list is used or not
-
See also
BWlist
-
@@ -911,8 +619,7 @@ bool shouldWorkAsync ( bool Craplog::isFileNameValid ( - const std::string &  - name) + const std::string & name) const @@ -926,46 +633,13 @@ bool shouldWorkAsync (
Returns
Wheter it does respect the criterions or not
-
See also
LogName
- -
-
- -

◆ isWarnlistUsed()

- -
-
- - - - - - - - - - - - - - - - - - -
bool Craplog::isWarnlistUsed (const unsigned & web_server_id,
const int & log_field_id 
) const
-
- -

Returns whether the relative warnlist is set to be used or not.

-
Parameters
- - - +
Exceptions
+
web_server_idThe ID of the Web Server
log_field_idThe ID of the log field
+
DoNotCatchException
-
Returns
Whether the list is used or not
-
See also
BWlist
+
See also
LogName
@@ -978,25 +652,17 @@ bool shouldWorkAsync ( void Craplog::makeChart ( - const QChart::ChartTheme &  - theme, + const QChart::ChartTheme & theme, - const std::unordered_map< std::string, QFont > &  - fonts, + const std::unordered_map< std::string, QFont > & fonts, - QChartView *  - size_chart  - - - - ) - const + QChartView * size_chart ) const
@@ -1014,8 +680,8 @@ bool shouldWorkAsync (
- -

◆ sanitizeBWitem()

+ +

◆ setApacheLogFormat()

@@ -1024,66 +690,20 @@ bool shouldWorkAsync ( - + - - - - - + - - - - - - -
std::string Craplog::sanitizeBWitem bool Craplog::setApacheLogFormat (const int & log_field_id,
const std::string & format_string) const std::string & new_item 
) const
-private +noexcept
-

Sanitizes an item removing the unwanted elements.

-

Called when adding a new item to a list

Parameters
- - - -
log_field_idThe ID of the log field
new_itemThe item to be sanitized
-
-
-
Returns
The sanitized item
-
Exceptions
- - -
BWlistException,GenericException
-
-
-
See also
BWlist
- -
-
- -

◆ setApacheLogFormat()

- -
-
- - - - - - - - -
bool Craplog::setApacheLogFormat (const std::string & format_string)
-
- -

Sets the Apache2 LogsFormat from the given format string.

+

Sets the Apache2 LogsFormat from the given format string.

Parameters
@@ -1095,156 +715,88 @@ bool  @@ -31,7 +33,7 @@
format_stringThe logs format string
shouldWorkAsync ( - -

◆ setBlacklist()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
void Craplog::setBlacklist (const unsigned & web_server_id,
const int & log_field_id,
const std::vector< std::string > & new_list 
)
-
- -

Sets the relative items list.

-
Parameters
- - - - -
web_server_idThe ID of the Web Server
log_field_idThe ID of the log field
new_listThe new items list
-
-
-
See also
BWlist
- -
-
- -

◆ setBlacklistUsed()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
void Craplog::setBlacklistUsed (const unsigned & web_server_id,
const int & log_field_id,
const bool used 
)
-
- -

Sets the relative blacklist to be used or not.

-
Parameters
- - - - -
web_server_idThe ID of the Web Server
log_field_idThe ID of the log field
usedWhether the list is to be used or not
-
-
-
See also
BWlist
- -
-
- -

◆ setCurrentLogFormat()

+ +

◆ setCurrentLogFormat()

+ + + + + +
- +
void Craplog::setCurrentLogFormat ())
+
+noexcept

Uses the current Web Server to set the relative logs format.

-
See also
LogsFormat
+
See also
LogsFormat
- -

◆ setCurrentWSID()

+ +

◆ setCurrentWebServer()

+ + + + + +
- + - - +
void Craplog::setCurrentWSID void Craplog::setCurrentWebServer (const unsigned web_server_id)const WebServer web_server)
+
+noexcept

Sets the currently used Web Server ID.

Parameters
- +
web_server_idThe new currently used Web Server
web_serverThe new currently used Web Server
- -

◆ setHashesDatabasePath()

+ +

◆ setHashesDatabasePath()

+ + + + + +
- - +
void Craplog::setHashesDatabasePath (const std::string & path)const std::string & path)
+
+noexcept

Sets the new path for the log files' Hashes database.

@@ -1257,33 +809,34 @@ bool 
shouldWorkAsync ( - -

◆ setIisLogFormat()

+ +

◆ setIisLogFormat()

+ + + + + +
- - + - - - - - - - +
bool Craplog::setIisLogFormat (const std::string & format_string, const std::string & format_string,
const int log_module 
)const IISLogsModule log_module )
+
+noexcept
-

Sets the IIS LogsFormat from the given format string.

+

Sets the IIS LogsFormat from the given format string.

Parameters
@@ -1292,24 +845,37 @@ bool  @@ -31,7 +33,7 @@
format_stringThe logs format string
shouldWorkAsync (
Returns
Whether the process was successful or not
-
See also
FormatOps, FormatOps::LogsFormat, FormatOps::processIisFormatString()
+
Exceptions
+ + +
DoNotCatchException
+
+
+
See also
FormatOps, FormatOps::LogsFormat, FormatOps::processIisFormatString()
- -

◆ setLogFileSelected()

+ +

◆ setLogFileSelected()

+ + + + + +
- - +
bool Craplog::setLogFileSelected (const QString & file_name)const QString & file_name)
+
+noexcept

Sets a file in the list as selected.

@@ -1320,40 +886,41 @@ bool 
shouldWorkAsync (
Returns
Wheter the given file name has been found in the list
-
See also
LogFile, logs_list
+
See also
LogFile, logs_list
- -

◆ setLogsPath()

+ +

◆ setLogsPath()

+ + + + + +
- - + - - - - - - - +
void Craplog::setLogsPath (const unsigned & web_server, const WebServer & web_server,
const std::string & new_path 
)const std::string & new_path )
+
+noexcept

Sets a new path for the given Web Server to search the logs in.

Parameters
- +
web_serverThe ID of the Web Server
web_serverThe Web Server
new_pathThe new path
@@ -1361,23 +928,30 @@ bool 
shouldWorkAsync ( - -

◆ setNginxLogFormat()

+ +

◆ setNginxLogFormat()

+ + + + + +
- - +
bool Craplog::setNginxLogFormat (const std::string & format_string)const std::string & format_string)
+
+noexcept
-

Sets the Nginx LogsFormat from the given format string.

+

Sets the Nginx LogsFormat from the given format string.

Parameters
@@ -1389,20 +963,27 @@ bool  @@ -31,7 +33,7 @@
format_stringThe logs format string
shouldWorkAsync ( - -

◆ setStatsDatabasePath()

+ +

◆ setStatsDatabasePath()

+ + + + + +
- - +
void Craplog::setStatsDatabasePath (const std::string & path)const std::string & path)
+
+noexcept

Sets the new path for the logs Collection database.

@@ -1413,276 +994,6 @@ bool 
shouldWorkAsync ( - - - -

◆ setWarnlist()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
void Craplog::setWarnlist (const unsigned & web_server_id,
const int & log_field_id,
const std::vector< std::string > & new_list 
)
-
- -

Sets the relative items list.

-
Parameters
- - - - -
web_server_idThe ID of the Web Server
log_field_idThe ID of the log field
new_listThe new items list
-
-
-
See also
BWlist
- -
-
- -

◆ setWarnlistUsed()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
void Craplog::setWarnlistUsed (const unsigned & web_server_id,
const int & log_field_id,
const bool used 
)
-
- -

Sets the relative warnlist to be used or not.

-
Parameters
- - - - -
web_server_idThe ID of the Web Server
log_field_idThe ID of the log field
usedWhether the list is to be used or not
-
-
-
See also
BWlist
- -
-
- -

◆ warnlistAdd()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
void Craplog::warnlistAdd (const unsigned & web_server_id,
const int & log_field_id,
const std::string & new_item 
)
-
- -

Adds an item to the relative list.

-
Parameters
- - - - -
web_server_idThe ID of the Web Server
log_field_idThe ID of the log field
new_itemThe new item to add to the list
-
-
-
See also
BWlist
- -
-
- -

◆ warnlistMoveDown()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
int Craplog::warnlistMoveDown (const unsigned & web_server_id,
const int & log_field_id,
const std::string & item 
)
-
- -

Moves an item one position down in the relative list.

-
Parameters
- - - - -
web_server_idThe ID of the Web Server
log_field_idThe ID of the log field
itemThe item to move
-
-
-
See also
BWlist
- -
-
- -

◆ warnlistMoveUp()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
int Craplog::warnlistMoveUp (const unsigned & web_server_id,
const int & log_field_id,
const std::string & item 
)
-
- -

Moves an item one position up in the relative list.

-
Parameters
- - - - -
web_server_idThe ID of the Web Server
log_field_idThe ID of the log field
itemThe item to move
-
-
-
See also
BWlist
- -
-
- -

◆ warnlistRemove()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
void Craplog::warnlistRemove (const unsigned & web_server_id,
const int & log_field_id,
const std::string & item 
)
-
- -

Removes an item from the relative list.

-
Parameters
- - - - -
web_server_idThe ID of the Web Server
log_field_idThe ID of the log field
itemThe item to remove from the list
-
-
-
See also
BWlist
-

The documentation for this class was generated from the following files:
    @@ -1692,7 +1003,7 @@ bool 
shouldWorkAsync ( diff --git a/docs/html/classCraplog.png b/docs/html/classCraplog.png index ad0e94f1..83e2f277 100644 Binary files a/docs/html/classCraplog.png and b/docs/html/classCraplog.png differ diff --git a/docs/html/classCraplogLister-members.html b/docs/html/classCraplogLister-members.html index e2885cda..8e198aa6 100644 --- a/docs/html/classCraplogLister-members.html +++ b/docs/html/classCraplogLister-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@
-
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
- + @@ -79,7 +81,7 @@ $(function() {
diff --git a/docs/html/classCraplogLister.html b/docs/html/classCraplogLister.html index a98e1a5d..71119e2d 100644 --- a/docs/html/classCraplogLister.html +++ b/docs/html/classCraplogLister.html @@ -3,12 +3,14 @@ - + LogDoctor: CraplogLister Class Reference + + @@ -22,7 +24,7 @@
-
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
- + @@ -73,7 +75,7 @@ $(function() {
-
CraplogLister Class Reference
+
CraplogLister Class Referencefinal
@@ -89,7 +91,7 @@ Inheritance diagram for CraplogLister:
diff --git a/docs/html/classCraplogLister.png b/docs/html/classCraplogLister.png index 243b9308..1ffd3fdc 100644 Binary files a/docs/html/classCraplogLister.png and b/docs/html/classCraplogLister.png differ diff --git a/docs/html/classCraplogParser-members.html b/docs/html/classCraplogParser-members.html index 408638ed..2f1e1730 100644 --- a/docs/html/classCraplogParser-members.html +++ b/docs/html/classCraplogParser-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@
-
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
- + @@ -80,11 +82,11 @@ $(function() { joinLogLines()CraplogParserprivate parseLogLines()CraplogParserprivate storeData(QSqlDatabase &db)CraplogParserprivate - storeLogLines()CraplogParserprivate + storeLogLines(QSqlDatabase &db)CraplogParserprivate
diff --git a/docs/html/classCraplogParser.html b/docs/html/classCraplogParser.html index 0588c927..7b9d96dd 100644 --- a/docs/html/classCraplogParser.html +++ b/docs/html/classCraplogParser.html @@ -3,12 +3,14 @@ - + LogDoctor: CraplogParser Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,31 +76,28 @@ $(function() {
Private Member Functions | List of all members
-
CraplogParser Class Reference
+
CraplogParser Class Referencefinal
Inheritance diagram for CraplogParser:
- - -CraplogParserInterface - -
+ +
- + - + - - - - + + + +

Private Member Functions

void joinLogLines ()
void joinLogLines ()
 Reads the selected files and append the resulting lines to the list.
 
void parseLogLines ()
void parseLogLines ()
 Parses the lines in the list and stores their data in the data collection.
 
void storeLogLines ()
 Handles the process of storing data in the database.
 
bool storeData (QSqlDatabase &db)
void storeLogLines (QSqlDatabase &db)
 Handles the process of storing data in the database.
 
bool storeData (QSqlDatabase &db)
 Stores the data collection in the logs Collection database.
 
@@ -115,7 +114,7 @@ Private Member Functions void CraplogParser::joinLogLines ( - ) + ) @@ -148,7 +147,7 @@ Private Member Functions void CraplogParser::parseLogLines ( - ) + ) @@ -181,8 +180,7 @@ Private Member Functions bool CraplogParser::storeData ( - QSqlDatabase &  - db) + QSqlDatabase & db) @@ -196,22 +194,22 @@ Private Member Functions

Stores the data collection in the logs Collection database.

Parameters
- +
dbA database instance, already initizlized
dbThe database instance, already initialized
Returns
Whether the operation has been successful or not
Exceptions
- +
WebServerException
WebServerException
- -

◆ storeLogLines()

+ +

◆ storeLogLines()

@@ -222,7 +220,7 @@ Private Member Functions void CraplogParser::storeLogLines ( - ) + QSqlDatabase & db) @@ -234,7 +232,13 @@ Private Member Functions

Handles the process of storing data in the database.

-
See also
storeData()
+
Parameters
+ + +
dbThe database instance, not initialized already
+
+
+
See also
storeData()
@@ -245,7 +249,7 @@ Private Member Functions diff --git a/docs/html/classCraplogParser.png b/docs/html/classCraplogParser.png index 76516fc9..2d01d48b 100644 Binary files a/docs/html/classCraplogParser.png and b/docs/html/classCraplogParser.png differ diff --git a/docs/html/classCraplogParserAsync.html b/docs/html/classCraplogParserAsync.html deleted file mode 100644 index 3c838946..00000000 --- a/docs/html/classCraplogParserAsync.html +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - - -LogDoctor: CraplogParserAsync Class Reference - - - - - - - - - -
-
- - - - - - - -
-
LogDoctor 3.00 -
-
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
-
-
- - - - - - - - -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
-
-Private Member Functions | -List of all members
-
CraplogParserAsync Class Reference
-
-
-
-Inheritance diagram for CraplogParserAsync:
-
-
- - -CraplogParserInterface - -
- - - - - - - - - - - - - - -

-Private Member Functions

void joinLogLines (std::promise< logs_lines_t > &log_lines, const logs_file_t &logs_file)
 Reads the selected files and append the resulting lines to the list.
 
void parseLogLines (std::future< logs_lines_t > &log_lines)
 Parses the lines in the list and stores their data in the data collection.
 
void storeLogLines ()
 Handles the process of storing data in the database.
 
bool storeData (QSqlDatabase &db)
 Stores the data collection in the logs Collection database.
 
-

Member Function Documentation

- -

◆ joinLogLines()

- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - -
void CraplogParserAsync::joinLogLines (std::promise< logs_lines_t > & log_lines,
const logs_file_t & logs_file 
)
-
-private
-
- -

Reads the selected files and append the resulting lines to the list.

-
Exceptions
- - -
GenericException
-
-
- -
-
- -

◆ parseLogLines()

- -
-
- - - - - -
- - - - - - - - -
void CraplogParserAsync::parseLogLines (std::future< logs_lines_t > & log_lines)
-
-private
-
- -

Parses the lines in the list and stores their data in the data collection.

-
Exceptions
- - -
LogParserException
-
-
- -
-
- -

◆ storeData()

- -
-
- - - - - -
- - - - - - - - -
bool CraplogParserAsync::storeData (QSqlDatabase & db)
-
-private
-
- -

Stores the data collection in the logs Collection database.

-
Parameters
- - -
dbA database instance, already initizlized
-
-
-
Returns
Whether the operation has been successful or not
-
Exceptions
- - -
WebServerException
-
-
- -
-
- -

◆ storeLogLines()

- -
-
- - - - - -
- - - - - - - -
void CraplogParserAsync::storeLogLines ()
-
-private
-
- -

Handles the process of storing data in the database.

-
See also
storeData()
- -
-
-
The documentation for this class was generated from the following files: -
- - - - diff --git a/docs/html/classCraplogParserAsync.png b/docs/html/classCraplogParserAsync.png deleted file mode 100644 index d201e522..00000000 Binary files a/docs/html/classCraplogParserAsync.png and /dev/null differ diff --git a/docs/html/classCraplogParserInterface.png b/docs/html/classCraplogParserInterface.png deleted file mode 100644 index 8e390ae7..00000000 Binary files a/docs/html/classCraplogParserInterface.png and /dev/null differ diff --git a/docs/html/classCrapnote-members.html b/docs/html/classCrapnote-members.html index ef46f98e..d594b518 100644 --- a/docs/html/classCrapnote-members.html +++ b/docs/html/classCrapnote-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -80,12 +82,12 @@ $(function() { on_button_FontSize_Minus_clicked()Crapnoteprivateslot on_button_FontSize_Plus_clicked()Crapnoteprivateslot on_spinBox_FontSize_valueChanged(int arg1)Crapnoteprivateslot - setColorScheme(const int &color_scheme_id)Crapnote - setTextFont(const QFont &font)Crapnote + setColorScheme(const ColorsScheme colors_scheme)Crapnote + setTextFont(QFont font) noexceptCrapnote diff --git a/docs/html/classCrapnote.html b/docs/html/classCrapnote.html index 096653ad..e9161341 100644 --- a/docs/html/classCrapnote.html +++ b/docs/html/classCrapnote.html @@ -3,12 +3,14 @@ - + LogDoctor: Crapnote Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -75,12 +77,12 @@ $(function() { Public Member Functions | Private Slots | List of all members -
Crapnote Class Reference
+
Crapnote Class Referencefinal

Crapnote. - More...

+ More...

#include <crapnote.h>

@@ -92,14 +94,13 @@ Inheritance diagram for Crapnote:
- - - - - - + + + + + +

Public Member Functions

-void setTextFont (const QFont &font)
 Sets the given font.
 
-void setColorScheme (const int &color_scheme_id)
 Sets the given color-scheme.
 
+void setTextFont (QFont font) noexcept
 Sets the given font.
 
void setColorScheme (const ColorsScheme colors_scheme)
 Sets the given color-scheme.
 
@@ -119,14 +120,40 @@ void  @@ -31,7 +33,7 @@

Private Slots

on_button_FontSize_Pl

Detailed Description

Crapnote.

A simple block-note like widget

-

The documentation for this class was generated from the following files:
    +

    Member Function Documentation

    + +

    ◆ setColorScheme()

    + +
    +
    + + + + + + + +
    void Crapnote::setColorScheme (const ColorsScheme colors_scheme)
    +
    + +

    Sets the given color-scheme.

    +
    Exceptions
    + + +
    DoNotCatchException
    +
    +
    + +
    +
    +
    The documentation for this class was generated from the following files:
    • logdoctor/tools/crapnote/crapnote.h
    • logdoctor/tools/crapnote/crapnote.cpp
    diff --git a/docs/html/classCrapnote.png b/docs/html/classCrapnote.png index 0f17b9a5..0e34ac5c 100644 Binary files a/docs/html/classCrapnote.png and b/docs/html/classCrapnote.png differ diff --git a/docs/html/classCrappath-members.html b/docs/html/classCrappath-members.html new file mode 100644 index 00000000..85b31017 --- /dev/null +++ b/docs/html/classCrappath-members.html @@ -0,0 +1,87 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
    +
    + + + + + + + +
    +
    LogDoctor 4.00 +
    +
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    +
    +
    + + + + + + + + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    +
    Crappath Member List
    +
    +
    + +

    This is the complete list of members for Crappath, including all inherited members.

    +
    + + + + diff --git a/docs/html/classCrappath.html b/docs/html/classCrappath.html new file mode 100644 index 00000000..595f6d33 --- /dev/null +++ b/docs/html/classCrappath.html @@ -0,0 +1,97 @@ + + + + + + + +LogDoctor: Crappath Class Reference + + + + + + + + + + + +
    +
    + + + + + + + +
    +
    LogDoctor 4.00 +
    +
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    +
    +
    + + + + + + + + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    + +
    Crappath Class Reference
    +
    +
    +
    +Inheritance diagram for Crappath:
    +
    +
    + +
    +
    The documentation for this class was generated from the following files:
      +
    • logdoctor/tools/crappath/crappath.h
    • +
    • logdoctor/tools/crappath/crappath.cpp
    • +
    +
    + + + + diff --git a/docs/html/classCrappath.png b/docs/html/classCrappath.png new file mode 100644 index 00000000..e555c50c Binary files /dev/null and b/docs/html/classCrappath.png differ diff --git a/docs/html/classCrapup-members.html b/docs/html/classCrapup-members.html index 448509a5..76e4021d 100644 --- a/docs/html/classCrapup-members.html +++ b/docs/html/classCrapup-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@
-
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
- + @@ -79,15 +81,14 @@ $(function() { - - - - - + + + +
abortRequest()Crapupsignal
closeEvent(QCloseEvent *event) overrideCrapupprivateslot
Crapup(QWidget *parent=nullptr)Crapupexplicit
deleteReply()Crapupprivate
requestTimeout()Crapupprivateslot
rotateImg()Crapupprivateslot
versionCheck(const float current_version)Crapup
deleteReply()Crapupprivate
requestTimeout()Crapupprivateslot
rotateImg()Crapupprivateslot
versionCheck(const float current_version)Crapup
diff --git a/docs/html/classCrapup.html b/docs/html/classCrapup.html index 6a8bbcd2..9d052e9a 100644 --- a/docs/html/classCrapup.html +++ b/docs/html/classCrapup.html @@ -3,12 +3,14 @@ - + LogDoctor: Crapup Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -77,12 +79,12 @@ $(function() { Private Slots | Private Member Functions | List of all members -
Crapup Class Reference
+
Crapup Class Referencefinal

Crapup. - More...

+ More...

#include <crapup.h>

@@ -101,10 +103,7 @@ void abortRequest () - - - - +

Public Member Functions

 Crapup (QWidget *parent=nullptr)
 Class constructor.
 
void versionCheck (const float current_version)
void versionCheck (const float current_version)
 Performs a version check.
 
@@ -114,7 +113,7 @@ Private Slots void  - + - +
closeEvent (QCloseEvent *event) override
 Override.
 
void requestTimeout ()
void requestTimeout ()
 Called when a request's times out.
 
@@ -131,42 +130,7 @@ void deleteReply ()

Detailed Description

Constructor & Destructor Documentation

- -

◆ Crapup()

- -
-
- - - - - -
- - - - - - - - -
Crapup::Crapup (QWidget * parent = nullptr)
-
-explicit
-
- -

Class constructor.

-
Parameters
- - -
parentThe parent Widget
-
-
- -
-
-

Member Function Documentation

+

Member Function Documentation

◆ requestTimeout

@@ -179,7 +143,7 @@ void 
deleteReply () void Crapup::requestTimeout ())
@@ -191,7 +155,7 @@ void deleteReply ()

Called when a request's times out.

-
See also
deleteReply(), abortRequest()
+
See also
deleteReply(), abortRequest()
@@ -204,8 +168,7 @@ void deleteReply () void Crapup::versionCheck ( - const float  - current_version) + const float current_version) @@ -234,7 +197,7 @@ void deleteReply () diff --git a/docs/html/classCrapup.png b/docs/html/classCrapup.png index ce3ab70e..756ced77 100644 Binary files a/docs/html/classCrapup.png and b/docs/html/classCrapup.png differ diff --git a/docs/html/classCrapview-members.html b/docs/html/classCrapview-members.html index e3ac485f..e77b038b 100644 --- a/docs/html/classCrapview-members.html +++ b/docs/html/classCrapview-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -77,30 +79,28 @@ $(function() {

This is the complete list of members for Crapview, including all inherited members.

- - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
calcGlobals(std::vector< std::tuple< QString, QString > > &recur_list, std::vector< std::tuple< QString, QString > > &traffic_list, std::vector< std::tuple< QString, QString > > &perf_list, std::vector< QString > &work_list, const QString &web_server) constCrapview
clearDates()Crapview
drawCount(QTableWidget *table, QChartView *chart, const QChart::ChartTheme &theme, const QString &web_server, const QString &year, const QString &month, const QString &day, const QString &field) constCrapview
drawDay(QChartView *chart, const QChart::ChartTheme &theme, const QString &web_server, const QString &from_year, const QString &from_month, const QString &from_day, const QString &to_year, const QString &to_month, const QString &to_day, const QString &field, const QString &filter) constCrapview
drawRelat(QChartView *chart, const QChart::ChartTheme &theme, const QString &web_server, const QString &from_year, const QString &from_month, const QString &from_day, const QString &to_year, const QString &to_month, const QString &to_day, const QString &field_1, const QString &filter_1, const QString &field_2, const QString &filter_2) constCrapview
drawSpeed(QTableWidget *table, QChartView *chart, const QChart::ChartTheme &theme, const QString &web_server, const QString &year, const QString &month, const QString &day, const QString &protocol, const QString &method, const QString &uri, const QString &query, const QString &response) constCrapview
drawWarn(QTableWidget *table, QChartView *chart, const QChart::ChartTheme &theme, const QString &web_server, const QString &year, const QString &month, const QString &day, const QString &hour) constCrapview
getDays(const QString &web_server, const QString &year, const QString &month) constCrapview
getDialogsLevel() constCrapview
getFields(const std::string &tab) constCrapview
getHours() constCrapview
getLogFieldID(const QString &field_str) constCrapview
getLogFieldString(const size_t field_id) constCrapview
getMonthNumber(const QString &month_str) constCrapview
getMonths(const QString &web_server, const QString &year) constCrapview
getYears(const QString &web_server) constCrapview
refreshDates()Crapview
setDbPath(const std::string &path)Crapview
setDialogsLevel(const int new_level)Crapview
updateWarn(QTableWidget *table, const QString &web_server) constCrapview
calcGlobals(std::vector< std::tuple< QString, QString > > &recur_list, std::vector< std::tuple< QString, QString > > &traffic_list, std::vector< std::tuple< QString, QString > > &perf_list, std::vector< QString > &work_list, const QString web_server) constCrapview
clearDates() noexceptCrapview
drawCount(QTableWidget *table, QChartView *chart, const QChart::ChartTheme &theme, const QString web_server, const QString year, const QString month, const QString day, const QString field) constCrapview
drawDay(QChartView *chart, const QChart::ChartTheme &theme, const QString web_server, const QString from_year, const QString from_month, const QString from_day, const QString to_year, const QString to_month, const QString to_day, const QString field_str, const LogField field, const QString filter) constCrapview
drawRelat(QChartView *chart, const QChart::ChartTheme &theme, const QString web_server, const QString from_year, const QString from_month, const QString from_day, const QString to_year, const QString to_month, const QString to_day, const QString field_1_str, const LogField field_1, const QString filter_1, const QString field_2_str, const LogField field_2, const QString filter_2) constCrapview
drawSpeed(QTableWidget *table, QChartView *chart, const QChart::ChartTheme &theme, const QString web_server, const QString year, const QString month, const QString day, const QString protocol, const QString method, const QString uri, const QString query, const QString response) constCrapview
drawWarn(QTableWidget *table, QChartView *chart, const QChart::ChartTheme &theme, const QString web_server, const QString year, const QString month, const QString day, const QString hour, const Warnlist &warnlist) constCrapview
getDays(const QString &web_server, const QString &year, const QString &month) const noexceptCrapview
getDialogsLevel() const noexceptCrapview
getHours() const noexceptCrapview
getMonthNumber(const QString &month_str) const noexceptCrapview
getMonths(const QString &web_server, const QString &year) const noexceptCrapview
getSpeedHeaderColumns() const noexceptCrapview
getWarnHeaderColumns() const noexceptCrapview
getYears(const QString &web_server) const noexceptCrapview
refreshDates()Crapview
setDbPath(const std::string &path) noexceptCrapview
setDialogsLevel(const DialogsLevel new_level) noexceptCrapview
diff --git a/docs/html/classCrapview.html b/docs/html/classCrapview.html index 8fbf6bd4..5a9ae25b 100644 --- a/docs/html/classCrapview.html +++ b/docs/html/classCrapview.html @@ -3,12 +3,14 @@ - + LogDoctor: Crapview Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,12 +76,12 @@ $(function() {
Public Member Functions | List of all members
-
Crapview Class Reference
+
Crapview Class Referencefinal

Crapview. - More...

+ More...

#include <crapview.h>

@@ -91,77 +93,71 @@ Inheritance diagram for Crapview:
- - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

-int getDialogsLevel () const
 Returns the Dialogs level.
 
-void setDialogsLevel (const int new_level)
 Sets the new Dialogs level.
 
void setDbPath (const std::string &path)
 Sets the new path for the logs Collection database.
 
QString getLogFieldString (const size_t field_id) const
 Returns the printable log field corresponding to the given ID.
 
int getLogFieldID (const QString &field_str) const
 Returns the log field ID corresponding to the given printable field.
 
int getMonthNumber (const QString &month_str) const
 Returns the month number corresponding to the given printable month.
 
+DialogsLevel getDialogsLevel () const noexcept
 Returns the Dialogs level.
 
+void setDialogsLevel (const DialogsLevel new_level) noexcept
 Sets the new Dialogs level.
 
void setDbPath (const std::string &path) noexcept
 Sets the new path for the logs Collection database.
 
int getMonthNumber (const QString &month_str) const noexcept
 Returns the month number corresponding to the given printable month.
 
void refreshDates ()
 Refreshes the list of the dates which are available in the database.
 
-void clearDates ()
 Erases the list of available dates.
 
QStringList getYears (const QString &web_server) const
 Returns le list of available years, for the given web server.
 
QStringList getMonths (const QString &web_server, const QString &year) const
 Returns le list of available months in the given year, for the given web server.
 
QStringList getDays (const QString &web_server, const QString &year, const QString &month) const
 Returns le list of available days in the given month and year, for the given web server.
 
QStringList getHours () const
 Returns all the hours of the day.
 
QStringList getFields (const std::string &tab) const
 Returns a list of the fields for the given tab.
 
void updateWarn (QTableWidget *table, const QString &web_server) const
 Updates the database applying the changes which have been made to the table.
 
void drawWarn (QTableWidget *table, QChartView *chart, const QChart::ChartTheme &theme, const QString &web_server, const QString &year, const QString &month, const QString &day, const QString &hour) const
 Draws the chart and fills the table for the Warnings stats.
 
void drawSpeed (QTableWidget *table, QChartView *chart, const QChart::ChartTheme &theme, const QString &web_server, const QString &year, const QString &month, const QString &day, const QString &protocol, const QString &method, const QString &uri, const QString &query, const QString &response) const
 Draws the chart and fills the table for the Speed stats.
 
void drawCount (QTableWidget *table, QChartView *chart, const QChart::ChartTheme &theme, const QString &web_server, const QString &year, const QString &month, const QString &day, const QString &field) const
 Draws the chart and fills the table for the Counts stats.
 
void drawDay (QChartView *chart, const QChart::ChartTheme &theme, const QString &web_server, const QString &from_year, const QString &from_month, const QString &from_day, const QString &to_year, const QString &to_month, const QString &to_day, const QString &field, const QString &filter) const
 Draws the chart for the Daytime stats.
 
void drawRelat (QChartView *chart, const QChart::ChartTheme &theme, const QString &web_server, const QString &from_year, const QString &from_month, const QString &from_day, const QString &to_year, const QString &to_month, const QString &to_day, const QString &field_1, const QString &filter_1, const QString &field_2, const QString &filter_2) const
 Draws the chart for the Relational stats.
 
bool calcGlobals (std::vector< std::tuple< QString, QString > > &recur_list, std::vector< std::tuple< QString, QString > > &traffic_list, std::vector< std::tuple< QString, QString > > &perf_list, std::vector< QString > &work_list, const QString &web_server) const
 Retrieves the data to fill the Globals stats.
 
+void clearDates () noexcept
 Erases the list of available dates.
 
QStringList getYears (const QString &web_server) const noexcept
 Returns le list of available years, for the given web server.
 
QStringList getMonths (const QString &web_server, const QString &year) const noexcept
 Returns le list of available months in the given year, for the given web server.
 
QStringList getDays (const QString &web_server, const QString &year, const QString &month) const noexcept
 Returns le list of available days in the given month and year, for the given web server.
 
QStringList getHours () const noexcept
 Returns all the hours of the day.
 
QStringList getWarnHeaderColumns () const noexcept
 Returns a list of the translated columns.
 
QStringList getSpeedHeaderColumns () const noexcept
 Returns a list of the translated columns.
 
void drawWarn (QTableWidget *table, QChartView *chart, const QChart::ChartTheme &theme, const QString web_server, const QString year, const QString month, const QString day, const QString hour, const Warnlist &warnlist) const
 Draws the chart and fills the table for the Warnings stats.
 
void drawSpeed (QTableWidget *table, QChartView *chart, const QChart::ChartTheme &theme, const QString web_server, const QString year, const QString month, const QString day, const QString protocol, const QString method, const QString uri, const QString query, const QString response) const
 Draws the chart and fills the table for the Speed stats.
 
void drawCount (QTableWidget *table, QChartView *chart, const QChart::ChartTheme &theme, const QString web_server, const QString year, const QString month, const QString day, const QString field) const
 Draws the chart and fills the table for the Counts stats.
 
void drawDay (QChartView *chart, const QChart::ChartTheme &theme, const QString web_server, const QString from_year, const QString from_month, const QString from_day, const QString to_year, const QString to_month, const QString to_day, const QString field_str, const LogField field, const QString filter) const
 Draws the chart for the Daytime stats.
 
void drawRelat (QChartView *chart, const QChart::ChartTheme &theme, const QString web_server, const QString from_year, const QString from_month, const QString from_day, const QString to_year, const QString to_month, const QString to_day, const QString field_1_str, const LogField field_1, const QString filter_1, const QString field_2_str, const LogField field_2, const QString filter_2) const
 Draws the chart for the Relational stats.
 
bool calcGlobals (std::vector< std::tuple< QString, QString > > &recur_list, std::vector< std::tuple< QString, QString > > &traffic_list, std::vector< std::tuple< QString, QString > > &perf_list, std::vector< QString > &work_list, const QString web_server) const
 Retrieves the data to fill the Globals stats.
 

Detailed Description

Crapview.

Performs operations related to the visualization of the statistics

Member Function Documentation

- -

◆ calcGlobals()

+ +

◆ calcGlobals()

@@ -169,37 +165,27 @@ void clearDates () bool Crapview::calcGlobals ( - std::vector< std::tuple< QString, QString > > &  - recur_list, + std::vector< std::tuple< QString, QString > > & recur_list, - std::vector< std::tuple< QString, QString > > &  - traffic_list, + std::vector< std::tuple< QString, QString > > & traffic_list, - std::vector< std::tuple< QString, QString > > &  - perf_list, + std::vector< std::tuple< QString, QString > > & perf_list, - std::vector< QString > &  - work_list, + std::vector< QString > & work_list, - const QString &  - web_server  - - - - ) - const + const QString web_server ) const
@@ -219,8 +205,8 @@ void clearDates ()
- -

◆ drawCount()

+ +

◆ drawCount()

@@ -228,55 +214,42 @@ void clearDates () void Crapview::drawCount ( - QTableWidget *  - table, + QTableWidget * table, - QChartView *  - chart, + QChartView * chart, - const QChart::ChartTheme &  - theme, + const QChart::ChartTheme & theme, - const QString &  - web_server, + const QString web_server, - const QString &  - year, + const QString year, - const QString &  - month, + const QString month, - const QString &  - day, + const QString day, - const QString &  - field  - - - - ) - const + const QString field ) const
@@ -298,8 +271,8 @@ void clearDates ()
- -

◆ drawDay()

+ +

◆ drawDay()

@@ -307,73 +280,62 @@ void clearDates () void Crapview::drawDay ( - QChartView *  - chart, + QChartView * chart, - const QChart::ChartTheme &  - theme, + const QChart::ChartTheme & theme, - const QString &  - web_server, + const QString web_server, - const QString &  - from_year, + const QString from_year, - const QString &  - from_month, + const QString from_month, - const QString &  - from_day, + const QString from_day, - const QString &  - to_year, + const QString to_year, - const QString &  - to_month, + const QString to_month, - const QString &  - to_day, + const QString to_day, - const QString &  - field, + const QString field_str, - const QString &  - filter  + const LogField field, + - ) - const + const QString filter ) const
@@ -398,8 +360,8 @@ void clearDates ()
- -

◆ drawRelat()

+ +

◆ drawRelat()

@@ -407,85 +369,77 @@ void clearDates () void Crapview::drawRelat ( - QChartView *  - chart, + QChartView * chart, - const QChart::ChartTheme &  - theme, + const QChart::ChartTheme & theme, - const QString &  - web_server, + const QString web_server, - const QString &  - from_year, + const QString from_year, - const QString &  - from_month, + const QString from_month, - const QString &  - from_day, + const QString from_day, - const QString &  - to_year, + const QString to_year, - const QString &  - to_month, + const QString to_month, - const QString &  - to_day, + const QString to_day, - const QString &  - field_1, + const QString field_1_str, - const QString &  - filter_1, + const LogField field_1, - const QString &  - field_2, + const QString filter_1, - const QString &  - filter_2  + const QString field_2_str, + - ) - const + const LogField field_2, + + + + + const QString filter_2 ) const
@@ -512,8 +466,8 @@ void clearDates ()
- -

◆ drawSpeed()

+ +

◆ drawSpeed()

@@ -521,79 +475,62 @@ void clearDates () void Crapview::drawSpeed ( - QTableWidget *  - table, + QTableWidget * table, - QChartView *  - chart, + QChartView * chart, - const QChart::ChartTheme &  - theme, + const QChart::ChartTheme & theme, - const QString &  - web_server, + const QString web_server, - const QString &  - year, + const QString year, - const QString &  - month, + const QString month, - const QString &  - day, + const QString day, - const QString &  - protocol, + const QString protocol, - const QString &  - method, + const QString method, - const QString &  - uri, + const QString uri, - const QString &  - query, + const QString query, - const QString &  - response  - - - - ) - const + const QString response ) const
@@ -619,8 +556,8 @@ void clearDates ()
- -

◆ drawWarn()

+ +

◆ drawWarn()

@@ -628,55 +565,47 @@ void clearDates () void Crapview::drawWarn ( - QTableWidget *  - table, + QTableWidget * table, - QChartView *  - chart, + QChartView * chart, - const QChart::ChartTheme &  - theme, + const QChart::ChartTheme & theme, - const QString &  - web_server, + const QString web_server, - const QString &  - year, + const QString year, - const QString &  - month, + const QString month, - const QString &  - day, + const QString day, - const QString &  - hour  + const QString hour, + - ) - const + const Warnlist & warnlist ) const
@@ -692,42 +621,43 @@ void clearDates ()monthThe printable month name dayThe day houtThe hour + warnlistThe warnlists to check against
- -

◆ getDays()

+ +

◆ getDays()

+ + + + + +
- - + - - + - - - - - - - +
QStringList Crapview::getDays (const QString & web_server, const QString & web_server,
const QString & year, const QString & year,
const QString & month 
) constconst QString & month ) const
+
+noexcept

Returns le list of available days in the given month and year, for the given web server.

@@ -743,46 +673,27 @@ void clearDates ()
- -

◆ getFields()

- -
-
- - - - - - - - -
QStringList Crapview::getFields (const std::string & tab) const
-
- -

Returns a list of the fields for the given tab.

-
Parameters
- - -
tabThe stats tab
-
-
-
Returns
The list of fields
- -
-
- -

◆ getHours()

+ +

◆ getHours()

+ + + + + +
- +
QStringList Crapview::getHours ()) const
+
+noexcept

Returns all the hours of the day.

@@ -790,74 +701,27 @@ void clearDates ()
- -

◆ getLogFieldID()

- -
-
- - - - - - - - -
int Crapview::getLogFieldID (const QString & field_str) const
-
- -

Returns the log field ID corresponding to the given printable field.

-
Parameters
- - -
field_strThe log field
-
-
-
Returns
The ID of the log field
- -
-
- -

◆ getLogFieldString()

- -
-
- - - - - - - - -
QString Crapview::getLogFieldString (const size_t field_id) const
-
- -

Returns the printable log field corresponding to the given ID.

-

The field gets translated to be printable before being returned

Parameters
- - -
field_idThe ID of the log fiels
-
-
-
Returns
The printable field
- -
-
- -

◆ getMonthNumber()

+ +

◆ getMonthNumber()

+ + + + + +
- - +
int Crapview::getMonthNumber (const QString & month_str)const QString & month_str) const
+
+noexcept

Returns the month number corresponding to the given printable month.

@@ -871,30 +735,31 @@ void clearDates ()
- -

◆ getMonths()

+ +

◆ getMonths()

+ + + + + +
- - + - - - - - - - +
QStringList Crapview::getMonths (const QString & web_server, const QString & web_server,
const QString & year 
) constconst QString & year ) const
+
+noexcept

Returns le list of available months in the given year, for the given web server.

@@ -909,20 +774,83 @@ void clearDates ()
- -

◆ getYears()

+ +

◆ getSpeedHeaderColumns()

+ + + + + +
+ + + + + + + +
QStringList Crapview::getSpeedHeaderColumns () const
+
+noexcept
+
+ +

Returns a list of the translated columns.

+

To be inserted in a header

Returns
The list of fields
+ +
+
+ +

◆ getWarnHeaderColumns()

+ +
+
+ + + + + +
+ + + + + + + +
QStringList Crapview::getWarnHeaderColumns () const
+
+noexcept
+
+ +

Returns a list of the translated columns.

+

To be inserted in a header

Returns
The list of fields
+ +
+
+ +

◆ getYears()

+ +
+
+ + + + + +
- - +
QStringList Crapview::getYears (const QString & web_server)const QString & web_server) const
+
+noexcept

Returns le list of available years, for the given web server.

@@ -936,61 +864,31 @@ void clearDates ()
- -

◆ setDbPath()

+ +

◆ setDbPath()

+ + + + + +
- - +
void Crapview::setDbPath (const std::string & path)const std::string & path)
+
+noexcept

Sets the new path for the logs Collection database.

-
See also
DbQuery::setDbPath()
- -
-
- -

◆ updateWarn()

- -
-
- - - - - - - - - - - - - - - - - - -
void Crapview::updateWarn (QTableWidget * table,
const QString & web_server 
) const
-
- -

Updates the database applying the changes which have been made to the table.

-
Parameters
- - - -
tableThe Warnings stats table
web_serverThe printable Web Server name
-
-
+
See also
DbQuery::setDbPath()
@@ -1001,7 +899,7 @@ void clearDates () diff --git a/docs/html/classCrapview.png b/docs/html/classCrapview.png index a8d71899..e0206f9f 100644 Binary files a/docs/html/classCrapview.png and b/docs/html/classCrapview.png differ diff --git a/docs/html/classCrissCross-members.html b/docs/html/classCrissCross-members.html index 611438ca..747ffa8a 100644 --- a/docs/html/classCrissCross-members.html +++ b/docs/html/classCrissCross-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -77,19 +79,19 @@ $(function() {

This is the complete list of members for CrissCross, including all inherited members.

- - - - - + + + + + - + - +
AI_makeChoice() constCrissCrossprivate
AI_playTurn()CrissCrossprivate
AI_updateWeights()CrissCrossprivate
checkVictory()CrissCrossprivate
draw()CrissCrossprivate
AI_makeChoice() const noexceptCrissCrossprivate
AI_playTurn() noexceptCrissCrossprivate
AI_updateWeights() noexceptCrissCrossprivate
checkVictory() noexceptCrissCrossprivate
draw() noexceptCrissCrossprivate
endTurn()CrissCrossprivate
gameDraw() constCrissCrossprivate
gameDraw() const noexceptCrissCrossprivate
nextTurn()CrissCrossprivate
victory()CrissCrossprivate
victory() noexceptCrissCrossprivate
diff --git a/docs/html/classCrissCross.html b/docs/html/classCrissCross.html index 2db6b6fa..c638e520 100644 --- a/docs/html/classCrissCross.html +++ b/docs/html/classCrissCross.html @@ -3,12 +3,14 @@ - + LogDoctor: CrissCross Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,12 +76,12 @@ $(function() { -
CrissCross Class Reference
+
CrissCross Class Referencefinal

CrissCross. - More...

+ More...

#include <game.h>

@@ -99,39 +101,39 @@ void endTurn ()nextTurn ()  Switches to the next turn.
  - -bool checkVictory () - Checks whether somebody won or not.
-  - -bool gameDraw () const - Checks whether the game is draw or not.
-  - -void victory () - Someone won, process the victory.
-  - -void draw () - The match is over but nobody won, the game is draw.
-  - -void AI_playTurn () - Main function for the AI to play its turn.
-  -void AI_updateWeights () - Updates the weights of the tiles.
-  -unsigned AI_makeChoice () const - Makes the choice depending on the weights.
-  + +bool checkVictory () noexcept + Checks whether somebody won or not.
+  + +bool gameDraw () const noexcept + Checks whether the game is draw or not.
+  + +void victory () noexcept + Someone won, process the victory.
+  + +void draw () noexcept + The match is over but nobody won, the game is draw.
+  + +void AI_playTurn () noexcept + Main function for the AI to play its turn.
+  +void AI_updateWeights () noexcept + Updates the weights of the tiles.
+  +unsigned AI_makeChoice () const noexcept + Makes the choice depending on the weights.

Detailed Description

CrissCross.

Player vs AI criss-cross game

Member Function Documentation

- -

◆ AI_makeChoice()

+ +

◆ AI_makeChoice()

@@ -142,25 +144,25 @@ void AI_playTurn () unsigned CrissCross::AI_makeChoice ( - ) + ) const -private +privatenoexcept

Makes the choice depending on the weights.

Returns
The tile to select
-
See also
AI_playTurn();
+
See also
AI_playTurn();
- -

◆ AI_updateWeights()

+ +

◆ AI_updateWeights()

@@ -171,19 +173,19 @@ void AI_playTurn () void CrissCross::AI_updateWeights ( - ) + ) -private +privatenoexcept

Updates the weights of the tiles.

-
See also
AI_playTurn();
+
See also
AI_playTurn();
@@ -194,7 +196,7 @@ void AI_playTurn () diff --git a/docs/html/classCrissCross.png b/docs/html/classCrissCross.png index f36f39ab..bda5a68f 100644 Binary files a/docs/html/classCrissCross.png and b/docs/html/classCrissCross.png differ diff --git a/docs/html/classDatabaseException-members.html b/docs/html/classDatabaseException-members.html new file mode 100644 index 00000000..f14b663d --- /dev/null +++ b/docs/html/classDatabaseException-members.html @@ -0,0 +1,87 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+
DatabaseException Member List
+
+
+ +

This is the complete list of members for DatabaseException, including all inherited members.

+
+ + + + diff --git a/docs/html/classDatabaseException.html b/docs/html/classDatabaseException.html new file mode 100644 index 00000000..4ad7261b --- /dev/null +++ b/docs/html/classDatabaseException.html @@ -0,0 +1,108 @@ + + + + + + + +LogDoctor: DatabaseException Class Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+ +
DatabaseException Class Referencefinal
+
+
+ +

DatabaseException. + More...

+ +

#include <exceptions.h>

+
+Inheritance diagram for DatabaseException:
+
+
+ + +LogDoctorException + +
+

Detailed Description

+

DatabaseException.

+

Exception related to the database

+

The documentation for this class was generated from the following files:
    +
  • logdoctor/modules/exceptions.h
  • +
  • logdoctor/modules/exceptions.cpp
  • +
+
+ + + + diff --git a/docs/html/classDatabaseException.png b/docs/html/classDatabaseException.png new file mode 100644 index 00000000..6026ba07 Binary files /dev/null and b/docs/html/classDatabaseException.png differ diff --git a/docs/html/classDatabaseWrapper-members.html b/docs/html/classDatabaseWrapper-members.html new file mode 100644 index 00000000..6f2f3cf5 --- /dev/null +++ b/docs/html/classDatabaseWrapper-members.html @@ -0,0 +1,97 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+
DatabaseWrapper Member List
+
+
+ +

This is the complete list of members for DatabaseWrapper, including all inherited members.

+ + + + + + + + + + +
commitTransaction(const bool explain_msg, const bool explain_err)DatabaseWrapper
getQuery() noexceptDatabaseWrapper
name() const noexceptDatabaseWrapperinline
open(const std::string &path, const bool explain_err)DatabaseWrapper
openNew(const std::string &path)DatabaseWrapper
operator*() noexceptDatabaseWrapperinline
operator->() noexceptDatabaseWrapperinline
rollbackTransaction(const bool explain_msg, const bool explain_err)DatabaseWrapper
startTransaction(const bool explain_msg, const bool explain_err)DatabaseWrapper
+ + + + diff --git a/docs/html/classDatabaseWrapper.html b/docs/html/classDatabaseWrapper.html new file mode 100644 index 00000000..23b904ff --- /dev/null +++ b/docs/html/classDatabaseWrapper.html @@ -0,0 +1,277 @@ + + + + + + + +LogDoctor: DatabaseWrapper Class Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+ +
DatabaseWrapper Class Referencefinal
+
+
+ +

DatabaseWrapper. + More...

+ +

#include <database.h>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

+QSqlDatabase * operator-> () noexcept
 Returns a pointer to the underlying QSqlDatabase instance.
 
+QSqlDatabase & operator* () noexcept
 Returns a reference to the underlying QSqlDatabase instance.
 
+const QString & name () const noexcept
 Returns the name of the database.
 
void open (const std::string &path, const bool explain_err)
 Opens the database file at the given path.
 
void openNew (const std::string &path)
 Opens the database file at the given path.
 
void startTransaction (const bool explain_msg, const bool explain_err)
 Starts an ACID transaction on the database.
 
void commitTransaction (const bool explain_msg, const bool explain_err)
 Commits an ongoing transaction.
 
void rollbackTransaction (const bool explain_msg, const bool explain_err)
 Rolls back an ongoing transaction.
 
+QueryWrapper getQuery () noexcept
 Returns an instance of a QueryWrapper associated with the database.
 
+

Detailed Description

+

DatabaseWrapper.

+

A wrapper around a QSqlDatabase

+

Member Function Documentation

+ +

◆ commitTransaction()

+ +
+
+ + + + + + + + + + + +
void DatabaseWrapper::commitTransaction (const bool explain_msg,
const bool explain_err )
+
+ +

Commits an ongoing transaction.

+

Throws in case of failure

Exceptions
+ + +
VoidException
+
+
+ +
+
+ +

◆ open()

+ +
+
+ + + + + + + + + + + +
void DatabaseWrapper::open (const std::string & path,
const bool explain_err )
+
+ +

Opens the database file at the given path.

+

Throws if the file cannot be opened or if opening fails

Exceptions
+ + +
VoidException
+
+
+ +
+
+ +

◆ openNew()

+ +
+
+ + + + + + + +
void DatabaseWrapper::openNew (const std::string & path)
+
+ +

Opens the database file at the given path.

+

Used when creating a new database file. Throws if opening fails.

Exceptions
+ + +
VoidException
+
+
+ +
+
+ +

◆ rollbackTransaction()

+ +
+
+ + + + + + + + + + + +
void DatabaseWrapper::rollbackTransaction (const bool explain_msg,
const bool explain_err )
+
+ +

Rolls back an ongoing transaction.

+

Throws in case of failure

Exceptions
+ + +
VoidException
+
+
+ +
+
+ +

◆ startTransaction()

+ +
+
+ + + + + + + + + + + +
void DatabaseWrapper::startTransaction (const bool explain_msg,
const bool explain_err )
+
+ +

Starts an ACID transaction on the database.

+

Throws in case of failure

Exceptions
+ + +
VoidException
+
+
+ +
+
+
The documentation for this class was generated from the following files:
    +
  • logdoctor/modules/database/database.h
  • +
  • logdoctor/modules/database/database.cpp
  • +
+
+ + + + diff --git a/docs/html/classDateTimeException-members.html b/docs/html/classDateTimeException-members.html index f9a05b2c..945389b6 100644 --- a/docs/html/classDateTimeException-members.html +++ b/docs/html/classDateTimeException-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -79,7 +81,7 @@ $(function() {
diff --git a/docs/html/classDateTimeException.html b/docs/html/classDateTimeException.html index a08a67b5..7b773415 100644 --- a/docs/html/classDateTimeException.html +++ b/docs/html/classDateTimeException.html @@ -3,12 +3,14 @@ - + LogDoctor: DateTimeException Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -73,20 +75,23 @@ $(function() {
-
DateTimeException Class Reference
+
DateTimeException Class Referencefinal

DateTimeException. - More...

+ More...

#include <exceptions.h>

Inheritance diagram for DateTimeException:
- -
+ + +LogDoctorException + +

Detailed Description

DateTimeException.

Exception related to a date/time

@@ -97,7 +102,7 @@ Inheritance diagram for DateTimeException:
diff --git a/docs/html/classDateTimeException.png b/docs/html/classDateTimeException.png index 8fc51ac7..59d7bcb7 100644 Binary files a/docs/html/classDateTimeException.png and b/docs/html/classDateTimeException.png differ diff --git a/docs/html/classDaytimeLogFieldsListModel-members.html b/docs/html/classDaytimeLogFieldsListModel-members.html new file mode 100644 index 00000000..d4e76c03 --- /dev/null +++ b/docs/html/classDaytimeLogFieldsListModel-members.html @@ -0,0 +1,87 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+
DaytimeLogFieldsListModel Member List
+
+
+ +

This is the complete list of members for DaytimeLogFieldsListModel, including all inherited members.

+
+ + + + diff --git a/docs/html/classCraplogParserInterface.html b/docs/html/classDaytimeLogFieldsListModel.html similarity index 74% rename from docs/html/classCraplogParserInterface.html rename to docs/html/classDaytimeLogFieldsListModel.html index 8ad3bbdd..714110c4 100644 --- a/docs/html/classCraplogParserInterface.html +++ b/docs/html/classDaytimeLogFieldsListModel.html @@ -3,12 +3,14 @@ - + -LogDoctor: CraplogParserInterface Class Reference +LogDoctor: DaytimeLogFieldsListModel Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -72,28 +74,27 @@ $(function() {
-
CraplogParserInterface Class Referenceabstract
+List of all members
+
DaytimeLogFieldsListModel Class Referencefinal
-Inheritance diagram for CraplogParserInterface:
+Inheritance diagram for DaytimeLogFieldsListModel:
- - -CraplogParser -CraplogParserAsync + + +LogFieldsListModel

The documentation for this class was generated from the following files:
    -
  • logdoctor/modules/craplog/modules/workers/parser_interface.h
  • -
  • logdoctor/modules/craplog/modules/workers/parser_interface.cpp
  • +
  • logdoctor/customs/models/logfields_listmodel.h
  • +
  • logdoctor/customs/models/logfields_listmodel.cpp
diff --git a/docs/html/classDaytimeLogFieldsListModel.png b/docs/html/classDaytimeLogFieldsListModel.png new file mode 100644 index 00000000..5df4a849 Binary files /dev/null and b/docs/html/classDaytimeLogFieldsListModel.png differ diff --git a/docs/html/classDbQuery-members.html b/docs/html/classDbQuery-members.html index d33a82f1..d7dd51fa 100644 --- a/docs/html/classDbQuery-members.html +++ b/docs/html/classDbQuery-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -78,26 +80,26 @@ $(function() {

This is the complete list of members for DbQuery, including all inherited members.

- - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + +
countDays(const int from_year, const int from_month, const int from_day, const int to_year, const int to_month, const int to_day)DbQueryprivatestatic
countMonths(const int from_year, const int from_month, const int to_year, const int to_month)DbQueryprivatestatic
getDaytimeCounts(std::optional< stats_day_items_t > &result, const QString &web_server, const QString &from_year_, const QString &from_month_, const QString &from_day_, const QString &to_year_, const QString &to_month_, const QString &to_day_, const QString &log_field_, const QString &field_filter) constDbQuery
getDbField(const QString &tr_fld) constDbQueryprivate
getGlobalCounts(const QString &web_server, const std::map< int, std::map< int, std::vector< int > > > &dates, std::vector< std::unordered_map< QString, unsigned > > &recurs, std::tuple< QString, int > &traf_date, std::unordered_map< int, double > &traf_day, std::unordered_map< int, double > &traf_hour, std::vector< long long > &perf_time, std::vector< long long > &perf_sent, std::vector< long long > &perf_receiv, long &req_count) constDbQuery
getItemsCount(std::optional< stats_count_items_t > &result, const QString &web_server, const QString &year, const QString &month, const QString &day, const QString &log_field) constDbQuery
getMinuteGap(const int minute, const int gap=10)DbQueryprivatestatic
getMonthDays(const int year, const int month)DbQueryprivatestatic
getMonthNumber(const QString &month_str) constDbQueryprivate
getRelationalCountsDay(std::optional< stats_relat_items_t > &result, const QString &web_server, const QString &year_, const QString &month_, const QString &day_, const QString &log_field_1_, const QString &field_filter_1, const QString &log_field_2_, const QString &field_filter_2) constDbQuery
getRelationalCountsPeriod(std::optional< stats_relat_items_t > &result, const QString &web_server, const QString &from_year_, const QString &from_month_, const QString &from_day_, const QString &to_year_, const QString &to_month_, const QString &to_day_, const QString &log_field_1_, const QString &field_filter_1, const QString &log_field_2_, const QString &field_filter_2) constDbQuery
getSpeedData(std::optional< stats_speed_items_t > &result, const QString &web_server, const QString &year_, const QString &month_, const QString &day_, const QString &protocol_f, const QString &method_f, const QString &uri_f, const QString &query_f, const QString &response_f) constDbQuery
getWarnCounts(std::optional< stats_warn_items_t > &result, const QString &web_server, const QString &year_, const QString &month_, const QString &day_, const QString &hour_) constDbQuery
refreshDates(std::optional< stats_dates_t > &result)DbQuery
setDbPath(const std::string &path)DbQuery
setDialogLevel(const int new_level)DbQuery
updateWarnings(const QString &web_server, const std::vector< std::tuple< int, int > > &updates) constDbQuery
countMonths(const int from_year, const int from_month, const int to_year, const int to_month) noexceptDbQueryprivatestatic
getDaytimeCounts(std::optional< stats_day_items_t > &result, QStringView web_server, QStringView from_year_, QStringView from_month_, QStringView from_day_, QStringView to_year_, QStringView to_month_, QStringView to_day_, const LogField log_field_, QStringView field_filter) constDbQuery
getDbField(const LogField fld) constDbQueryprivate
getDbField(QStringView tr_fld) constDbQueryprivate
getGlobalCounts(std::optional< GlobalsData > &result, QStringView web_server, const stats_dates_t &dates) constDbQuery
getItemsCount(std::optional< stats_count_items_t > &result, QStringView web_server, QStringView year, QStringView month, QStringView day, QStringView log_field) constDbQuery
getMinuteGap(const int minute, const int gap=10)DbQueryprivatestatic
getMonthDays(const int year, const int month)DbQueryprivatestatic
getMonthNumber(QStringView month_str) constDbQueryprivate
getRelationalCountsDay(std::optional< stats_relat_items_t > &result, QStringView web_server, QStringView year_, QStringView month_, QStringView day_, const LogField log_field_1_, QStringView field_filter_1, const LogField log_field_2_, QStringView field_filter_2) constDbQuery
getRelationalCountsPeriod(std::optional< stats_relat_items_t > &result, QStringView web_server, QStringView from_year_, QStringView from_month_, QStringView from_day_, QStringView to_year_, QStringView to_month_, QStringView to_day_, const LogField log_field_1_, QStringView field_filter_1, const LogField log_field_2_, QStringView field_filter_2) constDbQuery
getSpeedData(std::optional< stats_speed_items_t > &result, QStringView web_server, QStringView year_, QStringView month_, QStringView day_, QStringView protocol_f, QStringView method_f, QStringView uri_f, QStringView query_f, QStringView response_f) constDbQuery
getWarningsData(std::optional< stats_warn_items_t > &result, QStringView web_server, QStringView year_, QStringView month_, QStringView day_, QStringView hour_) constDbQuery
refreshDates(std::optional< database_dates_t > &result) noexceptDbQuery
setDbPath(std::string &&path) noexceptDbQuery
setDialogLevel(const DialogsLevel new_level) noexceptDbQuery
diff --git a/docs/html/classDbQuery.html b/docs/html/classDbQuery.html index 7a85ff01..b363631e 100644 --- a/docs/html/classDbQuery.html +++ b/docs/html/classDbQuery.html @@ -3,12 +3,14 @@ - + LogDoctor: DbQuery Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -76,70 +78,70 @@ $(function() { Private Member Functions | Static Private Member Functions | List of all members
-
DbQuery Class Reference
+
DbQuery Class Referencefinal
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

-void setDialogLevel (const int new_level)
 Returns the Dialogs level.
 
void setDbPath (const std::string &path)
 Sets the path for the logs Collection database.
 
void refreshDates (std::optional< stats_dates_t > &result)
 Refreshes the dates which are available in the database.
 
void updateWarnings (const QString &web_server, const std::vector< std::tuple< int, int > > &updates) const
 Updates the database applying the changes made in the Warnings statistics table.
 
void getWarnCounts (std::optional< stats_warn_items_t > &result, const QString &web_server, const QString &year_, const QString &month_, const QString &day_, const QString &hour_) const
 Retrieves the data needed for the Warnings statistics.
 
void getSpeedData (std::optional< stats_speed_items_t > &result, const QString &web_server, const QString &year_, const QString &month_, const QString &day_, const QString &protocol_f, const QString &method_f, const QString &uri_f, const QString &query_f, const QString &response_f) const
 Retrieves the data needed for the Speed statistics.
 
void getItemsCount (std::optional< stats_count_items_t > &result, const QString &web_server, const QString &year, const QString &month, const QString &day, const QString &log_field) const
 Retrieves the data needed for the Counts statistics.
 
void getDaytimeCounts (std::optional< stats_day_items_t > &result, const QString &web_server, const QString &from_year_, const QString &from_month_, const QString &from_day_, const QString &to_year_, const QString &to_month_, const QString &to_day_, const QString &log_field_, const QString &field_filter) const
 Retrieves the data needed for the Daytime statistics.
 
void getRelationalCountsDay (std::optional< stats_relat_items_t > &result, const QString &web_server, const QString &year_, const QString &month_, const QString &day_, const QString &log_field_1_, const QString &field_filter_1, const QString &log_field_2_, const QString &field_filter_2) const
 Retrieves the data needed for the Relationsl statistics.
 
void getRelationalCountsPeriod (std::optional< stats_relat_items_t > &result, const QString &web_server, const QString &from_year_, const QString &from_month_, const QString &from_day_, const QString &to_year_, const QString &to_month_, const QString &to_day_, const QString &log_field_1_, const QString &field_filter_1, const QString &log_field_2_, const QString &field_filter_2) const
 Retrieves the data needed for the Relational statistics.
 
bool getGlobalCounts (const QString &web_server, const std::map< int, std::map< int, std::vector< int > > > &dates, std::vector< std::unordered_map< QString, unsigned > > &recurs, std::tuple< QString, int > &traf_date, std::unordered_map< int, double > &traf_day, std::unordered_map< int, double > &traf_hour, std::vector< long long > &perf_time, std::vector< long long > &perf_sent, std::vector< long long > &perf_receiv, long &req_count) const
 Retrieves the data needed for the Global statistics.
 
+void setDialogLevel (const DialogsLevel new_level) noexcept
 Returns the Dialogs level.
 
void setDbPath (std::string &&path) noexcept
 Sets the path for the logs Collection database.
 
void refreshDates (std::optional< database_dates_t > &result) noexcept
 Refreshes the dates which are available in the database.
 
void getWarningsData (std::optional< stats_warn_items_t > &result, QStringView web_server, QStringView year_, QStringView month_, QStringView day_, QStringView hour_) const
 Retrieves the data needed for the Warnings statistics.
 
void getSpeedData (std::optional< stats_speed_items_t > &result, QStringView web_server, QStringView year_, QStringView month_, QStringView day_, QStringView protocol_f, QStringView method_f, QStringView uri_f, QStringView query_f, QStringView response_f) const
 Retrieves the data needed for the Speed statistics.
 
void getItemsCount (std::optional< stats_count_items_t > &result, QStringView web_server, QStringView year, QStringView month, QStringView day, QStringView log_field) const
 Retrieves the data needed for the Counts statistics.
 
void getDaytimeCounts (std::optional< stats_day_items_t > &result, QStringView web_server, QStringView from_year_, QStringView from_month_, QStringView from_day_, QStringView to_year_, QStringView to_month_, QStringView to_day_, const LogField log_field_, QStringView field_filter) const
 Retrieves the data needed for the Daytime statistics.
 
void getRelationalCountsDay (std::optional< stats_relat_items_t > &result, QStringView web_server, QStringView year_, QStringView month_, QStringView day_, const LogField log_field_1_, QStringView field_filter_1, const LogField log_field_2_, QStringView field_filter_2) const
 Retrieves the data needed for the Relationsl statistics.
 
void getRelationalCountsPeriod (std::optional< stats_relat_items_t > &result, QStringView web_server, QStringView from_year_, QStringView from_month_, QStringView from_day_, QStringView to_year_, QStringView to_month_, QStringView to_day_, const LogField log_field_1_, QStringView field_filter_1, const LogField log_field_2_, QStringView field_filter_2) const
 Retrieves the data needed for the Relational statistics.
 
void getGlobalCounts (std::optional< GlobalsData > &result, QStringView web_server, const stats_dates_t &dates) const
 Retrieves the data needed for the Global statistics.
 
- - - - - - + + + + + + + + +

Private Member Functions

QString getDbField (const QString &tr_fld) const
 Returns the database field corresponding to the relative log field.
 
int getMonthNumber (const QString &month_str) const
 Returns the month number in the year.
 
const QString & getDbField (const LogField fld) const
 Returns the database field corresponding to the relative log field.
 
const QString & getDbField (QStringView tr_fld) const
 Returns the database field corresponding to the relative log field.
 
int getMonthNumber (QStringView month_str) const
 Returns the month number in the year.
 
- + - + - + - - - + + +

Static Private Member Functions

static int getMinuteGap (const int minute, const int gap=10)
static int getMinuteGap (const int minute, const int gap=10)
 Returns the minute gap for the given minute with the given gap.
 
static int getMonthDays (const int year, const int month)
static int getMonthDays (const int year, const int month)
 Returns the number of days for a given month.
 
static int countDays (const int from_year, const int from_month, const int from_day, const int to_year, const int to_month, const int to_day)
static int countDays (const int from_year, const int from_month, const int from_day, const int to_year, const int to_month, const int to_day)
 Returns the number of days in a given period.
 
static int countMonths (const int from_year, const int from_month, const int to_year, const int to_month)
 Returns the number of months in a given period.
 
static int countMonths (const int from_year, const int from_month, const int to_year, const int to_month) noexcept
 Returns the number of months in a given period.
 

Member Function Documentation

@@ -154,43 +156,32 @@ Static Private Member Functions int DbQuery::countDays ( - const int  - from_year, + const int from_year, - const int  - from_month, + const int from_month, - const int  - from_day, + const int from_day, - const int  - to_year, + const int to_year, - const int  - to_month, + const int to_month, - const int  - to_day  - - - - ) - + const int to_day ) @@ -222,8 +213,8 @@ Static Private Member Functions
- -

◆ countMonths()

+ +

◆ countMonths()

@@ -234,36 +225,27 @@ Static Private Member Functions int DbQuery::countMonths ( - const int  - from_year, + const int from_year, - const int  - from_month, + const int from_month, - const int  - to_year, + const int to_year, - const int  - to_month  - - - - ) - + const int to_month ) -staticprivate +staticprivatenoexcept
@@ -282,8 +264,8 @@ Static Private Member Functions
- -

◆ getDaytimeCounts()

+ +

◆ getDaytimeCounts()

@@ -291,67 +273,52 @@ Static Private Member Functions void DbQuery::getDaytimeCounts ( - std::optional< stats_day_items_t > &  - result, + std::optional< stats_day_items_t > & result, - const QString &  - web_server, + QStringView web_server, - const QString &  - from_year_, + QStringView from_year_, - const QString &  - from_month_, + QStringView from_month_, - const QString &  - from_day_, + QStringView from_day_, - const QString &  - to_year_, + QStringView to_year_, - const QString &  - to_month_, + QStringView to_month_, - const QString &  - to_day_, + QStringView to_day_, - const QString &  - log_field_, + const LogField log_field_, - const QString &  - field_filter  - - - - ) - const + QStringView field_filter ) const
@@ -372,11 +339,20 @@ Static Private Member Functions +
Exceptions
+ + + + + +
VoidException
CrapviewException
ConversionException
DateTimeException
+
+
- -

◆ getDbField()

+ +

◆ getDbField() [1/2]

@@ -385,10 +361,49 @@ Static Private Member Functions - + - - + + + +
QString DbQuery::getDbField const QString & DbQuery::getDbField (const QString & tr_fld)const LogField fld) const
+ + +private + + +
+ +

Returns the database field corresponding to the relative log field.

+
Parameters
+ + +
fldThe log field
+
+
+
Returns
The database field
+
Exceptions
+ + +
CrapviewException
+
+
+ +
+
+ +

◆ getDbField() [2/2]

+ +
+
+ + +
Returns
The database field
+
Exceptions
+
+ + + + +
const QString & DbQuery::getDbField (QStringView tr_fld) const
@@ -407,79 +422,35 @@ Static Private Member Functions
+ +
CrapviewException
+ +
- -

◆ getGlobalCounts()

+ +

◆ getGlobalCounts()

- + - - + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
bool DbQuery::getGlobalCounts void DbQuery::getGlobalCounts (const QString & web_server, std::optional< GlobalsData > & result,
const std::map< int, std::map< int, std::vector< int > > > & dates, QStringView web_server,
std::vector< std::unordered_map< QString, unsigned > > & recurs,
std::tuple< QString, int > & traf_date,
std::unordered_map< int, double > & traf_day,
std::unordered_map< int, double > & traf_hour,
std::vector< long long > & perf_time,
std::vector< long long > & perf_sent,
std::vector< long long > & perf_receiv,
long & req_count 
) constconst stats_dates_t & dates ) const
@@ -487,25 +458,25 @@ Static Private Member Functions

Retrieves the data needed for the Global statistics.

Parameters
+ - - - - - - - -
resultHolds the data only if the operation completed succssfully
web_serverThe ID of the Web Server to use
datesThe dates to query
recursWill hold the recurrencies of the items
traf_dateWill hold the most trafficked date and the count
traf_dayWill hold the most trafficked day of the week and the count
traf_hourWill hold the most trafficked hour of the day and the count
perf_timeWill hold the overallo time taken
perf_sentWill hold the overall Bytes sent
perf_receivWill hold the overall Bytes received
req_countWill hold the number of requests examined by the query
-
Returns
Whether the operation has been successful or not
+
Exceptions
+ + + + +
VoidException
CrapviewException
ConversionException
+
+
- -

◆ getItemsCount()

+ +

◆ getItemsCount()

@@ -513,43 +484,32 @@ Static Private Member Functions void DbQuery::getItemsCount ( - std::optional< stats_count_items_t > &  - result, + std::optional< stats_count_items_t > & result, - const QString &  - web_server, + QStringView web_server, - const QString &  - year, + QStringView year, - const QString &  - month, + QStringView month, - const QString &  - day, + QStringView day, - const QString &  - log_field  - - - - ) - const + QStringView log_field ) const
@@ -566,6 +526,14 @@ Static Private Member Functions +
Exceptions
+ + + + +
VoidException
CrapviewException
DateTimeException
+
+
@@ -581,19 +549,12 @@ Static Private Member Functions int DbQuery::getMinuteGap ( - const int  - minute, + const int minute, - const int  - gap = 10  - - - - ) - + const int gap = 10 ) @@ -633,19 +594,12 @@ Static Private Member Functions int DbQuery::getMonthDays ( - const int  - year, + const int year, - const int  - month  - - - - ) - + const int month ) @@ -673,8 +627,8 @@ Static Private Member Functions
- -

◆ getMonthNumber()

+ +

◆ getMonthNumber()

@@ -685,8 +639,7 @@ Static Private Member Functions int DbQuery::getMonthNumber ( - const QString &  - month_str) + QStringView month_str) const @@ -705,11 +658,17 @@ Static Private Member Functions
Returns
The month number
+
Exceptions
+ + +
DateTimeException
+
+
- -

◆ getRelationalCountsDay()

+ +

◆ getRelationalCountsDay()

@@ -717,61 +676,47 @@ Static Private Member Functions void DbQuery::getRelationalCountsDay ( - std::optional< stats_relat_items_t > &  - result, + std::optional< stats_relat_items_t > & result, - const QString &  - web_server, + QStringView web_server, - const QString &  - year_, + QStringView year_, - const QString &  - month_, + QStringView month_, - const QString &  - day_, + QStringView day_, - const QString &  - log_field_1_, + const LogField log_field_1_, - const QString &  - field_filter_1, + QStringView field_filter_1, - const QString &  - log_field_2_, + const LogField log_field_2_, - const QString &  - field_filter_2  - - - - ) - const + QStringView field_filter_2 ) const
@@ -791,12 +736,21 @@ Static Private Member Functions -
See also
getRelationalCountsPeriod()
+
Exceptions
+ + + + + +
VoidException
CrapviewException
ConversionException
DateTimeException
+
+
+
See also
getRelationalCountsPeriod()
- -

◆ getRelationalCountsPeriod()

+ +

◆ getRelationalCountsPeriod()

@@ -804,79 +758,62 @@ Static Private Member Functions void DbQuery::getRelationalCountsPeriod ( - std::optional< stats_relat_items_t > &  - result, + std::optional< stats_relat_items_t > & result, - const QString &  - web_server, + QStringView web_server, - const QString &  - from_year_, + QStringView from_year_, - const QString &  - from_month_, + QStringView from_month_, - const QString &  - from_day_, + QStringView from_day_, - const QString &  - to_year_, + QStringView to_year_, - const QString &  - to_month_, + QStringView to_month_, - const QString &  - to_day_, + QStringView to_day_, - const QString &  - log_field_1_, + const LogField log_field_1_, - const QString &  - field_filter_1, + QStringView field_filter_1, - const QString &  - log_field_2_, + const LogField log_field_2_, - const QString &  - field_filter_2  - - - - ) - const + QStringView field_filter_2 ) const
@@ -899,12 +836,21 @@ Static Private Member Functions -
See also
getRelationalCountsDay()
+
Exceptions
+ + + + + +
VoidException
CrapviewException
ConversionException
DateTimeException
+
+
+
See also
getRelationalCountsDay()
- -

◆ getSpeedData()

+ +

◆ getSpeedData()

@@ -912,67 +858,52 @@ Static Private Member Functions void DbQuery::getSpeedData ( - std::optional< stats_speed_items_t > &  - result, + std::optional< stats_speed_items_t > & result, - const QString &  - web_server, + QStringView web_server, - const QString &  - year_, + QStringView year_, - const QString &  - month_, + QStringView month_, - const QString &  - day_, + QStringView day_, - const QString &  - protocol_f, + QStringView protocol_f, - const QString &  - method_f, + QStringView method_f, - const QString &  - uri_f, + QStringView uri_f, - const QString &  - query_f, + QStringView query_f, - const QString &  - response_f  - - - - ) - const + QStringView response_f ) const
@@ -993,55 +924,53 @@ Static Private Member Functions +
Exceptions
+ + + + + +
VoidException
CrapviewException
ConversionException
DateTimeException
+
+
- -

◆ getWarnCounts()

+ +

◆ getWarningsData()

- + - - + - - + - - + - - + - - + - - - - - - - +
void DbQuery::getWarnCounts void DbQuery::getWarningsData (std::optional< stats_warn_items_t > & result, std::optional< stats_warn_items_t > & result,
const QString & web_server, QStringView web_server,
const QString & year_, QStringView year_,
const QString & month_, QStringView month_,
const QString & day_, QStringView day_,
const QString & hour_ 
) constQStringView hour_ ) const
@@ -1058,23 +987,38 @@ Static Private Member Functions +
Exceptions
+ + + + +
VoidException
ConversionException
DateTimeException
+
+
- -

◆ refreshDates()

+ +

◆ refreshDates()

+ + + + + +
- - +
void DbQuery::refreshDates (std::optional< stats_dates_t > & result)std::optional< database_dates_t > & result)
+
+noexcept

Refreshes the dates which are available in the database.

@@ -1084,64 +1028,41 @@ Static Private Member Functions +
Exceptions
+ + + +
VoidException
ConversionException
+
+
- -

◆ setDbPath()

+ +

◆ setDbPath()

+ + + + + +
- - +
void DbQuery::setDbPath (const std::string & path)std::string && path)
+
+noexcept

Sets the path for the logs Collection database.

-
See also
Crapview::setDbPath()
- -
-
- -

◆ updateWarnings()

- -
-
- - - - - - - - - - - - - - - - - - -
void DbQuery::updateWarnings (const QString & web_server,
const std::vector< std::tuple< int, int > > & updates 
) const
-
- -

Updates the database applying the changes made in the Warnings statistics table.

-
Parameters
- - - -
web_serverThe ID of the Web Server to use
updatesThe list of rowids to update and the corresponding warning values
-
-
+
See also
Crapview::setDbPath()
@@ -1152,7 +1073,7 @@ Static Private Member Functions diff --git a/docs/html/classDialogBool-members.html b/docs/html/classDialogBool-members.html index 91126470..7d765b51 100644 --- a/docs/html/classDialogBool-members.html +++ b/docs/html/classDialogBool-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -83,7 +85,7 @@ $(function() { diff --git a/docs/html/classDialogBool.html b/docs/html/classDialogBool.html index b5c43a56..0e2b8917 100644 --- a/docs/html/classDialogBool.html +++ b/docs/html/classDialogBool.html @@ -3,12 +3,14 @@ - + LogDoctor: DialogBool Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -75,12 +77,12 @@ $(function() { Public Member Functions | Private Slots | List of all members -
DialogBool Class Reference
+
DialogBool Class Referencefinal

DialogBool. - More...

+ More...

#include <boolean_dialog.h>

@@ -92,8 +94,7 @@ Inheritance diagram for DialogBool:
- - +

Public Member Functions

 DialogBool (const QString &title, const QString &text, QWidget *parent=nullptr)
 Dialog constructor.
 DialogBool (const QString &title, const QString &text, QWidget *parent=nullptr)
 
- - + - - + - - - - - - - +

@@ -123,25 +124,17 @@ void 

on_button_YES_clicked
DialogBool::DialogBool (const QString & title, const QString & title,
const QString & text, const QString & text,
QWidget * parent = nullptr 
)QWidget * parent = nullptr )
@@ -150,8 +143,6 @@ void on_button_YES_clicked
- -

Dialog constructor.

Parameters
@@ -170,7 +161,7 @@ void  @@ -31,7 +33,7 @@
titleThe title
on_button_YES_clicked diff --git a/docs/html/classDialogBool.png b/docs/html/classDialogBool.png index b5e94b2c..9466a466 100644 Binary files a/docs/html/classDialogBool.png and b/docs/html/classDialogBool.png differ diff --git a/docs/html/classDialogIda-members.html b/docs/html/classDialogIda-members.html index 9c3b9a7d..2b2560f4 100644 --- a/docs/html/classDialogIda-members.html +++ b/docs/html/classDialogIda-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@
-
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
- + @@ -84,7 +86,7 @@ $(function() { diff --git a/docs/html/classDialogIda.html b/docs/html/classDialogIda.html index f05c8713..ed155b08 100644 --- a/docs/html/classDialogIda.html +++ b/docs/html/classDialogIda.html @@ -3,12 +3,14 @@ - + LogDoctor: DialogIda Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -75,12 +77,12 @@ $(function() { Public Member Functions | Private Slots | List of all members -
DialogIda Class Reference
+
DialogIda Class Referencefinal

DialogIda. - More...

+ More...

#include <ida_dialog.h>

@@ -92,8 +94,7 @@ Inheritance diagram for DialogIda:
- - +

Public Member Functions

 DialogIda (const QString &title, const QString &text, const bool ignore=true, const bool discard=true, const bool abort=true, QWidget *parent=nullptr)
 Dialog constructor.
 DialogIda (const QString &title, const QString &text, const bool ignore=true, const bool discard=true, const bool abort=true, QWidget *parent=nullptr)
 
- - + - - + - - + - - + - - + - - - - - - - +

@@ -127,43 +128,32 @@ void 

on_button_ABORT_click
DialogIda::DialogIda (const QString & title, const QString & title,
const QString & text, const QString & text,
const bool ignore = true, const bool ignore = true,
const bool discard = true, const bool discard = true,
const bool abort = true, const bool abort = true,
QWidget * parent = nullptr 
)QWidget * parent = nullptr )
@@ -172,8 +162,6 @@ void on_button_ABORT_click
- -

Dialog constructor.

Parameters
@@ -195,7 +183,7 @@ void  @@ -31,7 +33,7 @@
titleThe title
on_button_ABORT_click diff --git a/docs/html/classDialogIda.png b/docs/html/classDialogIda.png index a215db1d..44beae0f 100644 Binary files a/docs/html/classDialogIda.png and b/docs/html/classDialogIda.png differ diff --git a/docs/html/classDialogMsg-members.html b/docs/html/classDialogMsg-members.html index ef64821f..d054cf34 100644 --- a/docs/html/classDialogMsg-members.html +++ b/docs/html/classDialogMsg-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@
-
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
- + @@ -83,7 +85,7 @@ $(function() { diff --git a/docs/html/classDialogMsg.html b/docs/html/classDialogMsg.html index e49270d8..44992c16 100644 --- a/docs/html/classDialogMsg.html +++ b/docs/html/classDialogMsg.html @@ -3,12 +3,14 @@ - + LogDoctor: DialogMsg Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -75,12 +77,12 @@ $(function() { Public Member Functions | Private Slots | List of all members -
DialogMsg Class Reference
+
DialogMsg Class Referencefinal

DialogMsg. - More...

+ More...

#include <message_dialog.h>

@@ -92,8 +94,7 @@ Inheritance diagram for DialogMsg:
- - +

Public Member Functions

 DialogMsg (const QString &title, const QString &text, const QString &additional, const MsgType type, QWidget *parent=nullptr)
 Dialog constructor.
 DialogMsg (const QString &title, const QString &text, const QString &additional, const MsgType type, QWidget *parent=nullptr)
 
- - + - - + - - + - - + - - - - - - - +

@@ -123,37 +124,27 @@ void 

on_button_Ok_clicked<
DialogMsg::DialogMsg (const QString & title, const QString & title,
const QString & text, const QString & text,
const QString & additional, const QString & additional,
const MsgType type, const MsgType type,
QWidget * parent = nullptr 
)QWidget * parent = nullptr )
@@ -162,8 +153,6 @@ void on_button_Ok_clicked<
- -

Dialog constructor.

Parameters
@@ -183,7 +172,7 @@ void  @@ -31,7 +33,7 @@
titleThe title
on_button_Ok_clicked< diff --git a/docs/html/classDialogMsg.png b/docs/html/classDialogMsg.png index 535c68d5..132881cd 100644 Binary files a/docs/html/classDialogMsg.png and b/docs/html/classDialogMsg.png differ diff --git a/docs/html/classDialogSec-members.html b/docs/html/classDialogSec-members.html index 2ea32606..69624bf7 100644 --- a/docs/html/classDialogSec-members.html +++ b/docs/html/classDialogSec-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@
-
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
- + @@ -86,15 +88,17 @@ $(function() { choiceDatabaseWrongTable(const QString &db_name, const QString &table_name, QWidget *parent=nullptr)DialogSecstatic choiceDirNotDir(const QString &path, QWidget *parent=nullptr)DialogSecstatic choiceDuplicateFile(const QString &msg, QWidget *parent=nullptr)DialogSecstatic - choiceFileAlreadyUsed(const QString &msg, QWidget *parent=nullptr)DialogSecstatic - choiceFileNotFile(const QString &path, QWidget *parent=nullptr)DialogSecstatic - choiceFileSizeWarning(const QString &msg, QWidget *parent=nullptr)DialogSecstatic - choiceFileSizeWarning2(const QString &msg, QWidget *parent=nullptr)DialogSecstatic - choiceSelectedFileNotFound(const QString &file, QWidget *parent=nullptr)DialogSecstatic - errConfDirNotWritable(const QString &dir, const QString &err, QWidget *parent=nullptr)DialogSecstatic - errConfFailedWriting(const QString &msg, const QString &err, QWidget *parent=nullptr)DialogSecstatic - errConfFileNotReadable(const QString &file, const QString &err, QWidget *parent=nullptr)DialogSecstatic - errConfFileNotWritable(const QString &file, const QString &err, QWidget *parent=nullptr)DialogSecstatic + choiceFailedApplyingConfigs(const QString &msg, QWidget *parent=nullptr)DialogSecstatic + choiceFileAlreadyUsed(const QString &msg, QWidget *parent=nullptr)DialogSecstatic + choiceFileNotFile(const QString &path, QWidget *parent=nullptr)DialogSecstatic + choiceFileSizeWarning(const QString &msg, QWidget *parent=nullptr)DialogSecstatic + choiceFileSizeWarning2(const QString &msg, QWidget *parent=nullptr)DialogSecstatic + choiceSelectedFileNotFound(const QString &file, QWidget *parent=nullptr)DialogSecstatic + errConfDirNotWritable(const QString &dir, const QString &err, QWidget *parent=nullptr)DialogSecstatic + errConfFailedWriting(const QString &msg, const QString &err, QWidget *parent=nullptr)DialogSecstatic + errConfFileNotReadable(const QString &file, const QString &err, QWidget *parent=nullptr)DialogSecstatic + errConfFileNotWritable(const QString &file, const QString &err, QWidget *parent=nullptr)DialogSecstatic + errConvertingData(const QString &fromType, const QString &intoType, const QString &value, QWidget *parent=nullptr)DialogSecstatic errDatabaseFailedBackup(const QString &msg, const QString &err, QWidget *parent=nullptr)DialogSecstatic errDatabaseFailedCreating(const QString &db_name, QWidget *parent=nullptr)DialogSecstatic errDatabaseFailedExecuting(const QString &db_name, const QString &statement, const QString &err, QWidget *parent=nullptr)DialogSecstatic @@ -106,37 +110,41 @@ $(function() { errDirNotExists(const QString &dir, QWidget *parent=nullptr)DialogSecstatic errDirNotReadable(const QString &dir, const QString &err, QWidget *parent=nullptr)DialogSecstatic errDirNotWritable(const QString &dir, const QString &err, QWidget *parent=nullptr)DialogSecstatic - errFailedApplyingConfigs(const QString &msg, QWidget *parent=nullptr)DialogSecstatic + errFailedApplyingConfigsItem(const QString &msg, QWidget *parent=nullptr)DialogSecstatic errFailedDefiningLogType(const QString &file, QWidget *parent=nullptr)DialogSecstatic - errFailedMakeDir(const QString &msg, const QString &err, QWidget *parent=nullptr)DialogSecstatic - errFailedParsingLogs(const QString &message, QWidget *parent=nullptr)DialogSecstatic - errFailedReadFile(const QString &file, const bool skipping=false, QWidget *parent=nullptr)DialogSecstatic - errFileNotFound(const QString &file, const bool report=false, QWidget *parent=nullptr)DialogSecstatic - errGeneric(const QString &message, const bool report_msg=false, QWidget *parent=nullptr)DialogSecstatic - errHelpFailed(const QString &link, const QString &msg, QWidget *parent=nullptr)DialogSecstatic - errHelpNotFound(const QString &link, QWidget *parent=nullptr)DialogSecstatic - errHelpNotReadable(const QString &link, QWidget *parent=nullptr)DialogSecstatic - errInvalidLogFormatString(const QString &msg, QWidget *parent=nullptr)DialogSecstatic - errLangLocaleInvalid(const QString &locale, QWidget *parent=nullptr)DialogSecstatic - errLangNotAccepted(const QString &locale, QWidget *parent=nullptr)DialogSecstatic - errLogFormatNoFields(QWidget *parent=nullptr)DialogSecstatic - errLogFormatNoSeparators(QWidget *parent=nullptr)DialogSecstatic - errLogFormatNotSet(QWidget *parent=nullptr)DialogSecstatic + errFailedInsertUsedHashes(QWidget *parent=nullptr)DialogSecstatic + errFailedMakeDir(const QString &msg, const QString &err, QWidget *parent=nullptr)DialogSecstatic + errFailedParsingLogs(const QString &message, QWidget *parent=nullptr)DialogSecstatic + errFailedReadFile(const QString &file, const bool skipping=false, QWidget *parent=nullptr)DialogSecstatic + errFileNotFound(const QString &file, const bool report=false, QWidget *parent=nullptr)DialogSecstatic + errGeneric(const QString &message, const bool report_msg=false, QWidget *parent=nullptr)DialogSecstatic + errHelpFailed(const QString &link, const QString &msg, QWidget *parent=nullptr)DialogSecstatic + errHelpNotFound(const QString &link, QWidget *parent=nullptr)DialogSecstatic + errHelpNotReadable(const QString &link, QWidget *parent=nullptr)DialogSecstatic + errInvalidLogFormatString(const QString &msg, QWidget *parent=nullptr)DialogSecstatic + errLangLocaleInvalid(const QString &locale, QWidget *parent=nullptr)DialogSecstatic + errLangNotAccepted(const QString &locale, QWidget *parent=nullptr)DialogSecstatic + errLogFormatNoFields(QWidget *parent=nullptr)DialogSecstatic + errLogFormatNoSeparators(QWidget *parent=nullptr)DialogSecstatic + errLogFormatNotSet(QWidget *parent=nullptr)DialogSecstatic + errProcessingStatsData(const QString &err, QWidget *parent=nullptr)DialogSecstatic errRenaming(const QString &path, const QString &err, QWidget *parent=nullptr)DialogSecstatic errSqlDriverNotFound(const QString &driver, QWidget *parent=nullptr)DialogSecstatic msgDatabaseCreated(const QString &db_name, QWidget *parent=nullptr)DialogSecstatic - msgNoFileToParse(QWidget *parent=nullptr)DialogSecstatic - msgNotEnoughMemory(const QString &msg, QWidget *parent=nullptr)DialogSecstatic - warnConfFileNotFound(const QString &file, QWidget *parent=nullptr)DialogSecstatic - warnDirNotReadable(QWidget *parent=nullptr)DialogSecstatic - warnDirNotWritable(QWidget *parent=nullptr)DialogSecstatic - warnEmptyFile(const QString &file, QWidget *parent=nullptr)DialogSecstatic - warnFileNotReadable(const QString &file, QWidget *parent=nullptr)DialogSecstatic + msgNoDataForStats(QWidget *parent=nullptr)DialogSecstatic + msgNoFileToParse(QWidget *parent=nullptr)DialogSecstatic + msgNotEnoughMemory(const QString &msg, QWidget *parent=nullptr)DialogSecstatic + warnConfFileNotFound(const QString &file, QWidget *parent=nullptr)DialogSecstatic + warnDirNotReadable(QWidget *parent=nullptr)DialogSecstatic + warnDirNotWritable(QWidget *parent=nullptr)DialogSecstatic + warnEmptyFile(const QString &file, QWidget *parent=nullptr)DialogSecstatic + warnFileNotReadable(const QString &file, QWidget *parent=nullptr)DialogSecstatic + warnInvalidConfigsList(const QStringList &list, QWidget *parent=nullptr)DialogSecstatic warnInvalidItemBW(QWidget *parent=nullptr)DialogSecstatic diff --git a/docs/html/classDialogSec.html b/docs/html/classDialogSec.html index d8eb7e81..48d7e284 100644 --- a/docs/html/classDialogSec.html +++ b/docs/html/classDialogSec.html @@ -3,12 +3,14 @@ - + LogDoctor: DialogSec Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -75,12 +77,12 @@ $(function() { Static Public Member Functions | Static Private Member Functions | List of all members -
DialogSec Class Reference
+
DialogSec Class Referencefinal

DialogSec. - More...

+ More...

#include <dialogs.h>

@@ -128,10 +130,18 @@ static void errConfFileNot static void errConfDirNotWritable (const QString &dir, const QString &err, QWidget *parent=nullptr)  Missing read permission for the configuration file's directory.
  - -static void errFailedApplyingConfigs (const QString &msg, QWidget *parent=nullptr) - Missing write permission for the configuration file's directory.
-  + +static void errFailedApplyingConfigsItem (const QString &msg, QWidget *parent=nullptr) + An error occured while applying the value retrieved from the conf file.
+  + +static void warnInvalidConfigsList (const QStringList &list, QWidget *parent=nullptr) + The lines in the list caused an error and cannot be applied.
+  + +static bool choiceFailedApplyingConfigs (const QString &msg, QWidget *parent=nullptr) + Failed to apply user provided configurations.
static void errHelpFailed (const QString &link, const QString &msg, QWidget *parent=nullptr)  Help resource is not a file.
@@ -232,6 +242,10 @@ static int choiceFileAlrea static int choiceDuplicateFile (const QString &msg, QWidget *parent=nullptr)  A selected log file appears twice in the selection.
  + +static void errFailedInsertUsedHashes (QWidget *parent=nullptr) + An error occured while inserting the new files' hashes into the daabase.
static int choiceFileSizeWarning (const QString &msg, QWidget *parent=nullptr)  The size of a log file which has been selected to be parsed exceeds the warning size.
@@ -264,6 +278,14 @@ static void errLogFormatNo static void errFailedParsingLogs (const QString &message, QWidget *parent=nullptr)  An error occured while parsing logs.
  + +static void errProcessingStatsData (const QString &err, QWidget *parent=nullptr) + An error occured while processing data.
+  + +static void msgNoDataForStats (QWidget *parent=nullptr) + No data, cannot draw the chart.
static void errFileNotFound (const QString &file, const bool report=false, QWidget *parent=nullptr)  File not found.
@@ -304,6 +326,10 @@ static void warnDirNotWrit static void errFailedMakeDir (const QString &msg, const QString &err, QWidget *parent=nullptr)  Failed to create a directory.
  + +static void errConvertingData (const QString &fromType, const QString &intoType, const QString &value, QWidget *parent=nullptr) + Failed to convert some data from one type into another.
static bool choiceDirNotDir (const QString &path, QWidget *parent=nullptr)  An entry was supposed to be a directory but it's not.
@@ -330,7 +356,7 @@ static bool choiceDatabase
diff --git a/docs/html/classDialogSec.png b/docs/html/classDialogSec.png index 5aa0a78c..7edee6b5 100644 Binary files a/docs/html/classDialogSec.png and b/docs/html/classDialogSec.png differ diff --git a/docs/html/classDonutBreakdown-members.html b/docs/html/classDonutBreakdown-members.html index 0b546b9b..c1df139f 100644 --- a/docs/html/classDonutBreakdown-members.html +++ b/docs/html/classDonutBreakdown-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -83,7 +85,7 @@ $(function() {
diff --git a/docs/html/classDonutBreakdown.html b/docs/html/classDonutBreakdown.html index 4b30a19c..8e127e15 100644 --- a/docs/html/classDonutBreakdown.html +++ b/docs/html/classDonutBreakdown.html @@ -3,12 +3,14 @@ - + LogDoctor: DonutBreakdown Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -75,12 +77,12 @@ $(function() { Public Member Functions | Private Member Functions | List of all members -
DonutBreakdown Class Reference
+
DonutBreakdown Class Referencefinal

DonutBreakdon. - More...

+ More...

#include <donuts.h>

@@ -92,7 +94,7 @@ Inheritance diagram for DonutBreakdown:
- +

Public Member Functions

void addBreakdownSeries (QPieSeries *series, const QColor &color, const QFont &font)
void addBreakdownSeries (QPieSeries *series, const QColor &color, const QFont &font)
 Adds a slice to the donut.
 
@@ -120,25 +122,17 @@ void  - - + - - + - - - - - - - +
updateLegendMarkers void DonutBreakdown::addBreakdownSeries (QPieSeries * series, QPieSeries * series,
const QColor & color, const QColor & color,
const QFont & font 
)const QFont & font )
@@ -163,7 +157,7 @@ void updateLegendMarkers diff --git a/docs/html/classDonutBreakdown.png b/docs/html/classDonutBreakdown.png index 262e63bf..3d0aca04 100644 Binary files a/docs/html/classDonutBreakdown.png and b/docs/html/classDonutBreakdown.png differ diff --git a/docs/html/classEnumeratdArray-members.html b/docs/html/classEnumeratdArray-members.html new file mode 100644 index 00000000..f4d86f65 --- /dev/null +++ b/docs/html/classEnumeratdArray-members.html @@ -0,0 +1,87 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+
EnumeratdArray< Array > Member List
+
+
+ +

This is the complete list of members for EnumeratdArray< Array >, including all inherited members.

+
+ + + + diff --git a/docs/html/classEnumeratdArray.html b/docs/html/classEnumeratdArray.html new file mode 100644 index 00000000..ee05e3a4 --- /dev/null +++ b/docs/html/classEnumeratdArray.html @@ -0,0 +1,90 @@ + + + + + + + +LogDoctor: EnumeratdArray< Array > Class Template Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+ +
EnumeratdArray< Array > Class Template Reference
+
+
+
The documentation for this class was generated from the following file:
    +
  • logdoctor/utilities/arrays.h
  • +
+
+ + + + diff --git a/docs/html/classFileHandler-members.html b/docs/html/classFileHandler-members.html new file mode 100644 index 00000000..7213bf40 --- /dev/null +++ b/docs/html/classFileHandler-members.html @@ -0,0 +1,87 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+
FileHandler< Stream > Member List
+
+
+ +

This is the complete list of members for FileHandler< Stream >, including all inherited members.

+
+ + + + diff --git a/docs/html/classFileHandler.html b/docs/html/classFileHandler.html new file mode 100644 index 00000000..66743578 --- /dev/null +++ b/docs/html/classFileHandler.html @@ -0,0 +1,98 @@ + + + + + + + +LogDoctor: FileHandler< Stream > Class Template Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+ +
FileHandler< Stream > Class Template Referencefinal
+
+
+ +

RAII class to handle s file resource. + More...

+

Detailed Description

+
template<typename Stream>
+class FileHandler< Stream >

RAII class to handle s file resource.

+

RAII class to handle a file stream resource.

+

The documentation for this class was generated from the following files:
    +
  • logdoctor/utilities/gzip.cpp
  • +
  • logdoctor/utilities/io.cpp
  • +
+
+ + + + diff --git a/docs/html/classFood-members.html b/docs/html/classFood-members.html index ddde374a..a21be0b9 100644 --- a/docs/html/classFood-members.html +++ b/docs/html/classFood-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -77,20 +79,19 @@ $(function() {

This is the complete list of members for Food, including all inherited members.

- - - - - - - - - - + + + + + + + + +
imageFoodprivate
img_ratFoodprivate
inTile(const unsigned x, const unsigned y) constFood
movableFoodprivate
move(const Snake &snake)Food
spawn(const Snake &snake, const Snake &snake_)Food
update(const unsigned new_x, const unsigned new_y)Food
xFoodprivate
X() constFood
Y() constFood
img_ratFoodprivate
inTile(const unsigned x, const unsigned y) const noexceptFood
movableFoodprivate
move(const Snake &snake)Food
spawn(const Snake &snake, const Snake &snake_) noexceptFood
update(const unsigned new_x, const unsigned new_y) noexceptFood
xFoodprivate
X() const noexceptFood
Y() const noexceptFood
diff --git a/docs/html/classFood.html b/docs/html/classFood.html index d34df1f6..c4daf426 100644 --- a/docs/html/classFood.html +++ b/docs/html/classFood.html @@ -3,12 +3,14 @@ - + LogDoctor: Food Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -75,35 +77,35 @@ $(function() { Public Member Functions | Private Attributes | List of all members -
Food Class Reference
+
Food Class Referencefinal
- - - - - - - - - - - - + + + + + + + + + + + + - - - + + +

Public Member Functions

-unsigned X () const
 Returns the position on the X-axis.
 
unsigned Y () const
 Returns the position on the Y-axis.
 
-bool inTile (const unsigned x, const unsigned y) const
 Checks whether is there a part of the snake in the given position.
 
-void spawn (const Snake &snake, const Snake &snake_)
 Spawns the egg/rat in a new position.
 
+unsigned X () const noexcept
 Returns the position on the X-axis.
 
unsigned Y () const noexcept
 Returns the position on the Y-axis.
 
+bool inTile (const unsigned x, const unsigned y) const noexcept
 Checks whether is there a part of the snake in the given position.
 
+void spawn (const Snake &snake, const Snake &snake_) noexcept
 Spawns the egg/rat in a new position.
 
void move (const Snake &snake)
 Moves the rat.
 
-void update (const unsigned new_x, const unsigned new_y)
 Updates the position and direction of the entity.
 
+void update (const unsigned new_x, const unsigned new_y) noexcept
 Updates the position and direction of the entity.
 
@@ -111,13 +113,8 @@ Private Attributes const QPixmap  - - - - - + + @@ -125,24 +122,58 @@ unsigned 

Private Attributes

img_rat { ":/games/games/snake/rat.png" }
 The image which graphically represents the food.
 
-QGraphicsPixmapItem * image = nullptr
 Whether the food is a rat or an egg.
 
-bool movable
 The position on the X-axis.
bool movable
 < Whether the food is a rat or an egg
 
unsigned x
x
 

Member Function Documentation

- -

◆ Y()

+ +

◆ Y()

+ + + + + +
- +
unsigned Food::Y ()) const
+
+noexcept

Returns the position on the Y-axis.

Returns the image

+
+
+

Member Data Documentation

+ +

◆ movable

+ +
+
+ + + + + +
+ + + + +
bool Food::movable
+
+private
+
+ +

< Whether the food is a rat or an egg

+

The position on the X-axis

+

The documentation for this class was generated from the following files:
    @@ -152,7 +183,7 @@ unsigned x
diff --git a/docs/html/classFormatOps-members.html b/docs/html/classFormatOps-members.html index 59b093e4..2cf1e7b2 100644 --- a/docs/html/classFormatOps-members.html +++ b/docs/html/classFormatOps-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -77,19 +79,20 @@ $(function() {

This is the complete list of members for FormatOps, including all inherited members.

- - - - - - - - - + + + + + + + + + +
APACHE_ALFFormatOpsprivate
getApacheLogSample(const LogsFormat &log_format) constFormatOps
getIisLogSample(const LogsFormat &log_format) constFormatOps
getNginxLogSample(const LogsFormat &log_format) constFormatOps
IIS_ALFFormatOpsprivate
NGINX_ALFFormatOpsprivate
processApacheFormatString(const std::string &format_string) constFormatOps
processIisFormatString(const std::string &format_string, const int &log_module) constFormatOps
processNginxFormatString(const std::string &format_string) constFormatOps
APACHE_ALFFormatOpsprivate
APACHE_ALF_VFormatOpsprivate
getApacheLogSample(const LogsFormat &log_format) const noexceptFormatOps
getIisLogSample(const LogsFormat &log_format) const noexceptFormatOps
getNginxLogSample(const LogsFormat &log_format) const noexceptFormatOps
IIS_ALFFormatOpsprivate
NGINX_ALFFormatOpsprivate
processApacheFormatString(const std::string &format_string) constFormatOps
processIisFormatString(const std::string &format_string, const IISLogsModule log_module) constFormatOps
processNginxFormatString(const std::string &format_string) constFormatOps
diff --git a/docs/html/classFormatOps.html b/docs/html/classFormatOps.html index d38da55f..247cc797 100644 --- a/docs/html/classFormatOps.html +++ b/docs/html/classFormatOps.html @@ -3,12 +3,14 @@ - + LogDoctor: FormatOps Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -75,68 +77,80 @@ $(function() { Public Member Functions | Private Attributes | List of all members -
FormatOps Class Reference
+
FormatOps Class Referencefinal

FormatOps. - More...

+ More...

#include <formats.h>

- + - + - - - - - - - - - - - - + + + + + + + + + + + +

Public Member Functions

LogsFormat processApacheFormatString (const std::string &format_string) const
LogsFormat processApacheFormatString (const std::string &format_string) const
 Processes the given string to extrapolate the format for Apache2.
 
LogsFormat processNginxFormatString (const std::string &format_string) const
LogsFormat processNginxFormatString (const std::string &format_string) const
 Processes the given string to extrapolate the format for Nginx.
 
LogsFormat processIisFormatString (const std::string &format_string, const int &log_module) const
 Processes the given string to extrapolate the format for the IIS.
 
QString getApacheLogSample (const LogsFormat &log_format) const
 Returns a log line sample based on the given format.
 
QString getNginxLogSample (const LogsFormat &log_format) const
 Returns a log line sample based on the given format.
 
QString getIisLogSample (const LogsFormat &log_format) const
 Returns a log line sample based on the given format.
 
LogsFormat processIisFormatString (const std::string &format_string, const IISLogsModule log_module) const
 Processes the given string to extrapolate the format for the IIS.
 
QString getApacheLogSample (const LogsFormat &log_format) const noexcept
 Returns a log line sample based on the given format.
 
QString getNginxLogSample (const LogsFormat &log_format) const noexcept
 Returns a log line sample based on the given format.
 
QString getIisLogSample (const LogsFormat &log_format) const noexcept
 Returns a log line sample based on the given format.
 
- - - - - - - - - + + + + + + + + + + + +

Private Attributes

const std::unordered_map< std::string, std::string > APACHE_ALF
 < Access logs fields formats
 
-const std::unordered_map< std::string, std::string > NGINX_ALF
 < Access logs fields formats
 
-const std::unordered_map< std::string, std::string > IIS_ALF
 < Access logs fields formats (W3C)
 
+const simple_fields_umap_t APACHE_ALF
 Access logs fields formats.
 
+const composed_fields_umap_t APACHE_ALF_V
 Composed access logs fields formats.
 
+const simple_fields_umap_t NGINX_ALF
 Access logs fields formats.
 
+const simple_fields_umap_t IIS_ALF
 Access logs fields formats (W3C)
 

Detailed Description

FormatOps.

Operations for the logs formats

Member Function Documentation

- -

◆ getApacheLogSample()

+ +

◆ getApacheLogSample()

+ + + + + +
- - +
QString FormatOps::getApacheLogSample (const LogsFormatlog_format)const LogsFormat & log_format) const
+
+noexcept

Returns a log line sample based on the given format.

@@ -147,24 +161,31 @@ const std::unordered_map< std::string, std::string > 
Returns
The sample line
-
See also
LogsFormat, Craplog::getLogsFormatSample()
+
See also
LogsFormat, Craplog::getLogsFormatSample()
- -

◆ getIisLogSample()

+ +

◆ getIisLogSample()

+ + + + + +
- - +
QString FormatOps::getIisLogSample (const LogsFormatlog_format)const LogsFormat & log_format) const
+
+noexcept

Returns a log line sample based on the given format.

@@ -175,24 +196,31 @@ const std::unordered_map< std::string, std::string > 
Returns
The sample line
-
See also
LogsFormat, Craplog::getLogsFormatSample()
+
See also
LogsFormat, Craplog::getLogsFormatSample()
- -

◆ getNginxLogSample()

+ +

◆ getNginxLogSample()

+ + + + + +
- - +
QString FormatOps::getNginxLogSample (const LogsFormatlog_format)const LogsFormat & log_format) const
+
+noexcept

Returns a log line sample based on the given format.

@@ -203,7 +231,7 @@ const std::unordered_map< std::string, std::string > 
Returns
The sample line
-
See also
LogsFormat, Craplog::getLogsFormatSample()
+
See also
LogsFormat, Craplog::getLogsFormatSample()
@@ -214,10 +242,9 @@ const std::unordered_map< std::string, std::string >  - + - - +
LogsFormat FormatOps::processApacheFormatString LogsFormat FormatOps::processApacheFormatString (const std::string & format_string)const std::string & format_string) const
@@ -237,32 +264,25 @@ const std::unordered_map< std::string, std::string > 
See also
LogsFormat
+
See also
LogsFormat
- -

◆ processIisFormatString()

+ +

◆ processIisFormatString()

- + - - + - - - - - - - +
LogsFormat FormatOps::processIisFormatString LogsFormat FormatOps::processIisFormatString (const std::string & format_string, const std::string & format_string,
const int & log_module 
) constconst IISLogsModule log_module ) const
@@ -282,7 +302,7 @@ const std::unordered_map< std::string, std::string > 
See also
LogsFormat
+
See also
LogsFormat
@@ -293,10 +313,9 @@ const std::unordered_map< std::string, std::string >  - + - - +
LogsFormat FormatOps::processNginxFormatString LogsFormat FormatOps::processNginxFormatString (const std::string & format_string)const std::string & format_string) const
@@ -316,33 +335,7 @@ const std::unordered_map< std::string, std::string > 
See also
LogsFormat
- - - -

Member Data Documentation

- -

◆ APACHE_ALF

- -
-
- - - - - -
- - - - -
const std::unordered_map<std::string, std::string> FormatOps::APACHE_ALF
-
-private
-
- -

< Access logs fields formats

-

Composed access logs fields formats

+
See also
LogsFormat
@@ -353,7 +346,7 @@ const std::unordered_map< std::string, std::string >  diff --git a/docs/html/classGameDialog-members.html b/docs/html/classGameDialog-members.html index cff0e345..c5fe1364 100644 --- a/docs/html/classGameDialog-members.html +++ b/docs/html/classGameDialog-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -82,7 +84,7 @@ $(function() { diff --git a/docs/html/classGameDialog.html b/docs/html/classGameDialog.html index 1ed375de..c73ca429 100644 --- a/docs/html/classGameDialog.html +++ b/docs/html/classGameDialog.html @@ -3,12 +3,14 @@ - + LogDoctor: GameDialog Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -75,12 +77,12 @@ $(function() { Public Member Functions | Private Slots | List of all members -
GameDialog Class Reference
+
GameDialog Class Referencefinal

GameDialog. - More...

+ More...

#include <game_dialog.h>

@@ -92,7 +94,7 @@ Inheritance diagram for GameDialog:
- +

Public Member Functions

 GameDialog (const QString &title, const QString &text, QWidget *parent=nullptr)
 GameDialog (const QString &title, const QString &text, QWidget *parent=nullptr)
 Dialog constructor.
 
@@ -119,25 +121,17 @@ void  - - + - - + - - - - - - - +
on_button_Ok_clicked<
GameDialog::GameDialog (const QString & title, const QString & title,
const QString & text, const QString & text,
QWidget * parent = nullptr 
)QWidget * parent = nullptr )
@@ -166,7 +160,7 @@ void on_button_Ok_clicked<
diff --git a/docs/html/classGameDialog.png b/docs/html/classGameDialog.png index 5516180d..334405a9 100644 Binary files a/docs/html/classGameDialog.png and b/docs/html/classGameDialog.png differ diff --git a/docs/html/classGenericException-members.html b/docs/html/classGenericException-members.html index 5f8f147d..4626a5ad 100644 --- a/docs/html/classGenericException-members.html +++ b/docs/html/classGenericException-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -79,7 +81,7 @@ $(function() { diff --git a/docs/html/classGenericException.html b/docs/html/classGenericException.html index 847123e3..b17562e7 100644 --- a/docs/html/classGenericException.html +++ b/docs/html/classGenericException.html @@ -3,12 +3,14 @@ - + LogDoctor: GenericException Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -73,20 +75,23 @@ $(function() {
-
GenericException Class Reference
+
GenericException Class Referencefinal

GenericException. - More...

+ More...

#include <exceptions.h>

Inheritance diagram for GenericException:
- -
+ + +LogDoctorException + +

Detailed Description

GenericException.

Generic exception for general purposes

@@ -97,7 +102,7 @@ Inheritance diagram for GenericException:
diff --git a/docs/html/classGenericException.png b/docs/html/classGenericException.png index 94312c0a..73169f38 100644 Binary files a/docs/html/classGenericException.png and b/docs/html/classGenericException.png differ diff --git a/docs/html/classHashOps-members.html b/docs/html/classHashOps-members.html index b03191f2..e4f5eb35 100644 --- a/docs/html/classHashOps-members.html +++ b/docs/html/classHashOps-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -78,14 +80,14 @@ $(function() {

This is the complete list of members for HashOps, including all inherited members.

- - - - + + + +
digestFile(const std::string &file_path, std::string &hash)HashOpsstatic
hasBeenUsed(const std::string &file_hash, const unsigned &web_server_id) constHashOps
insertUsedHashes(const std::string &db_path, const std::vector< std::string > &hashes, const unsigned &web_server_id)HashOps
loadUsedHashesLists(const std::string &db_path)HashOps
setDialogLevel(const int new_level)HashOps
hasBeenUsed(const std::string &file_hash, const WebServer &web_server) const noexceptHashOps
insertUsedHashes(const std::string &db_path, const std::vector< std::string > &hashes, const WebServer &web_server)HashOps
loadUsedHashesLists(const std::string &db_path) noexceptHashOps
setDialogLevel(const DialogsLevel new_level) noexceptHashOps
diff --git a/docs/html/classHashOps.html b/docs/html/classHashOps.html index c9b129d8..a2c1f81c 100644 --- a/docs/html/classHashOps.html +++ b/docs/html/classHashOps.html @@ -3,12 +3,14 @@ - + LogDoctor: HashOps Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -75,34 +77,34 @@ $(function() { Public Member Functions | Static Public Member Functions | List of all members -
HashOps Class Reference
+
HashOps Class Referencefinal

HashOps. - More...

+ More...

#include <hash.h>

- - - - - - - - - - - - + + + + + + + + + + + +

Public Member Functions

-void setDialogLevel (const int new_level)
 Sets the new Dialogs level.
 
bool loadUsedHashesLists (const std::string &db_path)
 Retrieves the lists of hashes from the database file.
 
bool hasBeenUsed (const std::string &file_hash, const unsigned &web_server_id) const
 Checks if the given hash equals one which is already in the list.
 
bool insertUsedHashes (const std::string &db_path, const std::vector< std::string > &hashes, const unsigned &web_server_id)
 Inserts multiple hashes in the corresponding database table.
 
+void setDialogLevel (const DialogsLevel new_level) noexcept
 Sets the new Dialogs level.
 
bool loadUsedHashesLists (const std::string &db_path) noexcept
 Retrieves the lists of hashes from the database file.
 
bool hasBeenUsed (const std::string &file_hash, const WebServer &web_server) const noexcept
 Checks if the given hash equals one which is already in the list.
 
void insertUsedHashes (const std::string &db_path, const std::vector< std::string > &hashes, const WebServer &web_server)
 Inserts multiple hashes in the corresponding database table.
 
- +

Static Public Member Functions

static void digestFile (const std::string &file_path, std::string &hash)
static void digestFile (const std::string &file_path, std::string &hash)
 Returns the hash resulting from the content of the given file.
 
@@ -122,19 +124,12 @@ Static Public Member Functions void HashOps::digestFile ( - const std::string &  - file_path, + const std::string & file_path, - std::string &  - hash  - - - - ) - + std::string & hash ) @@ -162,30 +157,31 @@ Static Public Member Functions
- -

◆ hasBeenUsed()

+ +

◆ hasBeenUsed()

+ + + + + +
- - + - - - - - - - +
bool HashOps::hasBeenUsed (const std::string & file_hash, const std::string & file_hash,
const unsigned & web_server_id 
) constconst WebServer & web_server ) const
+
+noexcept

Checks if the given hash equals one which is already in the list.

@@ -200,34 +196,26 @@ Static Public Member Functions
- -

◆ insertUsedHashes()

+ +

◆ insertUsedHashes()

- + - - + - - + - - - - - - - +
bool HashOps::insertUsedHashes void HashOps::insertUsedHashes (const std::string & db_path, const std::string & db_path,
const std::vector< std::string > & hashes, const std::vector< std::string > & hashes,
const unsigned & web_server_id 
)const WebServer & web_server )
@@ -241,24 +229,36 @@ Static Public Member Functions -
Returns
Whether the operation has been successful or not
+
Exceptions
+ + +
VoidException
+
+
- -

◆ loadUsedHashesLists()

+ +

◆ loadUsedHashesLists()

+ + + + + +
- - +
bool HashOps::loadUsedHashesLists (const std::string & db_path)const std::string & db_path)
+
+noexcept

Retrieves the lists of hashes from the database file.

@@ -269,6 +269,12 @@ Static Public Member Functions
Returns
Whether the operation has been successful or not
+
Exceptions
+ + +
VoidException
+
+
@@ -279,7 +285,7 @@ Static Public Member Functions diff --git a/docs/html/classLogDoctorException.html b/docs/html/classLogDoctorException.html new file mode 100644 index 00000000..54b84120 --- /dev/null +++ b/docs/html/classLogDoctorException.html @@ -0,0 +1,110 @@ + + + + + + + +LogDoctor: LogDoctorException Class Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+
LogDoctorException Class Reference
+
+
+ +

LogDoctorException. + More...

+ +

#include <exceptions.h>

+
+Inheritance diagram for LogDoctorException:
+
+
+ + +BWlistException +DatabaseException +DateTimeException +GenericException +LogFormatException +LogParserException + +
+

Detailed Description

+

LogDoctorException.

+

Base class for internal exceptions

+

The documentation for this class was generated from the following file:
    +
  • logdoctor/modules/exceptions.h
  • +
+
+ + + + diff --git a/docs/html/classLogDoctorException.png b/docs/html/classLogDoctorException.png new file mode 100644 index 00000000..ddd5fb5b Binary files /dev/null and b/docs/html/classLogDoctorException.png differ diff --git a/docs/html/classWebServerException-members.html b/docs/html/classLogFieldsListModel-members.html similarity index 88% rename from docs/html/classWebServerException-members.html rename to docs/html/classLogFieldsListModel-members.html index f0d96383..eb1f91a6 100644 --- a/docs/html/classWebServerException-members.html +++ b/docs/html/classLogFieldsListModel-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -71,15 +73,15 @@ $(function() {
-
WebServerException Member List
+
LogFieldsListModel Member List
-

This is the complete list of members for WebServerException, including all inherited members.

+

This is the complete list of members for LogFieldsListModel, including all inherited members.

diff --git a/docs/html/classLogFieldsListModel.html b/docs/html/classLogFieldsListModel.html new file mode 100644 index 00000000..eeb19434 --- /dev/null +++ b/docs/html/classLogFieldsListModel.html @@ -0,0 +1,101 @@ + + + + + + + +LogDoctor: LogFieldsListModel Class Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+ +
LogFieldsListModel Class Reference
+
+
+
+Inheritance diagram for LogFieldsListModel:
+
+
+ + +DaytimeLogFieldsListModel +RelationslLogFieldsListModel + +
+
The documentation for this class was generated from the following files:
    +
  • logdoctor/customs/models/logfields_listmodel.h
  • +
  • logdoctor/customs/models/logfields_listmodel.cpp
  • +
+
+ + + + diff --git a/docs/html/classLogFieldsListModel.png b/docs/html/classLogFieldsListModel.png new file mode 100644 index 00000000..3524f1b5 Binary files /dev/null and b/docs/html/classLogFieldsListModel.png differ diff --git a/docs/html/classLogFile.html b/docs/html/classLogFile.html deleted file mode 100644 index f5072ce1..00000000 --- a/docs/html/classLogFile.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - -LogDoctor: LogFile Class Reference - - - - - - - - - -
-
- - - - - - - -
-
LogDoctor 3.00 -
-
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
-
-
- - - - - - - - -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
- -
LogFile Class Reference
-
-
- -

Holds informations about a log file. - More...

- -

#include <lib.h>

- - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

-bool isSelected () const
 < Wheter the file has been selected to be use or not
 
-bool hasBeenUsed () const
 < Wheter the file has been used already or not
 
-size_t size () const
 < The size of the file
 
-const QString & name () const
 < The name of the file, to be displayed in the list
 
-const std::string & hash () const
 < The sha256 hash of the content
 
-const std::string & path () const
 < The path of the file, including the file name
 
-

Detailed Description

-

Holds informations about a log file.

-

The documentation for this class was generated from the following file:
    -
  • logdoctor/modules/craplog/modules/lib.h
  • -
-
- - - - diff --git a/docs/html/classLogFileTreeWidgetItem-members.html b/docs/html/classLogFileTreeWidgetItem-members.html index 385cc632..6a6e7dd7 100644 --- a/docs/html/classLogFileTreeWidgetItem-members.html +++ b/docs/html/classLogFileTreeWidgetItem-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -79,7 +81,7 @@ $(function() { diff --git a/docs/html/classLogFileTreeWidgetItem.html b/docs/html/classLogFileTreeWidgetItem.html index 57a7fc09..e3f6708d 100644 --- a/docs/html/classLogFileTreeWidgetItem.html +++ b/docs/html/classLogFileTreeWidgetItem.html @@ -3,12 +3,14 @@ - + LogDoctor: LogFileTreeWidgetItem Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -73,7 +75,7 @@ $(function() {
-
LogFileTreeWidgetItem Class Reference
+
LogFileTreeWidgetItem Class Referencefinal
@@ -83,12 +85,12 @@ Inheritance diagram for LogFileTreeWidgetItem:

The documentation for this class was generated from the following file:
    -
  • logdoctor/customs/treewidgetitems.h
  • +
  • logdoctor/customs/logfile_treewidgetitem.h
diff --git a/docs/html/classLogFileTreeWidgetItem.png b/docs/html/classLogFileTreeWidgetItem.png index fa9c4968..b8b54f09 100644 Binary files a/docs/html/classLogFileTreeWidgetItem.png and b/docs/html/classLogFileTreeWidgetItem.png differ diff --git a/docs/html/classLogFormatException-members.html b/docs/html/classLogFormatException-members.html index 16617d56..8233d708 100644 --- a/docs/html/classLogFormatException-members.html +++ b/docs/html/classLogFormatException-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -79,7 +81,7 @@ $(function() { diff --git a/docs/html/classLogFormatException.html b/docs/html/classLogFormatException.html index 48ef13a1..51cd0420 100644 --- a/docs/html/classLogFormatException.html +++ b/docs/html/classLogFormatException.html @@ -3,12 +3,14 @@ - + LogDoctor: LogFormatException Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -73,20 +75,23 @@ $(function() {
-
LogFormatException Class Reference
+
LogFormatException Class Referencefinal

LogFormatException. - More...

+ More...

#include <exceptions.h>

Inheritance diagram for LogFormatException:
- -
+ + +LogDoctorException + +

Detailed Description

LogFormatException.

Exception related to a Logs Format

@@ -97,7 +102,7 @@ Inheritance diagram for LogFormatException:
diff --git a/docs/html/classLogFormatException.png b/docs/html/classLogFormatException.png index 67c7e82a..d6b60241 100644 Binary files a/docs/html/classLogFormatException.png and b/docs/html/classLogFormatException.png differ diff --git a/docs/html/classLogParserException-members.html b/docs/html/classLogParserException-members.html index c45e4907..6729b6d1 100644 --- a/docs/html/classLogParserException-members.html +++ b/docs/html/classLogParserException-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -79,7 +81,7 @@ $(function() { diff --git a/docs/html/classLogParserException.html b/docs/html/classLogParserException.html index 11c2a1f9..b93f754f 100644 --- a/docs/html/classLogParserException.html +++ b/docs/html/classLogParserException.html @@ -3,12 +3,14 @@ - + LogDoctor: LogParserException Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -73,20 +75,23 @@ $(function() {
-
LogParserException Class Reference
+
LogParserException Class Referencefinal

LogParserException. - More...

+ More...

#include <exceptions.h>

Inheritance diagram for LogParserException:
- -
+ + +LogDoctorException + +

Detailed Description

LogParserException.

Exception related to the logs parser

@@ -97,7 +102,7 @@ Inheritance diagram for LogParserException:
diff --git a/docs/html/classLogParserException.png b/docs/html/classLogParserException.png index 0809377c..2ad66935 100644 Binary files a/docs/html/classLogParserException.png and b/docs/html/classLogParserException.png differ diff --git a/docs/html/classMainSlice-members.html b/docs/html/classMainSlice-members.html index ea6a5bc1..51ab4f0a 100644 --- a/docs/html/classMainSlice-members.html +++ b/docs/html/classMainSlice-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -84,7 +86,7 @@ $(function() { diff --git a/docs/html/classMainSlice.html b/docs/html/classMainSlice.html index e059b860..92b82391 100644 --- a/docs/html/classMainSlice.html +++ b/docs/html/classMainSlice.html @@ -3,12 +3,14 @@ - + LogDoctor: MainSlice Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -75,12 +77,12 @@ $(function() { Public Slots | Public Member Functions | List of all members -
MainSlice Class Reference
+
MainSlice Class Referencefinal

Represents a slice. - More...

+ More...

#include <donuts.h>

@@ -103,7 +105,7 @@ Public Member Functions QPieSeries * breakdownSeries () const  Returns the series.
  -void setName (QString name) +void setName (QString name)  Sets the name.
  @@ -124,8 +126,7 @@ QString name () const< void MainSlice::setName ( - QString  - name) + QString name) @@ -148,7 +149,7 @@ QString name () const<
diff --git a/docs/html/classMainSlice.png b/docs/html/classMainSlice.png index f67e8903..da4f8403 100644 Binary files a/docs/html/classMainSlice.png and b/docs/html/classMainSlice.png differ diff --git a/docs/html/classMainWindow-members.html b/docs/html/classMainWindow-members.html index 49eb2d99..66f84fb1 100644 --- a/docs/html/classMainWindow-members.html +++ b/docs/html/classMainWindow-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -79,8 +81,10 @@ $(function() { - - + + + + @@ -88,9 +92,11 @@ $(function() { - + - + + + @@ -100,7 +106,7 @@ $(function() {
backupDatabase() constMainWindowprivate
checkDataDB()MainWindowprivate
defineOSspec()MainWindowprivate
detectIconsTheme()MainWindowprivate
dbUsable()MainWindowprivate
defineOSspec()MainWindowprivate
detectIconsTheme()MainWindowprivate
dialogsLevelFromInt(const int dialogs_level)MainWindowprivate
geometryToString() constMainWindowprivate
list2string(const std::vector< std::string > &list, const bool user_agent=false) constMainWindowprivate
makeInitialChecks()MainWindowprivate
parentPath(const std::string &path) constMainWindowprivate
readConfigs()MainWindowprivate
refreshStatsDates()MainWindowprivate
resolvePath(const std::string &path) constMainWindowprivate
resolvePath(const std::string &path) const noexceptMainWindowprivate
setDbWorkingState(const bool working)MainWindowprivate
setGeometryFromString(const std::string &geometry)MainWindowprivate
setDialogsLevelFromString(const std::string &dialogs_level)MainWindowprivate
setGeometryFromString(const std::string &geometry)MainWindowprivate
setWebServerFromString(const std::string &web_server)MainWindowprivate
string2list(const std::string &string, const bool user_agent=false) constMainWindowprivate
updateUiFonts()MainWindowprivate
updateUiIcons()MainWindowprivate
diff --git a/docs/html/classMainWindow.html b/docs/html/classMainWindow.html index 4e291c7a..2cd88aa1 100644 --- a/docs/html/classMainWindow.html +++ b/docs/html/classMainWindow.html @@ -3,12 +3,14 @@ - + LogDoctor: MainWindow Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -75,12 +77,12 @@ $(function() { Private Slots | Private Member Functions | List of all members -
MainWindow Class Reference
+
MainWindow Class Referencefinal

MainWindow. - More...

+ More...

#include <mainwindow.h>

@@ -92,7 +94,7 @@ Inheritance diagram for MainWindow:
- +

Private Slots

void menu_actionEnglishGb_triggered ()
void menu_actionEnglishGb_triggered ()
 
- + - + - + - + + + + + + + + + + @@ -141,10 +153,10 @@ void  - - - + + + @@ -153,10 +165,6 @@ std::string  - - - @@ -165,7 +173,14 @@ void  - + + + + + + +

@@ -109,22 +111,32 @@ void 

readConfigs ()writeConfigs ()
 Writes the current configuration on file.
 
std::string list2string (const std::vector< std::string > &list, const bool user_agent=false) const
std::string list2string (const std::vector< std::string > &list, const bool user_agent=false) const
 Converts a list of items to a string.
 
std::vector< std::string > string2list (const std::string &string, const bool user_agent=false) const
std::vector< std::string > string2list (const std::string &string, const bool user_agent=false) const
 Retrieves a list of items from the given string.
 
void updateUiLanguage ()
 Translates the UI to the selected language.
 
std::string geometryToString () const
std::string geometryToString () const
 Converts the window's geometry to string.
 
void setGeometryFromString (const std::string &geometry)
void setGeometryFromString (const std::string &geometry)
 Retrieves the window geometry from the given string.
 
void setDialogsLevelFromString (const std::string &dialogs_level)
 Retrieves the dialogs level from the given string.
 
+DialogsLevel dialogsLevelFromInt (const int dialogs_level)
 Returns the dialogs level corresponding to the given number.
 
void setWebServerFromString (const std::string &web_server)
 Retrieves the Web Server from the given string.
 
void detectIconsTheme ()
 Auto-detects the icon-set to use depending on the current window theme.
updateUiTheme ()< void updateUiFonts ()
 Updates the fonts on the window.
 
-std::string resolvePath (const std::string &path) const
 Resolves the given path and returns the canonical path.
 
+std::string resolvePath (const std::string &path) const noexcept
 Resolves the given path and returns the canonical path.
 
std::string parentPath (const std::string &path) const
 Returns the parent folder of the given path.
parentPath void makeInitialChecks ()
 Makes the initial integrity checks.
 
-bool checkDataDB ()
 Checks the integrity of the logs data collection database.
 
void backupDatabase () const
 Backs-up the logs data collection database.
backupDatabase () void setDbWorkingState (const bool working)
 Called when a member begins/ends performing operations on the database.
 
void refreshStatsDates ()
bool dbUsable ()
 Weak check on the logs data collection database.
 
+bool checkDataDB ()
 Checks the integrity of the logs data collection database.
 
void refreshStatsDates ()
 Queries the available dates from the db and apply to the tabs.
 
@@ -173,6 +188,34 @@ void setDbWorkingState

MainWindow.

The parent window

Member Function Documentation

+ +

◆ dbUsable()

+ +
+
+ + + + + +
+ + + + + + + +
bool MainWindow::dbUsable ()
+
+private
+
+ +

Weak check on the logs data collection database.

+

Returns true if the database is free (no other process is running that may access it for read/write operations) and it exists

See also
checkDataDB
+ +
+

◆ geometryToString()

@@ -185,7 +228,7 @@ void setDbWorkingState std::string MainWindow::geometryToString ( - ) + ) const @@ -197,7 +240,7 @@ void setDbWorkingState

Converts the window's geometry to string.

-
See also
writeConfigs()
+
See also
writeConfigs()
@@ -213,19 +256,12 @@ void setDbWorkingState std::string MainWindow::list2string ( - const std::vector< std::string > &  - list, + const std::vector< std::string > & list, - const bool  - user_agent = false  - - - - ) - const + const bool user_agent = false ) const @@ -244,7 +280,7 @@ void setDbWorkingState
Returns
The resulting string
-
See also
writeConfigs()
+
See also
writeConfigs()
@@ -260,7 +296,7 @@ void setDbWorkingState void MainWindow::menu_actionEnglishGb_triggered ( - ) + ) @@ -286,7 +322,7 @@ void setDbWorkingState void MainWindow::refreshStatsDates ( - ) + ) @@ -300,6 +336,34 @@ void setDbWorkingState

Queries the available dates from the db and apply to the tabs.

See also
Crapview::refreshDates()
+ + + +

◆ setDialogsLevelFromString()

+ +
+
+ + + + + +
+ + + + + + + +
void MainWindow::setDialogsLevelFromString (const std::string & dialogs_level)
+
+private
+
+ +

Retrieves the dialogs level from the given string.

+
See also
readConfigs()
+
@@ -314,8 +378,7 @@ void setDbWorkingState void MainWindow::setGeometryFromString ( - const std::string &  - geometry) + const std::string & geometry) @@ -327,7 +390,35 @@ void setDbWorkingState

Retrieves the window geometry from the given string.

-
See also
readConfigs()
+
See also
readConfigs()
+ +
+ + +

◆ setWebServerFromString()

+ +
+
+ + + + + +
+ + + + + + + +
void MainWindow::setWebServerFromString (const std::string & web_server)
+
+private
+
+ +

Retrieves the Web Server from the given string.

+
See also
readConfigs()
@@ -343,19 +434,12 @@ void setDbWorkingState std::vector< std::string > MainWindow::string2list ( - const std::string &  - string, + const std::string & string, - const bool  - user_agent = false  - - - - ) - const + const bool user_agent = false ) const @@ -374,7 +458,7 @@ void setDbWorkingState
Returns
The resulting list
-
See also
readConfigs()
+
See also
readConfigs()
@@ -385,7 +469,7 @@ void setDbWorkingState diff --git a/docs/html/classMainWindow.png b/docs/html/classMainWindow.png index 49ef1450..02c66092 100644 Binary files a/docs/html/classMainWindow.png and b/docs/html/classMainWindow.png differ diff --git a/docs/html/classQueryWrapper-members.html b/docs/html/classQueryWrapper-members.html new file mode 100644 index 00000000..9efd70a2 --- /dev/null +++ b/docs/html/classQueryWrapper-members.html @@ -0,0 +1,96 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+
QueryWrapper Member List
+
+
+ +

This is the complete list of members for QueryWrapper, including all inherited members.

+ + + + + + + + + +
dbName() const noexceptQueryWrapperinline
operator()()QueryWrapperinline
operator()(const QString &text)QueryWrapper
operator->() noexceptQueryWrapperinline
operator<<(const char *text) noexceptQueryWrapperinline
operator<<(const QString &text) noexceptQueryWrapperinline
operator[](const int idx) const noexceptQueryWrapperinline
size()QueryWrapper
+ + + + diff --git a/docs/html/classQueryWrapper.html b/docs/html/classQueryWrapper.html new file mode 100644 index 00000000..7000db6c --- /dev/null +++ b/docs/html/classQueryWrapper.html @@ -0,0 +1,217 @@ + + + + + + + +LogDoctor: QueryWrapper Class Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+ +
QueryWrapper Class Referencefinal
+
+
+ +

QueryWrapper. + More...

+ +

#include <database.h>

+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

+QSqlQuery * operator-> () noexcept
 Returns a pointer to the underlying QSqlQuery instance.
 
+void operator<< (const char *text) noexcept
 Appends the given text to the internal statement.
 
+void operator<< (const QString &text) noexcept
 Appends the given text to the internal statement.
 
void operator() ()
 Executes the query using the internal statement.
 
void operator() (const QString &text)
 Executes the query using the given statement.
 
+QVariant operator[] (const int idx) const noexcept
 Returns the query value at the given index of the current record.
 
size_t size ()
 Returns the number of records in the query result.
 
+const QString & dbName () const noexcept
 Returns the name of the associated database.
 
+

Detailed Description

+

QueryWrapper.

+

A wrapper around a QSqlQuery, associated with a database

+

Member Function Documentation

+ +

◆ operator()() [1/2]

+ +
+
+ + + + + +
+ + + + + + + +
void QueryWrapper::operator() ()
+
+inline
+
+ +

Executes the query using the internal statement.

+

Throws in case of failure

Exceptions
+ + +
VoidException
+
+
+ +
+
+ +

◆ operator()() [2/2]

+ +
+
+ + + + + + + +
void QueryWrapper::operator() (const QString & text)
+
+ +

Executes the query using the given statement.

+

Throws in case of failure

Exceptions
+ + +
VoidException
+
+
+ +
+
+ +

◆ size()

+ +
+
+ + + + + + + +
size_t QueryWrapper::size ()
+
+ +

Returns the number of records in the query result.

+

Throws if the query cannot be restored at the initial position

Exceptions
+ + +
DatabaseException
+
+
+ +
+
+
The documentation for this class was generated from the following files:
    +
  • logdoctor/modules/database/database.h
  • +
  • logdoctor/modules/database/database.cpp
  • +
+
+ + + + diff --git a/docs/html/classRelationslLogFieldsListModel-members.html b/docs/html/classRelationslLogFieldsListModel-members.html new file mode 100644 index 00000000..03f3b801 --- /dev/null +++ b/docs/html/classRelationslLogFieldsListModel-members.html @@ -0,0 +1,87 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+
RelationslLogFieldsListModel Member List
+
+
+ +

This is the complete list of members for RelationslLogFieldsListModel, including all inherited members.

+
+ + + + diff --git a/docs/html/classRelationslLogFieldsListModel.html b/docs/html/classRelationslLogFieldsListModel.html new file mode 100644 index 00000000..acb16ceb --- /dev/null +++ b/docs/html/classRelationslLogFieldsListModel.html @@ -0,0 +1,100 @@ + + + + + + + +LogDoctor: RelationslLogFieldsListModel Class Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+ +
RelationslLogFieldsListModel Class Referencefinal
+
+
+
+Inheritance diagram for RelationslLogFieldsListModel:
+
+
+ + +LogFieldsListModel + +
+
The documentation for this class was generated from the following files:
    +
  • logdoctor/customs/models/logfields_listmodel.h
  • +
  • logdoctor/customs/models/logfields_listmodel.cpp
  • +
+
+ + + + diff --git a/docs/html/classRelationslLogFieldsListModel.png b/docs/html/classRelationslLogFieldsListModel.png new file mode 100644 index 00000000..1b6aa9ac Binary files /dev/null and b/docs/html/classRelationslLogFieldsListModel.png differ diff --git a/docs/html/classRichText-members.html b/docs/html/classRichText-members.html index f060ebfc..788fcebd 100644 --- a/docs/html/classRichText-members.html +++ b/docs/html/classRichText-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -77,13 +79,13 @@ $(function() {

This is the complete list of members for RichText, including all inherited members.

- +
enrichLogs(QString &rich_content, const std::string &content, const LogsFormat &logs_format, TextBrowser &TB)RichTextstatic
enrichLogs(QString &rich_content, const std::string &content, const LogsFormat &logs_format, const TextBrowser &TB)RichTextstatic
richLogsDefault(QString &rich_str)RichTextstatic
richLogsFailure(QString &rich_str)RichTextstatic
diff --git a/docs/html/classRichText.html b/docs/html/classRichText.html index 9a91becb..880f6d05 100644 --- a/docs/html/classRichText.html +++ b/docs/html/classRichText.html @@ -3,12 +3,14 @@ - + LogDoctor: RichText Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,12 +76,12 @@ $(function() { -
RichText Class Reference
+
RichText Class Referencefinal

RichText. - More...

+ More...

#include <rtf.h>

@@ -91,13 +93,13 @@ Inheritance diagram for RichText:
- - - - + + + + - +

Static Public Member Functions

static void enrichLogs (QString &rich_content, const std::string &content, const LogsFormat &logs_format, TextBrowser &TB)
 Enriches the content of a log file with HTML/CSS code.
 
static void richLogsDefault (QString &rich_str)
static void enrichLogs (QString &rich_content, const std::string &content, const LogsFormat &logs_format, const TextBrowser &TB)
 Enriches the content of a log file with HTML/CSS code.
 
static void richLogsDefault (QString &rich_str)
 Provides the default string.
 
static void richLogsFailure (QString &rich_str)
static void richLogsFailure (QString &rich_str)
 Provides the failure string.
 
@@ -105,8 +107,8 @@ Static Public Member Functions

RichText.

Utilities for the TextBrowser

Member Function Documentation

- -

◆ enrichLogs()

+ +

◆ enrichLogs()

@@ -117,31 +119,22 @@ Static Public Member Functions void RichText::enrichLogs ( - QString &  - rich_content, + QString & rich_content, - const std::string &  - content, + const std::string & content, - const LogsFormat &  - logs_format, + const LogsFormat & logs_format, - TextBrowser &  - TB  - - - - ) - + const TextBrowser & TB ) @@ -176,8 +169,7 @@ Static Public Member Functions void RichText::richLogsDefault ( - QString &  - rich_str) + QString & rich_str) @@ -210,8 +202,7 @@ Static Public Member Functions void RichText::richLogsFailure ( - QString &  - rich_str) + QString & rich_str) @@ -239,7 +230,7 @@ Static Public Member Functions
diff --git a/docs/html/classRichText.png b/docs/html/classRichText.png index 72dab49a..4ac74349 100644 Binary files a/docs/html/classRichText.png and b/docs/html/classRichText.png differ diff --git a/docs/html/classSHA256-members.html b/docs/html/classSHA256-members.html index ae4ad75e..0d5b36af 100644 --- a/docs/html/classSHA256-members.html +++ b/docs/html/classSHA256-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -79,7 +81,7 @@ $(function() {
diff --git a/docs/html/classSHA256.html b/docs/html/classSHA256.html index d4071c21..e69e7960 100644 --- a/docs/html/classSHA256.html +++ b/docs/html/classSHA256.html @@ -3,12 +3,14 @@ - + LogDoctor: SHA256 Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -83,7 +85,7 @@ $(function() {
diff --git a/docs/html/classSnake-members.html b/docs/html/classSnake-members.html index 34480542..515f45c2 100644 --- a/docs/html/classSnake-members.html +++ b/docs/html/classSnake-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -77,15 +79,15 @@ $(function() {

This is the complete list of members for Snake, including all inherited members.

- + - - + +
direction() constSnake
direction() const noexceptSnake
grow(const bool is_borning)Snakeprivate
inTile(const unsigned x, const unsigned y, const bool avoid_tail=true) constSnake
setDirection(const Direction new_direction)Snake
inTile(const unsigned x, const unsigned y, const bool avoid_tail=true) const noexceptSnake
setDirection(const Direction new_direction) noexceptSnake
update(QGraphicsScene *field_scene=nullptr, const bool dry=false, const bool is_borning=false)Snake
diff --git a/docs/html/classSnake.html b/docs/html/classSnake.html index 06143ee1..1093b990 100644 --- a/docs/html/classSnake.html +++ b/docs/html/classSnake.html @@ -3,12 +3,14 @@ - + LogDoctor: Snake Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -76,7 +78,7 @@ $(function() { Public Member Functions | Private Member Functions | List of all members -
Snake Class Reference
+
Snake Class Referencefinal
@@ -93,18 +95,18 @@ Classes - - - - - - - - - + + + + + + + + + @@ -124,7 +126,7 @@ void  @@ -31,7 +33,7 @@

Public Member Functions

-bool inTile (const unsigned x, const unsigned y, const bool avoid_tail=true) const
 Checks whether is there a part of the snake in the given position.
 
-void setDirection (const Direction new_direction)
 Sets the new direction (of the head)
 
-const Direction & direction () const
 Returns the current direction (of the head)
 
+bool inTile (const unsigned x, const unsigned y, const bool avoid_tail=true) const noexcept
 Checks whether is there a part of the snake in the given position.
 
+void setDirection (const Direction new_direction) noexcept
 Sets the new direction (of the head)
 
+const Direction & direction () const noexcept
 Returns the current direction (of the head)
 
void update (QGraphicsScene *field_scene=nullptr, const bool dry=false, const bool is_borning=false)
 Updates the position and direction of the entire snake.
grow (const bool diff --git a/docs/html/classSnake.png b/docs/html/classSnake.png index 97528776..4f83ecd9 100644 Binary files a/docs/html/classSnake.png and b/docs/html/classSnake.png differ diff --git a/docs/html/classSnakeGame-members.html b/docs/html/classSnakeGame-members.html index 2371109c..6fa1f7d9 100644 --- a/docs/html/classSnakeGame-members.html +++ b/docs/html/classSnakeGame-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@
-
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
- + @@ -80,17 +82,17 @@ $(function() { checkCollision(Snake &snake, Snake &adv_snake, const bool is_adv)SnakeGameprivate foodSnakeGameprivate GameMode enum nameSnakeGameprivate - key_eventsSnakeGameprivate - keyPressEvent(QKeyEvent *event) overrideSnakeGameprivate + key_eventsSnakeGameprivate + keyPressEvent(QKeyEvent *event) noexcept overrideSnakeGameprivate MAX_SNAKE_LENGTHSnakeGameprivate processGameLogic()SnakeGameprivateslot - processNextKeyEvent()SnakeGameprivate + processNextKeyEvent() noexceptSnakeGameprivate snakeSnakeGameprivate updateGameScore()SnakeGameprivate
diff --git a/docs/html/classSnakeGame.html b/docs/html/classSnakeGame.html index 2437b4d2..e29c41b0 100644 --- a/docs/html/classSnakeGame.html +++ b/docs/html/classSnakeGame.html @@ -3,12 +3,14 @@ - + LogDoctor: SnakeGame Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -77,12 +79,12 @@ $(function() { Private Member Functions | Private Attributes | List of all members -
SnakeGame Class Reference
+
SnakeGame Class Referencefinal

Snake. - More...

+ More...

#include <game.h>

@@ -94,11 +96,11 @@ Inheritance diagram for SnakeGame:
- - +

Private Types

enum class  GameMode { Classic -, Hunt -, Battle +
enum class  GameMode { Classic +, Hunt +, Battle }
 Enumerates the available game modes. More...
 Enumerates the available game modes. More...
 

@@ -110,14 +112,14 @@ void 

processGameLogic
- - - - - - + + + + + + +void 

Private Member Functions

void keyPressEvent (QKeyEvent *event) override
 Stores the valid key events in a queue.
 
void processNextKeyEvent ()
 Processes the key events in the queue.
 
void keyPressEvent (QKeyEvent *event) noexcept override
 Stores the valid key events in a queue.
 
void processNextKeyEvent () noexcept
 Processes the key events in the queue.
 
-void checkCollision (Snake &snake, Snake &adv_snake, const bool is_adv)
checkCollision (Snake &snake, Snake &adv_snake, const bool is_adv)
 Checks if a snake will collide with another entity.
 
@@ -127,10 +129,10 @@ void updateGameScore (
- - - + + + @@ -158,7 +160,7 @@ const size_t  @@ -181,8 +183,8 @@ const size_t  - - +

Private Attributes

-std::queue< unsigned short > key_events
 Stores the key events.
 
+std::queue< Direction > key_events
 Stores the key events.
 
const size_t MAX_SNAKE_LENGTH { 64 }
 The maximum length of the snake.
MAX_SNAKE_LEN - +
enum class SnakeGame::GameModeenum class SnakeGame::GameMode
MAX_SNAKE_LEN

Member Function Documentation

- -

◆ keyPressEvent()

+ +

◆ keyPressEvent()

@@ -193,25 +195,24 @@ const size_t 
MAX_SNAKE_LEN
void SnakeGame::keyPressEvent (QKeyEvent * event)QKeyEvent * event)
-overrideprivate +overrideprivatenoexcept

Stores the valid key events in a queue.

-

Valid keys are UP/DOWN/LEFT/RIGHT arrows and W/S/A/D letters

See also
key_events, processNextKeyEvent()
+

Valid keys are UP/DOWN/LEFT/RIGHT arrows and W/S/A/D letters

See also
key_events, processNextKeyEvent()
- -

◆ processNextKeyEvent()

+ +

◆ processNextKeyEvent()

@@ -222,19 +223,19 @@ const size_t MAX_SNAKE_LEN void SnakeGame::processNextKeyEvent ( - ) + ) -private +privatenoexcept

Processes the key events in the queue.

-
See also
key_events, keyPressEvent()
+
See also
key_events, keyPressEvent()
@@ -245,7 +246,7 @@ const size_t MAX_SNAKE_LEN diff --git a/docs/html/classSnakeGame.png b/docs/html/classSnakeGame.png index 5d5b9e73..af97ebd2 100644 Binary files a/docs/html/classSnakeGame.png and b/docs/html/classSnakeGame.png differ diff --git a/docs/html/classTR-members.html b/docs/html/classTR-members.html index 70ff747f..31941242 100644 --- a/docs/html/classTR-members.html +++ b/docs/html/classTR-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -79,7 +81,7 @@ $(function() { diff --git a/docs/html/classTR.html b/docs/html/classTR.html index 6a2a85aa..9e9e5c60 100644 --- a/docs/html/classTR.html +++ b/docs/html/classTR.html @@ -3,12 +3,14 @@ - + LogDoctor: TR Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -73,12 +75,12 @@ $(function() {
-
TR Class Reference
+
TR Class Referencefinal

TR. - More...

+ More...

#include <shared.h>

@@ -90,14 +92,13 @@ Inheritance diagram for TR:

Detailed Description

TR.

Fictitious class for the translations

-

The documentation for this class was generated from the following files:
    +

The documentation for this class was generated from the following file:
  • logdoctor/modules/shared.h
  • -
  • logdoctor/modules/shared.cpp
diff --git a/docs/html/classTR.png b/docs/html/classTR.png index 528759ec..ef5ff273 100644 Binary files a/docs/html/classTR.png and b/docs/html/classTR.png differ diff --git a/docs/html/classTextBrowser-members.html b/docs/html/classTextBrowser-members.html index f7969e6f..45425a78 100644 --- a/docs/html/classTextBrowser-members.html +++ b/docs/html/classTextBrowser-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -77,19 +79,19 @@ $(function() {

This is the complete list of members for TextBrowser, including all inherited members.

- - - - - - - - - + + + + + + + + +
getColorScheme() constTextBrowser
getColorSchemeID() constTextBrowser
getFont() constTextBrowser
getFontFamily() constTextBrowser
getWideLinesUsage() constTextBrowser
makePreview(QString &content) constTextBrowser
setColorScheme(const int &color_scheme_id, const std::unordered_map< std::string, QString > &color_scheme)TextBrowser
setFont(const QFont &font)TextBrowser
setWideLinesUsage(const bool &use_wide_lines)TextBrowser
getColorScheme() const noexceptTextBrowser
getColorSchemeID() const noexceptTextBrowser
getFont() const noexceptTextBrowser
getFontFamily() const noexceptTextBrowser
getWideLinesUsage() const noexceptTextBrowser
makePreview(QString &content) const noexceptTextBrowser
setColorScheme(const ColorsScheme colors_scheme_id, const std::unordered_map< std::string, QString > &colors_scheme) noexceptTextBrowser
setFont(const QFont &font) noexceptTextBrowser
setWideLinesUsage(const bool use_wide_lines) noexceptTextBrowser
diff --git a/docs/html/classTextBrowser.html b/docs/html/classTextBrowser.html index e71d9aa3..5d6fce9a 100644 --- a/docs/html/classTextBrowser.html +++ b/docs/html/classTextBrowser.html @@ -3,12 +3,14 @@ - + LogDoctor: TextBrowser Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,71 +76,78 @@ $(function() { -
TextBrowser Class Reference
+
TextBrowser Class Referencefinal

TextBrowser. - More...

+ More...

#include <tb.h>

- - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

-bool getWideLinesUsage () const
 Returns whether the wide lines option is set to be used or not.
 
-int getColorSchemeID () const
 Returns the ID of the color scheme in use.
 
-const std::unordered_map< std::string, QString > & getColorScheme () const
 Returns the color scheme in use.
 
-const QString & getFontFamily () const
 Returns the family of the font in use.
 
-const QFont & getFont () const
 Returns the font in use.
 
-void setWideLinesUsage (const bool &use_wide_lines)
 Sets whether to use wide lines or not.
 
-void setColorScheme (const int &color_scheme_id, const std::unordered_map< std::string, QString > &color_scheme)
 Stes the given color scheme as the one in use.
 
-void setFont (const QFont &font)
 Sets the given font as the one in use.
 
void makePreview (QString &content) const
 Builds the preview which will be shown in the configs tab.
 
+bool getWideLinesUsage () const noexcept
 Returns whether the wide lines option is set to be used or not.
 
+ColorsScheme getColorSchemeID () const noexcept
 Returns the ID of the color scheme in use.
 
+const std::unordered_map< std::string, QString > & getColorScheme () const noexcept
 Returns the color scheme in use.
 
+const QString & getFontFamily () const noexcept
 Returns the family of the font in use.
 
+const QFont & getFont () const noexcept
 Returns the font in use.
 
+void setWideLinesUsage (const bool use_wide_lines) noexcept
 Sets whether to use wide lines or not.
 
+void setColorScheme (const ColorsScheme colors_scheme_id, const std::unordered_map< std::string, QString > &colors_scheme) noexcept
 Stes the given color scheme as the one in use.
 
+void setFont (const QFont &font) noexcept
 Sets the given font as the one in use.
 
void makePreview (QString &content) const noexcept
 Builds the preview which will be shown in the configs tab.
 

Detailed Description

TextBrowser.

Perform operations for files visualization

Member Function Documentation

- -

◆ makePreview()

+ +

◆ makePreview()

+ + + + + +
- - +
void TextBrowser::makePreview (QString & content)QString & content) const
+
+noexcept

Builds the preview which will be shown in the configs tab.

@@ -158,7 +167,7 @@ void setFont (const QF
diff --git a/docs/html/classWebServerException.html b/docs/html/classVoidException.html similarity index 75% rename from docs/html/classWebServerException.html rename to docs/html/classVoidException.html index e5386226..e511686a 100644 --- a/docs/html/classWebServerException.html +++ b/docs/html/classVoidException.html @@ -3,12 +3,14 @@ - + -LogDoctor: WebServerException Class Reference +LogDoctor: VoidException Class Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -71,33 +73,24 @@ $(function() {
- -
WebServerException Class Reference
+
VoidException Class Reference
-

WebServerException. - More...

+

VoidException. + More...

#include <exceptions.h>

-
-Inheritance diagram for WebServerException:
-
-
- -

Detailed Description

-

WebServerException.

-

Exception related to a Web Server

-

The documentation for this class was generated from the following files:
    +

    VoidException.

    +

    Base class for some internal exceptions. Used when a message has already been shown, or there is no need to show one.

    +

    The documentation for this class was generated from the following file:
    • logdoctor/modules/exceptions.h
    • -
    • logdoctor/modules/exceptions.cpp
diff --git a/docs/html/classWebServerException.png b/docs/html/classWebServerException.png deleted file mode 100644 index 214e6aab..00000000 Binary files a/docs/html/classWebServerException.png and /dev/null differ diff --git a/docs/html/classZippedArrays-members.html b/docs/html/classZippedArrays-members.html new file mode 100644 index 00000000..2ae94682 --- /dev/null +++ b/docs/html/classZippedArrays-members.html @@ -0,0 +1,87 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+
ZippedArrays< Array > Member List
+
+
+ +

This is the complete list of members for ZippedArrays< Array >, including all inherited members.

+
+ + + + diff --git a/docs/html/classZippedArrays.html b/docs/html/classZippedArrays.html new file mode 100644 index 00000000..77f5fe5f --- /dev/null +++ b/docs/html/classZippedArrays.html @@ -0,0 +1,90 @@ + + + + + + + +LogDoctor: ZippedArrays< Array > Class Template Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+ +
ZippedArrays< Array > Class Template Reference
+
+
+
The documentation for this class was generated from the following file:
    +
  • logdoctor/utilities/arrays.h
  • +
+
+ + + + diff --git a/docs/html/classes.html b/docs/html/classes.html index 799ded01..300e4d92 100644 --- a/docs/html/classes.html +++ b/docs/html/classes.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Index + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,49 +76,64 @@ $(function() {
Class Index
-
B | C | D | F | G | H | L | M | R | S | T | W
+
B | C | D | E | F | G | H | L | M | P | Q | R | S | T | V | W | Z
diff --git a/docs/html/clipboard.js b/docs/html/clipboard.js new file mode 100644 index 00000000..42c1fb0e --- /dev/null +++ b/docs/html/clipboard.js @@ -0,0 +1,61 @@ +/** + +The code below is based on the Doxygen Awesome project, see +https://github.com/jothepro/doxygen-awesome-css + +MIT License + +Copyright (c) 2021 - 2022 jothepro + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +let clipboard_title = "Copy to clipboard" +let clipboard_icon = `` +let clipboard_successIcon = `` +let clipboard_successDuration = 1000 + +$(function() { + if(navigator.clipboard) { + const fragments = document.getElementsByClassName("fragment") + for(const fragment of fragments) { + const clipboard_div = document.createElement("div") + clipboard_div.classList.add("clipboard") + clipboard_div.innerHTML = clipboard_icon + clipboard_div.title = clipboard_title + $(clipboard_div).click(function() { + const content = this.parentNode.cloneNode(true) + // filter out line number and folded fragments from file listings + content.querySelectorAll(".lineno, .ttc, .foldclosed").forEach((node) => { node.remove() }) + let text = content.textContent + // remove trailing newlines and trailing spaces from empty lines + text = text.replace(/^\s*\n/gm,'\n').replace(/\n*$/,'') + navigator.clipboard.writeText(text); + this.classList.add("success") + this.innerHTML = clipboard_successIcon + window.setTimeout(() => { // switch back to normal icon after timeout + this.classList.remove("success") + this.innerHTML = clipboard_icon + }, clipboard_successDuration); + }) + fragment.insertBefore(clipboard_div, fragment.firstChild) + } + } +}) diff --git a/docs/html/cookie.js b/docs/html/cookie.js new file mode 100644 index 00000000..53ad21d9 --- /dev/null +++ b/docs/html/cookie.js @@ -0,0 +1,58 @@ +/*! + Cookie helper functions + Copyright (c) 2023 Dimitri van Heesch + Released under MIT license. +*/ +let Cookie = { + cookie_namespace: 'doxygen_', + + readSetting(cookie,defVal) { + if (window.chrome) { + const val = localStorage.getItem(this.cookie_namespace+cookie) || + sessionStorage.getItem(this.cookie_namespace+cookie); + if (val) return val; + } else { + let myCookie = this.cookie_namespace+cookie+"="; + if (document.cookie) { + const index = document.cookie.indexOf(myCookie); + if (index != -1) { + const valStart = index + myCookie.length; + let valEnd = document.cookie.indexOf(";", valStart); + if (valEnd == -1) { + valEnd = document.cookie.length; + } + return document.cookie.substring(valStart, valEnd); + } + } + } + return defVal; + }, + + writeSetting(cookie,val,days=10*365) { // default days='forever', 0=session cookie, -1=delete + if (window.chrome) { + if (days==0) { + sessionStorage.setItem(this.cookie_namespace+cookie,val); + } else { + localStorage.setItem(this.cookie_namespace+cookie,val); + } + } else { + let date = new Date(); + date.setTime(date.getTime()+(days*24*60*60*1000)); + const expiration = days!=0 ? "expires="+date.toGMTString()+";" : ""; + document.cookie = this.cookie_namespace + cookie + "=" + + val + "; SameSite=Lax;" + expiration + "path=/"; + } + }, + + eraseSetting(cookie) { + if (window.chrome) { + if (localStorage.getItem(this.cookie_namespace+cookie)) { + localStorage.removeItem(this.cookie_namespace+cookie); + } else if (sessionStorage.getItem(this.cookie_namespace+cookie)) { + sessionStorage.removeItem(this.cookie_namespace+cookie); + } + } else { + this.writeSetting(cookie,'',-1); + } + }, +} diff --git a/docs/html/dir_01fec9b22571a82eb07ead4e65bff8c5.html b/docs/html/dir_01fec9b22571a82eb07ead4e65bff8c5.html index 675c2ef3..02a88df0 100644 --- a/docs/html/dir_01fec9b22571a82eb07ead4e65bff8c5.html +++ b/docs/html/dir_01fec9b22571a82eb07ead4e65bff8c5.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/modules/dialogs Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -81,7 +83,7 @@ $(function() { diff --git a/docs/html/dir_04e1f2400eed58ce238b4e46b2304549.html b/docs/html/dir_04e1f2400eed58ce238b4e46b2304549.html index f5a25703..de030283 100644 --- a/docs/html/dir_04e1f2400eed58ce238b4e46b2304549.html +++ b/docs/html/dir_04e1f2400eed58ce238b4e46b2304549.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/tools/crapnote Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -78,10 +80,16 @@ $(function() {
crapnote Directory Reference
+ + + + +

+Directories

 modules
 
diff --git a/docs/html/dir_0b2945b0d42401f508318991d330c382.html b/docs/html/dir_0b2945b0d42401f508318991d330c382.html new file mode 100644 index 00000000..6214bbda --- /dev/null +++ b/docs/html/dir_0b2945b0d42401f508318991d330c382.html @@ -0,0 +1,89 @@ + + + + + + + +LogDoctor: logdoctor/tools/crappath Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
crappath Directory Reference
+
+
+
+ + + + diff --git a/docs/html/dir_166af4970eb35776782da3373b1769ca.html b/docs/html/dir_166af4970eb35776782da3373b1769ca.html index 4eb726fa..92dc8f4b 100644 --- a/docs/html/dir_166af4970eb35776782da3373b1769ca.html +++ b/docs/html/dir_166af4970eb35776782da3373b1769ca.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/modules Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -81,6 +83,10 @@ $(function() { + + + + @@ -91,13 +97,17 @@ Directories + + + +

Directories

 blacklists
 
 changelog
 
 craphelp
 
 crapinfo
 
 crapview
 
 database
 
 dialogs
 
 warnlists
 
diff --git a/docs/html/dir_207111a21097e13d4b6980b9c3b2cb3f.html b/docs/html/dir_207111a21097e13d4b6980b9c3b2cb3f.html index 7217f3bb..95dbc32a 100644 --- a/docs/html/dir_207111a21097e13d4b6980b9c3b2cb3f.html +++ b/docs/html/dir_207111a21097e13d4b6980b9c3b2cb3f.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/modules/crapinfo/modules Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -81,7 +83,7 @@ $(function() { diff --git a/docs/html/dir_2a11e7ed8d1e2ade9e7f2856b2d0ea57.html b/docs/html/dir_2a11e7ed8d1e2ade9e7f2856b2d0ea57.html index d871111d..13dc5dde 100644 --- a/docs/html/dir_2a11e7ed8d1e2ade9e7f2856b2d0ea57.html +++ b/docs/html/dir_2a11e7ed8d1e2ade9e7f2856b2d0ea57.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/globals Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -81,7 +83,7 @@ $(function() { diff --git a/docs/html/dir_2ef329c049701099eb049ebc9f51b946.html b/docs/html/dir_2ef329c049701099eb049ebc9f51b946.html index f9d8efe8..34ad1bad 100644 --- a/docs/html/dir_2ef329c049701099eb049ebc9f51b946.html +++ b/docs/html/dir_2ef329c049701099eb049ebc9f51b946.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/games/snake/modules Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -81,7 +83,7 @@ $(function() { diff --git a/docs/html/dir_3a0bb91303b349fae8fa9b3a632cefff.html b/docs/html/dir_3a0bb91303b349fae8fa9b3a632cefff.html index 5daae4a2..8f14eb90 100644 --- a/docs/html/dir_3a0bb91303b349fae8fa9b3a632cefff.html +++ b/docs/html/dir_3a0bb91303b349fae8fa9b3a632cefff.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/games Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -89,7 +91,7 @@ Directories diff --git a/docs/html/dir_3a58e609366573e7d8347a5d5e4da9c0.html b/docs/html/dir_3a58e609366573e7d8347a5d5e4da9c0.html index 8676da73..5e53b098 100644 --- a/docs/html/dir_3a58e609366573e7d8347a5d5e4da9c0.html +++ b/docs/html/dir_3a58e609366573e7d8347a5d5e4da9c0.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/games/crisscross/modules Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -81,7 +83,7 @@ $(function() { diff --git a/docs/html/dir_4216b1c8c447536616ff22cc879c2748.html b/docs/html/dir_4216b1c8c447536616ff22cc879c2748.html index 800c7ab5..ee46903a 100644 --- a/docs/html/dir_4216b1c8c447536616ff22cc879c2748.html +++ b/docs/html/dir_4216b1c8c447536616ff22cc879c2748.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/games/snake Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -87,7 +89,7 @@ Directories diff --git a/docs/html/dir_57ca74fa262fbaade1ff2ea5ffd51c9a.html b/docs/html/dir_57ca74fa262fbaade1ff2ea5ffd51c9a.html new file mode 100644 index 00000000..41dc6edc --- /dev/null +++ b/docs/html/dir_57ca74fa262fbaade1ff2ea5ffd51c9a.html @@ -0,0 +1,89 @@ + + + + + + + +LogDoctor: logdoctor/modules/blacklists/modules Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
modules Directory Reference
+
+
+
+ + + + diff --git a/docs/html/dir_64ab1cdb8c5cdc072070fa7afc65bdf3.html b/docs/html/dir_64ab1cdb8c5cdc072070fa7afc65bdf3.html index d3a0f2ef..e796744b 100644 --- a/docs/html/dir_64ab1cdb8c5cdc072070fa7afc65bdf3.html +++ b/docs/html/dir_64ab1cdb8c5cdc072070fa7afc65bdf3.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/modules/crapview Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -87,7 +89,7 @@ Directories diff --git a/docs/html/dir_67954b59ee47ddf9c2e22fde879dcd80.html b/docs/html/dir_67954b59ee47ddf9c2e22fde879dcd80.html new file mode 100644 index 00000000..a429dcf8 --- /dev/null +++ b/docs/html/dir_67954b59ee47ddf9c2e22fde879dcd80.html @@ -0,0 +1,89 @@ + + + + + + + +LogDoctor: logdoctor/modules/warnlists/modules Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
modules Directory Reference
+
+
+
+ + + + diff --git a/docs/html/dir_7445445f1643ef41aafc7f4f0499cff7.html b/docs/html/dir_7445445f1643ef41aafc7f4f0499cff7.html index 8e251806..74290945 100644 --- a/docs/html/dir_7445445f1643ef41aafc7f4f0499cff7.html +++ b/docs/html/dir_7445445f1643ef41aafc7f4f0499cff7.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/modules/craplog/modules Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -87,7 +89,7 @@ Directories diff --git a/docs/html/dir_7cd0ceaf2658a97b0f7fba0138ff1b04.html b/docs/html/dir_7cd0ceaf2658a97b0f7fba0138ff1b04.html index 34d86831..7b8147a6 100644 --- a/docs/html/dir_7cd0ceaf2658a97b0f7fba0138ff1b04.html +++ b/docs/html/dir_7cd0ceaf2658a97b0f7fba0138ff1b04.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/tools Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -83,11 +85,13 @@ $(function() { Directories  crapnote   + crappath diff --git a/docs/html/dir_89e090ef9a1797a727043bd31c22de25.html b/docs/html/dir_89e090ef9a1797a727043bd31c22de25.html index 2099451c..a007d507 100644 --- a/docs/html/dir_89e090ef9a1797a727043bd31c22de25.html +++ b/docs/html/dir_89e090ef9a1797a727043bd31c22de25.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/modules/crapup Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -87,7 +89,7 @@ Directories diff --git a/docs/html/dir_8dd979417119b54218f1f79b81aeb7f8.html b/docs/html/dir_8dd979417119b54218f1f79b81aeb7f8.html new file mode 100644 index 00000000..f90e4557 --- /dev/null +++ b/docs/html/dir_8dd979417119b54218f1f79b81aeb7f8.html @@ -0,0 +1,89 @@ + + + + + + + +LogDoctor: logdoctor/tools/crapnote/modules Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
modules Directory Reference
+
+
+
+ + + + diff --git a/docs/html/dir_8ebefac94c61e55715c048a6831f432d.html b/docs/html/dir_8ebefac94c61e55715c048a6831f432d.html index a3a35e7e..88ed9f91 100644 --- a/docs/html/dir_8ebefac94c61e55715c048a6831f432d.html +++ b/docs/html/dir_8ebefac94c61e55715c048a6831f432d.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/modules/crapup/modules Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -81,7 +83,7 @@ $(function() { diff --git a/docs/html/dir_9435ca5cf080eab6f8746f45b27d7231.html b/docs/html/dir_9435ca5cf080eab6f8746f45b27d7231.html index 743c28d4..0debe9ea 100644 --- a/docs/html/dir_9435ca5cf080eab6f8746f45b27d7231.html +++ b/docs/html/dir_9435ca5cf080eab6f8746f45b27d7231.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/games/crisscross Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -87,7 +89,7 @@ Directories diff --git a/docs/html/dir_95afeb94b45e011c2c5ca8a56bc70059.html b/docs/html/dir_95afeb94b45e011c2c5ca8a56bc70059.html new file mode 100644 index 00000000..e95c0890 --- /dev/null +++ b/docs/html/dir_95afeb94b45e011c2c5ca8a56bc70059.html @@ -0,0 +1,95 @@ + + + + + + + +LogDoctor: logdoctor/modules/changelog Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
changelog Directory Reference
+
+
+ + + + +

+Directories

 modules
 
+
+ + + + diff --git a/docs/html/dir_a74e11123a295a4e318d334da8a4cfdc.html b/docs/html/dir_a74e11123a295a4e318d334da8a4cfdc.html index 98616e37..bb9ef28e 100644 --- a/docs/html/dir_a74e11123a295a4e318d334da8a4cfdc.html +++ b/docs/html/dir_a74e11123a295a4e318d334da8a4cfdc.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -83,8 +85,6 @@ $(function() { Directories  customs   - defines games    globals @@ -99,7 +99,7 @@ Directories diff --git a/docs/html/dir_aefa70d5835bf2f969448f72963649c1.html b/docs/html/dir_aefa70d5835bf2f969448f72963649c1.html index 04457d7b..a7a6c006 100644 --- a/docs/html/dir_aefa70d5835bf2f969448f72963649c1.html +++ b/docs/html/dir_aefa70d5835bf2f969448f72963649c1.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/modules/craplog Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -87,7 +89,7 @@ Directories diff --git a/docs/html/dir_b0c24e8b7a918e3b5567c6f1ec673ccb.html b/docs/html/dir_b0c24e8b7a918e3b5567c6f1ec673ccb.html index 03ea036f..ccc05172 100644 --- a/docs/html/dir_b0c24e8b7a918e3b5567c6f1ec673ccb.html +++ b/docs/html/dir_b0c24e8b7a918e3b5567c6f1ec673ccb.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/modules/craplog/modules/workers Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -78,10 +80,16 @@ $(function() {
workers Directory Reference
+ + + + +

+Directories

 impl
 
diff --git a/docs/html/dir_b6252024f481e722d6b2901bb7fca39c.html b/docs/html/dir_b6252024f481e722d6b2901bb7fca39c.html new file mode 100644 index 00000000..6c15bb8c --- /dev/null +++ b/docs/html/dir_b6252024f481e722d6b2901bb7fca39c.html @@ -0,0 +1,89 @@ + + + + + + + +LogDoctor: logdoctor/modules/craplog/modules/workers/impl Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
impl Directory Reference
+
+
+
+ + + + diff --git a/docs/html/dir_b7610c71fd3387c1581ad37fc5d3235c.html b/docs/html/dir_b7610c71fd3387c1581ad37fc5d3235c.html index 1e970ff7..2cd0e0d0 100644 --- a/docs/html/dir_b7610c71fd3387c1581ad37fc5d3235c.html +++ b/docs/html/dir_b7610c71fd3387c1581ad37fc5d3235c.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/utilities Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -81,7 +83,7 @@ $(function() { diff --git a/docs/html/dir_b8dec9dcdfad2e15b4737f1776b90530.html b/docs/html/dir_b8dec9dcdfad2e15b4737f1776b90530.html index 02029bb9..ed5dfec3 100644 --- a/docs/html/dir_b8dec9dcdfad2e15b4737f1776b90530.html +++ b/docs/html/dir_b8dec9dcdfad2e15b4737f1776b90530.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/tests Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -81,7 +83,7 @@ $(function() { diff --git a/docs/html/dir_bd0b3fdb9d3141a0d22a74c2c6a59ffc.html b/docs/html/dir_bd0b3fdb9d3141a0d22a74c2c6a59ffc.html index ef4fd952..8c34f51d 100644 --- a/docs/html/dir_bd0b3fdb9d3141a0d22a74c2c6a59ffc.html +++ b/docs/html/dir_bd0b3fdb9d3141a0d22a74c2c6a59ffc.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/modules/crapview/modules Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -81,7 +83,7 @@ $(function() { diff --git a/docs/html/dir_c94d4a9946d52ee1a5c0908d1e22de24.html b/docs/html/dir_c94d4a9946d52ee1a5c0908d1e22de24.html new file mode 100644 index 00000000..03942202 --- /dev/null +++ b/docs/html/dir_c94d4a9946d52ee1a5c0908d1e22de24.html @@ -0,0 +1,89 @@ + + + + + + + +LogDoctor: logdoctor/modules/changelog/modules Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
modules Directory Reference
+
+
+
+ + + + diff --git a/docs/html/dir_da69750a55fc3d82348ed49a1aabbb69.html b/docs/html/dir_da69750a55fc3d82348ed49a1aabbb69.html new file mode 100644 index 00000000..6aa5d3dc --- /dev/null +++ b/docs/html/dir_da69750a55fc3d82348ed49a1aabbb69.html @@ -0,0 +1,95 @@ + + + + + + + +LogDoctor: logdoctor/modules/blacklists Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
blacklists Directory Reference
+
+
+ + + + +

+Directories

 modules
 
+
+ + + + diff --git a/docs/html/dir_ddde8a31807f7acc3ab9e1a37d6673de.html b/docs/html/dir_ddde8a31807f7acc3ab9e1a37d6673de.html new file mode 100644 index 00000000..ae1ec543 --- /dev/null +++ b/docs/html/dir_ddde8a31807f7acc3ab9e1a37d6673de.html @@ -0,0 +1,89 @@ + + + + + + + +LogDoctor: logdoctor/modules/database Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
database Directory Reference
+
+
+
+ + + + diff --git a/docs/html/dir_df1d1845b150ef57194b5115e0860e37.html b/docs/html/dir_df1d1845b150ef57194b5115e0860e37.html new file mode 100644 index 00000000..60b783c9 --- /dev/null +++ b/docs/html/dir_df1d1845b150ef57194b5115e0860e37.html @@ -0,0 +1,95 @@ + + + + + + + +LogDoctor: logdoctor/modules/warnlists Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
warnlists Directory Reference
+
+
+ + + + +

+Directories

 modules
 
+
+ + + + diff --git a/docs/html/dir_ac487f8ff3f18c21415d76e070583f81.html b/docs/html/dir_eb898debc1846d0fbddf9d34095cf5cd.html similarity index 83% rename from docs/html/dir_ac487f8ff3f18c21415d76e070583f81.html rename to docs/html/dir_eb898debc1846d0fbddf9d34095cf5cd.html index 7c0b5c2d..16bfe910 100644 --- a/docs/html/dir_ac487f8ff3f18c21415d76e070583f81.html +++ b/docs/html/dir_eb898debc1846d0fbddf9d34095cf5cd.html @@ -3,12 +3,14 @@ - + -LogDoctor: logdoctor/defines Directory Reference +LogDoctor: logdoctor/customs/models Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -71,17 +73,17 @@ $(function() {
-
defines Directory Reference
+
models Directory Reference
diff --git a/docs/html/dir_eed7e567d564c10631ac4772551893e5.html b/docs/html/dir_eed7e567d564c10631ac4772551893e5.html index 92021416..a01fd691 100644 --- a/docs/html/dir_eed7e567d564c10631ac4772551893e5.html +++ b/docs/html/dir_eed7e567d564c10631ac4772551893e5.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/modules/crapinfo Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -87,7 +89,7 @@ Directories diff --git a/docs/html/dir_f365f8d8c9b76858e6c828f1b6d47223.html b/docs/html/dir_f365f8d8c9b76858e6c828f1b6d47223.html index 354e9f46..46853d1b 100644 --- a/docs/html/dir_f365f8d8c9b76858e6c828f1b6d47223.html +++ b/docs/html/dir_f365f8d8c9b76858e6c828f1b6d47223.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/customs Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -78,10 +80,16 @@ $(function() {
customs Directory Reference
+ + + + +

+Directories

 models
 
diff --git a/docs/html/dir_fc12ceffd2563856433d7c178b8ff976.html b/docs/html/dir_fc12ceffd2563856433d7c178b8ff976.html index 4247b7ec..a6d1378c 100644 --- a/docs/html/dir_fc12ceffd2563856433d7c178b8ff976.html +++ b/docs/html/dir_fc12ceffd2563856433d7c178b8ff976.html @@ -3,12 +3,14 @@ - + LogDoctor: logdoctor/modules/craphelp Directory Reference + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -81,7 +83,7 @@ $(function() { diff --git a/docs/html/doxygen.css b/docs/html/doxygen.css index 009a9b55..7b7d851b 100644 --- a/docs/html/doxygen.css +++ b/docs/html/doxygen.css @@ -1,4 +1,4 @@ -/* The standard CSS for doxygen 1.9.8*/ +/* The standard CSS for doxygen 1.10.0*/ html { /* page base colors */ @@ -145,6 +145,7 @@ html { --fragment-lineno-link-bg-color: #D8D8D8; --fragment-lineno-link-hover-fg-color: #4665A2; --fragment-lineno-link-hover-bg-color: #C8C8C8; +--fragment-copy-ok-color: #2EC82E; --tooltip-foreground-color: black; --tooltip-background-color: white; --tooltip-border-color: gray; @@ -168,6 +169,28 @@ html { --font-family-icon: Arial,Helvetica; --font-family-tooltip: Roboto,sans-serif; +/** special sections */ +--warning-color-bg: #f8d1cc; +--warning-color-hl: #b61825; +--warning-color-text: #75070f; +--note-color-bg: #faf3d8; +--note-color-hl: #f3a600; +--note-color-text: #5f4204; +--todo-color-bg: #e4f3ff; +--todo-color-hl: #1879C4; +--todo-color-text: #274a5c; +--test-color-bg: #e8e8ff; +--test-color-hl: #3939C4; +--test-color-text: #1a1a5c; +--deprecated-color-bg: #ecf0f3; +--deprecated-color-hl: #5b6269; +--deprecated-color-text: #43454a; +--bug-color-bg: #e4dafd; +--bug-color-hl: #5b2bdd; +--bug-color-text: #2a0d72; +--invariant-color-bg: #d8f1e3; +--invariant-color-hl: #44b86f; +--invariant-color-text: #265532; } @media (prefers-color-scheme: dark) { @@ -309,7 +332,7 @@ html { --code-link-color: #79C0FF; --code-external-link-color: #79C0FF; --fragment-foreground-color: #C9D1D9; ---fragment-background-color: black; +--fragment-background-color: #090D16; --fragment-border-color: #30363D; --fragment-lineno-border-color: #30363D; --fragment-lineno-background-color: black; @@ -318,6 +341,7 @@ html { --fragment-lineno-link-bg-color: #303030; --fragment-lineno-link-hover-fg-color: #8E96A1; --fragment-lineno-link-hover-bg-color: #505050; +--fragment-copy-ok-color: #0EA80E; --tooltip-foreground-color: #C9D1D9; --tooltip-background-color: #202020; --tooltip-border-color: #C9D1D9; @@ -341,6 +365,28 @@ html { --font-family-icon: Arial,Helvetica; --font-family-tooltip: Roboto,sans-serif; +/** special sections */ +--warning-color-bg: #2e1917; +--warning-color-hl: #ad2617; +--warning-color-text: #f5b1aa; +--note-color-bg: #3b2e04; +--note-color-hl: #f1b602; +--note-color-text: #ceb670; +--todo-color-bg: #163750; +--todo-color-hl: #1982D2; +--todo-color-text: #dcf0fa; +--test-color-bg: #121258; +--test-color-hl: #4242cf; +--test-color-text: #c0c0da; +--deprecated-color-bg: #2e323b; +--deprecated-color-hl: #738396; +--deprecated-color-text: #abb0bd; +--bug-color-bg: #2a2536; +--bug-color-hl: #7661b3; +--bug-color-text: #ae9ed6; +--invariant-color-bg: #303a35; +--invariant-color-hl: #76ce96; +--invariant-color-text: #cceed5; }} body { background-color: var(--page-background-color); @@ -357,8 +403,6 @@ body, table, div, p, dl { /* @group Heading Levels */ .title { - font-weight: 400; - font-size: 14px; font-family: var(--font-family-normal); line-height: 28px; font-size: 150%; @@ -556,7 +600,13 @@ a { } a:hover { - text-decoration: underline; + text-decoration: none; + background: linear-gradient(to bottom, transparent 0,transparent calc(100% - 1px), currentColor 100%); +} + +a:hover > span.arrow { + text-decoration: none; + background : var(--nav-background-color); } a.el { @@ -632,30 +682,63 @@ ul.multicol { .fragment { text-align: left; direction: ltr; - overflow-x: auto; /*Fixed: fragment lines overlap floating elements*/ + overflow-x: auto; overflow-y: hidden; + position: relative; + min-height: 12px; + margin: 10px 0px; + padding: 10px 10px; + border: 1px solid var(--fragment-border-color); + border-radius: 4px; + background-color: var(--fragment-background-color); + color: var(--fragment-foreground-color); } pre.fragment { - border: 1px solid var(--fragment-border-color); - background-color: var(--fragment-background-color); - color: var(--fragment-foreground-color); - padding: 4px 6px; - margin: 4px 8px 4px 2px; - overflow: auto; - word-wrap: break-word; - font-size: 9pt; - line-height: 125%; - font-family: var(--font-family-monospace); - font-size: 105%; + word-wrap: break-word; + font-size: 10pt; + line-height: 125%; + font-family: var(--font-family-monospace); } -div.fragment { - padding: 0 0 1px 0; /*Fixed: last line underline overlap border*/ - margin: 4px 8px 4px 2px; - color: var(--fragment-foreground-color); - background-color: var(--fragment-background-color); - border: 1px solid var(--fragment-border-color); +.clipboard { + width: 24px; + height: 24px; + right: 5px; + top: 5px; + opacity: 0; + position: absolute; + display: inline; + overflow: auto; + fill: var(--fragment-foreground-color); + justify-content: center; + align-items: center; + cursor: pointer; +} + +.clipboard.success { + border: 1px solid var(--fragment-foreground-color); + border-radius: 4px; +} + +.fragment:hover .clipboard, .clipboard.success { + opacity: .28; +} + +.clipboard:hover, .clipboard.success { + opacity: 1 !important; +} + +.clipboard:active:not([class~=success]) svg { + transform: scale(.91); +} + +.clipboard.success svg { + fill: var(--fragment-copy-ok-color); +} + +.clipboard.success { + border-color: var(--fragment-copy-ok-color); } div.line { @@ -778,10 +861,6 @@ img.light-mode-visible { display: none; } -img.formulaDsp { - -} - img.formulaInl, img.inline { vertical-align: middle; } @@ -1081,17 +1160,25 @@ dl.reflist dd { .paramtype { white-space: nowrap; + padding: 0px; + padding-bottom: 1px; } .paramname { - color: var(--memdef-param-name-color); white-space: nowrap; + padding: 0px; + padding-bottom: 1px; + margin-left: 2px; } + .paramname em { + color: var(--memdef-param-name-color); font-style: normal; + margin-right: 1px; } -.paramname code { - line-height: 14px; + +.paramname .paramdefval { + font-family: var(--font-family-monospace); } .params, .retval, .exception, .tparams { @@ -1425,7 +1512,6 @@ table.fieldtable { { height:32px; display:block; - text-decoration: none; outline: none; color: var(--nav-text-normal-color); font-family: var(--font-family-nav); @@ -1514,7 +1600,8 @@ dl { padding: 0 0 0 0; } -/* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug, dl.examples */ +/* + dl.section { margin-left: 0px; padding-left: 0px; @@ -1569,8 +1656,101 @@ dl.bug { border-color: #C08050; } +*/ + +dl.bug dt a, dl.deprecated dt a, dl.todo dt a, dl.test a { + font-weight: bold !important; +} + +dl.warning, dl.attention, dl.note, dl.deprecated, dl.bug, +dl.invariant, dl.pre, dl.post, dl.todo, dl.test, dl.remark { + padding: 10px; + margin: 10px 0px; + overflow: hidden; + margin-left: 0; + border-radius: 4px; +} + dl.section dd { - margin-bottom: 6px; + margin-bottom: 2px; +} + +dl.warning, dl.attention { + background: var(--warning-color-bg); + border-left: 8px solid var(--warning-color-hl); + color: var(--warning-color-text); +} + +dl.warning dt, dl.attention dt { + color: var(--warning-color-hl); +} + +dl.note, dl.remark { + background: var(--note-color-bg); + border-left: 8px solid var(--note-color-hl); + color: var(--note-color-text); +} + +dl.note dt, dl.remark dt { + color: var(--note-color-hl); +} + +dl.todo { + background: var(--todo-color-bg); + border-left: 8px solid var(--todo-color-hl); + color: var(--todo-color-text); +} + +dl.todo dt { + color: var(--todo-color-hl); +} + +dl.test { + background: var(--test-color-bg); + border-left: 8px solid var(--test-color-hl); + color: var(--test-color-text); +} + +dl.test dt { + color: var(--test-color-hl); +} + +dl.bug dt a { + color: var(--bug-color-hl) !important; +} + +dl.bug { + background: var(--bug-color-bg); + border-left: 8px solid var(--bug-color-hl); + color: var(--bug-color-text); +} + +dl.bug dt a { + color: var(--bug-color-hl) !important; +} + +dl.deprecated { + background: var(--deprecated-color-bg); + border-left: 8px solid var(--deprecated-color-hl); + color: var(--deprecated-color-text); +} + +dl.deprecated dt a { + color: var(--deprecated-color-hl) !important; +} + +dl.section dd, dl.bug dd, dl.deprecated dd, dl.todo dd, dl.test dd { + margin-inline-start: 0px; +} + +dl.invariant, dl.pre, dl.post { + background: var(--invariant-color-bg); + border-left: 8px solid var(--invariant-color-hl); + color: var(--invariant-color-text); +} + +dl.invariant dt, dl.pre dt, dl.post dt { + color: var(--invariant-color-hl); } @@ -1585,12 +1765,12 @@ dl.section dd { vertical-align: bottom; border-collapse: separate; } - + #projectlogo img -{ +{ border: 0px none; } - + #projectalign { vertical-align: middle; diff --git a/docs/html/doxygen_crawl.html b/docs/html/doxygen_crawl.html new file mode 100644 index 00000000..89f34acf --- /dev/null +++ b/docs/html/doxygen_crawl.html @@ -0,0 +1,298 @@ + + + +Validator / crawler helper + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/html/dynsections.js b/docs/html/dynsections.js index b73c8288..8f493264 100644 --- a/docs/html/dynsections.js +++ b/docs/html/dynsections.js @@ -22,171 +22,173 @@ @licend The above is the entire license notice for the JavaScript code in this file */ -function toggleVisibility(linkObj) -{ - var base = $(linkObj).attr('id'); - var summary = $('#'+base+'-summary'); - var content = $('#'+base+'-content'); - var trigger = $('#'+base+'-trigger'); - var src=$(trigger).attr('src'); - if (content.is(':visible')===true) { - content.hide(); - summary.show(); - $(linkObj).addClass('closed').removeClass('opened'); - $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); - } else { - content.show(); - summary.hide(); - $(linkObj).removeClass('closed').addClass('opened'); - $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); - } - return false; -} -function updateStripes() -{ - $('table.directory tr'). - removeClass('even').filter(':visible:even').addClass('even'); - $('table.directory tr'). - removeClass('odd').filter(':visible:odd').addClass('odd'); -} +let dynsection = { -function toggleLevel(level) -{ - $('table.directory tr').each(function() { - var l = this.id.split('_').length-1; - var i = $('#img'+this.id.substring(3)); - var a = $('#arr'+this.id.substring(3)); - if (l'); - // add vertical lines to other rows - $('span[class=lineno]').not(':eq(0)').append(''); - // add toggle controls to lines with fold divs - $('div[class=foldopen]').each(function() { - // extract specific id to use - var id = $(this).attr('id').replace('foldopen',''); - // extract start and end foldable fragment attributes - var start = $(this).attr('data-start'); - var end = $(this).attr('data-end'); - // replace normal fold span with controls for the first line of a foldable fragment - $(this).find('span[class=fold]:first').replaceWith(''); - // append div for folded (closed) representation - $(this).after(''); - // extract the first line from the "open" section to represent closed content - var line = $(this).children().first().clone(); - // remove any glow that might still be active on the original line - $(line).removeClass('glow'); - if (start) { - // if line already ends with a start marker (e.g. trailing {), remove it - $(line).html($(line).html().replace(new RegExp('\\s*'+start+'\\s*$','g'),'')); - } - // replace minus with plus symbol - $(line).find('span[class=fold]').css('background-image',plusImg[relPath]); - // append ellipsis - $(line).append(' '+start+''+end); - // insert constructed line into closed div - $('#foldclosed'+id).html(line); - }); -} + this.updateStripes(); + }, + toggleFolder : function(id) { + // the clicked row + const currentRow = $('#row_'+id); + + // all rows after the clicked row + const rows = currentRow.nextAll("tr"); + + const re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub + + // only match elements AFTER this one (can't hide elements before) + const childRows = rows.filter(function() { return this.id.match(re); }); + + // first row is visible we are HIDING + if (childRows.filter(':first').is(':visible')===true) { + // replace down arrow by right arrow for current row + const currentRowSpans = currentRow.find("span"); + currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed"); + currentRowSpans.filter(".arrow").html('►'); + rows.filter("[id^=row_"+id+"]").hide(); // hide all children + } else { // we are SHOWING + // replace right arrow by down arrow for current row + const currentRowSpans = currentRow.find("span"); + currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen"); + currentRowSpans.filter(".arrow").html('▼'); + // replace down arrows by right arrows for child rows + const childRowsSpans = childRows.find("span"); + childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed"); + childRowsSpans.filter(".arrow").html('►'); + childRows.show(); //show all children + } + this.updateStripes(); + }, + + toggleInherit : function(id) { + const rows = $('tr.inherit.'+id); + const img = $('tr.inherit_header.'+id+' img'); + const src = $(img).attr('src'); + if (rows.filter(':first').is(':visible')===true) { + rows.css('display','none'); + $(img).attr('src',src.substring(0,src.length-8)+'closed.png'); + } else { + rows.css('display','table-row'); // using show() causes jump in firefox + $(img).attr('src',src.substring(0,src.length-10)+'open.png'); + } + }, +}; + +let codefold = { + opened : true, + + // in case HTML_COLORSTYLE is LIGHT or DARK the vars will be replaced, so we write them out explicitly and use double quotes + plusImg: [ "var(--fold-plus-image)", "var(--fold-plus-image-relpath)" ], + minusImg: [ "var(--fold-minus-image)", "var(--fold-minus-image-relpath)" ], + + // toggle all folding blocks + toggle_all : function(relPath) { + if (this.opened) { + $('#fold_all').css('background-image',this.plusImg[relPath]); + $('div[id^=foldopen]').hide(); + $('div[id^=foldclosed]').show(); + } else { + $('#fold_all').css('background-image',this.minusImg[relPath]); + $('div[id^=foldopen]').show(); + $('div[id^=foldclosed]').hide(); + } + this.opened=!this.opened; + }, + + // toggle single folding block + toggle : function(id) { + $('#foldopen'+id).toggle(); + $('#foldclosed'+id).toggle(); + }, + + init : function(relPath) { + $('span[class=lineno]').css({ + 'padding-right':'4px', + 'margin-right':'2px', + 'display':'inline-block', + 'width':'54px', + 'background':'linear-gradient(var(--fold-line-color),var(--fold-line-color)) no-repeat 46px/2px 100%' + }); + // add global toggle to first line + $('span[class=lineno]:first').append(''); + // add vertical lines to other rows + $('span[class=lineno]').not(':eq(0)').append(''); + // add toggle controls to lines with fold divs + $('div[class=foldopen]').each(function() { + // extract specific id to use + const id = $(this).attr('id').replace('foldopen',''); + // extract start and end foldable fragment attributes + const start = $(this).attr('data-start'); + const end = $(this).attr('data-end'); + // replace normal fold span with controls for the first line of a foldable fragment + $(this).find('span[class=fold]:first').replaceWith(''); + // append div for folded (closed) representation + $(this).after(''); + // extract the first line from the "open" section to represent closed content + const line = $(this).children().first().clone(); + // remove any glow that might still be active on the original line + $(line).removeClass('glow'); + if (start) { + // if line already ends with a start marker (e.g. trailing {), remove it + $(line).html($(line).html().replace(new RegExp('\\s*'+start+'\\s*$','g'),'')); + } + // replace minus with plus symbol + $(line).find('span[class=fold]').css('background-image',codefold.plusImg[relPath]); + // append ellipsis + $(line).append(' '+start+''+end); + // insert constructed line into closed div + $('#foldclosed'+id).html(line); + }); + }, +}; /* @license-end */ diff --git a/docs/html/functions.html b/docs/html/functions.html index ac291629..d6ec0b5c 100644 --- a/docs/html/functions.html +++ b/docs/html/functions.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -75,16 +77,19 @@ $(function() {

- a -

diff --git a/docs/html/functions_b.html b/docs/html/functions_b.html index c3e9e787..b803e473 100644 --- a/docs/html/functions_b.html +++ b/docs/html/functions_b.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -75,16 +77,12 @@ $(function() {

- b -

diff --git a/docs/html/functions_c.html b/docs/html/functions_c.html index 790dc9b1..84768939 100644 --- a/docs/html/functions_c.html +++ b/docs/html/functions_c.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,12 +76,14 @@ $(function() {
Here is a list of all documented class members with links to the class documentation for each member:

- c -

diff --git a/docs/html/functions_d.html b/docs/html/functions_d.html index 90358ad6..4cae8f65 100644 --- a/docs/html/functions_d.html +++ b/docs/html/functions_d.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,25 +76,29 @@ $(function() {
Here is a list of all documented class members with links to the class documentation for each member:

- d -

diff --git a/docs/html/functions_e.html b/docs/html/functions_e.html index 788c9d55..c1708e38 100644 --- a/docs/html/functions_e.html +++ b/docs/html/functions_e.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,14 +76,15 @@ $(function() {
Here is a list of all documented class members with links to the class documentation for each member:

- e -

diff --git a/docs/html/functions_enum.html b/docs/html/functions_enum.html index f793056b..bb61e688 100644 --- a/docs/html/functions_enum.html +++ b/docs/html/functions_enum.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Enumerations + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -77,7 +79,7 @@ $(function() { diff --git a/docs/html/functions_f.html b/docs/html/functions_f.html index 89c36889..16593fe9 100644 --- a/docs/html/functions_f.html +++ b/docs/html/functions_f.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,14 +76,15 @@ $(function() {
Here is a list of all documented class members with links to the class documentation for each member:

- f -

diff --git a/docs/html/functions_func.html b/docs/html/functions_func.html index 172d0765..f43fb990 100644 --- a/docs/html/functions_func.html +++ b/docs/html/functions_func.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -75,15 +77,17 @@ $(function() {

- a -

diff --git a/docs/html/functions_func_b.html b/docs/html/functions_func_b.html index ac3960eb..828e4867 100644 --- a/docs/html/functions_func_b.html +++ b/docs/html/functions_func_b.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -75,16 +77,12 @@ $(function() {

- b -

diff --git a/docs/html/functions_func_c.html b/docs/html/functions_func_c.html index 4242d4b6..0bb99a1a 100644 --- a/docs/html/functions_func_c.html +++ b/docs/html/functions_func_c.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,12 +76,14 @@ $(function() {
Here is a list of all documented functions with links to the class documentation for each member:

- c -

diff --git a/docs/html/functions_func_d.html b/docs/html/functions_func_d.html index 37e6f1e9..775040da 100644 --- a/docs/html/functions_func_d.html +++ b/docs/html/functions_func_d.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,25 +76,29 @@ $(function() {
Here is a list of all documented functions with links to the class documentation for each member:

- d -

diff --git a/docs/html/functions_func_e.html b/docs/html/functions_func_e.html index 27a65c6d..7e331a86 100644 --- a/docs/html/functions_func_e.html +++ b/docs/html/functions_func_e.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,13 +76,14 @@ $(function() {
Here is a list of all documented functions with links to the class documentation for each member:

- e -

diff --git a/docs/html/functions_func_f.html b/docs/html/functions_func_f.html new file mode 100644 index 00000000..1e9565c9 --- /dev/null +++ b/docs/html/functions_func_f.html @@ -0,0 +1,87 @@ + + + + + + + +LogDoctor: Class Members - Functions + + + + + + + + + + + +
+
+ + + + + + + +
+
LogDoctor 4.00 +
+
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
+
+
+ + + + + + + +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all documented functions with links to the class documentation for each member:
+ +

- f -

+
+ + + + diff --git a/docs/html/functions_func_g.html b/docs/html/functions_func_g.html index 787a82eb..8b6a48c8 100644 --- a/docs/html/functions_func_g.html +++ b/docs/html/functions_func_g.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -75,58 +77,60 @@ $(function() {

- g -

diff --git a/docs/html/functions_func_h.html b/docs/html/functions_func_h.html index b804d8e9..8fc9e372 100644 --- a/docs/html/functions_func_h.html +++ b/docs/html/functions_func_h.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,17 +76,16 @@ $(function() {
Here is a list of all documented functions with links to the class documentation for each member:

- h -

diff --git a/docs/html/functions_func_i.html b/docs/html/functions_func_i.html index 0bf2faf0..303b4f9c 100644 --- a/docs/html/functions_func_i.html +++ b/docs/html/functions_func_i.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,18 +76,17 @@ $(function() {
Here is a list of all documented functions with links to the class documentation for each member:

- i -

diff --git a/docs/html/functions_func_j.html b/docs/html/functions_func_j.html index 26f47582..9c8a2a5e 100644 --- a/docs/html/functions_func_j.html +++ b/docs/html/functions_func_j.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,12 +76,12 @@ $(function() {
Here is a list of all documented functions with links to the class documentation for each member:

- j -

diff --git a/docs/html/functions_func_k.html b/docs/html/functions_func_k.html index 0c0497a5..7d6a88b7 100644 --- a/docs/html/functions_func_k.html +++ b/docs/html/functions_func_k.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,12 +76,12 @@ $(function() {
Here is a list of all documented functions with links to the class documentation for each member:

- k -

diff --git a/docs/html/functions_func_l.html b/docs/html/functions_func_l.html index 689a5c73..704186e9 100644 --- a/docs/html/functions_func_l.html +++ b/docs/html/functions_func_l.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -75,12 +77,13 @@ $(function() {

- l -

diff --git a/docs/html/functions_func_m.html b/docs/html/functions_func_m.html index d84b5c66..7925ea69 100644 --- a/docs/html/functions_func_m.html +++ b/docs/html/functions_func_m.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -76,17 +78,22 @@ $(function() {

- m -

diff --git a/docs/html/functions_func_n.html b/docs/html/functions_func_n.html index 11ac6f2d..3a1438a5 100644 --- a/docs/html/functions_func_n.html +++ b/docs/html/functions_func_n.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -74,13 +76,13 @@ $(function() {
Here is a list of all documented functions with links to the class documentation for each member:

- n -

diff --git a/docs/html/functions_func_o.html b/docs/html/functions_func_o.html index 17c96a23..10e085fd 100644 --- a/docs/html/functions_func_o.html +++ b/docs/html/functions_func_o.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
LogDoctor 3.00 +
LogDoctor 4.00
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
@@ -31,7 +33,7 @@
- + @@ -84,11 +86,20 @@ $(function() {
  • on_button_ShowAdditional_clicked() : DialogMsg
  • on_button_YES_clicked() : DialogBool
  • on_spinBox_FontSize_valueChanged() : Crapnote
  • +
  • open() : DatabaseWrapper
  • +
  • openNew() : DatabaseWrapper
  • +
  • operator bool() : FieldData
  • +
  • operator()() : QueryWrapper
  • +
  • operator*() : DatabaseWrapper, FieldData
  • +
  • operator+() : FieldData
  • +
  • operator->() : DatabaseWrapper, QueryWrapper
  • +
  • operator<<() : QueryWrapper
  • +
  • operator[]() : QueryWrapper
  • diff --git a/docs/html/functions_func_p.html b/docs/html/functions_func_p.html index 3abb01ad..ccc51238 100644 --- a/docs/html/functions_func_p.html +++ b/docs/html/functions_func_p.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -75,18 +77,18 @@ $(function() {

    - p -

    diff --git a/docs/html/functions_func_r.html b/docs/html/functions_func_r.html index e6c0cba7..79c90321 100644 --- a/docs/html/functions_func_r.html +++ b/docs/html/functions_func_r.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -76,18 +78,21 @@ $(function() {

    - r -

    diff --git a/docs/html/functions_func_s.html b/docs/html/functions_func_s.html index 3ee2925b..7e2c58c9 100644 --- a/docs/html/functions_func_s.html +++ b/docs/html/functions_func_s.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -74,43 +76,48 @@ $(function() {
    Here is a list of all documented functions with links to the class documentation for each member:

    - s -

    diff --git a/docs/html/functions_func_u.html b/docs/html/functions_func_u.html index 6f75e631..101b5a64 100644 --- a/docs/html/functions_func_u.html +++ b/docs/html/functions_func_u.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -74,7 +76,7 @@ $(function() {
    Here is a list of all documented functions with links to the class documentation for each member:

    - u -

    diff --git a/docs/html/functions_func_v.html b/docs/html/functions_func_v.html index 61d81e8e..3e3ddd70 100644 --- a/docs/html/functions_func_v.html +++ b/docs/html/functions_func_v.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -75,12 +77,12 @@ $(function() {

    - v -

    diff --git a/docs/html/functions_func_w.html b/docs/html/functions_func_w.html index 6cf011cf..c3a0fd0d 100644 --- a/docs/html/functions_func_w.html +++ b/docs/html/functions_func_w.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -79,17 +81,14 @@ $(function() {
  • warnDirNotWritable() : DialogSec
  • warnEmptyFile() : DialogSec
  • warnFileNotReadable() : DialogSec
  • +
  • warnInvalidConfigsList() : DialogSec
  • warnInvalidItemBW() : DialogSec
  • -
  • warnlistAdd() : Craplog
  • -
  • warnlistMoveDown() : Craplog
  • -
  • warnlistMoveUp() : Craplog
  • -
  • warnlistRemove() : Craplog
  • writeConfigs() : MainWindow
  • diff --git a/docs/html/functions_func_x.html b/docs/html/functions_func_x.html index 0e8f8fdf..584f21bc 100644 --- a/docs/html/functions_func_x.html +++ b/docs/html/functions_func_x.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -74,12 +76,12 @@ $(function() {
    Here is a list of all documented functions with links to the class documentation for each member:

    - x -

    diff --git a/docs/html/functions_func_y.html b/docs/html/functions_func_y.html index bf608c68..4cb86417 100644 --- a/docs/html/functions_func_y.html +++ b/docs/html/functions_func_y.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Functions + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -74,12 +76,12 @@ $(function() {
    Here is a list of all documented functions with links to the class documentation for each member:

    - y -

    diff --git a/docs/html/functions_g.html b/docs/html/functions_g.html index 73333085..1984ab66 100644 --- a/docs/html/functions_g.html +++ b/docs/html/functions_g.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -75,59 +77,61 @@ $(function() {

    - g -

    diff --git a/docs/html/functions_h.html b/docs/html/functions_h.html index 3352bb16..458b8d06 100644 --- a/docs/html/functions_h.html +++ b/docs/html/functions_h.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -74,17 +76,16 @@ $(function() {
    Here is a list of all documented class members with links to the class documentation for each member:

    - h -

    diff --git a/docs/html/functions_i.html b/docs/html/functions_i.html index d6f32a5a..1c9d5123 100644 --- a/docs/html/functions_i.html +++ b/docs/html/functions_i.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -74,22 +76,21 @@ $(function() {
    Here is a list of all documented class members with links to the class documentation for each member:

    - i -

    diff --git a/docs/html/functions_j.html b/docs/html/functions_j.html index 31557b39..e9cd63d0 100644 --- a/docs/html/functions_j.html +++ b/docs/html/functions_j.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -74,12 +76,12 @@ $(function() {
    Here is a list of all documented class members with links to the class documentation for each member:

    - j -

    diff --git a/docs/html/functions_k.html b/docs/html/functions_k.html index 0f1c8e3a..be7c0afb 100644 --- a/docs/html/functions_k.html +++ b/docs/html/functions_k.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -74,13 +76,13 @@ $(function() {
    Here is a list of all documented class members with links to the class documentation for each member:

    - k -

    diff --git a/docs/html/functions_l.html b/docs/html/functions_l.html index 5a800f62..ac5de8f2 100644 --- a/docs/html/functions_l.html +++ b/docs/html/functions_l.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -74,14 +76,14 @@ $(function() {
    Here is a list of all documented class members with links to the class documentation for each member:

    - l -

    diff --git a/docs/html/functions_m.html b/docs/html/functions_m.html index 90d74bba..6d70066b 100644 --- a/docs/html/functions_m.html +++ b/docs/html/functions_m.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -76,19 +78,24 @@ $(function() {

    - m -

    diff --git a/docs/html/functions_n.html b/docs/html/functions_n.html index 230a9b83..d545453a 100644 --- a/docs/html/functions_n.html +++ b/docs/html/functions_n.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -74,15 +76,15 @@ $(function() {
    Here is a list of all documented class members with links to the class documentation for each member:

    - n -

    diff --git a/docs/html/functions_o.html b/docs/html/functions_o.html index 76a8ddb8..05f84873 100644 --- a/docs/html/functions_o.html +++ b/docs/html/functions_o.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -84,11 +86,20 @@ $(function() {
  • on_button_ShowAdditional_clicked() : DialogMsg
  • on_button_YES_clicked() : DialogBool
  • on_spinBox_FontSize_valueChanged() : Crapnote
  • +
  • open() : DatabaseWrapper
  • +
  • openNew() : DatabaseWrapper
  • +
  • operator bool() : FieldData
  • +
  • operator()() : QueryWrapper
  • +
  • operator*() : DatabaseWrapper, FieldData
  • +
  • operator+() : FieldData
  • +
  • operator->() : DatabaseWrapper, QueryWrapper
  • +
  • operator<<() : QueryWrapper
  • +
  • operator[]() : QueryWrapper
  • diff --git a/docs/html/functions_p.html b/docs/html/functions_p.html index 1c43f17c..452782fa 100644 --- a/docs/html/functions_p.html +++ b/docs/html/functions_p.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -75,19 +77,19 @@ $(function() {

    - p -

    diff --git a/docs/html/functions_r.html b/docs/html/functions_r.html index a7eea04f..4c18c067 100644 --- a/docs/html/functions_r.html +++ b/docs/html/functions_r.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -76,18 +78,21 @@ $(function() {

    - r -

    diff --git a/docs/html/functions_rela.html b/docs/html/functions_rela.html new file mode 100644 index 00000000..68c7bfe8 --- /dev/null +++ b/docs/html/functions_rela.html @@ -0,0 +1,85 @@ + + + + + + + +LogDoctor: Class Members - Related Symbols + + + + + + + + + + + +
    +
    + + + + + + + +
    +
    LogDoctor 4.00 +
    +
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    +
    +
    + + + + + + + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    Here is a list of all documented related symbols with links to the class documentation for each member:
    +
    + + + + diff --git a/docs/html/functions_s.html b/docs/html/functions_s.html index a2e0cef3..f341924a 100644 --- a/docs/html/functions_s.html +++ b/docs/html/functions_s.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -74,47 +76,52 @@ $(function() {
    Here is a list of all documented class members with links to the class documentation for each member:

    - s -

    diff --git a/docs/html/functions_u.html b/docs/html/functions_u.html index e34f2c46..a0823586 100644 --- a/docs/html/functions_u.html +++ b/docs/html/functions_u.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -74,7 +76,7 @@ $(function() {
    Here is a list of all documented class members with links to the class documentation for each member:

    - u -

    diff --git a/docs/html/functions_v.html b/docs/html/functions_v.html index 6ba29fd2..94d0fb02 100644 --- a/docs/html/functions_v.html +++ b/docs/html/functions_v.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -75,12 +77,12 @@ $(function() {

    - v -

    diff --git a/docs/html/functions_vars.html b/docs/html/functions_vars.html index f39508c5..f5d31540 100644 --- a/docs/html/functions_vars.html +++ b/docs/html/functions_vars.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members - Variables + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -72,36 +74,35 @@ $(function() {
    Here is a list of all documented variables with links to the class documentation for each member:
    diff --git a/docs/html/functions_w.html b/docs/html/functions_w.html index dfa31c1d..3fe51a97 100644 --- a/docs/html/functions_w.html +++ b/docs/html/functions_w.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -79,17 +81,14 @@ $(function() {
  • warnDirNotWritable() : DialogSec
  • warnEmptyFile() : DialogSec
  • warnFileNotReadable() : DialogSec
  • +
  • warnInvalidConfigsList() : DialogSec
  • warnInvalidItemBW() : DialogSec
  • -
  • warnlistAdd() : Craplog
  • -
  • warnlistMoveDown() : Craplog
  • -
  • warnlistMoveUp() : Craplog
  • -
  • warnlistRemove() : Craplog
  • writeConfigs() : MainWindow
  • diff --git a/docs/html/functions_x.html b/docs/html/functions_x.html index 528dba17..e7b730fc 100644 --- a/docs/html/functions_x.html +++ b/docs/html/functions_x.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -74,14 +76,13 @@ $(function() {
    Here is a list of all documented class members with links to the class documentation for each member:

    - x -

    diff --git a/docs/html/functions_y.html b/docs/html/functions_y.html index e1f24ed0..0a1dacfb 100644 --- a/docs/html/functions_y.html +++ b/docs/html/functions_y.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Members + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -75,12 +77,12 @@ $(function() {

    - y -

    diff --git a/docs/html/hierarchy.html b/docs/html/hierarchy.html index 7e730e02..8721cf66 100644 --- a/docs/html/hierarchy.html +++ b/docs/html/hierarchy.html @@ -3,12 +3,14 @@ - + LogDoctor: Class Hierarchy + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -75,64 +77,92 @@ $(function() {
    This inheritance list is sorted roughly, but not completely, alphabetically:
    -
    [detail level 123]
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
    [detail level 123]
     CBodyPartInstance of a part of the body of the snake
     CBWlistHold the items of a blacklist/warnlist
     CDbQuery
     Cstd::exception
     CBWlistExceptionBWlistException
     CDateTimeExceptionDateTimeException
     CGenericExceptionGenericException
     CLogFormatExceptionLogFormatException
     CLogParserExceptionLogParserException
     CWebServerExceptionWebServerException
     CFood
     CFormatOpsFormatOps
     CHashOpsHashOps
     CLogFileHolds informations about a log file
     CCraplog::LogNameWeb Server specific file names criterions
     CLogsFormatHolds informations about a log format
     CQChart
     CDonutBreakdownDonutBreakdon
     CQDialog
     CDialogBoolDialogBool
     CDialogIdaDialogIda
     CDialogMsgDialogMsg
     CGameDialogGameDialog
     CQMainWindow
     CMainWindowMainWindow
     CQObject
     CCraplogCraplog
     CCraplogLister
     CCraplogParserInterface
     CCraplogParser
     CCraplogParserAsync
     CCrapviewCrapview
     CDialogSecDialogSec
     CRichTextRichText
     CTRTR
     CQPieSlice
     CMainSliceRepresents a slice
     CQTreeWidgetItem
     CLogFileTreeWidgetItem
     CQWidget
     CCraphelpCraphelp
     CCrapinfoCrapinfo
     CCrapnoteCrapnote
     CCrapupCrapup
     CCrissCrossCrissCross
     CSnakeGameSnake
     CSHA256
     CTextBrowserTextBrowser
     CSnake::Tile
     Cstd::vector
     CSnake
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
     CBlacklist
     CBlacklistItem
     CBlacklists
     CBodyPartInstance of a part of the body of the snake
     CDatabaseHandler
     CDatabaseWrapperDatabaseWrapper
     CDbQuery
     CDoNotCatchExceptionDoNotCatchException
     CEnumeratdArray< Array >
     CEnumerator< Array >
     CFieldDataFieldData
     CFileHandler< Stream >RAII class to handle s file resource
     CFood
     CFormatOpsFormatOps
     CGlobalsData
     CHashOpsHashOps
     CLogDoctorExceptionLogDoctorException
     CBWlistExceptionBWlistException
     CDatabaseExceptionDatabaseException
     CDateTimeExceptionDateTimeException
     CGenericExceptionGenericException
     CLogFormatExceptionLogFormatException
     CLogParserExceptionLogParserException
     CLogFileHolds informations about a log file
     CLogLineDataLogLineData
     CCraplog::LogNameWeb Server specific file names criterions
     CLogsFormatHolds informations about a log format
     CMakeNewDatabase
     CPerformanceData
     CPerfs
     CQAbstractListModel
     CLogFieldsListModel
     CDaytimeLogFieldsListModel
     CRelationslLogFieldsListModel
     CQChart
     CDonutBreakdownDonutBreakdon
     CQDialog
     CDialogBoolDialogBool
     CDialogIdaDialogIda
     CDialogMsgDialogMsg
     CGameDialogGameDialog
     CQFileDialog
     CCrappath
     CQMainWindow
     CMainWindowMainWindow
     CQObject
     CCraplogCraplog
     CCraplogLister
     CCraplogParser
     CCrapviewCrapview
     CDialogSecDialogSec
     CRichTextRichText
     CTRTR
     CQPieSlice
     CMainSliceRepresents a slice
     CQTreeWidgetItem
     CLogFileTreeWidgetItem
     CQueryWrapperQueryWrapper
     CQWidget
     CChangelogChangelog
     CCraphelpCraphelp
     CCrapinfoCrapinfo
     CCrapnoteCrapnote
     CCrapupCrapup
     CCrissCrossCrissCross
     CSnakeGameSnake
     CRecurrenceData
     CSHA256
     CTextBrowserTextBrowser
     CSnake::Tile
     CTrafficData
     Cstd::vector
     CSnake
     CVoidExceptionVoidException
     CWarnlist
     CWarnlistItem
     CWarnlists
     CZippedArrays< Array >
     CZipperator< Array >
    diff --git a/docs/html/index.html b/docs/html/index.html index e1d09fac..14630ee9 100644 --- a/docs/html/index.html +++ b/docs/html/index.html @@ -3,12 +3,14 @@ - + LogDoctor: Main Page + + @@ -22,7 +24,7 @@ Logo -
    LogDoctor 3.00 +
    LogDoctor 4.00
    Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
    @@ -31,7 +33,7 @@
    - + @@ -74,10 +76,11 @@ $(function() {
    LogDoctor Documentation
    +
    diff --git a/docs/html/menu.js b/docs/html/menu.js index b0b26936..717761d0 100644 --- a/docs/html/menu.js +++ b/docs/html/menu.js @@ -24,13 +24,12 @@ */ function initMenu(relPath,searchEnabled,serverSide,searchPage,search) { function makeTree(data,relPath) { - var result=''; + let result=''; if ('children' in data) { result+='
      '; - for (var i in data.children) { - var url; - var link; - link = data.children[i].url; + for (let i in data.children) { + let url; + const link = data.children[i].url; if (link.substring(0,1)=='^') { url = link.substring(1); } else { @@ -44,7 +43,7 @@ function initMenu(relPath,searchEnabled,serverSide,searchPage,search) { } return result; } - var searchBoxHtml; + let searchBoxHtml; if (searchEnabled) { if (serverSide) { searchBoxHtml='
      '+ @@ -88,29 +87,28 @@ function initMenu(relPath,searchEnabled,serverSide,searchPage,search) { if (searchBoxHtml) { $('#main-menu').append('
    • '); } - var $mainMenuState = $('#main-menu-state'); - var prevWidth = 0; + const $mainMenuState = $('#main-menu-state'); + let prevWidth = 0; if ($mainMenuState.length) { - function initResizableIfExists() { + const initResizableIfExists = function() { if (typeof initResizable==='function') initResizable(); } // animate mobile menu - $mainMenuState.change(function(e) { - var $menu = $('#main-menu'); - var options = { duration: 250, step: initResizableIfExists }; + $mainMenuState.change(function() { + const $menu = $('#main-menu'); + let options = { duration: 250, step: initResizableIfExists }; if (this.checked) { - options['complete'] = function() { $menu.css('display', 'block') }; + options['complete'] = () => $menu.css('display', 'block'); $menu.hide().slideDown(options); } else { - options['complete'] = function() { $menu.css('display', 'none') }; + options['complete'] = () => $menu.css('display', 'none'); $menu.show().slideUp(options); } }); // set default menu visibility - function resetState() { - var $menu = $('#main-menu'); - var $mainMenuState = $('#main-menu-state'); - var newWidth = $(window).outerWidth(); + const resetState = function() { + const $menu = $('#main-menu'); + const newWidth = $(window).outerWidth(); if (newWidth!=prevWidth) { if ($(window).outerWidth()<768) { $mainMenuState.prop('checked',false); $menu.hide(); diff --git a/docs/html/menudata.js b/docs/html/menudata.js index 2aede50b..8147cf79 100644 --- a/docs/html/menudata.js +++ b/docs/html/menudata.js @@ -24,6 +24,7 @@ */ var menudata={children:[ {text:"Main Page",url:"index.html"}, +{text:"Related Pages",url:"pages.html"}, {text:"Namespaces",url:"namespaces.html",children:[ {text:"Namespace List",url:"namespaces.html"}, {text:"Namespace Members",url:"namespacemembers.html",children:[ @@ -40,7 +41,8 @@ var menudata={children:[ {text:"r",url:"namespacemembers.html#index_r"}, {text:"s",url:"namespacemembers.html#index_s"}, {text:"t",url:"namespacemembers.html#index_t"}, -{text:"w",url:"namespacemembers.html#index_w"}]}, +{text:"w",url:"namespacemembers.html#index_w"}, +{text:"z",url:"namespacemembers.html#index_z"}]}, {text:"Functions",url:"namespacemembers_func.html",children:[ {text:"a",url:"namespacemembers_func.html#index_a"}, {text:"c",url:"namespacemembers_func.html#index_c"}, @@ -54,7 +56,8 @@ var menudata={children:[ {text:"r",url:"namespacemembers_func.html#index_r"}, {text:"s",url:"namespacemembers_func.html#index_s"}, {text:"t",url:"namespacemembers_func.html#index_t"}, -{text:"w",url:"namespacemembers_func.html#index_w"}]}]}]}, +{text:"w",url:"namespacemembers_func.html#index_w"}, +{text:"z",url:"namespacemembers_func.html#index_z"}]}]}]}, {text:"Classes",url:"annotated.html",children:[ {text:"Class List",url:"annotated.html"}, {text:"Class Index",url:"classes.html"}, @@ -90,6 +93,7 @@ var menudata={children:[ {text:"c",url:"functions_func_c.html#index_c"}, {text:"d",url:"functions_func_d.html#index_d"}, {text:"e",url:"functions_func_e.html#index_e"}, +{text:"f",url:"functions_func_f.html#index_f"}, {text:"g",url:"functions_func_g.html#index_g"}, {text:"h",url:"functions_func_h.html#index_h"}, {text:"i",url:"functions_func_i.html#index_i"}, @@ -108,4 +112,5 @@ var menudata={children:[ {text:"x",url:"functions_func_x.html#index_x"}, {text:"y",url:"functions_func_y.html#index_y"}]}, {text:"Variables",url:"functions_vars.html"}, -{text:"Enumerations",url:"functions_enum.html"}]}]}]} +{text:"Enumerations",url:"functions_enum.html"}, +{text:"Related Symbols",url:"functions_rela.html"}]}]}]} diff --git a/docs/html/namespaceArrayOps.html b/docs/html/namespaceArrayOps.html new file mode 100644 index 00000000..cdd3ee4d --- /dev/null +++ b/docs/html/namespaceArrayOps.html @@ -0,0 +1,185 @@ + + + + + + + +LogDoctor: ArrayOps Namespace Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      ArrayOps Namespace Reference
      +
      +
      + +

      ArrayOps. +More...

      + + + + + + + + + + +

      +Functions

      template<typename Array >
      auto zip (Array &l_array, Array &r_array)
       Zips two arrays.
       
      template<typename Array >
      auto enumerate (const Array &array)
       Enumerates an array.
       
      +

      Detailed Description

      +

      ArrayOps.

      +

      Utilities for the arrays

      +

      Function Documentation

      + +

      ◆ enumerate()

      + +
      +
      +
      +template<typename Array >
      + + + + + +
      + + + + + + + +
      auto ArrayOps::enumerate (const Array & array)
      +
      +inline
      +
      + +

      Enumerates an array.

      +
      Parameters
      + + +
      arrayThe array
      +
      +
      +
      Returns
      An iterator over the two array along with the index
      +
      Todo
      Replace with std::views::enumerate when clang will fully support it
      + +
      +
      + +

      ◆ zip()

      + +
      +
      +
      +template<typename Array >
      + + + + + +
      + + + + + + + + + + + +
      auto ArrayOps::zip (Array & l_array,
      Array & r_array )
      +
      +inline
      +
      + +

      Zips two arrays.

      +
      Parameters
      + + + +
      l_arrayThe left-side array
      r_arrayThe right-side array
      +
      +
      +
      Returns
      An iterator over the two arrays
      +
      Todo
      Replace with std::views::zip when clang will fully support it
      + +
      +
      +
      + + + + diff --git a/docs/html/namespaceBWutils.html b/docs/html/namespaceBWutils.html new file mode 100644 index 00000000..3f0ee8ef --- /dev/null +++ b/docs/html/namespaceBWutils.html @@ -0,0 +1,210 @@ + + + + + + + +LogDoctor: BWutils Namespace Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      BWutils Namespace Reference
      +
      +
      + +

      BWutils. +More...

      + + + + + + + + + + + + + + +

      +Functions

      std::string sanitizedMethod (const std::string &item)
       Returns a sanitized item which can be inserted in a list.
       
      std::string sanitizedUri (const std::string &item)
       Returns a sanitized item which can be inserted in a list.
       
      std::string sanitizedClient (const std::string &item)
       Returns a sanitized item which can be inserted in a list.
       
      std::string sanitizedUserAgent (std::string_view item)
       Returns a sanitized item which can be inserted in a list.
       
      +

      Detailed Description

      +

      BWutils.

      +

      Utilities for blacklists and warnlists

      See also
      Blasklists, Warnlists
      +

      Function Documentation

      + +

      ◆ sanitizedClient()

      + +
      +
      + + + + + + + +
      std::string BWutils::sanitizedClient (const std::string & item)
      +
      + +

      Returns a sanitized item which can be inserted in a list.

      +

      This functions doesn't check it the client is actually a valid IP address, only whether it is composed by the proper set of characters (for an IPv4 or an IPv6)

      Exceptions
      + + +
      BWlistException
      +
      +
      + +
      +
      + +

      ◆ sanitizedMethod()

      + +
      +
      + + + + + + + +
      std::string BWutils::sanitizedMethod (const std::string & item)
      +
      + +

      Returns a sanitized item which can be inserted in a list.

      +

      This fuction doesn't check if the method is actually a valid HTTP method, only whether the given string is sintattically acceptable.

      Exceptions
      + + +
      BWlistException
      +
      +
      + +
      +
      + +

      ◆ sanitizedUri()

      + +
      +
      + + + + + + + +
      std::string BWutils::sanitizedUri (const std::string & item)
      +
      + +

      Returns a sanitized item which can be inserted in a list.

      +

      This function percent-encodes some of the characters in the provided string: /#&?=+

      Exceptions
      + + +
      BWlistException
      +
      +
      + +
      +
      + +

      ◆ sanitizedUserAgent()

      + +
      +
      + + + + + + + +
      std::string BWutils::sanitizedUserAgent (std::string_view item)
      +
      + +

      Returns a sanitized item which can be inserted in a list.

      +

      This function back-slashes every double-quotes in the provided string

      Exceptions
      + + +
      BWlistException
      +
      +
      + +
      +
      +
      + + + + diff --git a/docs/html/namespaceCharOps.html b/docs/html/namespaceCharOps.html new file mode 100644 index 00000000..69f7e052 --- /dev/null +++ b/docs/html/namespaceCharOps.html @@ -0,0 +1,283 @@ + + + + + + + +LogDoctor: CharOps Namespace Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      CharOps Namespace Reference
      +
      +
      + +

      CharOps. +More...

      + + + + + + + + + + + + + + + + + +

      +Functions

      bool isNumeric (const char &chr) noexcept
       Checks whether a character is numeric.
       
      bool isAlphabetic (const char &chr) noexcept
       Checks whether a character is alphabetic.
       
      bool isAlnum (const char &chr) noexcept
       Checks whether a character is alphanumeric.
       
      bool isHex (const char &chr) noexcept
       Checks whether a character is hexadecimal.
       
      bool isIP (const char &chr) noexcept
       Checks whether a character can be part of an IPv4/IPv6.
       
      +

      Detailed Description

      +

      CharOps.

      +

      Utilities for chars

      +

      Function Documentation

      + +

      ◆ isAlnum()

      + +
      +
      + + + + + +
      + + + + + + + +
      bool CharOps::isAlnum (const char & chr)
      +
      +inlinenoexcept
      +
      + +

      Checks whether a character is alphanumeric.

      +
      Parameters
      + + +
      chrThe target character
      +
      +
      +
      Returns
      The result of the check
      + +
      +
      + +

      ◆ isAlphabetic()

      + +
      +
      + + + + + +
      + + + + + + + +
      bool CharOps::isAlphabetic (const char & chr)
      +
      +inlinenoexcept
      +
      + +

      Checks whether a character is alphabetic.

      +
      Parameters
      + + +
      chrThe target character
      +
      +
      +
      Returns
      The result of the check
      + +
      +
      + +

      ◆ isHex()

      + +
      +
      + + + + + +
      + + + + + + + +
      bool CharOps::isHex (const char & chr)
      +
      +inlinenoexcept
      +
      + +

      Checks whether a character is hexadecimal.

      +
      Parameters
      + + +
      chrThe target character
      +
      +
      +
      Returns
      The result of the check
      + +
      +
      + +

      ◆ isIP()

      + +
      +
      + + + + + +
      + + + + + + + +
      bool CharOps::isIP (const char & chr)
      +
      +inlinenoexcept
      +
      + +

      Checks whether a character can be part of an IPv4/IPv6.

      +
      Parameters
      + + +
      chrThe target character
      +
      +
      +
      Returns
      The result of the check
      + +
      +
      + +

      ◆ isNumeric()

      + +
      +
      + + + + + +
      + + + + + + + +
      bool CharOps::isNumeric (const char & chr)
      +
      +inlinenoexcept
      +
      + +

      Checks whether a character is numeric.

      +
      Parameters
      + + +
      chrThe target character
      +
      +
      +
      Returns
      The result of the check
      + +
      +
      +
      + + + + diff --git a/docs/html/namespaceCheckSec.html b/docs/html/namespaceCheckSec.html index 9ffd8f2a..a014def2 100644 --- a/docs/html/namespaceCheckSec.html +++ b/docs/html/namespaceCheckSec.html @@ -3,12 +3,14 @@ - + LogDoctor: CheckSec Namespace Reference + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -78,38 +80,45 @@ $(function() {

      CheckSec. -More...

      +More...

      - - - - - - - - - + + + + + + + + +

      Functions

      bool checkCollectionDatabase (const std::string &db_path)
       Checks the structure's integrity of the Collection database.
       
      bool checkHashesDatabase (const std::string &db_path)
       Checks the structure's integrity of the Hashes database.
       
      bool checkDatabaseFile (const std::string &db_path, const QString &db_name)
       Checks the database file.
       
      bool checkCollectionDatabase (const std::string &db_path) noexcept
       Checks the structure's integrity of the Collection database.
       
      bool checkHashesDatabase (const std::string &db_path) noexcept
       Checks the structure's integrity of the Hashes database.
       
      bool checkDatabaseFile (const std::string &db_path, const QString &db_name) noexcept
       Basic checks on a database file.
       

      Detailed Description

      CheckSec.

      Utilities used to check the databases

      Function Documentation

      - -

      ◆ checkCollectionDatabase()

      + +

      ◆ checkCollectionDatabase()

      + + + + + +
      - - +
      bool CheckSec::checkCollectionDatabase (const std::string & db_path)const std::string & db_path)
      +
      +noexcept

      Checks the structure's integrity of the Collection database.

      @@ -124,33 +133,34 @@ Functions
      - -

      ◆ checkDatabaseFile()

      + +

      ◆ checkDatabaseFile()

      + + + + + +
      - - + - - - - - - - +
      bool CheckSec::checkDatabaseFile (const std::string & db_path, const std::string & db_path,
      const QString & db_name 
      )const QString & db_name )
      +
      +noexcept
      -

      Checks the database file.

      +

      Basic checks on a database file.

      Parameters
      @@ -159,24 +169,31 @@ Functions
      Returns
      The result of the check
      -
      See also
      IOutils::exists(), IOutils::isFile(), IOutils::checkFile()
      +
      See also
      IOutils::exists(), IOutils::isFile(), IOutils::checkFile()
      - -

      ◆ checkHashesDatabase()

      + +

      ◆ checkHashesDatabase()

      +
      db_pathPath of the database file
      + + + + +
      - - +
      bool CheckSec::checkHashesDatabase (const std::string & db_path)const std::string & db_path)
      +
      +noexcept

      Checks the structure's integrity of the Hashes database.

      @@ -194,7 +211,7 @@ Functions
      diff --git a/docs/html/namespaceColorSec.html b/docs/html/namespaceColorSec.html index af96ba72..6608c385 100644 --- a/docs/html/namespaceColorSec.html +++ b/docs/html/namespaceColorSec.html @@ -3,12 +3,14 @@ - + LogDoctor: ColorSec Namespace Reference + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -78,19 +80,19 @@ $(function() {

      ColorSec. -More...

      +More...

      - - - - - - - + + + + + + +

      Functions

      -std::unordered_map< std::string, QColor > getColors ()
       Provides a map with pre-made colors.
       
      -std::unordered_map< int, std::unordered_map< std::string, QString > > getColorSchemes ()
       Provides a map with pre-made color-schemes for the TextBrowser.
       
      void applyChartTheme (const std::unordered_map< std::string, QFont > &fonts, QChartView *chart_view)
      +std::unordered_map< std::string, QColor > getColors () noexcept
       Provides a map with pre-made colors.
       
      +std::unordered_map< ColorsScheme, std::unordered_map< std::string, QString > > getColorSchemes () noexcept
       Provides a map with pre-made color-schemes for the TextBrowser.
       
      void applyChartTheme (const std::unordered_map< std::string, QFont > &fonts, QChartView *chart_view)
       Applies the choosen theme to the given chart.
       
      @@ -107,19 +109,12 @@ std::unordered_map< int, std::unordered_map< std::string, QString > > void ColorSec::applyChartTheme ( - const std::unordered_map< std::string, QFont > &  - fonts, + const std::unordered_map< std::string, QFont > & fonts, - QChartView *  - chart_view  - - - - ) - + QChartView * chart_view )
      @@ -132,13 +127,19 @@ std::unordered_map< int, std::unordered_map< std::string, QString > > +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      diff --git a/docs/html/namespaceDatabasesConnections.html b/docs/html/namespaceDatabasesConnections.html new file mode 100644 index 00000000..5bf62170 --- /dev/null +++ b/docs/html/namespaceDatabasesConnections.html @@ -0,0 +1,91 @@ + + + + + + + +LogDoctor: DatabasesConnections Namespace Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      +
      DatabasesConnections Namespace Reference
      +
      +
      + +

      DatabasesConnections. +More...

      +

      Detailed Description

      +

      DatabasesConnections.

      +

      Names of the databases connections

      +
      + + + + diff --git a/docs/html/namespaceDatabasesNames.html b/docs/html/namespaceDatabasesNames.html new file mode 100644 index 00000000..83a10deb --- /dev/null +++ b/docs/html/namespaceDatabasesNames.html @@ -0,0 +1,91 @@ + + + + + + + +LogDoctor: DatabasesNames Namespace Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      +
      DatabasesNames Namespace Reference
      +
      +
      + +

      DatabasesNames. +More...

      +

      Detailed Description

      +

      DatabasesNames.

      +

      Names of the databases

      +
      + + + + diff --git a/docs/html/namespaceDateTimeOps.html b/docs/html/namespaceDateTimeOps.html index 3a3064a8..784f1d4c 100644 --- a/docs/html/namespaceDateTimeOps.html +++ b/docs/html/namespaceDateTimeOps.html @@ -3,12 +3,14 @@ - + LogDoctor: DateTimeOps Namespace Reference + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -78,20 +80,20 @@ $(function() {

      DateTimeOps. -More...

      +More...

      - - - + + +

      Functions

      std::vector< std::string > processDateTime (std::string_view datetime, std::string_view format)
       Returns a standardized list of items representing the given date and time.
       
      std::vector< std::string > processDateTime (std::string_view datetime, const LogsFormatField format)
       Returns a standardized list of items representing the given date and time.
       

      Detailed Description

      DateTimeOps.

      Operations for the dates

      Function Documentation

      - -

      ◆ processDateTime()

      + +

      ◆ processDateTime()

      @@ -99,19 +101,12 @@ Functions std::vector< std::string > DateTimeOps::processDateTime ( - std::string_view  - datetime, + std::string_view datetime, - std::string_view  - format  - - - - ) - + const LogsFormatField format )
      @@ -137,7 +132,7 @@ Functions
      diff --git a/docs/html/namespaceFilterOps.html b/docs/html/namespaceFilterOps.html index d7cc29cb..ef6a86e1 100644 --- a/docs/html/namespaceFilterOps.html +++ b/docs/html/namespaceFilterOps.html @@ -3,12 +3,14 @@ - + LogDoctor: FilterOps Namespace Reference + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -78,78 +80,49 @@ $(function() {

      FilterOps. -More...

      +More...

      - - - - - - - - - - - - + + + + + + + + +

      Functions

      std::optional< QString > parseNull (const QString &filter_str, const bool to_clean=true)
       Parses a filter for NULL or NOT NULL final values.
       
      std::optional< QString > parseBooleanFilter (const QString &filter_str)
       Parses a filter for a database field with boolean type.
       
      std::optional< QString > parseNumericFilter (const QString &filter_str)
       Parses a filter for a log field with integer type.
       
      std::optional< QString > parseTextualFilter (const QString &filter_str)
       Parses a filter for a log field with text type.
       
      std::optional< QString > parseNull (const QString &filter_str, const bool to_clean=true) noexcept
       Parses a filter for NULL or NOT NULL final values.
       
      std::optional< QString > parseNumericFilter (const QString &filter_str) noexcept
       Parses a filter for a log field with integer type.
       
      std::optional< QString > parseTextualFilter (const QString &filter_str) noexcept
       Parses a filter for a log field with text type.
       

      Detailed Description

      FilterOps.

      Operations on query filters

      Function Documentation

      - -

      ◆ parseBooleanFilter()

      - -
      -
      - - - - - - - - -
      std::optional< QString > FilterOps::parseBooleanFilter (const QString & filter_str)
      -
      - -

      Parses a filter for a database field with boolean type.

      -

      Boolean filters are not locale-dependant, meaning that English syntax must be used: 'TRUE', 'FALSE'. This filter is case-insensitive.

      Parameters
      - - -
      field_strThe given filter
      -
      -
      -
      Returns
      The resulting filter to apply to the query, if valid
      - -
      -
      - -

      ◆ parseNull()

      + +

      ◆ parseNull()

      + + + + + +
      - - + - - - - - - - +
      std::optional< QString > FilterOps::parseNull (const QString & filter_str, const QString & filter_str,
      const bool to_clean = true 
      )const bool to_clean = true )
      +
      +noexcept

      Parses a filter for NULL or NOT NULL final values.

      @@ -164,20 +137,27 @@ Functions
      - -

      ◆ parseNumericFilter()

      + +

      ◆ parseNumericFilter()

      + + + + + +
      - - +
      std::optional< QString > FilterOps::parseNumericFilter (const QString & filter_str)const QString & filter_str)
      +
      +noexcept

      Parses a filter for a log field with integer type.

      @@ -191,20 +171,27 @@ Functions
      - -

      ◆ parseTextualFilter()

      + +

      ◆ parseTextualFilter()

      + + + + + +
      - - +
      std::optional< QString > FilterOps::parseTextualFilter (const QString & filter_str)const QString & filter_str)
      +
      +noexcept

      Parses a filter for a log field with text type.

      @@ -221,7 +208,7 @@ Functions
      diff --git a/docs/html/namespaceGZutils.html b/docs/html/namespaceGZutils.html index 06e8fa00..1624b6bd 100644 --- a/docs/html/namespaceGZutils.html +++ b/docs/html/namespaceGZutils.html @@ -3,12 +3,14 @@ - + LogDoctor: GZutils Namespace Reference + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -78,11 +80,11 @@ $(function() {

      GZUtils. -More...

      +More...

      - +

      Functions

      void readFile (const std::string &path, std::string &content)
      void readFile (const std::string &path, std::string &content)
       Reads a GZipped file.
       
      @@ -99,19 +101,12 @@ Functions void GZutils::readFile ( - const std::string &  - path, + const std::string & path, - std::string &  - content  - - - - ) - + std::string & content )
      @@ -130,7 +125,7 @@ Functions
      diff --git a/docs/html/namespaceGlobalConfigs.html b/docs/html/namespaceGlobalConfigs.html index c5142d6e..47df883d 100644 --- a/docs/html/namespaceGlobalConfigs.html +++ b/docs/html/namespaceGlobalConfigs.html @@ -3,12 +3,14 @@ - + LogDoctor: GlobalConfigs Namespace Reference + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -76,14 +78,14 @@ $(function() {

      GlobalConfigs. -More...

      +More...

      Detailed Description

      GlobalConfigs.

      Globally shared configurations

      diff --git a/docs/html/namespaceIOutils.html b/docs/html/namespaceIOutils.html index 351394ff..fcdf350b 100644 --- a/docs/html/namespaceIOutils.html +++ b/docs/html/namespaceIOutils.html @@ -3,12 +3,14 @@ - + LogDoctor: IOutils Namespace Reference + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -78,75 +80,75 @@ $(function() {

      IOUtils. -More...

      +More...

      - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - + - + + + + + + + + + +

      Functions

      bool exists (std::string_view path)
       Checks the existence of a file/folder.
       
      bool isFile (std::string_view path)
       Checks if a path exists and points to a file.
       
      bool checkFile (std::string_view path, const bool readable=false, const bool writable=false)
       Checks if a path exists, if it points to a file and if the user has read and/or write permissions on it.
       
      bool isDir (std::string_view path)
       Checks if a path exists and points to a directory.
       
      bool checkDir (std::string_view path, const bool readable=false, const bool writable=false)
       Checks if a path exists, if it points to a folder and if the user has read and/or write permissions on it.
       
      bool makeDir (std::string_view path, std::error_code &err) noexcept(true)
       Creates a directory.
       
      bool renameAsCopy (std::string_view path, std::error_code &err) noexcept(true)
       Renames an entry with a trailing '.copy'.
       
      void readFile (const std::string &path, std::string &content)
      bool checkFile (std::string_view path, const bool readable=false, const bool writable=false) noexcept
       Checks if a path exists, if it points to a file and if the user has read and/or write permissions on it.
       
      bool checkDir (std::string_view path, const bool readable=false, const bool writable=false) noexcept
       Checks if a path exists, if it points to a folder and if the user has read and/or write permissions on it.
       
      bool makeDir (std::string_view path, std::error_code &err) noexcept
       Creates a directory.
       
      bool renameAsCopy (std::string_view path, std::error_code &err) noexcept
       Renames an entry with a trailing '.copy'.
       
      void readFile (const std::string &path, std::string &content)
       Reads the content of a file.
       
      void randomLines (const std::string &path, std::vector< std::string > &lines, const size_t n_lines=16ul, const bool strip_lines=true)
      void randomLines (const std::string &path, std::vector< std::string > &lines, const size_t n_lines=16ul, const bool strip_lines=true)
       Randomly pick lines from a file.
       
      void writeOnFile (const std::string &path, std::string_view content)
      void writeOnFile (const std::string &path, std::string_view content)
       Writes a string on file.
       
      bool exists (std::string_view path) noexcept
       Checks the existence of a file/folder.
       
      bool isFile (std::string_view path) noexcept
       Checks if a path exists and points to a file.
       
      bool isDir (std::string_view path) noexcept
       Checks if a path exists and points to a directory.
       

      Detailed Description

      IOUtils.

      Utilities to work on files

      Function Documentation

      - -

      ◆ checkDir()

      + +

      ◆ checkDir()

      + + + + + +
      - - + - - + - - - - - - - +
      bool IOutils::checkDir (std::string_view path, std::string_view path,
      const bool readable = false, const bool readable = false,
      const bool writable = false 
      )const bool writable = false )
      +
      +noexcept

      Checks if a path exists, if it points to a folder and if the user has read and/or write permissions on it.

      @@ -162,36 +164,36 @@ Functions
      - -

      ◆ checkFile()

      + +

      ◆ checkFile()

      + + + + + +
      - - + - - + - - - - - - - +
      bool IOutils::checkFile (std::string_view path, std::string_view path,
      const bool readable = false, const bool readable = false,
      const bool writable = false 
      )const bool writable = false )
      +
      +noexcept

      Checks if a path exists, if it points to a file and if the user has read and/or write permissions on it.

      @@ -207,20 +209,27 @@ Functions
      - -

      ◆ exists()

      + +

      ◆ exists()

      + + + + + +
      - - +
      bool IOutils::exists (std::string_view path)std::string_view path)
      +
      +inlinenoexcept

      Checks the existence of a file/folder.

      @@ -234,20 +243,27 @@ Functions
      - -

      ◆ isDir()

      + +

      ◆ isDir()

      + + + + + +
      - - +
      bool IOutils::isDir (std::string_view path)std::string_view path)
      +
      +inlinenoexcept

      Checks if a path exists and points to a directory.

      @@ -261,20 +277,27 @@ Functions
      - -

      ◆ isFile()

      + +

      ◆ isFile()

      + + + + + +
      - - +
      bool IOutils::isFile (std::string_view path)std::string_view path)
      +
      +inlinenoexcept

      Checks if a path exists and points to a file.

      @@ -288,8 +311,8 @@ Functions
      - -

      ◆ makeDir()

      + +

      ◆ makeDir()

      @@ -300,19 +323,12 @@ Functions bool IOutils::makeDir ( - std::string_view  - path, + std::string_view path, - std::error_code &  - err  - - - - ) - + std::error_code & err ) @@ -342,31 +358,22 @@ Functions void IOutils::randomLines ( - const std::string &  - path, + const std::string & path, - std::vector< std::string > &  - lines, + std::vector< std::string > & lines, - const size_t  - n_lines = 16ul, + const size_t n_lines = 16ul, - const bool  - strip_lines = true  - - - - ) - + const bool strip_lines = true )
      @@ -393,19 +400,12 @@ Functions void IOutils::readFile ( - const std::string &  - path, + const std::string & path, - std::string &  - content  - - - - ) - + std::string & content )
      @@ -421,8 +421,8 @@ Functions
      - -

      ◆ renameAsCopy()

      + +

      ◆ renameAsCopy()

      @@ -433,19 +433,12 @@ Functions bool IOutils::renameAsCopy ( - std::string_view  - path, + std::string_view path, - std::error_code &  - err  - - - - ) - + std::error_code & err ) @@ -476,19 +469,12 @@ Functions void IOutils::writeOnFile ( - const std::string &  - path, + const std::string & path, - std::string_view  - content  - - - - ) - + std::string_view content )
      @@ -507,7 +493,7 @@ Functions
      diff --git a/docs/html/namespaceLogOps.html b/docs/html/namespaceLogOps.html index 280df29a..c811defb 100644 --- a/docs/html/namespaceLogOps.html +++ b/docs/html/namespaceLogOps.html @@ -3,12 +3,14 @@ - + LogDoctor: LogOps Namespace Reference + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -78,42 +80,43 @@ $(function() {

      LogOps. -More...

      +More...

      - - - + + +

      Functions

      LogType defineFileType (const std::vector< std::string > &lines, const LogsFormat &format)
       Defines the type of a file.
       
      LogType defineFileType (const std::vector< std::string > &lines, const LogsFormat &format) noexcept
       Defines the type of a file.
       

      Detailed Description

      LogOps.

      Operations for the logs

      Function Documentation

      - -

      ◆ defineFileType()

      + +

      ◆ defineFileType()

      + + + + + +
      - - + - - - - - - - +
      LogType LogOps::defineFileType (const std::vector< std::string > & lines, const std::vector< std::string > & lines,
      const LogsFormatformat 
      )const LogsFormat & format )
      +
      +noexcept

      Defines the type of a file.

      @@ -132,7 +135,7 @@ Functions
      diff --git a/docs/html/namespaceMemOps.html b/docs/html/namespaceMemOps.html index 1b222423..93db7935 100644 --- a/docs/html/namespaceMemOps.html +++ b/docs/html/namespaceMemOps.html @@ -3,12 +3,14 @@ - + LogDoctor: MemOps Namespace Reference + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -78,11 +80,11 @@ $(function() {

      MemOps. -More...

      +More...

      - +

      Functions

      size_t availableMemory ()
      size_t availableMemory ()
       Returns the available (free) memory in the system.
       
      @@ -99,7 +101,7 @@ Functions size_t MemOps::availableMemory ( - ) + ) @@ -107,13 +109,19 @@ Functions

      Returns the available (free) memory in the system.

      Returns
      The amount of memory in Bytes
      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      diff --git a/docs/html/namespacePrintSec.html b/docs/html/namespacePrintSec.html index 9d773ac7..a5aeb068 100644 --- a/docs/html/namespacePrintSec.html +++ b/docs/html/namespacePrintSec.html @@ -3,12 +3,14 @@ - + LogDoctor: PrintSec Namespace Reference + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -78,47 +80,54 @@ $(function() {

      PrintSec. -More...

      +More...

      - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +

      Functions

      QString printableSize (const size_t bytes)
       Formats the size including the suffix, for display purposes.
       
      QString printableSpeed (const double bytes, const double seconds)
       Formats the speed including the suffix, for display purposes.
       
      QString printableTime (const unsigned seconds)
       Formats the time, for display purposes.
       
      QString printableTime (const int hour, const int minute, const int second)
       Returns a string of the given time in the format HH:MM:SS.
       
      QString printableDate (const int year, const int month, const int day)
       Returns a string of the given date in the format YYYY-MM-DD.
       
      QString printableBool (const int value)
       Returns a string corresponding to the given value.
       
      QString printableSize (const size_t bytes) noexcept
       Formats the size including the suffix, for display purposes.
       
      QString printableSpeed (const double bytes, const double seconds) noexcept
       Formats the speed including the suffix, for display purposes.
       
      QString printableTime (const unsigned seconds) noexcept
       Formats the time, for display purposes.
       
      QString printableTime (const int hour, const int minute, const int second) noexcept
       Returns a string of the given time in the format HH:MM:SS.
       
      QString printableDate (const int year, const int month, const int day) noexcept
       Returns a string of the given date in the format YYYY-MM-DD.
       
      QString printableBool (const int value) noexcept
       Returns a string corresponding to the given value.
       

      Detailed Description

      PrintSec.

      Utilities to have printable stuff

      Function Documentation

      - -

      ◆ printableBool()

      + +

      ◆ printableBool()

      + + + + + +
      - - +
      QString PrintSec::printableBool (const int value)const int value)
      +
      +noexcept

      Returns a string corresponding to the given value.

      @@ -132,36 +141,36 @@ Functions
      - -

      ◆ printableDate()

      + +

      ◆ printableDate()

      + + + + + +
      - - + - - + - - - - - - - +
      QString PrintSec::printableDate (const int year, const int year,
      const int month, const int month,
      const int day 
      )const int day )
      +
      +noexcept

      Returns a string of the given date in the format YYYY-MM-DD.

      @@ -177,20 +186,27 @@ Functions
      - -

      ◆ printableSize()

      + +

      ◆ printableSize()

      + + + + + +
      - - +
      QString PrintSec::printableSize (const size_t bytes)const size_t bytes)
      +
      +noexcept

      Formats the size including the suffix, for display purposes.

      @@ -204,30 +220,31 @@ Functions
      - -

      ◆ printableSpeed()

      + +

      ◆ printableSpeed()

      + + + + + +
      - - + - - - - - - - +
      QString PrintSec::printableSpeed (const double bytes, const double bytes,
      const double seconds 
      )const double seconds )
      +
      +noexcept

      Formats the speed including the suffix, for display purposes.

      @@ -242,36 +259,36 @@ Functions
      - -

      ◆ printableTime() [1/2]

      + +

      ◆ printableTime() [1/2]

      + + + + + +
      - - + - - + - - - - - - - +
      QString PrintSec::printableTime (const int hour, const int hour,
      const int minute, const int minute,
      const int second 
      )const int second )
      +
      +noexcept

      Returns a string of the given time in the format HH:MM:SS.

      @@ -287,20 +304,27 @@ Functions
      - -

      ◆ printableTime() [2/2]

      + +

      ◆ printableTime() [2/2]

      + + + + + +
      - - +
      QString PrintSec::printableTime (const unsigned seconds)const unsigned seconds)
      +
      +noexcept

      Formats the time, for display purposes.

      @@ -317,7 +341,7 @@ Functions
      diff --git a/docs/html/namespaceStringOps.html b/docs/html/namespaceStringOps.html index 5ecef5ad..5e5e1bfe 100644 --- a/docs/html/namespaceStringOps.html +++ b/docs/html/namespaceStringOps.html @@ -3,12 +3,14 @@ - + LogDoctor: StringOps Namespace Reference + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -78,126 +80,118 @@ $(function() {

      StringOps. -More...

      +More...

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

      Functions

      size_t count (std::string_view str, const char flag)
       Count the occurrences of the given sequence in the given string.
       
      size_t count (std::string_view str, std::string_view flag)
       Count the occurrences of the given sequence in the given string.
       
      bool isNumeric (const char &chr)
       Checks whether character is numeric.
       
      bool isNumeric (std::string_view str)
       Checks whether a string only contains numeric characters.
       
      bool isAlphabetic (const char &chr)
       Checks whether a character is alphabetic.
       
      bool isAlphabetic (std::string_view str)
       Checks whether a string only contains alphabetic characters.
       
      bool isAlnum (const char &chr)
       Checks whether a character is alpha-numeric.
       
      bool isAlnum (std::string_view str)
       Checks whether a string only contains alpha-numeric characters.
       
      bool isHex (const char &chr)
       Checks whether a string only contains hexadecimal characters.
       
      bool isIP (std::string_view str)
       Checks whether a string contains only IPv4/IPv6 chars.
       
      bool startsWith (std::string_view str, const char flag)
       Checks if a string starts with the given sequence.
       
      bool startsWith (std::string_view str, std::string_view flag)
       Checks if a string starts with the given sequence.
       
      bool endsWith (std::string_view str, const char flag)
       Checks if a string ends with the given sequence.
       
      bool endsWith (std::string_view str, std::string_view flag)
       Checks if a string ends with the given sequence.
       
      bool contains (std::string_view str, std::string_view flag)
       Checks if a string contains the given sequence.
       
      std::string strip (const std::string &str, const char chr)
       Strips the given character from both the left and the right side of a string.
       
      std::string strip (const std::string &str, std::string_view chars=" \n\t\b\r\v")
       Strips the given characters from both the left and the right side of a string.
       
      std::string lstrip (const std::string &str, const char chr)
       Strips the given character from the left side of a string.
       
      std::string lstrip (const std::string &str, std::string_view chars=" \n\t\b\r\v")
       Strips the given characters from the left side of a string.
       
      std::string rstrip (const std::string &str, const char chr)
       Strips the given character from the right side of a string.
       
      std::string rstrip (const std::string &str, std::string_view chars=" \n\t\b\r\v")
       Strips the given characters from the right side of a string.
       
      std::string lstripUntil (const std::string &str, const char delim, const bool inclusive=true, const bool consecutives=true)
       Strips everything from a string starting from the left side untill the delimiter is found (a.k.a. cut)
       
      void split (std::vector< std::string > &list, const std::string &target_str, const char separator='\n')
       Splits a string using a separator.
       
      void split (std::vector< std::string > &list, const std::string &target_str, std::string_view separator)
       Splits a string using a separator.
       
      void splitrip (std::vector< std::string > &list, const std::string &target_str, const char separator='\n', std::string_view strips=" \n\t\b\r\v")
       Splits a string and strips all the splitted items.
       
      void splitrip (std::vector< std::string > &list, const std::string &target_str, std::string_view separator, std::string_view strips=" \n\t\b\r\v")
       Splits a string and strips all the splitted items.
       
      std::string replace (std::string_view str, std::string_view target, std::string_view replace)
       Replaces all the occurrences of a sequence with another.
       
      std::string toUpper (std::string_view str)
       Converts a string to upper case.
       
      std::string toLower (std::string_view str)
       Converts a string to lower case.
       
      size_t count (std::string_view str, std::string_view flag) noexcept
       Counts the occurrences of the given sequence in the given string.
       
      bool isNumeric (QStringView str) noexcept
       Checks whether a string only contains numeric characters.
       
      std::string strip (const std::string &str, const char chr) noexcept
       Strips the given character from both the left and the right side of a string.
       
      std::string strip (const std::string &str, const char *chars=" \n\t\b\r\v") noexcept
       Strips the given characters from both the left and the right side of a string.
       
      std::string lstrip (const std::string &str, const char chr) noexcept
       Strips the given character from the left side of a string.
       
      std::string lstrip (const std::string &str, const char *chars=" \n\t\b\r\v") noexcept
       Strips the given characters from the left side of a string.
       
      std::string rstrip (const std::string &str, const char chr) noexcept
       Strips the given character from the right side of a string.
       
      std::string rstrip (const std::string &str, const char *chars=" \n\t\b\r\v") noexcept
       Strips the given characters from the right side of a string.
       
      std::string lstripUntil (const std::string &str, const char delim, const bool inclusive=true, const bool consecutives=true) noexcept
       Strips everything from a string starting from the left side untill the delimiter is found (a.k.a. cut)
       
      void split (std::vector< std::string > &list, const std::string &target_str, const char separator='\n') noexcept
       Splits a string using a separator.
       
      void split (std::vector< std::string > &list, const std::string &target_str, std::string_view separator) noexcept
       Splits a string using a separator.
       
      void splitrip (std::vector< std::string > &list, const std::string &target_str, const char separator='\n', const char *strips=" \n\t\b\r\v") noexcept
       Splits a string and strips all the splitted items.
       
      void splitrip (std::vector< std::string > &list, const std::string &target_str, const char *separator, const char *strips=" \n\t\b\r\v") noexcept
       Splits a string and strips all the splitted items.
       
      std::string replace (std::string_view str, std::string_view target, std::string_view replace) noexcept
       Replaces all the occurrences of a sequence with another.
       
      std::string toUpper (std::string_view str) noexcept
       Converts a string to upper case.
       
      std::string toLower (std::string_view str) noexcept
       Converts a string to lower case.
       
      size_t count (std::string_view str, const char flag) noexcept
       Counts the occurrences of the given sequence in the given string.
       
      bool isNumeric (std::string_view str) noexcept
       Checks whether a string only contains numeric characters.
       
      bool isAlphabetic (std::string_view str) noexcept
       Checks whether a string only contains alphabetic characters.
       
      bool isAlnum (std::string_view str) noexcept
       Checks whether a string only contains alpha-numeric characters.
       
      bool isIP (std::string_view str) noexcept
       Checks whether a string contains only IPv4/IPv6 chars.
       
      bool startsWith (std::string_view str, const char flag) noexcept
       Checks if a string starts with the given sequence.
       
      bool startsWith (std::string_view str, std::string_view flag) noexcept
       Checks if a string starts with the given sequence.
       
      bool endsWith (std::string_view str, const char flag) noexcept
       Checks if a string ends with the given sequence.
       
      bool endsWith (std::string_view str, std::string_view flag) noexcept
       Checks if a string ends with the given sequence.
       
      bool contains (std::string_view str, std::string_view flag) noexcept
       Checks if a string contains the given sequence.
       

      Detailed Description

      StringOps.

      Utilities for the strings

      Function Documentation

      - -

      ◆ contains()

      + +

      ◆ contains()

      + + + + + +
      - - + - - - - - - - +
      bool StringOps::contains (std::string_view str, std::string_view str,
      std::string_view flag 
      )std::string_view flag )
      +
      +inlinenoexcept

      Checks if a string contains the given sequence.

      @@ -212,33 +206,34 @@ Functions
      - -

      ◆ count() [1/2]

      + +

      ◆ count() [1/2]

      + + + + + +
      - - + - - - - - - - +
      size_t StringOps::count (std::string_view str, std::string_view str,
      const char flag 
      )const char flag )
      +
      +inlinenoexcept
      -

      Count the occurrences of the given sequence in the given string.

      +

      Counts the occurrences of the given sequence in the given string.

      Parameters
      @@ -250,33 +245,34 @@ Functions - -

      ◆ count() [2/2]

      + +

      ◆ count() [2/2]

      +
      strThe target string
      + + + + +
      - - + - - - - - - - +
      size_t StringOps::count (std::string_view str, std::string_view str,
      std::string_view flag 
      )std::string_view flag )
      +
      +noexcept
      -

      Count the occurrences of the given sequence in the given string.

      +

      Counts the occurrences of the given sequence in the given string.

      Parameters
      @@ -288,30 +284,31 @@ Functions - -

      ◆ endsWith() [1/2]

      + +

      ◆ endsWith() [1/2]

      +
      strThe target string
      + + + + +
      - - + - - - - - - - +
      bool StringOps::endsWith (std::string_view str, std::string_view str,
      const char flag 
      )const char flag )
      +
      +inlinenoexcept

      Checks if a string ends with the given sequence.

      @@ -326,30 +323,31 @@ Functions
      - -

      ◆ endsWith() [2/2]

      + +

      ◆ endsWith() [2/2]

      + + + + + +
      - - + - - - - - - - +
      bool StringOps::endsWith (std::string_view str, std::string_view str,
      std::string_view flag 
      )std::string_view flag )
      +
      +inlinenoexcept

      Checks if a string ends with the given sequence.

      @@ -364,48 +362,27 @@ Functions
      - -

      ◆ isAlnum() [1/2]

      + +

      ◆ isAlnum()

      + + + + + +
      - - - - -
      bool StringOps::isAlnum (const char & chr)
      -
      - -

      Checks whether a character is alpha-numeric.

      -
      Parameters
      - - -
      strThe target character
      -
      -
      -
      Returns
      The result of the check
      -
      See also
      isAlnum
      - -
      - - -

      ◆ isAlnum() [2/2]

      - -
      -
      - - - - - - +
      bool StringOps::isAlnum (std::string_view str)std::string_view str)
      +
      +inlinenoexcept

      Checks whether a string only contains alpha-numeric characters.

      @@ -419,48 +396,27 @@ Functions
      - -

      ◆ isAlphabetic() [1/2]

      + +

      ◆ isAlphabetic()

      + + + + + +
      - - - - -
      bool StringOps::isAlphabetic (const char & chr)
      -
      - -

      Checks whether a character is alphabetic.

      -
      Parameters
      - - -
      strThe target character
      -
      -
      -
      Returns
      The result of the check
      -
      See also
      isAlphabetic()
      - -
      - - -

      ◆ isAlphabetic() [2/2]

      - -
      -
      - - - - - - +
      bool StringOps::isAlphabetic (std::string_view str)std::string_view str)
      +
      +inlinenoexcept

      Checks whether a string only contains alphabetic characters.

      @@ -474,47 +430,27 @@ Functions
      - -

      ◆ isHex()

      - -
      -
      - - - - - - - - -
      bool StringOps::isHex (const char & chr)
      -
      - -

      Checks whether a string only contains hexadecimal characters.

      -
      Parameters
      - - -
      strThe target character
      -
      -
      -
      Returns
      The result of the check
      - -
      -
      - -

      ◆ isIP()

      + +

      ◆ isIP()

      + + + + + +
      - - +
      bool StringOps::isIP (std::string_view str)std::string_view str)
      +
      +inlinenoexcept

      Checks whether a string contains only IPv4/IPv6 chars.

      @@ -528,48 +464,27 @@ Functions
      - -

      ◆ isNumeric() [1/2]

      + +

      ◆ isNumeric() [1/2]

      + + + + + +
      - - - - -
      bool StringOps::isNumeric (const char & chr)
      -
      - -

      Checks whether character is numeric.

      -
      Parameters
      - - -
      strThe target character
      -
      -
      -
      Returns
      The result of the check
      -
      See also
      isNumeric()
      - -
      - - -

      ◆ isNumeric() [2/2]

      - -
      -
      - - - - - - +
      bool StringOps::isNumeric (std::string_view str)QStringView str)
      +
      +noexcept

      Checks whether a string only contains numeric characters.

      @@ -583,68 +498,65 @@ Functions
      - -

      ◆ lstrip() [1/2]

      + +

      ◆ isNumeric() [2/2]

      + + + + + +
      - + - - - - - + - - - - - - -
      std::string StringOps::lstrip bool StringOps::isNumeric (const std::string & str,
      std::string_view str) const char chr 
      )
      +
      +inlinenoexcept
      -

      Strips the given character from the left side of a string.

      +

      Checks whether a string only contains numeric characters.

      Parameters
      -
      strThe target string
      chrThe character to strip away
      -
      Returns
      The result string
      +
      Returns
      The result of the check
      - -

      ◆ lstrip() [2/2]

      + +

      ◆ lstrip() [1/2]

      + + + + + +
      - - + - - - - - - - +
      std::string StringOps::lstrip (const std::string & str, const std::string & str,
      std::string_view chars = " \n\t\b\r\v" 
      )const char * chars = " \n\t\b\r\v" )
      +
      +noexcept

      Strips the given characters from the left side of a string.

      @@ -659,42 +571,80 @@ Functions
      - -

      ◆ lstripUntil()

      + +

      ◆ lstrip() [2/2]

      + + + + + +
      + + + + + + + + + + + +
      std::string StringOps::lstrip (const std::string & str,
      const char chr )
      +
      +noexcept
      +
      + +

      Strips the given character from the left side of a string.

      +
      Parameters
      + + + +
      strThe target string
      chrThe character to strip away
      +
      +
      +
      Returns
      The result string
      + +
      +
      + +

      ◆ lstripUntil()

      + +
      +
      + + + + + +
      - - + - - + - - + - - - - - - - +
      std::string StringOps::lstripUntil (const std::string & str, const std::string & str,
      const char delim, const char delim,
      const bool inclusive = true, const bool inclusive = true,
      const bool consecutives = true 
      )const bool consecutives = true )
      +
      +noexcept

      Strips everything from a string starting from the left side untill the delimiter is found (a.k.a. cut)

      @@ -711,36 +661,36 @@ Functions
      - -

      ◆ replace()

      + +

      ◆ replace()

      + + + + + +
      - - + - - + - - - - - - - +
      std::string StringOps::replace (std::string_view str, std::string_view str,
      std::string_view target, std::string_view target,
      std::string_view replace 
      )std::string_view replace )
      +
      +noexcept

      Replaces all the occurrences of a sequence with another.

      @@ -756,68 +706,31 @@ Functions
      - -

      ◆ rstrip() [1/2]

      + +

      ◆ rstrip() [1/2]

      + + + + + +
      - - + - - - - - - - - -
      std::string StringOps::rstrip (const std::string & str, const std::string & str,
      const char chr 
      )
      -
      - -

      Strips the given character from the right side of a string.

      -
      Parameters
      - - - -
      strThe target string
      chrThe character to strip away
      -
      -
      -
      Returns
      The result string
      - -
      - - -

      ◆ rstrip() [2/2]

      - -
      -
      - - - - - - - - - - - - - - - - - +
      std::string StringOps::rstrip (const std::string & str,
      std::string_view chars = " \n\t\b\r\v" 
      )const char * chars = " \n\t\b\r\v" )
      +
      +noexcept

      Strips the given characters from the right side of a string.

      @@ -832,36 +745,75 @@ Functions
      - -

      ◆ split() [1/2]

      + +

      ◆ rstrip() [2/2]

      + + + + + +
      + + + + + + + + + + + +
      std::string StringOps::rstrip (const std::string & str,
      const char chr )
      +
      +noexcept
      +
      + +

      Strips the given character from the right side of a string.

      +
      Parameters
      + + + +
      strThe target string
      chrThe character to strip away
      +
      +
      +
      Returns
      The result string
      + +
      +
      + +

      ◆ split() [1/2]

      + +
      +
      + + + + + +
      - - + - - + - - - - - - - +
      void StringOps::split (std::vector< std::string > & list, std::vector< std::string > & list,
      const std::string & target_str, const std::string & target_str,
      const char separator = '\n' 
      )const char separator = '\n' )
      +
      +noexcept

      Splits a string using a separator.

      @@ -876,36 +828,36 @@ Functions
      - -

      ◆ split() [2/2]

      + +

      ◆ split() [2/2]

      + + + + + +
      - - + - - + - - - - - - - +
      void StringOps::split (std::vector< std::string > & list, std::vector< std::string > & list,
      const std::string & target_str, const std::string & target_str,
      std::string_view separator 
      )std::string_view separator )
      +
      +noexcept

      Splits a string using a separator.

      @@ -920,42 +872,41 @@ Functions
      - -

      ◆ splitrip() [1/2]

      + +

      ◆ splitrip() [1/2]

      + + + + + +
      - - + - - + - - + - - - - - - - +
      void StringOps::splitrip (std::vector< std::string > & list, std::vector< std::string > & list,
      const std::string & target_str, const std::string & target_str,
      const char separator = '\n', const char * separator,
      std::string_view strips = " \n\t\b\r\v" 
      )const char * strips = " \n\t\b\r\v" )
      +
      +noexcept

      Splits a string and strips all the splitted items.

      @@ -971,42 +922,41 @@ Functions
      - -

      ◆ splitrip() [2/2]

      + +

      ◆ splitrip() [2/2]

      + + + + + +
      - - + - - + - - + - - - - - - - +
      void StringOps::splitrip (std::vector< std::string > & list, std::vector< std::string > & list,
      const std::string & target_str, const std::string & target_str,
      std::string_view separator, const char separator = '\n',
      std::string_view strips = " \n\t\b\r\v" 
      )const char * strips = " \n\t\b\r\v" )
      +
      +noexcept

      Splits a string and strips all the splitted items.

      @@ -1022,30 +972,31 @@ Functions
      - -

      ◆ startsWith() [1/2]

      + +

      ◆ startsWith() [1/2]

      + + + + + +
      - - + - - - - - - - +
      bool StringOps::startsWith (std::string_view str, std::string_view str,
      const char flag 
      )const char flag )
      +
      +inlinenoexcept

      Checks if a string starts with the given sequence.

      @@ -1060,30 +1011,31 @@ Functions
      - -

      ◆ startsWith() [2/2]

      + +

      ◆ startsWith() [2/2]

      + + + + + +
      - - + - - - - - - - +
      bool StringOps::startsWith (std::string_view str, std::string_view str,
      std::string_view flag 
      )std::string_view flag )
      +
      +inlinenoexcept

      Checks if a string starts with the given sequence.

      @@ -1098,68 +1050,31 @@ Functions
      - -

      ◆ strip() [1/2]

      + +

      ◆ strip() [1/2]

      + + + + + +
      - - + - - - - - - - - -
      std::string StringOps::strip (const std::string & str, const std::string & str,
      const char chr 
      )
      -
      - -

      Strips the given character from both the left and the right side of a string.

      -
      Parameters
      - - - -
      strThe target string
      chrThe character to strip away
      -
      -
      -
      Returns
      The result string
      - -
      - - -

      ◆ strip() [2/2]

      - -
      -
      - - - - - - - - - - - - - - - - - +
      std::string StringOps::strip (const std::string & str,
      std::string_view chars = " \n\t\b\r\v" 
      )const char * chars = " \n\t\b\r\v" )
      +
      +noexcept

      Strips the given characters from both the left and the right side of a string.

      @@ -1174,20 +1089,66 @@ Functions
      - -

      ◆ toLower()

      + +

      ◆ strip() [2/2]

      + + + + + +
      + + + + + + + + + + + +
      std::string StringOps::strip (const std::string & str,
      const char chr )
      +
      +noexcept
      +
      + +

      Strips the given character from both the left and the right side of a string.

      +
      Parameters
      + + + +
      strThe target string
      chrThe character to strip away
      +
      +
      +
      Returns
      The result string
      + +
      +
      + +

      ◆ toLower()

      + +
      +
      + + + + + +
      - - +
      std::string StringOps::toLower (std::string_view str)std::string_view str)
      +
      +noexcept

      Converts a string to lower case.

      @@ -1201,20 +1162,27 @@ Functions
      - -

      ◆ toUpper()

      + +

      ◆ toUpper()

      + + + + + +
      - - +
      std::string StringOps::toUpper (std::string_view str)std::string_view str)
      +
      +noexcept

      Converts a string to upper case.

      @@ -1231,7 +1199,7 @@ Functions
      diff --git a/docs/html/namespaceStyleSec.html b/docs/html/namespaceStyleSec.html index 23eab99e..c9ba9f57 100644 --- a/docs/html/namespaceStyleSec.html +++ b/docs/html/namespaceStyleSec.html @@ -3,12 +3,14 @@ - + LogDoctor: StyleSec Namespace Reference + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -78,38 +80,37 @@ $(function() {

      StyleSec. -More...

      +More...

      - - - + + +

      Functions

      void getStyleSheet (QString &stylesheet)
       Provides the requested stylesheet.
       
      QString getStyleSheet ()
       Returns the proper style sheet.
       

      Detailed Description

      StyleSec.

      Utilities for the stylesheets

      Function Documentation

      - -

      ◆ getStyleSheet()

      + +

      ◆ getStyleSheet()

      - + - - +
      void StyleSec::getStyleSheet QString StyleSec::getStyleSheet (QString & stylesheet))
      -

      Provides the requested stylesheet.

      -
      Parameters
      - - +

      Returns the proper style sheet.

      +
      Exceptions
      +
      stylesheetWill hold the stylesheet
      +
      DoNotCatchException
      @@ -119,7 +120,7 @@ Functions
      diff --git a/docs/html/namespaceTesting.html b/docs/html/namespaceTesting.html index 1d5ae66d..cac6c5bb 100644 --- a/docs/html/namespaceTesting.html +++ b/docs/html/namespaceTesting.html @@ -3,12 +3,14 @@ - + LogDoctor: Testing Namespace Reference + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -78,10 +80,14 @@ $(function() {

      Testing. -More...

      +More...

      + + + @@ -101,7 +107,7 @@ void  @@ -31,7 +33,7 @@

      Functions

      +void testOperators ()
       A Test suit for the defined operators.
       
      void testUtilities ()
       A Test suit for the utilities.
      testCrapviewModules diff --git a/docs/html/namespaceVecOps.html b/docs/html/namespaceVecOps.html index f16da473..b699455e 100644 --- a/docs/html/namespaceVecOps.html +++ b/docs/html/namespaceVecOps.html @@ -3,12 +3,14 @@ - + LogDoctor: VecOps Namespace Reference + + @@ -22,7 +24,7 @@
      -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      - + @@ -78,21 +80,21 @@ $(function() {

      VecOps. -More...

      +More...

      - - - - + + + +

      Functions

      template<typename T >
      bool contains (const std::vector< T > &list, const T &flag)
       Checks if a vector contains an element.
       
      template<typename T >
      bool contains (const std::vector< T > &list, const T &flag) noexcept
       Checks if a vector contains an element.
       

      Detailed Description

      VecOps.

      Utilities for the vectors

      Function Documentation

      - -

      ◆ contains()

      + +

      ◆ contains()

      @@ -105,24 +107,17 @@ template<typename T >
      bool VecOps::contains ( - const std::vector< T > &  - list, + const std::vector< T > & list, - const T &  - flag  - - - - ) - + const T & flag ) -inline +inlinenoexcept
      @@ -142,7 +137,7 @@ template<typename T >
      diff --git a/docs/html/namespacemembers.html b/docs/html/namespacemembers.html index cfbbc7af..bed65cc4 100644 --- a/docs/html/namespacemembers.html +++ b/docs/html/namespacemembers.html @@ -3,12 +3,14 @@ - + LogDoctor: Namespace Members + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -80,103 +82,113 @@ $(function() {

      - c -

      - d -

      - e -

      - g -

      - i -

      - l -

      - m -

      - p -

      - r -

      - s -

      - t -

      - w -

      + + +

      - z -

      diff --git a/docs/html/namespacemembers_func.html b/docs/html/namespacemembers_func.html index a9107b10..3e13a562 100644 --- a/docs/html/namespacemembers_func.html +++ b/docs/html/namespacemembers_func.html @@ -3,12 +3,14 @@ - + LogDoctor: Namespace Members + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -80,103 +82,113 @@ $(function() {

      - c -

      - d -

      - e -

      - g -

      - i -

      - l -

      - m -

      - p -

      - r -

      - s -

      - t -

      - w -

      + + +

      - z -

      diff --git a/docs/html/namespaces.html b/docs/html/namespaces.html index cae6d9a3..92a81623 100644 --- a/docs/html/namespaces.html +++ b/docs/html/namespaces.html @@ -3,12 +3,14 @@ - + LogDoctor: Namespace List + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -76,26 +78,31 @@ $(function() { diff --git a/docs/html/pages.html b/docs/html/pages.html new file mode 100644 index 00000000..f3eb8376 --- /dev/null +++ b/docs/html/pages.html @@ -0,0 +1,90 @@ + + + + + + + +LogDoctor: Related Pages + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + +
      + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      Related Pages
      +
      +
      +
      Here is a list of all related documentation pages:
      + + +
       Todo List
      +
      +
      + + + + diff --git a/docs/html/search/all_0.js b/docs/html/search/all_0.js index ddf3a882..5dcc69fb 100644 --- a/docs/html/search/all_0.js +++ b/docs/html/search/all_0.js @@ -1,11 +1,15 @@ var searchData= [ ['abortrequest_0',['abortRequest',['../classCrapup.html#aab00b3d7f06317c5ff2753821d2b67d7',1,'Crapup']]], - ['addbreakdownseries_1',['addBreakdownSeries',['../classDonutBreakdown.html#a161ef5e8ca88f2735a4971d1f66f7a72',1,'DonutBreakdown']]], - ['ai_5fmakechoice_2',['AI_makeChoice',['../classCrissCross.html#a6f329792d3f7f51f3334a84e1f1001ef',1,'CrissCross']]], - ['ai_5fplayturn_3',['AI_playTurn',['../classCrissCross.html#aefa21dcac38b6729af095fdc70be9ca9',1,'CrissCross']]], - ['ai_5fupdateweights_4',['AI_updateWeights',['../classCrissCross.html#a8c8798850707c8090bc8bf3d0f313109',1,'CrissCross']]], - ['apache_5falf_5',['APACHE_ALF',['../classFormatOps.html#a1dd258c0c0bb9091e25c2b36c47b5ad1',1,'FormatOps']]], - ['applycharttheme_6',['applyChartTheme',['../namespaceColorSec.html#af2d0f21c73979f6b9363e1a47718628d',1,'ColorSec']]], - ['availablememory_7',['availableMemory',['../namespaceMemOps.html#ae86bbf78d7743f9b6b98da053bfcbd08',1,'MemOps']]] + ['add_1',['add',['../structBlacklistItem.html#a341214f4d4ee5d961db35fa06f956b38',1,'BlacklistItem::add()'],['../structWarnlistItem.html#aae8e8c1d366694d298db2b89038f1569',1,'WarnlistItem::add()']]], + ['addbreakdownseries_2',['addBreakdownSeries',['../classDonutBreakdown.html#a161ef5e8ca88f2735a4971d1f66f7a72',1,'DonutBreakdown']]], + ['additem_3',['addItem',['../structBlacklists.html#ab0e2168256dbdf32d1bdd55d023940da',1,'Blacklists::addItem()'],['../structWarnlists.html#a1c250a9862c7a9bbe5db346a7a580e5b',1,'Warnlists::addItem()']]], + ['ai_5fmakechoice_4',['AI_makeChoice',['../classCrissCross.html#aaa6af51d74e3c8250c0fdf8b734bff16',1,'CrissCross']]], + ['ai_5fplayturn_5',['AI_playTurn',['../classCrissCross.html#a9546863583b69a7246a216794b88d062',1,'CrissCross']]], + ['ai_5fupdateweights_6',['AI_updateWeights',['../classCrissCross.html#a2fc7d3a6f907718ea430e138681ba328',1,'CrissCross']]], + ['apache_5falf_7',['APACHE_ALF',['../classFormatOps.html#a82e05a03cb896eb06574f7e79e14d8fe',1,'FormatOps']]], + ['apache_5falf_5fv_8',['APACHE_ALF_V',['../classFormatOps.html#a7da91fdd84e450e6892a8a530e051734',1,'FormatOps']]], + ['applycharttheme_9',['applyChartTheme',['../namespaceColorSec.html#af2d0f21c73979f6b9363e1a47718628d',1,'ColorSec']]], + ['arrayops_10',['ArrayOps',['../namespaceArrayOps.html',1,'']]], + ['availablememory_11',['availableMemory',['../namespaceMemOps.html#ae86bbf78d7743f9b6b98da053bfcbd08',1,'MemOps']]] ]; diff --git a/docs/html/search/all_1.js b/docs/html/search/all_1.js index 375c04cb..e3e2a5d4 100644 --- a/docs/html/search/all_1.js +++ b/docs/html/search/all_1.js @@ -2,12 +2,11 @@ var searchData= [ ['backupdatabase_0',['backupDatabase',['../classMainWindow.html#a40f3871eea9eaa252ed20a6808934844',1,'MainWindow']]], ['battle_1',['Battle',['../classSnakeGame.html#a146a1430f1f32269ad0ad4df759e6a2ea747d99f92ee9c080ba26108ac5d26488',1,'SnakeGame']]], - ['blacklistadd_2',['blacklistAdd',['../classCraplog.html#a392faae3babb5182215a30c154ea8053',1,'Craplog']]], - ['blacklistmovedown_3',['blacklistMoveDown',['../classCraplog.html#a13c94304a2d250da355d7930f6d448cc',1,'Craplog']]], - ['blacklistmoveup_4',['blacklistMoveUp',['../classCraplog.html#aa2ea4289aa04a420cd16a1d4c6a1e5cc',1,'Craplog']]], - ['blacklistremove_5',['blacklistRemove',['../classCraplog.html#a9924c43afafe215b676877017c0365fd',1,'Craplog']]], - ['bodypart_6',['BodyPart',['../structBodyPart.html',1,'']]], - ['breakdownseries_7',['breakdownSeries',['../classMainSlice.html#af44c7a7a24e34fcd30da0ed8c3412e0d',1,'MainSlice']]], - ['bwlist_8',['BWlist',['../structBWlist.html',1,'']]], - ['bwlistexception_9',['BWlistException',['../classBWlistException.html',1,'']]] + ['blacklist_2',['Blacklist',['../structBlacklist.html',1,'']]], + ['blacklistitem_3',['BlacklistItem',['../structBlacklistItem.html',1,'']]], + ['blacklists_4',['Blacklists',['../structBlacklists.html',1,'']]], + ['bodypart_5',['BodyPart',['../structBodyPart.html',1,'']]], + ['breakdownseries_6',['breakdownSeries',['../classMainSlice.html#af44c7a7a24e34fcd30da0ed8c3412e0d',1,'MainSlice']]], + ['bwlistexception_7',['BWlistException',['../classBWlistException.html',1,'']]], + ['bwutils_8',['BWutils',['../namespaceBWutils.html',1,'']]] ]; diff --git a/docs/html/search/all_10.js b/docs/html/search/all_10.js index 9c0ddf3a..8c27d6e6 100644 --- a/docs/html/search/all_10.js +++ b/docs/html/search/all_10.js @@ -1,18 +1,4 @@ var searchData= [ - ['randomlines_0',['randomLines',['../namespaceIOutils.html#aa52ebe237d181752064409cf0623a135',1,'IOutils']]], - ['readconfigs_1',['readConfigs',['../classMainWindow.html#aae306cbf256c5a686cc8d9f2a1dbb18b',1,'MainWindow']]], - ['readfile_2',['readfile',['../namespaceGZutils.html#a72f6960bddea2b816af84e7773d5c6b2',1,'GZutils::readFile()'],['../namespaceIOutils.html#a185c38eff9d9f4432c8138404941915e',1,'IOutils::readFile()']]], - ['recalculateangles_3',['recalculateAngles',['../classDonutBreakdown.html#acd747ee2bbd23ce84eaf9d4db57938e3',1,'DonutBreakdown']]], - ['refreshdates_4',['refreshdates',['../classCrapview.html#ac98b1cbc75604b5145b5cff36e96eb78',1,'Crapview::refreshDates()'],['../classDbQuery.html#a6739efb23d825be9585b773685382e41',1,'DbQuery::refreshDates()']]], - ['refreshstatsdates_5',['refreshStatsDates',['../classMainWindow.html#ac8f4c84b43d14b6dcc6cb7b5f75ce343',1,'MainWindow']]], - ['renameascopy_6',['renameAsCopy',['../namespaceIOutils.html#a5d2d1f6669cc9d355add7a41adf38d81',1,'IOutils']]], - ['replace_7',['replace',['../namespaceStringOps.html#a93a957fa06709c3c66fdd331bbdfdcdc',1,'StringOps']]], - ['requesttimeout_8',['requestTimeout',['../classCrapup.html#afe79a787fc0820afbc4573ca7091d880',1,'Crapup']]], - ['resolvepath_9',['resolvePath',['../classMainWindow.html#ac456e2e1b4211836e83d3111a8bdf84e',1,'MainWindow']]], - ['richlogsdefault_10',['richLogsDefault',['../classRichText.html#a28bf0bdd659cc7b7a58eab9e5cfad495',1,'RichText']]], - ['richlogsfailure_11',['richLogsFailure',['../classRichText.html#a6e5fe6270e6fed0b9e7c42eafc9b4732',1,'RichText']]], - ['richtext_12',['RichText',['../classRichText.html',1,'']]], - ['rotateimg_13',['rotateImg',['../classCrapup.html#a334624ab394fd773b0e6063e7baf7960',1,'Crapup']]], - ['rstrip_14',['rstrip',['../namespaceStringOps.html#a6ad9c0c897030d7c4c22f290348f9dd8',1,'StringOps::rstrip(const std::string &str, const char chr)'],['../namespaceStringOps.html#ae3109bdbff72270bc05d9e43cbf4ed63',1,'StringOps::rstrip(const std::string &str, std::string_view chars=" \n\t\b\r\v")']]] + ['querywrapper_0',['QueryWrapper',['../classQueryWrapper.html',1,'']]] ]; diff --git a/docs/html/search/all_11.js b/docs/html/search/all_11.js index 68673fbe..f40b907c 100644 --- a/docs/html/search/all_11.js +++ b/docs/html/search/all_11.js @@ -1,47 +1,23 @@ var searchData= [ - ['sanitizebwitem_0',['sanitizeBWitem',['../classCraplog.html#a4998730f8e6e81dd911d12f129354eb6',1,'Craplog']]], - ['separators_1',['separators',['../classLogsFormat.html#aab4ae0212440e906f09c0b91c699aaf9',1,'LogsFormat']]], - ['setapachelogformat_2',['setApacheLogFormat',['../classCraplog.html#a23aae84bc5b3eeda2be421b6a96dc43c',1,'Craplog']]], - ['setblacklist_3',['setBlacklist',['../classCraplog.html#aad346c6c09b48c1415fdd7f04181aa5f',1,'Craplog']]], - ['setblacklistused_4',['setBlacklistUsed',['../classCraplog.html#acbcf4bb6132f0fefe9551763c11496a1',1,'Craplog']]], - ['setcolorscheme_5',['setcolorscheme',['../classTextBrowser.html#a01d85d8805bd131c51da9fb3e1d2e070',1,'TextBrowser::setColorScheme()'],['../classCrapnote.html#a5981b895aa2298138e6153b1ff7d0370',1,'Crapnote::setColorScheme()']]], - ['setcurrentlogformat_6',['setCurrentLogFormat',['../classCraplog.html#a40e768bae158908993b467f9514aaab6',1,'Craplog']]], - ['setcurrentwsid_7',['setCurrentWSID',['../classCraplog.html#a1e014f540be7e6ac8f933c19cf8dc3a8',1,'Craplog']]], - ['setdbpath_8',['setdbpath',['../classCrapview.html#ac4f0e1215a892983b1c75f268bb1d60d',1,'Crapview::setDbPath()'],['../classDbQuery.html#a1e7cf5357869bc2c19053cb63afd6b67',1,'DbQuery::setDbPath()']]], - ['setdbworkingstate_9',['setDbWorkingState',['../classMainWindow.html#a8dc86c8568a64a7ab811956ba0be39dd',1,'MainWindow']]], - ['setdialoglevel_10',['setdialoglevel',['../classDbQuery.html#ab2a129e8bb094401ad344ecbc1d15a57',1,'DbQuery::setDialogLevel()'],['../classHashOps.html#aabc5c0547443d5245aadf23371f14daf',1,'HashOps::setDialogLevel()']]], - ['setdialogslevel_11',['setdialogslevel',['../classCrapview.html#a6926fe7c37e2f407e3846d0308546558',1,'Crapview::setDialogsLevel()'],['../classCraplog.html#a2474b6dc30efa50d0e7250d03ac829de',1,'Craplog::setDialogsLevel()']]], - ['setdirection_12',['setDirection',['../classSnake.html#a85d3b8250d5d26e3f23915c5bc43e372',1,'Snake']]], - ['setfont_13',['setFont',['../classTextBrowser.html#a1d47613908bacf424bb7bed38dac9b46',1,'TextBrowser']]], - ['setgeometryfromstring_14',['setGeometryFromString',['../classMainWindow.html#a0bca0aae0ee0e5dec7a671dbafb6a487',1,'MainWindow']]], - ['sethashesdatabasepath_15',['setHashesDatabasePath',['../classCraplog.html#ab5f943a6df16ccd491612b24e7007c5e',1,'Craplog']]], - ['setiislogformat_16',['setIisLogFormat',['../classCraplog.html#a478fc571718fd0bbd9d8f129e5121fad',1,'Craplog']]], - ['setlogfileselected_17',['setLogFileSelected',['../classCraplog.html#ac0d9729fcf0094d94f85e38e1a079f61',1,'Craplog']]], - ['setlogspath_18',['setLogsPath',['../classCraplog.html#afb1d1cb86cef2c8918a323285e3a222a',1,'Craplog']]], - ['setname_19',['setName',['../classMainSlice.html#a96fd7fc82e830b3b49c121e4b2081c44',1,'MainSlice']]], - ['setnginxlogformat_20',['setNginxLogFormat',['../classCraplog.html#a29ff6ef109e916a80b09f7ff6435334f',1,'Craplog']]], - ['setstatsdatabasepath_21',['setStatsDatabasePath',['../classCraplog.html#a3375c00b403ebfad353a55f30fe21445',1,'Craplog']]], - ['settextfont_22',['setTextFont',['../classCrapnote.html#a3c7b98a96114f8efdc06912ee3167e16',1,'Crapnote']]], - ['setwarningsize_23',['setWarningSize',['../classCraplog.html#a1e2d55bc0cd12ed0798e47e85067fa43',1,'Craplog']]], - ['setwarnlist_24',['setWarnlist',['../classCraplog.html#a7f57b917ae0f4567c77028014c494006',1,'Craplog']]], - ['setwarnlistused_25',['setWarnlistUsed',['../classCraplog.html#a13aca50203a4eec43bbfc8e441d09ee1',1,'Craplog']]], - ['setwidelinesusage_26',['setWideLinesUsage',['../classTextBrowser.html#a4a15c0db1622bcd312d29f1900e4428c',1,'TextBrowser']]], - ['sha256_27',['SHA256',['../classSHA256.html',1,'']]], - ['shouldworkasync_28',['shouldWorkAsync',['../classCraplog.html#af33e7aac1888e01e8cd020b596d3e549',1,'Craplog']]], - ['size_29',['size',['../classLogFile.html#a47abeb2567129ecf680fa9779607c421',1,'LogFile']]], - ['snake_30',['snake',['../classSnakeGame.html#a7448c2b54b8bc6e7b3d1d4aee12fbad7',1,'SnakeGame::snake'],['../classSnake.html',1,'Snake']]], - ['snakegame_31',['SnakeGame',['../classSnakeGame.html',1,'']]], - ['spawn_32',['spawn',['../classFood.html#a4322893c4935e218345e6373082f2ca6',1,'Food']]], - ['split_33',['split',['../namespaceStringOps.html#ac6e367ab487e4c7b88988b452a454118',1,'StringOps::split(std::vector< std::string > &list, const std::string &target_str, const char separator='\n')'],['../namespaceStringOps.html#adf152a1f72f20e4c6741d8e54f2945fb',1,'StringOps::split(std::vector< std::string > &list, const std::string &target_str, std::string_view separator)']]], - ['splitrip_34',['splitrip',['../namespaceStringOps.html#ac488bfd901b244955372575c89113cf1',1,'StringOps::splitrip(std::vector< std::string > &list, const std::string &target_str, const char separator='\n', std::string_view strips=" \n\t\b\r\v")'],['../namespaceStringOps.html#a091e46362ee6e0e1d196a9c5a4a47ac3',1,'StringOps::splitrip(std::vector< std::string > &list, const std::string &target_str, std::string_view separator, std::string_view strips=" \n\t\b\r\v")']]], - ['starts_35',['starts',['../structCraplog_1_1LogName.html#a6c853d2801446e1a6975e81a7c1bbace',1,'Craplog::LogName']]], - ['startswith_36',['startswith',['../namespaceStringOps.html#aebb197b47ac03286ec9011c931eaa9ce',1,'StringOps::startsWith(std::string_view str, std::string_view flag)'],['../namespaceStringOps.html#aec3a544ce4d3bf4db42744a952ed0b1a',1,'StringOps::startsWith(std::string_view str, const char flag)']]], - ['storedata_37',['storedata',['../classCraplogParser.html#a42c778719ee39b19095fb1b074451c14',1,'CraplogParser::storeData()'],['../classCraplogParserAsync.html#a9b1a0530c706114b776e886d6c17d911',1,'CraplogParserAsync::storeData()']]], - ['storeloglines_38',['storeloglines',['../classCraplogParser.html#ae867ec7dcef759f5758658d793b95f3f',1,'CraplogParser::storeLogLines()'],['../classCraplogParserAsync.html#a7bc816fb52cff3cf34d339b97fb67d11',1,'CraplogParserAsync::storeLogLines()']]], - ['string_39',['string',['../classLogsFormat.html#a504de7eb43b1992c22c2a46627992a75',1,'LogsFormat']]], - ['string2list_40',['string2list',['../classMainWindow.html#afdfa84d1123cc32172b2881d9b86e9bb',1,'MainWindow']]], - ['stringops_41',['StringOps',['../namespaceStringOps.html',1,'']]], - ['strip_42',['strip',['../namespaceStringOps.html#aa6b00592df01e1358f1f5444c56ea586',1,'StringOps::strip(const std::string &str, const char chr)'],['../namespaceStringOps.html#ae85e90bca975fe7effd78f4647450ef8',1,'StringOps::strip(const std::string &str, std::string_view chars=" \n\t\b\r\v")']]], - ['stylesec_43',['StyleSec',['../namespaceStyleSec.html',1,'']]] + ['randomlines_0',['randomLines',['../namespaceIOutils.html#aa52ebe237d181752064409cf0623a135',1,'IOutils']]], + ['readconfigs_1',['readConfigs',['../classMainWindow.html#aae306cbf256c5a686cc8d9f2a1dbb18b',1,'MainWindow']]], + ['readfile_2',['readFile',['../namespaceGZutils.html#a72f6960bddea2b816af84e7773d5c6b2',1,'GZutils::readFile()'],['../namespaceIOutils.html#a185c38eff9d9f4432c8138404941915e',1,'IOutils::readFile()']]], + ['recalculateangles_3',['recalculateAngles',['../classDonutBreakdown.html#acd747ee2bbd23ce84eaf9d4db57938e3',1,'DonutBreakdown']]], + ['recurrencedata_4',['RecurrenceData',['../structRecurrenceData.html',1,'']]], + ['refreshdates_5',['refreshDates',['../classCrapview.html#ac98b1cbc75604b5145b5cff36e96eb78',1,'Crapview::refreshDates()'],['../classDbQuery.html#adb3206452fd6f9a35e88e260e502c511',1,'DbQuery::refreshDates()']]], + ['refreshstatsdates_6',['refreshStatsDates',['../classMainWindow.html#ac8f4c84b43d14b6dcc6cb7b5f75ce343',1,'MainWindow']]], + ['relationsllogfieldslistmodel_7',['RelationslLogFieldsListModel',['../classRelationslLogFieldsListModel.html',1,'']]], + ['remove_8',['remove',['../structBlacklistItem.html#a878fdb847386aadb0e09bc78f5782b09',1,'BlacklistItem::remove()'],['../structWarnlistItem.html#a7a6c5acd0e4fcb67257c0650d2d86d8f',1,'WarnlistItem::remove()']]], + ['removeitem_9',['removeItem',['../structBlacklists.html#a08effb45b137d0c65d0d14e0fa3563f0',1,'Blacklists::removeItem()'],['../structWarnlists.html#ac5677ce2a63277eef300c12b09a84702',1,'Warnlists::removeItem()']]], + ['renameascopy_10',['renameAsCopy',['../namespaceIOutils.html#afb035f2ec3192ce64657ba5bf81bd86e',1,'IOutils']]], + ['replace_11',['replace',['../namespaceStringOps.html#ace505bb48e614c431a434a843cae0f1c',1,'StringOps']]], + ['requesttimeout_12',['requestTimeout',['../classCrapup.html#afe79a787fc0820afbc4573ca7091d880',1,'Crapup']]], + ['resolvepath_13',['resolvePath',['../classMainWindow.html#a773ee8bffbac52d0d646fb91792bc3ae',1,'MainWindow']]], + ['richlogsdefault_14',['richLogsDefault',['../classRichText.html#a28bf0bdd659cc7b7a58eab9e5cfad495',1,'RichText']]], + ['richlogsfailure_15',['richLogsFailure',['../classRichText.html#a6e5fe6270e6fed0b9e7c42eafc9b4732',1,'RichText']]], + ['richtext_16',['RichText',['../classRichText.html',1,'']]], + ['rollbacktransaction_17',['rollbackTransaction',['../classDatabaseWrapper.html#ab35901b0235ac94f29a4b90ef0ce1b0d',1,'DatabaseWrapper']]], + ['rotateimg_18',['rotateImg',['../classCrapup.html#a334624ab394fd773b0e6063e7baf7960',1,'Crapup']]], + ['rstrip_19',['rstrip',['../namespaceStringOps.html#a800fa9be19f7a5e05dea94f1d182a261',1,'StringOps::rstrip(const std::string &str, const char chr) noexcept'],['../namespaceStringOps.html#ab84d91c0a3990fcebcbce21a633f3539',1,'StringOps::rstrip(const std::string &str, const char *chars=" \n\t\b\r\v") noexcept']]] ]; diff --git a/docs/html/search/all_12.js b/docs/html/search/all_12.js index 5331c31b..f3528def 100644 --- a/docs/html/search/all_12.js +++ b/docs/html/search/all_12.js @@ -1,12 +1,57 @@ var searchData= [ - ['testcraplogmodules_0',['testCraplogModules',['../namespaceTesting.html#a26ca6af95ebd8bc1f45330d1f8e878ee',1,'Testing']]], - ['testcrapviewmodules_1',['testCrapviewModules',['../namespaceTesting.html#afda5137047f07a73c14a0da8a5ca35d6',1,'Testing']]], - ['testing_2',['Testing',['../namespaceTesting.html',1,'']]], - ['testutilities_3',['testUtilities',['../namespaceTesting.html#a61e6bd9fb48a1af951cb365b46e49924',1,'Testing']]], - ['textbrowser_4',['TextBrowser',['../classTextBrowser.html',1,'']]], - ['tile_5',['Tile',['../structSnake_1_1Tile.html',1,'Snake']]], - ['tolower_6',['toLower',['../namespaceStringOps.html#af2241555e2c9c57dd0575c491bfcd534',1,'StringOps']]], - ['toupper_7',['toUpper',['../namespaceStringOps.html#ab262a540cba212b1de09d19040732c73',1,'StringOps']]], - ['tr_8',['TR',['../classTR.html',1,'']]] + ['sanitized_0',['sanitized',['../structBlacklistItem.html#a99bfcaec421306f87fcb3b16556ffc46',1,'BlacklistItem::sanitized()'],['../structWarnlistItem.html#ad4aad2da114723b60e13bffd571c498f',1,'WarnlistItem::sanitized()']]], + ['sanitizedclient_1',['sanitizedClient',['../namespaceBWutils.html#a4f57c1c85b87ac43fb0bf96195c8731a',1,'BWutils']]], + ['sanitizedmethod_2',['sanitizedMethod',['../namespaceBWutils.html#a56a19fcd29b4ebaf6ab730746db367f8',1,'BWutils']]], + ['sanitizeduri_3',['sanitizedUri',['../namespaceBWutils.html#aa2b294e6841a4283f215fc3f2a3afd0e',1,'BWutils']]], + ['sanitizeduseragent_4',['sanitizedUserAgent',['../namespaceBWutils.html#a5d8e89d6418e0704bb4ed75b995b6c6a',1,'BWutils']]], + ['separators_5',['separators',['../structLogsFormat.html#aab4ae0212440e906f09c0b91c699aaf9',1,'LogsFormat']]], + ['set_6',['set',['../structBlacklistItem.html#a9ffe06223bf2195a5a0742555b22dab6',1,'BlacklistItem::set()'],['../structWarnlistItem.html#a208abfc8a1198dc74d572012da111390',1,'WarnlistItem::set()']]], + ['setapachelogformat_7',['setApacheLogFormat',['../classCraplog.html#a0fb53209bcee846b313b1468eb1f4ef4',1,'Craplog']]], + ['setcolorscheme_8',['setColorScheme',['../classTextBrowser.html#a9b897ce28d694102d5cef543b61bd0c6',1,'TextBrowser::setColorScheme()'],['../classCrapnote.html#a43bdc4bb96d5e288952d8131d02e3986',1,'Crapnote::setColorScheme()']]], + ['setcurrentlogformat_9',['setCurrentLogFormat',['../classCraplog.html#a2386945ea571452e4df5e9aa88268500',1,'Craplog']]], + ['setcurrentwebserver_10',['setCurrentWebServer',['../classCraplog.html#ade26470751608e99a4d9f076d2d0180e',1,'Craplog']]], + ['setdbpath_11',['setDbPath',['../classCrapview.html#aa8547bac9eb6b66cdede0f35b7a9d30b',1,'Crapview::setDbPath()'],['../classDbQuery.html#a6924de3d7b44efca2d5e6d4304f908c2',1,'DbQuery::setDbPath()']]], + ['setdbworkingstate_12',['setDbWorkingState',['../classMainWindow.html#a8dc86c8568a64a7ab811956ba0be39dd',1,'MainWindow']]], + ['setdialoglevel_13',['setDialogLevel',['../classHashOps.html#ac665e43481570b6461cc93acee8c601c',1,'HashOps::setDialogLevel()'],['../classDbQuery.html#acf41fe954be10734fba229174584cbae',1,'DbQuery::setDialogLevel()']]], + ['setdialogslevel_14',['setDialogsLevel',['../classCraplog.html#a00530348740394414661af9c71889419',1,'Craplog::setDialogsLevel()'],['../classCrapview.html#a392219de8f5874e59110a5b0610e97a2',1,'Crapview::setDialogsLevel()']]], + ['setdialogslevelfromstring_15',['setDialogsLevelFromString',['../classMainWindow.html#a278e74d4bbad27b52a149f7d03762d0f',1,'MainWindow']]], + ['setdirection_16',['setDirection',['../classSnake.html#a53e877a0a363018be8a2413c53dac4c8',1,'Snake']]], + ['setfont_17',['setFont',['../classTextBrowser.html#a5dcd585592c6b2a3adac36fa96da2970',1,'TextBrowser']]], + ['setgeometryfromstring_18',['setGeometryFromString',['../classMainWindow.html#a0bca0aae0ee0e5dec7a671dbafb6a487',1,'MainWindow']]], + ['sethashesdatabasepath_19',['setHashesDatabasePath',['../classCraplog.html#a633fe017bc347ef3004e9eac511afc5b',1,'Craplog']]], + ['setiislogformat_20',['setIisLogFormat',['../classCraplog.html#a27ba3271bf87a184c1b79a042e621821',1,'Craplog']]], + ['setlist_21',['setList',['../structBlacklists.html#ac57455c5e48a2e8e26a6c66d2907cebf',1,'Blacklists::setList()'],['../structWarnlists.html#a4779c99824ca840974453dcd264cfa27',1,'Warnlists::setList()']]], + ['setlogfileselected_22',['setLogFileSelected',['../classCraplog.html#aec8a7956a162138dd85ba3ed642c3dc9',1,'Craplog']]], + ['setlogspath_23',['setLogsPath',['../classCraplog.html#a37ccf5b76180f5561440ec72844437ba',1,'Craplog']]], + ['setname_24',['setName',['../classMainSlice.html#a96fd7fc82e830b3b49c121e4b2081c44',1,'MainSlice']]], + ['setnginxlogformat_25',['setNginxLogFormat',['../classCraplog.html#ac09bc16c7cc4ad33fe0abfe5c6a92e67',1,'Craplog']]], + ['setselected_26',['setSelected',['../structLogFile.html#a8ae07ac34e6c49d34cfee9ae04be3418',1,'LogFile']]], + ['setstatsdatabasepath_27',['setStatsDatabasePath',['../classCraplog.html#a038ce1d76adea57e98b04100338446f2',1,'Craplog']]], + ['settextfont_28',['setTextFont',['../classChangelog.html#a270c384c56c6d479345f6895fa4d885e',1,'Changelog::setTextFont()'],['../classCrapnote.html#a1f757b30dcb1876a554ecf86261a9bd9',1,'Crapnote::setTextFont()']]], + ['setunselected_29',['setUnselected',['../structLogFile.html#aabb586c88ff9513b83de42cdfcdbd477',1,'LogFile']]], + ['setused_30',['setUsed',['../structBlacklists.html#a0cd18c7125b51ead34363697419b20bf',1,'Blacklists::setUsed()'],['../structBlacklist.html#afa58bc716010e8fcbd682f1af725643c',1,'Blacklist::setUsed()'],['../structWarnlist.html#ab47c503e8b24d1aa8f654e1add6141a8',1,'Warnlist::setUsed()'],['../structWarnlists.html#a616f74926f1d42ec639b7941de81b583',1,'Warnlists::setUsed()']]], + ['setwarningsize_31',['setWarningSize',['../classCraplog.html#a21616321aa234ae53204ffd413c99105',1,'Craplog']]], + ['setwebserverfromstring_32',['setWebServerFromString',['../classMainWindow.html#a6dc46a6a6eb4e30b8ec3b5be20b26949',1,'MainWindow']]], + ['setwidelinesusage_33',['setWideLinesUsage',['../classTextBrowser.html#a78ee628c68a60a59b3518281a913f7d6',1,'TextBrowser']]], + ['sha256_34',['SHA256',['../classSHA256.html',1,'']]], + ['size_35',['size',['../structLogFile.html#a1205bc0634ff1893a55321ccf7cca666',1,'LogFile::size()'],['../structLogLineData.html#aef7f62bb9670423dbe88ffb72f19b04b',1,'LogLineData::size()'],['../classQueryWrapper.html#ac40628a1ff95c84f77625af40aa6d49e',1,'QueryWrapper::size()']]], + ['snake_36',['Snake',['../classSnake.html',1,'']]], + ['snake_37',['snake',['../classSnakeGame.html#a7448c2b54b8bc6e7b3d1d4aee12fbad7',1,'SnakeGame']]], + ['snakegame_38',['SnakeGame',['../classSnakeGame.html',1,'']]], + ['spawn_39',['spawn',['../classFood.html#a3af9975383d864fb2f5dae4dc3c549e8',1,'Food']]], + ['split_40',['split',['../namespaceStringOps.html#a1a6374c270d7b736af662973a032bcb1',1,'StringOps::split(std::vector< std::string > &list, const std::string &target_str, const char separator='\n') noexcept'],['../namespaceStringOps.html#a8d6fd8a79f5aa7adc1b385ae5287c14e',1,'StringOps::split(std::vector< std::string > &list, const std::string &target_str, std::string_view separator) noexcept']]], + ['splitrip_41',['splitrip',['../namespaceStringOps.html#a3102407f02c4b18073e595c00a733175',1,'StringOps::splitrip(std::vector< std::string > &list, const std::string &target_str, const char separator='\n', const char *strips=" \n\t\b\r\v") noexcept'],['../namespaceStringOps.html#adb2f084578c857a46287051a3e3f044b',1,'StringOps::splitrip(std::vector< std::string > &list, const std::string &target_str, const char *separator, const char *strips=" \n\t\b\r\v") noexcept']]], + ['starts_42',['starts',['../structCraplog_1_1LogName.html#a6c853d2801446e1a6975e81a7c1bbace',1,'Craplog::LogName']]], + ['startswith_43',['startsWith',['../namespaceStringOps.html#a4a7fe341a6c946f76c204d3ec7504319',1,'StringOps::startsWith(std::string_view str, const char flag) noexcept'],['../namespaceStringOps.html#ad65237bcace4d7816219c24b9696a2be',1,'StringOps::startsWith(std::string_view str, std::string_view flag) noexcept']]], + ['starttransaction_44',['startTransaction',['../classDatabaseWrapper.html#a987e29bdc153b8af1af6d7e7d3236373',1,'DatabaseWrapper']]], + ['storedata_45',['storeData',['../classCraplogParser.html#a42c778719ee39b19095fb1b074451c14',1,'CraplogParser']]], + ['storeloglines_46',['storeLogLines',['../classCraplogParser.html#a286be6fa72be8bbfe43066cc0d00c89b',1,'CraplogParser']]], + ['storemalformedrequestmultispace_47',['storeMalformedRequestMultiSpace',['../structLogLineData.html#a1c02deb8c2585b0d6492f8aaef07e4bf',1,'LogLineData']]], + ['storemalformedrequestonespace_48',['storeMalformedRequestOneSpace',['../structLogLineData.html#ac43fad13c4c9dbebab8e49f6b6c1592d',1,'LogLineData']]], + ['string_49',['string',['../structLogsFormat.html#a504de7eb43b1992c22c2a46627992a75',1,'LogsFormat']]], + ['string2list_50',['string2list',['../classMainWindow.html#afdfa84d1123cc32172b2881d9b86e9bb',1,'MainWindow']]], + ['stringops_51',['StringOps',['../namespaceStringOps.html',1,'']]], + ['strip_52',['strip',['../namespaceStringOps.html#a2b1a5d7ca0d8e4b2b619ab0a9ad20614',1,'StringOps::strip(const std::string &str, const char chr) noexcept'],['../namespaceStringOps.html#a2e40c8c956a4d657e9096b01dce02a65',1,'StringOps::strip(const std::string &str, const char *chars=" \n\t\b\r\v") noexcept']]], + ['stylesec_53',['StyleSec',['../namespaceStyleSec.html',1,'']]] ]; diff --git a/docs/html/search/all_13.js b/docs/html/search/all_13.js index b74338f5..cf9d3397 100644 --- a/docs/html/search/all_13.js +++ b/docs/html/search/all_13.js @@ -1,14 +1,15 @@ var searchData= [ - ['update_0',['update',['../classFood.html#a63d7fd88d5db54881de451b2429ed04d',1,'Food::update()'],['../structBodyPart.html#a6addb68ca5c7ac51dbb072e55ada5e33',1,'BodyPart::update()'],['../classSnake.html#ab3610a54cbc6b6ec8d44e24871d59301',1,'Snake::update()']]], - ['updategamescore_1',['updateGameScore',['../classSnakeGame.html#a420f3980fab86475ea4788a2e971597b',1,'SnakeGame']]], - ['updatelabel_2',['updateLabel',['../classMainSlice.html#aed2a6013aafca878143a8f05c391c590',1,'MainSlice']]], - ['updatelegendmarkers_3',['updateLegendMarkers',['../classDonutBreakdown.html#a682599f0fd4f13530b7bfe6dc3331578',1,'DonutBreakdown']]], - ['updateuifonts_4',['updateUiFonts',['../classMainWindow.html#a0b27c0bc56c7ffc801a32c90dbd529a6',1,'MainWindow']]], - ['updateuiicons_5',['updateUiIcons',['../classMainWindow.html#ab38da8951aefa2064b1e9d3bddd918ea',1,'MainWindow']]], - ['updateuilanguage_6',['updateUiLanguage',['../classMainWindow.html#a1f84f5977dc0d34a3f65f373be1214cd',1,'MainWindow']]], - ['updateuitheme_7',['updateUiTheme',['../classMainWindow.html#aa38e8aac36ede194803b378725fc123c',1,'MainWindow']]], - ['updatewarn_8',['updateWarn',['../classCrapview.html#a5936b20a36eb7293eb1ab7dffd5a28cf',1,'Crapview']]], - ['updatewarnings_9',['updateWarnings',['../classDbQuery.html#a6d86a91f0880d9d7ca27b6b9720257fd',1,'DbQuery']]], - ['used_10',['used',['../structBWlist.html#ae0664e12fbe88c18dc830cd93fbe6abc',1,'BWlist']]] + ['testcraplogmodules_0',['testCraplogModules',['../namespaceTesting.html#a26ca6af95ebd8bc1f45330d1f8e878ee',1,'Testing']]], + ['testcrapviewmodules_1',['testCrapviewModules',['../namespaceTesting.html#afda5137047f07a73c14a0da8a5ca35d6',1,'Testing']]], + ['testing_2',['Testing',['../namespaceTesting.html',1,'']]], + ['testoperators_3',['testOperators',['../namespaceTesting.html#a9ac32a7ffa8616455829bcf0f8496c3d',1,'Testing']]], + ['testutilities_4',['testUtilities',['../namespaceTesting.html#a61e6bd9fb48a1af951cb365b46e49924',1,'Testing']]], + ['textbrowser_5',['TextBrowser',['../classTextBrowser.html',1,'']]], + ['tile_6',['Tile',['../structSnake_1_1Tile.html',1,'Snake']]], + ['todo_20list_7',['Todo List',['../todo.html',1,'']]], + ['tolower_8',['toLower',['../namespaceStringOps.html#a5061aaadb5290959f7e14d6c54a491c5',1,'StringOps']]], + ['toupper_9',['toUpper',['../namespaceStringOps.html#a10bc74b0c6b388437925d6bf6c0cf6d1',1,'StringOps']]], + ['tr_10',['TR',['../classTR.html',1,'']]], + ['trafficdata_11',['TrafficData',['../structTrafficData.html',1,'']]] ]; diff --git a/docs/html/search/all_14.js b/docs/html/search/all_14.js index 65c77a4c..f5caf6ba 100644 --- a/docs/html/search/all_14.js +++ b/docs/html/search/all_14.js @@ -1,6 +1,11 @@ var searchData= [ - ['vecops_0',['VecOps',['../namespaceVecOps.html',1,'']]], - ['versioncheck_1',['versionCheck',['../classCrapup.html#a6d982e763155f2d28dcd55931623bb58',1,'Crapup']]], - ['victory_2',['victory',['../classCrissCross.html#afa0a5b671afad8da3d071c5629c134b3',1,'CrissCross']]] + ['update_0',['update',['../classFood.html#ad6db3b26ba5f1199549e99bf1df7a6f6',1,'Food::update()'],['../structBodyPart.html#a471589b6e0e29b42e2701f673be4743f',1,'BodyPart::update()'],['../classSnake.html#ab3610a54cbc6b6ec8d44e24871d59301',1,'Snake::update()']]], + ['updategamescore_1',['updateGameScore',['../classSnakeGame.html#a420f3980fab86475ea4788a2e971597b',1,'SnakeGame']]], + ['updatelabel_2',['updateLabel',['../classMainSlice.html#aed2a6013aafca878143a8f05c391c590',1,'MainSlice']]], + ['updatelegendmarkers_3',['updateLegendMarkers',['../classDonutBreakdown.html#a682599f0fd4f13530b7bfe6dc3331578',1,'DonutBreakdown']]], + ['updateuifonts_4',['updateUiFonts',['../classMainWindow.html#a0b27c0bc56c7ffc801a32c90dbd529a6',1,'MainWindow']]], + ['updateuiicons_5',['updateUiIcons',['../classMainWindow.html#ab38da8951aefa2064b1e9d3bddd918ea',1,'MainWindow']]], + ['updateuilanguage_6',['updateUiLanguage',['../classMainWindow.html#a1f84f5977dc0d34a3f65f373be1214cd',1,'MainWindow']]], + ['updateuitheme_7',['updateUiTheme',['../classMainWindow.html#aa38e8aac36ede194803b378725fc123c',1,'MainWindow']]] ]; diff --git a/docs/html/search/all_15.js b/docs/html/search/all_15.js index 2fda0b40..78fbc90b 100644 --- a/docs/html/search/all_15.js +++ b/docs/html/search/all_15.js @@ -1,16 +1,7 @@ var searchData= [ - ['warnconffilenotfound_0',['warnConfFileNotFound',['../classDialogSec.html#a3b25c703b036517d3de43596809f1845',1,'DialogSec']]], - ['warndirnotreadable_1',['warnDirNotReadable',['../classDialogSec.html#a57e732827bbb8e58fb863bdd47318b5b',1,'DialogSec']]], - ['warndirnotwritable_2',['warnDirNotWritable',['../classDialogSec.html#ade3c5fd40c2b38b688bfce8a4f2bcd51',1,'DialogSec']]], - ['warnemptyfile_3',['warnEmptyFile',['../classDialogSec.html#a4a80026203e34ff692bc720d65f5c097',1,'DialogSec']]], - ['warnfilenotreadable_4',['warnFileNotReadable',['../classDialogSec.html#a2424ed3e4b1c9a98a0ca979764d004b9',1,'DialogSec']]], - ['warninvaliditembw_5',['warnInvalidItemBW',['../classDialogSec.html#ae9cf747999d28638f8bec00dba752271',1,'DialogSec']]], - ['warnlistadd_6',['warnlistAdd',['../classCraplog.html#a0b8a8e9c44dc4a8878c64a674d1b74aa',1,'Craplog']]], - ['warnlistmovedown_7',['warnlistMoveDown',['../classCraplog.html#a539d63af92fc3e678c56fca2507ea908',1,'Craplog']]], - ['warnlistmoveup_8',['warnlistMoveUp',['../classCraplog.html#ad9932170d3148f5f49f18b056b9eb3f9',1,'Craplog']]], - ['warnlistremove_9',['warnlistRemove',['../classCraplog.html#a88e7879cc0a759504dd0c87185c58b89',1,'Craplog']]], - ['webserverexception_10',['WebServerException',['../classWebServerException.html',1,'']]], - ['writeconfigs_11',['writeConfigs',['../classMainWindow.html#a77e405bc3eb9a34a2517a45ed7dbabf0',1,'MainWindow']]], - ['writeonfile_12',['writeOnFile',['../namespaceIOutils.html#a88b18d0e0f947455640e1a3c9818f3db',1,'IOutils']]] + ['vecops_0',['VecOps',['../namespaceVecOps.html',1,'']]], + ['versioncheck_1',['versionCheck',['../classCrapup.html#a6d982e763155f2d28dcd55931623bb58',1,'Crapup']]], + ['victory_2',['victory',['../classCrissCross.html#a771c0a29f4e7d95f883c425f5d6ffa3f',1,'CrissCross']]], + ['voidexception_3',['VoidException',['../classVoidException.html',1,'']]] ]; diff --git a/docs/html/search/all_16.js b/docs/html/search/all_16.js index 0b8ad12d..bd218da9 100644 --- a/docs/html/search/all_16.js +++ b/docs/html/search/all_16.js @@ -1,4 +1,15 @@ var searchData= [ - ['x_0',['x',['../classFood.html#ae020ae6247a41acd4b8c701322a91a7a',1,'Food::X() const'],['../classFood.html#af35fa376e635e2de2eaf8861654215fe',1,'Food::x'],['../structBodyPart.html#a51183c659a9618d7a4a497c118f0df6c',1,'BodyPart::x']]] + ['warnconffilenotfound_0',['warnConfFileNotFound',['../classDialogSec.html#a3b25c703b036517d3de43596809f1845',1,'DialogSec']]], + ['warndirnotreadable_1',['warnDirNotReadable',['../classDialogSec.html#a57e732827bbb8e58fb863bdd47318b5b',1,'DialogSec']]], + ['warndirnotwritable_2',['warnDirNotWritable',['../classDialogSec.html#ade3c5fd40c2b38b688bfce8a4f2bcd51',1,'DialogSec']]], + ['warnemptyfile_3',['warnEmptyFile',['../classDialogSec.html#a4a80026203e34ff692bc720d65f5c097',1,'DialogSec']]], + ['warnfilenotreadable_4',['warnFileNotReadable',['../classDialogSec.html#a2424ed3e4b1c9a98a0ca979764d004b9',1,'DialogSec']]], + ['warninvalidconfigslist_5',['warnInvalidConfigsList',['../classDialogSec.html#a2a07c686501d9f772499dc9ebb47c38c',1,'DialogSec']]], + ['warninvaliditembw_6',['warnInvalidItemBW',['../classDialogSec.html#ae9cf747999d28638f8bec00dba752271',1,'DialogSec']]], + ['warnlist_7',['Warnlist',['../structWarnlist.html',1,'']]], + ['warnlistitem_8',['WarnlistItem',['../structWarnlistItem.html',1,'']]], + ['warnlists_9',['Warnlists',['../structWarnlists.html',1,'']]], + ['writeconfigs_10',['writeConfigs',['../classMainWindow.html#a77e405bc3eb9a34a2517a45ed7dbabf0',1,'MainWindow']]], + ['writeonfile_11',['writeOnFile',['../namespaceIOutils.html#a88b18d0e0f947455640e1a3c9818f3db',1,'IOutils']]] ]; diff --git a/docs/html/search/all_17.js b/docs/html/search/all_17.js index 041d4e2a..04b6720b 100644 --- a/docs/html/search/all_17.js +++ b/docs/html/search/all_17.js @@ -1,4 +1,5 @@ var searchData= [ - ['y_0',['y',['../classFood.html#aa48eeda2151769eb75a41c6aa3f216be',1,'Food::Y()'],['../structBodyPart.html#a6062a193e9cfd4a122153d6bedf99806',1,'BodyPart::y']]] + ['x_0',['x',['../classFood.html#af35fa376e635e2de2eaf8861654215fe',1,'Food::x'],['../structBodyPart.html#a51183c659a9618d7a4a497c118f0df6c',1,'BodyPart::x']]], + ['x_1',['X',['../classFood.html#a6f1549c041fe5445d0b96fa2d096c76e',1,'Food']]] ]; diff --git a/docs/html/search/all_18.js b/docs/html/search/all_18.js new file mode 100644 index 00000000..b25947a0 --- /dev/null +++ b/docs/html/search/all_18.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['y_0',['Y',['../classFood.html#ae4485a82fc3b4bcc5b714342da459c0f',1,'Food']]], + ['y_1',['y',['../structBodyPart.html#a6062a193e9cfd4a122153d6bedf99806',1,'BodyPart']]] +]; diff --git a/docs/html/search/all_19.js b/docs/html/search/all_19.js new file mode 100644 index 00000000..ade12d61 --- /dev/null +++ b/docs/html/search/all_19.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['zip_0',['zip',['../namespaceArrayOps.html#a4acbd634bddcf1acd35cf7830e37f262',1,'ArrayOps']]], + ['zippedarrays_1',['ZippedArrays',['../classZippedArrays.html',1,'']]], + ['zipperator_2',['Zipperator',['../structZipperator.html',1,'']]] +]; diff --git a/docs/html/search/all_2.js b/docs/html/search/all_2.js index 2b058b1e..015ad6c5 100644 --- a/docs/html/search/all_2.js +++ b/docs/html/search/all_2.js @@ -1,49 +1,55 @@ var searchData= [ - ['calcglobals_0',['calcGlobals',['../classCrapview.html#a3fd5b734339c134768334bec9f94c8ba',1,'Crapview']]], - ['changeiislogsbasenames_1',['changeIisLogsBaseNames',['../classCraplog.html#aa3322c13abbee68d72eee2b1100c83f6',1,'Craplog']]], - ['checkcollectiondatabase_2',['checkCollectionDatabase',['../namespaceCheckSec.html#abaeae12b56acc24ef8f600814e3f280f',1,'CheckSec']]], - ['checkcollision_3',['checkCollision',['../classSnakeGame.html#a937f69388e5c1dbf9d5f65ef7bf3b0d5',1,'SnakeGame']]], - ['checkdatabasefile_4',['checkDatabaseFile',['../namespaceCheckSec.html#a4ced4f1c9603e537b6ab5f22098dd229',1,'CheckSec']]], - ['checkdatadb_5',['checkDataDB',['../classMainWindow.html#af06cade6835503cbc7deeb6f23f93e3f',1,'MainWindow']]], - ['checkdir_6',['checkDir',['../namespaceIOutils.html#af5fcc130a1152a2fa5fca8308767db1a',1,'IOutils']]], - ['checkfile_7',['checkFile',['../namespaceIOutils.html#ad1d810e9f77d4755390e07c4011537b5',1,'IOutils']]], - ['checkhashesdatabase_8',['checkHashesDatabase',['../namespaceCheckSec.html#a012e382c91f035ced3c5868ad551a2ec',1,'CheckSec']]], - ['checksec_9',['CheckSec',['../namespaceCheckSec.html',1,'']]], - ['checkstuff_10',['checkStuff',['../classCraplog.html#a60452b1a4f33ec85128d96abfa65eb9c',1,'Craplog']]], - ['checkvictory_11',['checkVictory',['../classCrissCross.html#a502dc21b03a8c129d57493d2f3877d3c',1,'CrissCross']]], - ['choicedatabasemissingcolumn_12',['choiceDatabaseMissingColumn',['../classDialogSec.html#a52f90a8afacb290b67e2a7e523e9bea4',1,'DialogSec']]], - ['choicedatabasemissingtable_13',['choiceDatabaseMissingTable',['../classDialogSec.html#a1f0f600f2c65ab92d9d06421986652ac',1,'DialogSec']]], - ['choicedatabasenotfound_14',['choiceDatabaseNotFound',['../classDialogSec.html#a807ff1e2c7e990b7bc824e92709ce7a7',1,'DialogSec']]], - ['choicedatabaserenew_15',['choiceDatabaseRenew',['../classDialogSec.html#afbe18a768dd2b7bc50d1b26632792925',1,'DialogSec']]], - ['choicedatabasewrongcolumn_16',['choiceDatabaseWrongColumn',['../classDialogSec.html#a3f76ea2ac1a93f435777807917eb5300',1,'DialogSec']]], - ['choicedatabasewrongdatatype_17',['choiceDatabaseWrongDataType',['../classDialogSec.html#a8759bfa9a5a672982b6e8038fbd1b7b5',1,'DialogSec']]], - ['choicedatabasewrongtable_18',['choiceDatabaseWrongTable',['../classDialogSec.html#a28a45ef4f4b79d050ccb72b85a8ba4fc',1,'DialogSec']]], - ['choicedirnotdir_19',['choiceDirNotDir',['../classDialogSec.html#a12f1c605aac10164e61d4a4b867d962f',1,'DialogSec']]], - ['choiceduplicatefile_20',['choiceDuplicateFile',['../classDialogSec.html#ae0b81c32e3bf6c9e1d05816b24a6abc7',1,'DialogSec']]], - ['choicefilealreadyused_21',['choiceFileAlreadyUsed',['../classDialogSec.html#abf2378d24ab3e171645b6062b34a5737',1,'DialogSec']]], - ['choicefilenotfile_22',['choiceFileNotFile',['../classDialogSec.html#a7a8316a45f783c3e93507a0b0f60c350',1,'DialogSec']]], - ['choicefilesizewarning_23',['choiceFileSizeWarning',['../classDialogSec.html#a2b6f6a70833fddee1c826eab567d3337',1,'DialogSec']]], - ['choicefilesizewarning2_24',['choiceFileSizeWarning2',['../classDialogSec.html#a06f1e2d780a3927c4153ae5d3b6e1c08',1,'DialogSec']]], - ['choiceselectedfilenotfound_25',['choiceSelectedFileNotFound',['../classDialogSec.html#a29ded809542c2e742491300adff188cc',1,'DialogSec']]], - ['classic_26',['Classic',['../classSnakeGame.html#a146a1430f1f32269ad0ad4df759e6a2ead35b51b639528d580362ca7042de6a0e',1,'SnakeGame']]], - ['cleardates_27',['clearDates',['../classCrapview.html#ae0eb083eea7e2bef76345242da41bf69',1,'Crapview']]], - ['clearlogfilesselection_28',['clearLogFilesSelection',['../classCraplog.html#af712a3a0fce65fe3b46b63149dac35b4',1,'Craplog']]], - ['closeevent_29',['closeEvent',['../classCrapup.html#a1b3b1fa451669dc2791e5d14288a96e5',1,'Crapup']]], - ['colorsec_30',['ColorSec',['../namespaceColorSec.html',1,'']]], - ['contains_31',['contains',['../structCraplog_1_1LogName.html#a64fc39be93c9b1338ace87443ed597f3',1,'Craplog::LogName::contains'],['../namespaceStringOps.html#a5a3390d7109b031815fc5f25ffb8c69c',1,'StringOps::contains()'],['../namespaceVecOps.html#ad35b2db7bf722499e7279b1e667fbd76',1,'VecOps::contains()']]], - ['count_32',['count',['../namespaceStringOps.html#a51bb7905e70cc59a5dc541cb9dfb995f',1,'StringOps::count(std::string_view str, const char flag)'],['../namespaceStringOps.html#aec7a32ac06839af8c9f5104014ee3d97',1,'StringOps::count(std::string_view str, std::string_view flag)']]], - ['countdays_33',['countDays',['../classDbQuery.html#a4d34cbd13cf2781e454c30e581bd2905',1,'DbQuery']]], - ['countmonths_34',['countMonths',['../classDbQuery.html#a4ae0b762331e5687bc412fa6f16b706f',1,'DbQuery']]], - ['craphelp_35',['Craphelp',['../classCraphelp.html',1,'']]], - ['crapinfo_36',['crapinfo',['../classCrapinfo.html#a8dcb2ce3d5d374f14aef725e94971d7d',1,'Crapinfo::Crapinfo()'],['../classCrapinfo.html',1,'Crapinfo']]], - ['craplog_37',['Craplog',['../classCraplog.html',1,'']]], - ['craploglister_38',['CraplogLister',['../classCraplogLister.html',1,'']]], - ['craplogparser_39',['CraplogParser',['../classCraplogParser.html',1,'']]], - ['craplogparserasync_40',['CraplogParserAsync',['../classCraplogParserAsync.html',1,'']]], - ['craplogparserinterface_41',['CraplogParserInterface',['../classCraplogParserInterface.html',1,'']]], - ['crapnote_42',['Crapnote',['../classCrapnote.html',1,'']]], - ['crapup_43',['crapup',['../classCrapup.html#adc4e169000cdeb4e82db0bddfc7778a7',1,'Crapup::Crapup()'],['../classCrapup.html',1,'Crapup']]], - ['crapview_44',['Crapview',['../classCrapview.html',1,'']]], - ['crisscross_45',['CrissCross',['../classCrissCross.html',1,'']]] + ['calcglobals_0',['calcGlobals',['../classCrapview.html#a350742e9b0ec2c5480fad7598fe73f58',1,'Crapview']]], + ['changeiislogsbasenames_1',['changeIisLogsBaseNames',['../classCraplog.html#a95a5c02d09527651335efa0cdec02973',1,'Craplog']]], + ['changelog_2',['Changelog',['../classChangelog.html',1,'']]], + ['charops_3',['CharOps',['../namespaceCharOps.html',1,'']]], + ['checkcollectiondatabase_4',['checkCollectionDatabase',['../namespaceCheckSec.html#a2c48d11d8fccf7141cd676977a9e7bd8',1,'CheckSec']]], + ['checkcollision_5',['checkCollision',['../classSnakeGame.html#a937f69388e5c1dbf9d5f65ef7bf3b0d5',1,'SnakeGame']]], + ['checkcurrentlogsformat_6',['checkCurrentLogsFormat',['../classCraplog.html#a739612f3e2d0c2e27b1e3a5644eb482b',1,'Craplog']]], + ['checkdatabasefile_7',['checkDatabaseFile',['../namespaceCheckSec.html#a5009d318005e5d2b3c6c23111a09dfaf',1,'CheckSec']]], + ['checkdatadb_8',['checkDataDB',['../classMainWindow.html#af06cade6835503cbc7deeb6f23f93e3f',1,'MainWindow']]], + ['checkdir_9',['checkDir',['../namespaceIOutils.html#a2936b801d69bae9a65c13659a70b955b',1,'IOutils']]], + ['checkdriver_10',['checkDriver',['../structDatabaseHandler.html#a8b45700dcf52e73c310ee6d10291b4a5',1,'DatabaseHandler']]], + ['checkfile_11',['checkFile',['../namespaceIOutils.html#a09f2bbd8752f07a411fc7d1476778b78',1,'IOutils']]], + ['checkhashesdatabase_12',['checkHashesDatabase',['../namespaceCheckSec.html#a24eeb17387886eaf114dcc86fc978dd9',1,'CheckSec']]], + ['checksec_13',['CheckSec',['../namespaceCheckSec.html',1,'']]], + ['checkstuff_14',['checkStuff',['../classCraplog.html#a60452b1a4f33ec85128d96abfa65eb9c',1,'Craplog']]], + ['checkvictory_15',['checkVictory',['../classCrissCross.html#adfd19bd142a7c0f4a76b84bab21189c1',1,'CrissCross']]], + ['choicedatabasemissingcolumn_16',['choiceDatabaseMissingColumn',['../classDialogSec.html#a52f90a8afacb290b67e2a7e523e9bea4',1,'DialogSec']]], + ['choicedatabasemissingtable_17',['choiceDatabaseMissingTable',['../classDialogSec.html#a1f0f600f2c65ab92d9d06421986652ac',1,'DialogSec']]], + ['choicedatabasenotfound_18',['choiceDatabaseNotFound',['../classDialogSec.html#a807ff1e2c7e990b7bc824e92709ce7a7',1,'DialogSec']]], + ['choicedatabaserenew_19',['choiceDatabaseRenew',['../classDialogSec.html#afbe18a768dd2b7bc50d1b26632792925',1,'DialogSec']]], + ['choicedatabasewrongcolumn_20',['choiceDatabaseWrongColumn',['../classDialogSec.html#a3f76ea2ac1a93f435777807917eb5300',1,'DialogSec']]], + ['choicedatabasewrongdatatype_21',['choiceDatabaseWrongDataType',['../classDialogSec.html#a8759bfa9a5a672982b6e8038fbd1b7b5',1,'DialogSec']]], + ['choicedatabasewrongtable_22',['choiceDatabaseWrongTable',['../classDialogSec.html#a28a45ef4f4b79d050ccb72b85a8ba4fc',1,'DialogSec']]], + ['choicedirnotdir_23',['choiceDirNotDir',['../classDialogSec.html#a12f1c605aac10164e61d4a4b867d962f',1,'DialogSec']]], + ['choiceduplicatefile_24',['choiceDuplicateFile',['../classDialogSec.html#ae0b81c32e3bf6c9e1d05816b24a6abc7',1,'DialogSec']]], + ['choicefailedapplyingconfigs_25',['choiceFailedApplyingConfigs',['../classDialogSec.html#a56772385898ba184142862cbcc47d370',1,'DialogSec']]], + ['choicefilealreadyused_26',['choiceFileAlreadyUsed',['../classDialogSec.html#abf2378d24ab3e171645b6062b34a5737',1,'DialogSec']]], + ['choicefilenotfile_27',['choiceFileNotFile',['../classDialogSec.html#a7a8316a45f783c3e93507a0b0f60c350',1,'DialogSec']]], + ['choicefilesizewarning_28',['choiceFileSizeWarning',['../classDialogSec.html#a2b6f6a70833fddee1c826eab567d3337',1,'DialogSec']]], + ['choicefilesizewarning2_29',['choiceFileSizeWarning2',['../classDialogSec.html#a06f1e2d780a3927c4153ae5d3b6e1c08',1,'DialogSec']]], + ['choiceselectedfilenotfound_30',['choiceSelectedFileNotFound',['../classDialogSec.html#a29ded809542c2e742491300adff188cc',1,'DialogSec']]], + ['classic_31',['Classic',['../classSnakeGame.html#a146a1430f1f32269ad0ad4df759e6a2ead35b51b639528d580362ca7042de6a0e',1,'SnakeGame']]], + ['cleardates_32',['clearDates',['../classCrapview.html#ab5731c52c4989cfe2258089bb80cfdce',1,'Crapview']]], + ['clearlist_33',['clearList',['../structBlacklists.html#af286a65648e285237340527db32829a1',1,'Blacklists::clearList()'],['../structWarnlists.html#ae8da97eb51cee2620b32428c2cff697d',1,'Warnlists::clearList()']]], + ['clearlogfilesselection_34',['clearLogFilesSelection',['../classCraplog.html#a0686f3a32665d6de378d1dc7408ab7a8',1,'Craplog']]], + ['closeevent_35',['closeEvent',['../classCrapup.html#a1b3b1fa451669dc2791e5d14288a96e5',1,'Crapup']]], + ['colorsec_36',['ColorSec',['../namespaceColorSec.html',1,'']]], + ['committransaction_37',['commitTransaction',['../classDatabaseWrapper.html#a8bbfd03f0576da556f23e1ffb2c07c8c',1,'DatabaseWrapper']]], + ['contains_38',['contains',['../structCraplog_1_1LogName.html#a64fc39be93c9b1338ace87443ed597f3',1,'Craplog::LogName::contains'],['../namespaceStringOps.html#a3974d58d0986b5d1e48fdbbfadfca641',1,'StringOps::contains()'],['../namespaceVecOps.html#a129235247ff1fb66d875d2cec6869ccb',1,'VecOps::contains()']]], + ['count_39',['count',['../namespaceStringOps.html#ac316348ba7d81cdfaefe79fbaa9c8d72',1,'StringOps::count(std::string_view str, std::string_view flag) noexcept'],['../namespaceStringOps.html#a0447e69dc3208f2241085797859340fc',1,'StringOps::count(std::string_view str, const char flag) noexcept']]], + ['countdays_40',['countDays',['../classDbQuery.html#a4d34cbd13cf2781e454c30e581bd2905',1,'DbQuery']]], + ['countmonths_41',['countMonths',['../classDbQuery.html#ad271ebf5819d781bb6bfdfea2b4acf98',1,'DbQuery']]], + ['craphelp_42',['Craphelp',['../classCraphelp.html',1,'']]], + ['crapinfo_43',['Crapinfo',['../classCrapinfo.html',1,'Crapinfo'],['../classCrapinfo.html#a8dcb2ce3d5d374f14aef725e94971d7d',1,'Crapinfo::Crapinfo()']]], + ['craplog_44',['Craplog',['../classCraplog.html',1,'']]], + ['craploglister_45',['CraplogLister',['../classCraplogLister.html',1,'']]], + ['craplogparser_46',['CraplogParser',['../classCraplogParser.html',1,'']]], + ['crapnote_47',['Crapnote',['../classCrapnote.html',1,'']]], + ['crappath_48',['Crappath',['../classCrappath.html',1,'']]], + ['crapup_49',['Crapup',['../classCrapup.html',1,'']]], + ['crapview_50',['Crapview',['../classCrapview.html',1,'']]], + ['crisscross_51',['CrissCross',['../classCrissCross.html',1,'']]] ]; diff --git a/docs/html/search/all_3.js b/docs/html/search/all_3.js index 593150ef..bc533f21 100644 --- a/docs/html/search/all_3.js +++ b/docs/html/search/all_3.js @@ -1,23 +1,34 @@ var searchData= [ - ['datetimeexception_0',['DateTimeException',['../classDateTimeException.html',1,'']]], - ['datetimeops_1',['DateTimeOps',['../namespaceDateTimeOps.html',1,'']]], - ['dbquery_2',['DbQuery',['../classDbQuery.html',1,'']]], - ['definefiletype_3',['defineFileType',['../namespaceLogOps.html#a7d15efe4659c327d14bed3dfbec6949c',1,'LogOps']]], - ['defineosspec_4',['defineOSspec',['../classMainWindow.html#a190ea12a49c863423ebc169b1f8c92a2',1,'MainWindow']]], - ['deletereply_5',['deleteReply',['../classCrapup.html#a52cad2625d432f367ca6441ebd35e64b',1,'Crapup']]], - ['detecticonstheme_6',['detectIconsTheme',['../classMainWindow.html#a5684909fae2173eb30b7a77051042d0b',1,'MainWindow']]], - ['dialogbool_7',['dialogbool',['../classDialogBool.html',1,'DialogBool'],['../classDialogBool.html#aed40fd288c983c07b3abb7188655cb95',1,'DialogBool::DialogBool()']]], - ['dialogida_8',['dialogida',['../classDialogIda.html',1,'DialogIda'],['../classDialogIda.html#acb38348bcb6f6968f86a88948b1259d3',1,'DialogIda::DialogIda()']]], - ['dialogmsg_9',['dialogmsg',['../classDialogMsg.html',1,'DialogMsg'],['../classDialogMsg.html#ad8dfbc1525efc49207f912d451aa0fde',1,'DialogMsg::DialogMsg()']]], - ['dialogsec_10',['DialogSec',['../classDialogSec.html',1,'']]], - ['digestfile_11',['digestFile',['../classHashOps.html#ac74504e76a2c8e20506e446d2887ab53',1,'HashOps']]], - ['direction_12',['direction',['../structBodyPart.html#ad732b10425a86790821523da2388910b',1,'BodyPart::direction'],['../classSnake.html#a6152832ec0736c49fa6416ba30c46313',1,'Snake::direction()']]], - ['donutbreakdown_13',['DonutBreakdown',['../classDonutBreakdown.html',1,'']]], - ['draw_14',['draw',['../classCrissCross.html#a9f957e38250d4c58f2b232620891cb47',1,'CrissCross']]], - ['drawcount_15',['drawCount',['../classCrapview.html#aca27d259093a187db1015a4d68a2ceee',1,'Crapview']]], - ['drawday_16',['drawDay',['../classCrapview.html#af80a9ccb827db918362f407141af5609',1,'Crapview']]], - ['drawrelat_17',['drawRelat',['../classCrapview.html#ad16992f42b9e6f4b5efc8a012db59482',1,'Crapview']]], - ['drawspeed_18',['drawSpeed',['../classCrapview.html#a7e0ecbd3f83e901d42cbbb823265cb61',1,'Crapview']]], - ['drawwarn_19',['drawWarn',['../classCrapview.html#a89977ee5957ce6e8aef8a7a6d37ef5a6',1,'Crapview']]] + ['data_0',['data',['../structLogLineData.html#a84bdb9ef42b40ef7a6361e51443a40a8',1,'LogLineData']]], + ['databaseexception_1',['DatabaseException',['../classDatabaseException.html',1,'']]], + ['databasehandler_2',['DatabaseHandler',['../structDatabaseHandler.html',1,'']]], + ['databasesconnections_3',['DatabasesConnections',['../namespaceDatabasesConnections.html',1,'']]], + ['databasesnames_4',['DatabasesNames',['../namespaceDatabasesNames.html',1,'']]], + ['databasewrapper_5',['DatabaseWrapper',['../classDatabaseWrapper.html',1,'']]], + ['datetimeexception_6',['DateTimeException',['../classDateTimeException.html',1,'']]], + ['datetimeops_7',['DateTimeOps',['../namespaceDateTimeOps.html',1,'']]], + ['daytimelogfieldslistmodel_8',['DaytimeLogFieldsListModel',['../classDaytimeLogFieldsListModel.html',1,'']]], + ['dbname_9',['dbName',['../classQueryWrapper.html#aa6335147eadf1fb2b360f7337c98d0f9',1,'QueryWrapper']]], + ['dbquery_10',['DbQuery',['../classDbQuery.html',1,'']]], + ['dbusable_11',['dbUsable',['../classMainWindow.html#a80500e8151b811a6bcca43882db17a14',1,'MainWindow']]], + ['definefiletype_12',['defineFileType',['../namespaceLogOps.html#aaeafb5040234133c1feca9fed4f4e5d2',1,'LogOps']]], + ['defineosspec_13',['defineOSspec',['../classMainWindow.html#a190ea12a49c863423ebc169b1f8c92a2',1,'MainWindow']]], + ['deletereply_14',['deleteReply',['../classCrapup.html#a52cad2625d432f367ca6441ebd35e64b',1,'Crapup']]], + ['detecticonstheme_15',['detectIconsTheme',['../classMainWindow.html#a5684909fae2173eb30b7a77051042d0b',1,'MainWindow']]], + ['dialogbool_16',['DialogBool',['../classDialogBool.html',1,'DialogBool'],['../classDialogBool.html#aed40fd288c983c07b3abb7188655cb95',1,'DialogBool::DialogBool()']]], + ['dialogida_17',['DialogIda',['../classDialogIda.html',1,'DialogIda'],['../classDialogIda.html#acb38348bcb6f6968f86a88948b1259d3',1,'DialogIda::DialogIda()']]], + ['dialogmsg_18',['DialogMsg',['../classDialogMsg.html',1,'DialogMsg'],['../classDialogMsg.html#ad8dfbc1525efc49207f912d451aa0fde',1,'DialogMsg::DialogMsg()']]], + ['dialogsec_19',['DialogSec',['../classDialogSec.html',1,'']]], + ['dialogslevelfromint_20',['dialogsLevelFromInt',['../classMainWindow.html#a810897f817b3c3e9828f8a23a508a6e8',1,'MainWindow']]], + ['digestfile_21',['digestFile',['../classHashOps.html#ac74504e76a2c8e20506e446d2887ab53',1,'HashOps']]], + ['direction_22',['direction',['../structBodyPart.html#ad732b10425a86790821523da2388910b',1,'BodyPart::direction'],['../classSnake.html#aa497eee50dfe777501c9d398d133f672',1,'Snake::direction()']]], + ['donotcatchexception_23',['DoNotCatchException',['../structDoNotCatchException.html',1,'']]], + ['donutbreakdown_24',['DonutBreakdown',['../classDonutBreakdown.html',1,'']]], + ['draw_25',['draw',['../classCrissCross.html#acb0701307d815ab2c8bee7980bebf4bd',1,'CrissCross']]], + ['drawcount_26',['drawCount',['../classCrapview.html#ada344c04960f7b8dfa54d04bc7a59c8e',1,'Crapview']]], + ['drawday_27',['drawDay',['../classCrapview.html#aab468e4008724571d44d6244d918640d',1,'Crapview']]], + ['drawrelat_28',['drawRelat',['../classCrapview.html#a4e89a9a590435df939bc5edfac7dbb56',1,'Crapview']]], + ['drawspeed_29',['drawSpeed',['../classCrapview.html#ab569e9b9ab0f70a7620b5b78504175f5',1,'Crapview']]], + ['drawwarn_30',['drawWarn',['../classCrapview.html#a6ebee61566b688550e2e8074842fec7d',1,'Crapview']]] ]; diff --git a/docs/html/search/all_4.js b/docs/html/search/all_4.js index 30203769..b8bf89b6 100644 --- a/docs/html/search/all_4.js +++ b/docs/html/search/all_4.js @@ -1,42 +1,48 @@ var searchData= [ - ['editeddatabase_0',['editedDatabase',['../classCraplog.html#a68dd849eb25f6d0143c30676251dfc5f',1,'Craplog']]], + ['editeddatabase_0',['editedDatabase',['../classCraplog.html#aafa48706e27f79f5ba7d0bf8f8efaf2e',1,'Craplog']]], ['ends_1',['ends',['../structCraplog_1_1LogName.html#a84d26cb4dc6f8efd87b26ad77d048e15',1,'Craplog::LogName']]], - ['endswith_2',['endswith',['../namespaceStringOps.html#aa31fa90911d193832aab0bd2c337641c',1,'StringOps::endsWith(std::string_view str, const char flag)'],['../namespaceStringOps.html#a03327aaf5b652d05bdb4406611d6d00d',1,'StringOps::endsWith(std::string_view str, std::string_view flag)']]], + ['endswith_2',['endsWith',['../namespaceStringOps.html#a56c64ca6806bc01d6592dcf252ae1aa1',1,'StringOps::endsWith(std::string_view str, const char flag) noexcept'],['../namespaceStringOps.html#a89aa4526794ce074d8a8ec199e817354',1,'StringOps::endsWith(std::string_view str, std::string_view flag) noexcept']]], ['endturn_3',['endTurn',['../classCrissCross.html#a3d3d3eeb2b7666c4411c89cf153048e0',1,'CrissCross']]], - ['enrichlogs_4',['enrichLogs',['../classRichText.html#a2afa546c743511aba5eb62f4bdc1da09',1,'RichText']]], - ['errconfdirnotwritable_5',['errConfDirNotWritable',['../classDialogSec.html#a2cfc4ee49a455ec10253c133308e5235',1,'DialogSec']]], - ['errconffailedwriting_6',['errConfFailedWriting',['../classDialogSec.html#a2dcb66d839d8a10574414d45011e1764',1,'DialogSec']]], - ['errconffilenotreadable_7',['errConfFileNotReadable',['../classDialogSec.html#ae2a40f972582a40f5c4533cc7e2b425b',1,'DialogSec']]], - ['errconffilenotwritable_8',['errConfFileNotWritable',['../classDialogSec.html#a7c220883836ee79764e7a55813cc0cc9',1,'DialogSec']]], - ['errdatabasefailedbackup_9',['errDatabaseFailedBackup',['../classDialogSec.html#a20a23916efa18bb1a8dd1e91250f8557',1,'DialogSec']]], - ['errdatabasefailedcreating_10',['errDatabaseFailedCreating',['../classDialogSec.html#a8483bdc26a89628a826e69c454a7a6cf',1,'DialogSec']]], - ['errdatabasefailedexecuting_11',['errDatabaseFailedExecuting',['../classDialogSec.html#a64cfe33e61b020676857f98618aeb944',1,'DialogSec']]], - ['errdatabasefailedopening_12',['errDatabaseFailedOpening',['../classDialogSec.html#adad767386ecd10161f0eabda70d6c5d5',1,'DialogSec']]], - ['errdatabasenotfile_13',['errDatabaseNotFile',['../classDialogSec.html#a587689e07a401f5b51491e017535fd1d',1,'DialogSec']]], - ['errdatabasenotfound_14',['errDatabaseNotFound',['../classDialogSec.html#a1477572025f8b0457c821e57f6c8c54e',1,'DialogSec']]], - ['errdatabasenotreadable_15',['errDatabaseNotReadable',['../classDialogSec.html#a8b88d0e707f4d0100069208fe6969a74',1,'DialogSec']]], - ['errdatabasenotwritable_16',['errDatabaseNotWritable',['../classDialogSec.html#a6fbd29bf1e96b182b396315cfb49ea49',1,'DialogSec']]], - ['errdirnotexists_17',['errDirNotExists',['../classDialogSec.html#a1624e24d4d7b04b5479970234368db0e',1,'DialogSec']]], - ['errdirnotreadable_18',['errDirNotReadable',['../classDialogSec.html#a89580421a70af819c57f480de24d8e77',1,'DialogSec']]], - ['errdirnotwritable_19',['errDirNotWritable',['../classDialogSec.html#a24cd2a3e54b2969d4f33ba500bd7509b',1,'DialogSec']]], - ['errfailedapplyingconfigs_20',['errFailedApplyingConfigs',['../classDialogSec.html#a636ea87efbab1f9bb75431a48380cd39',1,'DialogSec']]], - ['errfaileddefininglogtype_21',['errFailedDefiningLogType',['../classDialogSec.html#a37b210d2f9a087eaf395a45ff2095ed5',1,'DialogSec']]], - ['errfailedmakedir_22',['errFailedMakeDir',['../classDialogSec.html#af10077a5f3ebbf3683801999d8005f9a',1,'DialogSec']]], - ['errfailedparsinglogs_23',['errFailedParsingLogs',['../classDialogSec.html#a8bdf9d669f24bffd5d996ec18020194b',1,'DialogSec']]], - ['errfailedreadfile_24',['errFailedReadFile',['../classDialogSec.html#a475316d013f45940a1953af608fe3d3f',1,'DialogSec']]], - ['errfilenotfound_25',['errFileNotFound',['../classDialogSec.html#a12d801b9dbfc0fc340c4bda5e69a6002',1,'DialogSec']]], - ['errgeneric_26',['errGeneric',['../classDialogSec.html#a6b7e8089712ea78ba9e6b2440dde2d1a',1,'DialogSec']]], - ['errhelpfailed_27',['errHelpFailed',['../classDialogSec.html#abc275ca943e81edb5459da0afbe8c8c3',1,'DialogSec']]], - ['errhelpnotfound_28',['errHelpNotFound',['../classDialogSec.html#a910d3500df728c06173056a4eac0c358',1,'DialogSec']]], - ['errhelpnotreadable_29',['errHelpNotReadable',['../classDialogSec.html#aefdc8e73c551460720d8a58e7e5e18bb',1,'DialogSec']]], - ['errinvalidlogformatstring_30',['errInvalidLogFormatString',['../classDialogSec.html#a3cc898412f2debd5eff058aa8cd88c80',1,'DialogSec']]], - ['errlanglocaleinvalid_31',['errLangLocaleInvalid',['../classDialogSec.html#ab2c944dbd7d2857d6ec7b0eba8b614ae',1,'DialogSec']]], - ['errlangnotaccepted_32',['errLangNotAccepted',['../classDialogSec.html#a38406ffaaed868ab75be5b7e8f35a1c2',1,'DialogSec']]], - ['errlogformatnofields_33',['errLogFormatNoFields',['../classDialogSec.html#a48efa757e87889491d2d723749647c00',1,'DialogSec']]], - ['errlogformatnoseparators_34',['errLogFormatNoSeparators',['../classDialogSec.html#a5cc9c61fd5d5dea50b248366a6bd6e54',1,'DialogSec']]], - ['errlogformatnotset_35',['errLogFormatNotSet',['../classDialogSec.html#af9f19176ce2981bd3397b9d033490cb8',1,'DialogSec']]], - ['errrenaming_36',['errRenaming',['../classDialogSec.html#a93804c66ed89197dceb292926fceb690',1,'DialogSec']]], - ['errsqldrivernotfound_37',['errSqlDriverNotFound',['../classDialogSec.html#a41c7f8f921aff3ecfb876be3d89276b6',1,'DialogSec']]], - ['exists_38',['exists',['../namespaceIOutils.html#aca83a80f57ec7447988db335cea3f180',1,'IOutils']]] + ['enrichlogs_4',['enrichLogs',['../classRichText.html#a4b7aa4cd838e9ea6780740047cdfa474',1,'RichText']]], + ['enumeratdarray_5',['EnumeratdArray',['../classEnumeratdArray.html',1,'']]], + ['enumerate_6',['enumerate',['../namespaceArrayOps.html#aec332afe52ccb712ba86f0a126702f49',1,'ArrayOps']]], + ['enumerator_7',['Enumerator',['../structEnumerator.html',1,'']]], + ['errconfdirnotwritable_8',['errConfDirNotWritable',['../classDialogSec.html#a2cfc4ee49a455ec10253c133308e5235',1,'DialogSec']]], + ['errconffailedwriting_9',['errConfFailedWriting',['../classDialogSec.html#a2dcb66d839d8a10574414d45011e1764',1,'DialogSec']]], + ['errconffilenotreadable_10',['errConfFileNotReadable',['../classDialogSec.html#ae2a40f972582a40f5c4533cc7e2b425b',1,'DialogSec']]], + ['errconffilenotwritable_11',['errConfFileNotWritable',['../classDialogSec.html#a7c220883836ee79764e7a55813cc0cc9',1,'DialogSec']]], + ['errconvertingdata_12',['errConvertingData',['../classDialogSec.html#ab571d3051c496c959274f21000750838',1,'DialogSec']]], + ['errdatabasefailedbackup_13',['errDatabaseFailedBackup',['../classDialogSec.html#a20a23916efa18bb1a8dd1e91250f8557',1,'DialogSec']]], + ['errdatabasefailedcreating_14',['errDatabaseFailedCreating',['../classDialogSec.html#a8483bdc26a89628a826e69c454a7a6cf',1,'DialogSec']]], + ['errdatabasefailedexecuting_15',['errDatabaseFailedExecuting',['../classDialogSec.html#a64cfe33e61b020676857f98618aeb944',1,'DialogSec']]], + ['errdatabasefailedopening_16',['errDatabaseFailedOpening',['../classDialogSec.html#adad767386ecd10161f0eabda70d6c5d5',1,'DialogSec']]], + ['errdatabasenotfile_17',['errDatabaseNotFile',['../classDialogSec.html#a587689e07a401f5b51491e017535fd1d',1,'DialogSec']]], + ['errdatabasenotfound_18',['errDatabaseNotFound',['../classDialogSec.html#a1477572025f8b0457c821e57f6c8c54e',1,'DialogSec']]], + ['errdatabasenotreadable_19',['errDatabaseNotReadable',['../classDialogSec.html#a8b88d0e707f4d0100069208fe6969a74',1,'DialogSec']]], + ['errdatabasenotwritable_20',['errDatabaseNotWritable',['../classDialogSec.html#a6fbd29bf1e96b182b396315cfb49ea49',1,'DialogSec']]], + ['errdirnotexists_21',['errDirNotExists',['../classDialogSec.html#a1624e24d4d7b04b5479970234368db0e',1,'DialogSec']]], + ['errdirnotreadable_22',['errDirNotReadable',['../classDialogSec.html#a89580421a70af819c57f480de24d8e77',1,'DialogSec']]], + ['errdirnotwritable_23',['errDirNotWritable',['../classDialogSec.html#a24cd2a3e54b2969d4f33ba500bd7509b',1,'DialogSec']]], + ['errfailedapplyingconfigsitem_24',['errFailedApplyingConfigsItem',['../classDialogSec.html#ab7e5f44cefc17e99cb3c91c21c0755b7',1,'DialogSec']]], + ['errfaileddefininglogtype_25',['errFailedDefiningLogType',['../classDialogSec.html#a37b210d2f9a087eaf395a45ff2095ed5',1,'DialogSec']]], + ['errfailedinsertusedhashes_26',['errFailedInsertUsedHashes',['../classDialogSec.html#a6668dbf080c96730fae96809a26d48d8',1,'DialogSec']]], + ['errfailedmakedir_27',['errFailedMakeDir',['../classDialogSec.html#af10077a5f3ebbf3683801999d8005f9a',1,'DialogSec']]], + ['errfailedparsinglogs_28',['errFailedParsingLogs',['../classDialogSec.html#a8bdf9d669f24bffd5d996ec18020194b',1,'DialogSec']]], + ['errfailedreadfile_29',['errFailedReadFile',['../classDialogSec.html#a475316d013f45940a1953af608fe3d3f',1,'DialogSec']]], + ['errfilenotfound_30',['errFileNotFound',['../classDialogSec.html#a12d801b9dbfc0fc340c4bda5e69a6002',1,'DialogSec']]], + ['errgeneric_31',['errGeneric',['../classDialogSec.html#a6b7e8089712ea78ba9e6b2440dde2d1a',1,'DialogSec']]], + ['errhelpfailed_32',['errHelpFailed',['../classDialogSec.html#abc275ca943e81edb5459da0afbe8c8c3',1,'DialogSec']]], + ['errhelpnotfound_33',['errHelpNotFound',['../classDialogSec.html#a910d3500df728c06173056a4eac0c358',1,'DialogSec']]], + ['errhelpnotreadable_34',['errHelpNotReadable',['../classDialogSec.html#aefdc8e73c551460720d8a58e7e5e18bb',1,'DialogSec']]], + ['errinvalidlogformatstring_35',['errInvalidLogFormatString',['../classDialogSec.html#a3cc898412f2debd5eff058aa8cd88c80',1,'DialogSec']]], + ['errlanglocaleinvalid_36',['errLangLocaleInvalid',['../classDialogSec.html#ab2c944dbd7d2857d6ec7b0eba8b614ae',1,'DialogSec']]], + ['errlangnotaccepted_37',['errLangNotAccepted',['../classDialogSec.html#a38406ffaaed868ab75be5b7e8f35a1c2',1,'DialogSec']]], + ['errlogformatnofields_38',['errLogFormatNoFields',['../classDialogSec.html#a48efa757e87889491d2d723749647c00',1,'DialogSec']]], + ['errlogformatnoseparators_39',['errLogFormatNoSeparators',['../classDialogSec.html#a5cc9c61fd5d5dea50b248366a6bd6e54',1,'DialogSec']]], + ['errlogformatnotset_40',['errLogFormatNotSet',['../classDialogSec.html#af9f19176ce2981bd3397b9d033490cb8',1,'DialogSec']]], + ['errprocessingstatsdata_41',['errProcessingStatsData',['../classDialogSec.html#af64324189aa2e42115afa0031dfc51c8',1,'DialogSec']]], + ['errrenaming_42',['errRenaming',['../classDialogSec.html#a93804c66ed89197dceb292926fceb690',1,'DialogSec']]], + ['errsqldrivernotfound_43',['errSqlDriverNotFound',['../classDialogSec.html#a41c7f8f921aff3ecfb876be3d89276b6',1,'DialogSec']]], + ['exists_44',['exists',['../namespaceIOutils.html#a4db5fef33faf62c104a7919c437a7725',1,'IOutils']]] ]; diff --git a/docs/html/search/all_5.js b/docs/html/search/all_5.js index 868e0f1e..c879feef 100644 --- a/docs/html/search/all_5.js +++ b/docs/html/search/all_5.js @@ -1,8 +1,12 @@ var searchData= [ - ['fields_0',['fields',['../classLogsFormat.html#abbe4416a99f0a95d893bc38b13380c90',1,'LogsFormat']]], - ['filterops_1',['FilterOps',['../namespaceFilterOps.html',1,'']]], - ['final_2',['final',['../classLogsFormat.html#ac3e0736a6c3544a39c3c85f719eb1553',1,'LogsFormat']]], - ['food_3',['food',['../classFood.html',1,'Food'],['../classSnakeGame.html#a24bb09f513593f8c816b41134f8684c3',1,'SnakeGame::food']]], - ['formatops_4',['FormatOps',['../classFormatOps.html',1,'']]] + ['fielddata_0',['FieldData',['../structFieldData.html',1,'']]], + ['fieldname_1',['fieldName',['../structBlacklistItem.html#a3efe7a6ac33a4e64a95af8cd3491806a',1,'BlacklistItem::fieldName()'],['../structWarnlistItem.html#a214684525d4c0269ad6fc24b15710efc',1,'WarnlistItem::fieldName()']]], + ['fields_2',['fields',['../structLogsFormat.html#af59e2f67fcf791a98e4003e894f694f9',1,'LogsFormat']]], + ['filehandler_3',['FileHandler',['../classFileHandler.html',1,'']]], + ['filterops_4',['FilterOps',['../namespaceFilterOps.html',1,'']]], + ['final_5',['final',['../structLogsFormat.html#ac3e0736a6c3544a39c3c85f719eb1553',1,'LogsFormat']]], + ['food_6',['Food',['../classFood.html',1,'']]], + ['food_7',['food',['../classSnakeGame.html#a24bb09f513593f8c816b41134f8684c3',1,'SnakeGame']]], + ['formatops_8',['FormatOps',['../classFormatOps.html',1,'']]] ]; diff --git a/docs/html/search/all_6.js b/docs/html/search/all_6.js index 1bff7564..fcc52290 100644 --- a/docs/html/search/all_6.js +++ b/docs/html/search/all_6.js @@ -1,58 +1,61 @@ var searchData= [ - ['gamedialog_0',['gamedialog',['../classGameDialog.html',1,'GameDialog'],['../classGameDialog.html#a64c49481c662dc6de69d7e3039d90218',1,'GameDialog::GameDialog()']]], - ['gamedraw_1',['gameDraw',['../classCrissCross.html#a4dbb7fba7bd0c37423ec572b28dc05cb',1,'CrissCross']]], + ['gamedialog_0',['GameDialog',['../classGameDialog.html',1,'GameDialog'],['../classGameDialog.html#a64c49481c662dc6de69d7e3039d90218',1,'GameDialog::GameDialog()']]], + ['gamedraw_1',['gameDraw',['../classCrissCross.html#ae587a35271f93f0247c09f52c83a419d',1,'CrissCross']]], ['gamemode_2',['GameMode',['../classSnakeGame.html#a146a1430f1f32269ad0ad4df759e6a2e',1,'SnakeGame']]], ['genericexception_3',['GenericException',['../classGenericException.html',1,'']]], ['geometrytostring_4',['geometryToString',['../classMainWindow.html#a6da24820c623e488217f8fdc3410b51e',1,'MainWindow']]], - ['getapachelogsample_5',['getApacheLogSample',['../classFormatOps.html#a2e0dfc31462771b5dbee807183021981',1,'FormatOps']]], - ['getblacklist_6',['getBlacklist',['../classCraplog.html#a8586cb34dddab990465c069deeb3b9d6',1,'Craplog']]], - ['getcolors_7',['getColors',['../namespaceColorSec.html#a1417a5b26652c4fbaceaf61b9477a3c4',1,'ColorSec']]], - ['getcolorscheme_8',['getColorScheme',['../classTextBrowser.html#a82cfa4f5053dc4220e2a11d97c677631',1,'TextBrowser']]], - ['getcolorschemeid_9',['getColorSchemeID',['../classTextBrowser.html#abd32a8479198b50ed84ada1fa79a6b95',1,'TextBrowser']]], - ['getcolorschemes_10',['getColorSchemes',['../namespaceColorSec.html#adf41ac920d56345d5340c20136b99445',1,'ColorSec']]], - ['getcurrentlogformat_11',['getCurrentLogFormat',['../classCraplog.html#a35da35fcca26354b017d339b9c25ccdd',1,'Craplog']]], - ['getcurrentwsid_12',['getCurrentWSID',['../classCraplog.html#add320174b7ae8f858d1c1e8bc5bb315a',1,'Craplog']]], - ['getdays_13',['getDays',['../classCrapview.html#a5c8cdc4ac91bd583d9b8a3d1aaea86c0',1,'Crapview']]], - ['getdaytimecounts_14',['getDaytimeCounts',['../classDbQuery.html#acf3ce4120be55f718298786c2865b73e',1,'DbQuery']]], - ['getdbfield_15',['getDbField',['../classDbQuery.html#a37720e27fdc817124b224f08aa9618ad',1,'DbQuery']]], - ['getdialogslevel_16',['getdialogslevel',['../classCraplog.html#a197c271fcf4ccb3ff13111dd7e42b091',1,'Craplog::getDialogsLevel()'],['../classCrapview.html#ac5bc1d50dc4d65ab3be5d85ce1010224',1,'Crapview::getDialogsLevel() const']]], - ['getfields_17',['getFields',['../classCrapview.html#a1ff83b4bda0d56e07163c8f9c30dd3ef',1,'Crapview']]], - ['getfont_18',['getFont',['../classTextBrowser.html#a04dda58a310e9f189224d5669c639df7',1,'TextBrowser']]], - ['getfontfamily_19',['getFontFamily',['../classTextBrowser.html#a10a6312d494fb85093d39687081b58d9',1,'TextBrowser']]], - ['getglobalcounts_20',['getGlobalCounts',['../classDbQuery.html#a278ca6ae98fe0de802927f909e40b79a',1,'DbQuery']]], - ['gethashesdatabasepath_21',['getHashesDatabasePath',['../classCraplog.html#ae4450126ded5f26a35379f165e6b29a6',1,'Craplog']]], - ['gethours_22',['getHours',['../classCrapview.html#a4e3937793d8ec572b0798dd1669bbff4',1,'Crapview']]], - ['getiislogsample_23',['getIisLogSample',['../classFormatOps.html#ac84d3f470507d50a9b70a158525342ba',1,'FormatOps']]], - ['getitemscount_24',['getItemsCount',['../classDbQuery.html#ac28b2a9352b50f537ec8e105e461277b',1,'DbQuery']]], - ['getlogfieldid_25',['getLogFieldID',['../classCrapview.html#a5469ce72afc57cd1c108172189031270',1,'Crapview']]], - ['getlogfieldstring_26',['getLogFieldString',['../classCrapview.html#ae103f35a46e97fc165edad43627b99a3',1,'Crapview']]], + ['get_5',['get',['../structBlacklists.html#aa45453bba09a2e32451149226bf74a74',1,'Blacklists::get(const WebServer ws)'],['../structBlacklists.html#ac2ce100ce6d845d6075fe51c15dba2c4',1,'Blacklists::get(const WebServer ws, const BlacklistField fld)'],['../structBlacklist.html#a1fadea47acfc9dc49d51d127a7c1b653',1,'Blacklist::get()'],['../structDatabaseHandler.html#a88e9b96f057bfc215feda12704bfc76a',1,'DatabaseHandler::get()'],['../structWarnlist.html#a25fb911f28a5643047823660a0c5f7ad',1,'Warnlist::get()'],['../structWarnlists.html#ae826377de88439372f26d4784986d7d6',1,'Warnlists::get(const WebServer ws)'],['../structWarnlists.html#a98654ec61c100bc6dae0514b091ea25b',1,'Warnlists::get(const WebServer ws, const WarnlistField fld)']]], + ['getapachelogsample_6',['getApacheLogSample',['../classFormatOps.html#a58b73f3dc433fea22315c178999d621c',1,'FormatOps']]], + ['getcolors_7',['getColors',['../namespaceColorSec.html#a084df7301f608504093007a90f867385',1,'ColorSec']]], + ['getcolorscheme_8',['getColorScheme',['../classTextBrowser.html#acae772fdaa45657ec122fe2a62cbea52',1,'TextBrowser']]], + ['getcolorschemeid_9',['getColorSchemeID',['../classTextBrowser.html#a70a2450945e1496ee285a3b7abd33c6c',1,'TextBrowser']]], + ['getcolorschemes_10',['getColorSchemes',['../namespaceColorSec.html#af087e0161d734f99e86fabde0e89814c',1,'ColorSec']]], + ['getconst_11',['getConst',['../structBlacklists.html#a278c426283cdf3128659a79a56613c5b',1,'Blacklists']]], + ['getcurrentlogformat_12',['getCurrentLogFormat',['../classCraplog.html#a0d35ae5254f94dafacb9416225ef9752',1,'Craplog']]], + ['getcurrentwebserver_13',['getCurrentWebServer',['../classCraplog.html#a3e63e280ac59d4712fab8ae529f8b919',1,'Craplog']]], + ['getdays_14',['getDays',['../classCrapview.html#a953574337d84ecc63082904b806f0149',1,'Crapview']]], + ['getdaytimecounts_15',['getDaytimeCounts',['../classDbQuery.html#aa2ef81698e34e36d20514823fa9d211b',1,'DbQuery']]], + ['getdbfield_16',['getDbField',['../classDbQuery.html#a5f652baa6d4a0af4177e5754edb99b21',1,'DbQuery::getDbField(const LogField fld) const'],['../classDbQuery.html#a5c6a8c4ea21e565c418e32eb90ff7d7c',1,'DbQuery::getDbField(QStringView tr_fld) const']]], + ['getdialogslevel_17',['getDialogsLevel',['../classCraplog.html#a8d70da9762053be0744d491c74a45c97',1,'Craplog::getDialogsLevel()'],['../classCrapview.html#a1501e7ecc7f0de57948a4d6ec73739e1',1,'Crapview::getDialogsLevel()']]], + ['getfont_18',['getFont',['../classTextBrowser.html#a6e31d189e6fa6f6b29d19b3b17a50f39',1,'TextBrowser']]], + ['getfontfamily_19',['getFontFamily',['../classTextBrowser.html#aea2b9d5a065ee625c2c530c3a833f8f2',1,'TextBrowser']]], + ['getglobalcounts_20',['getGlobalCounts',['../classDbQuery.html#a08061a6906bb027ebdee5a337482aba9',1,'DbQuery']]], + ['gethashesdatabasepath_21',['getHashesDatabasePath',['../classCraplog.html#a37cdeb09ed7af4c2c0072a2eeca01b1f',1,'Craplog']]], + ['gethours_22',['getHours',['../classCrapview.html#a7729561544e1a3d5e46748220843b678',1,'Crapview']]], + ['getiislogsample_23',['getIisLogSample',['../classFormatOps.html#ac2f8b6e0917e3393e2b3df3f1eefdb93',1,'FormatOps']]], + ['getitemscount_24',['getItemsCount',['../classDbQuery.html#a0199ea829fe90b7f9f392c35d9c73774',1,'DbQuery']]], + ['getlist_25',['getList',['../structBlacklists.html#a765e6fb9c9276dd9483002b73853da66',1,'Blacklists::getList()'],['../structWarnlists.html#ad66f3140dd314572780162c889c09910',1,'Warnlists::getList()']]], + ['getlistconst_26',['getListConst',['../structBlacklists.html#aaab71d2e4628a0b20302d580b8fb05ba',1,'Blacklists::getListConst()'],['../structWarnlists.html#a8b4dc9f42d6c40dc6fd457efa6120f7f',1,'Warnlists::getListConst()']]], ['getlogfileitem_27',['getLogFileItem',['../classCraplog.html#a03f799378a10ef054239a6ae807a8759',1,'Craplog']]], - ['getlogsformat_28',['getLogsFormat',['../classCraplog.html#accdb2181153cc63b6df29ac82a6749ac',1,'Craplog']]], - ['getlogsformatsample_29',['getLogsFormatSample',['../classCraplog.html#a95f8a07dcf1e0192e5c2c27bae4c93cc',1,'Craplog']]], - ['getlogsformatstring_30',['getLogsFormatString',['../classCraplog.html#a73ca3eb33066e39400b716fef18d2c32',1,'Craplog']]], - ['getlogslist_31',['getLogsList',['../classCraplog.html#ac15810ff1df0f2bf7c41dcbaefc52b4f',1,'Craplog']]], - ['getlogslistsize_32',['getLogsListSize',['../classCraplog.html#a8e240df009643dd3d385b20722161baf',1,'Craplog']]], - ['getlogspath_33',['getLogsPath',['../classCraplog.html#a404df4ad021c1f7e159617cddc0b18b7',1,'Craplog']]], + ['getlogsformat_28',['getLogsFormat',['../classCraplog.html#aac21533e0b7e0b679283eb705c0e02b6',1,'Craplog']]], + ['getlogsformatsample_29',['getLogsFormatSample',['../classCraplog.html#a12622a27780111b0b61c5e4d6abe8640',1,'Craplog']]], + ['getlogsformatstring_30',['getLogsFormatString',['../classCraplog.html#a16201b26843b82b44f0ea7bdca2640fb',1,'Craplog']]], + ['getlogslist_31',['getLogsList',['../classCraplog.html#a83c6473c9e3474eca227b55faca5eb32',1,'Craplog']]], + ['getlogslistsize_32',['getLogsListSize',['../classCraplog.html#a7a954060a71c18a515001b2f8dcb4a7e',1,'Craplog']]], + ['getlogspath_33',['getLogsPath',['../classCraplog.html#ae46e9afa61bb5ac8ed8d8af433a7eff6',1,'Craplog']]], ['getminutegap_34',['getMinuteGap',['../classDbQuery.html#ad84db758810e989b8f61ac992d683f4a',1,'DbQuery']]], ['getmonthdays_35',['getMonthDays',['../classDbQuery.html#a1ad1575ea0a9b5f3554e5d18bf0a3273',1,'DbQuery']]], - ['getmonthnumber_36',['getmonthnumber',['../classCrapview.html#acbeb5c6be095cf4c95f3cdbbf4c625de',1,'Crapview::getMonthNumber()'],['../classDbQuery.html#a9d619717133cedd8c1bf899b1004a4ce',1,'DbQuery::getMonthNumber()']]], - ['getmonths_37',['getMonths',['../classCrapview.html#a067eebbdf9166dbf0756c8bacdc8c5ca',1,'Crapview']]], - ['getnginxlogsample_38',['getNginxLogSample',['../classFormatOps.html#a60f1bba56a207556baf3bd0e577d524d',1,'FormatOps']]], - ['getparsedlines_39',['getParsedLines',['../classCraplog.html#ad30413632a8f83f04d62b39b40ca2bf8',1,'Craplog']]], - ['getparsedsize_40',['getParsedSize',['../classCraplog.html#aeae4e0cffef5cfd7520412e8140d9fcf',1,'Craplog']]], - ['getparsingspeed_41',['getParsingSpeed',['../classCraplog.html#a13abf90f6facb5f9304ed96cb0d60f49',1,'Craplog']]], - ['getrelationalcountsday_42',['getRelationalCountsDay',['../classDbQuery.html#ade63d90c7cf05115dac780d4d6884c6c',1,'DbQuery']]], - ['getrelationalcountsperiod_43',['getRelationalCountsPeriod',['../classDbQuery.html#a9dd64837bce2294c32866c85795db085',1,'DbQuery']]], - ['getspeeddata_44',['getSpeedData',['../classDbQuery.html#aab00855f73578e2cc83b4c2ffa2c04e9',1,'DbQuery']]], - ['getstatsdatabasepath_45',['getStatsDatabasePath',['../classCraplog.html#aa0740b5c11c9aa123bbb32326c494e31',1,'Craplog']]], - ['getstylesheet_46',['getStyleSheet',['../namespaceStyleSec.html#ac80ae7ce6ca669d26ca3ddca25e2398b',1,'StyleSec']]], - ['getwarncounts_47',['getWarnCounts',['../classDbQuery.html#a202b946c47e35d86f62e09cd1653479d',1,'DbQuery']]], - ['getwarningsize_48',['getWarningSize',['../classCraplog.html#a306e299ec33667ba0da257c842e39fc9',1,'Craplog']]], - ['getwarnlist_49',['getWarnlist',['../classCraplog.html#a8985d13c8fc2eed3b0d27f2f457f0c4e',1,'Craplog']]], - ['getwidelinesusage_50',['getWideLinesUsage',['../classTextBrowser.html#aa89d49d770f89a2b6ee438bcc39ce92b',1,'TextBrowser']]], - ['getyears_51',['getYears',['../classCrapview.html#a1c8e47e7ef3bb493b2876512df77998f',1,'Crapview']]], - ['globalconfigs_52',['GlobalConfigs',['../namespaceGlobalConfigs.html',1,'']]], - ['grow_53',['grow',['../classSnake.html#abe575cf3bd5b5d86a50029485d259ac4',1,'Snake']]], - ['gzutils_54',['GZutils',['../namespaceGZutils.html',1,'']]] + ['getmonthnumber_36',['getMonthNumber',['../classCrapview.html#a8cd3251788b5a81a024d67efedaa2787',1,'Crapview::getMonthNumber()'],['../classDbQuery.html#aab983801276d1ea9aca03390bc6e2ab1',1,'DbQuery::getMonthNumber()']]], + ['getmonths_37',['getMonths',['../classCrapview.html#ab04f8c6a4e5c057b8130127fc8b810dd',1,'Crapview']]], + ['getnginxlogsample_38',['getNginxLogSample',['../classFormatOps.html#a41c435c5a78c343059f57d4110cf2ac3',1,'FormatOps']]], + ['getparsedlines_39',['getParsedLines',['../classCraplog.html#a66861229e56b765a13f794f72072bb83',1,'Craplog']]], + ['getparsedsize_40',['getParsedSize',['../classCraplog.html#a75137d43a5b62838a2579417478656ec',1,'Craplog']]], + ['getparsingspeed_41',['getParsingSpeed',['../classCraplog.html#a044bc6cbc69da882b30a4ef6b6a7bd70',1,'Craplog']]], + ['getquery_42',['getQuery',['../classDatabaseWrapper.html#a2f2be3529a992ef261c3db9ae8a83776',1,'DatabaseWrapper']]], + ['getrelationalcountsday_43',['getRelationalCountsDay',['../classDbQuery.html#a40861d972e65c5c5ccdd7fab97b75352',1,'DbQuery']]], + ['getrelationalcountsperiod_44',['getRelationalCountsPeriod',['../classDbQuery.html#a39aec1ee108feecf392430e82a6bf339',1,'DbQuery']]], + ['getspeeddata_45',['getSpeedData',['../classDbQuery.html#a9b836475387a0ca70230d99b706ded6b',1,'DbQuery']]], + ['getspeedheadercolumns_46',['getSpeedHeaderColumns',['../classCrapview.html#a6138f094550da7542d144b10f77de54f',1,'Crapview']]], + ['getstatsdatabasepath_47',['getStatsDatabasePath',['../classCraplog.html#a2bae3469ee22f678bdbfa7d40b8cc384',1,'Craplog']]], + ['getstylesheet_48',['getStyleSheet',['../namespaceStyleSec.html#a04651d94220678bc33f38cbf25b52173',1,'StyleSec']]], + ['getwarnheadercolumns_49',['getWarnHeaderColumns',['../classCrapview.html#a05480368c32c29f19a10130bd7066f41',1,'Crapview']]], + ['getwarningsdata_50',['getWarningsData',['../classDbQuery.html#a803a3a10ec5318c337746928bfab4b98',1,'DbQuery']]], + ['getwarningsize_51',['getWarningSize',['../classCraplog.html#a02929f7e891c11b87549a052e9985fab',1,'Craplog']]], + ['getwidelinesusage_52',['getWideLinesUsage',['../classTextBrowser.html#a17ca5e2f3453ac5fcaf1643cbf6a2204',1,'TextBrowser']]], + ['getyears_53',['getYears',['../classCrapview.html#a73d54cba5cf55fe148ce2316f26343f9',1,'Crapview']]], + ['globalconfigs_54',['GlobalConfigs',['../namespaceGlobalConfigs.html',1,'']]], + ['globalsdata_55',['GlobalsData',['../structGlobalsData.html',1,'']]], + ['grow_56',['grow',['../classSnake.html#abe575cf3bd5b5d86a50029485d259ac4',1,'Snake']]], + ['gzutils_57',['GZutils',['../namespaceGZutils.html',1,'']]] ]; diff --git a/docs/html/search/all_7.js b/docs/html/search/all_7.js index 4b089592..10d0b211 100644 --- a/docs/html/search/all_7.js +++ b/docs/html/search/all_7.js @@ -1,11 +1,10 @@ var searchData= [ - ['hasbeenused_0',['hasbeenused',['../classHashOps.html#acc0ec2920945173835b3489a1b95164b',1,'HashOps::hasBeenUsed()'],['../classLogFile.html#a84287037ed72866b55ece09ad946efe3',1,'LogFile::hasBeenUsed() const']]], - ['hash_1',['hash',['../classLogFile.html#a4099a83df4e95c689a36378442cc547c',1,'LogFile']]], + ['hasbeenused_0',['hasBeenUsed',['../classHashOps.html#a250921916c76fc68ec937efb51b2a320',1,'HashOps::hasBeenUsed()'],['../structLogFile.html#a9475b134af9544cbf64f77ac016fa76b',1,'LogFile::hasBeenUsed() const noexcept']]], + ['hash_1',['hash',['../structLogFile.html#aecc6fb679bf7597dfd468f1334d41bfa',1,'LogFile']]], ['hashops_2',['HashOps',['../classHashOps.html',1,'']]], - ['helplogsformat_3',['helpLogsFormat',['../classCraphelp.html#a311257a3a833ec2fa8fe262fbd0646cb',1,'Craphelp']]], - ['helplogsformatdefault_4',['helpLogsFormatDefault',['../classCraphelp.html#acf0dd64949a11297fb23aa97971e241a',1,'Craphelp']]], - ['hireasyncworker_5',['hireAsyncWorker',['../classCraplog.html#a290000f88b366470fbfa370eb6edf3ae',1,'Craplog']]], - ['hireworker_6',['hireWorker',['../classCraplog.html#a6b8118aa003315fb83fe7c7edac59d22',1,'Craplog']]], - ['hunt_7',['Hunt',['../classSnakeGame.html#a146a1430f1f32269ad0ad4df759e6a2ea85dd070c26938d7a4184269c6ddacd1f',1,'SnakeGame']]] + ['helplogsformat_3',['helpLogsFormat',['../classCraphelp.html#a8009bde7d0c58925bb8b9031fedf8429',1,'Craphelp']]], + ['helplogsformatdefault_4',['helpLogsFormatDefault',['../classCraphelp.html#a598d158441d903b6505b05c879f55aac',1,'Craphelp']]], + ['hireworker_5',['hireWorker',['../classCraplog.html#a138768b187a349bca1f92c5fbfe636e2',1,'Craplog']]], + ['hunt_6',['Hunt',['../classSnakeGame.html#a146a1430f1f32269ad0ad4df759e6a2ea85dd070c26938d7a4184269c6ddacd1f',1,'SnakeGame']]] ]; diff --git a/docs/html/search/all_8.js b/docs/html/search/all_8.js index 89914ba4..8922b3b3 100644 --- a/docs/html/search/all_8.js +++ b/docs/html/search/all_8.js @@ -1,22 +1,21 @@ var searchData= [ - ['iis_5falf_0',['IIS_ALF',['../classFormatOps.html#aa4afc65bbc4887342cbb36381a26c3ba',1,'FormatOps']]], - ['image_1',['image',['../classFood.html#a053638cacc2d92acd0a29a597941f2ba',1,'Food::image'],['../structBodyPart.html#a1196ac7004a9559d2f2ef380885f2867',1,'BodyPart::image']]], + ['iis_5falf_0',['IIS_ALF',['../classFormatOps.html#a9e10bec68f996338b37ee1f34359be0f',1,'FormatOps']]], + ['image_1',['image',['../structBodyPart.html#a1196ac7004a9559d2f2ef380885f2867',1,'BodyPart']]], ['img_5frat_2',['img_rat',['../classFood.html#ad7ca002e1067c45e362f2193f679ac77',1,'Food']]], - ['initial_3',['initial',['../classLogsFormat.html#a160b9942307a37c343d28a26336ee5de',1,'LogsFormat']]], - ['insertusedhashes_4',['insertUsedHashes',['../classHashOps.html#a01e13190474d56d18b6faa4f8a7f5cac',1,'HashOps']]], - ['intile_5',['intile',['../classSnake.html#ab58698ed7c8d4c7b0a6cbfbb963c0225',1,'Snake::inTile()'],['../classFood.html#a1baa42d6f924ce2a37a2a97773fc57f6',1,'Food::inTile()']]], + ['initial_3',['initial',['../structLogsFormat.html#a160b9942307a37c343d28a26336ee5de',1,'LogsFormat']]], + ['insertusedhashes_4',['insertUsedHashes',['../classHashOps.html#a1f1c1c6c832a9204c785e127f5963269',1,'HashOps']]], + ['intile_5',['inTile',['../classFood.html#a219ff9d1daabbb73146a10a8ed622489',1,'Food::inTile()'],['../classSnake.html#a9e3ab613da3b0d195b4524986c938824',1,'Snake::inTile()']]], ['ioutils_6',['IOutils',['../namespaceIOutils.html',1,'']]], - ['isalnum_7',['isalnum',['../namespaceStringOps.html#ac2b7e457d07531e6e3d2ea90d2f7f88a',1,'StringOps::isAlnum(const char &chr)'],['../namespaceStringOps.html#a19be2ecc13f0bacd98b5d2f5165ce8fd',1,'StringOps::isAlnum(std::string_view str)']]], - ['isalphabetic_8',['isalphabetic',['../namespaceStringOps.html#a4796d3e899bf94b95b15c6b7ed732038',1,'StringOps::isAlphabetic(std::string_view str)'],['../namespaceStringOps.html#a4afc652a1086d1b90979623b2a00f46c',1,'StringOps::isAlphabetic(const char &chr)']]], - ['isblacklistused_9',['isBlacklistUsed',['../classCraplog.html#a08bf8aba58cb6dd7a3c3058d5083c880',1,'Craplog']]], - ['isdir_10',['isDir',['../namespaceIOutils.html#ade1bc91ae81b60cf001fb3493e09bc80',1,'IOutils']]], - ['isfile_11',['isFile',['../namespaceIOutils.html#a3984b9eb866436c0c6774e95d2467dd4',1,'IOutils']]], - ['isfilenamevalid_12',['isFileNameValid',['../classCraplog.html#a46998f8199f8a1365936d987c1daf1da',1,'Craplog']]], - ['ishex_13',['isHex',['../namespaceStringOps.html#ab0a082513e31757e5d52e94ed10790c1',1,'StringOps']]], - ['isip_14',['isIP',['../namespaceStringOps.html#aec7605798fefecaf4a3085c536d96926',1,'StringOps']]], - ['isnumeric_15',['isnumeric',['../namespaceStringOps.html#a509440540926f13d148755e386991e12',1,'StringOps::isNumeric(const char &chr)'],['../namespaceStringOps.html#a1c268a2a07b9cf01bc1b64a19e531994',1,'StringOps::isNumeric(std::string_view str)']]], - ['isparsing_16',['isParsing',['../classCraplog.html#a500ecf845b2b7a3044ca7796efde7d17',1,'Craplog']]], - ['isselected_17',['isSelected',['../classLogFile.html#a53b9f791010c0f86e73189e8d3b03ec4',1,'LogFile']]], - ['iswarnlistused_18',['isWarnlistUsed',['../classCraplog.html#a92550bd6b6f85846d9c4db60e1a50316',1,'Craplog']]] + ['isalnum_7',['isAlnum',['../namespaceCharOps.html#a321f744c443f3bb74897f58ed727ae61',1,'CharOps::isAlnum()'],['../namespaceStringOps.html#ad454dc2033102bec1a8732f1a3f80924',1,'StringOps::isAlnum()']]], + ['isalphabetic_8',['isAlphabetic',['../namespaceCharOps.html#a445df1734b86daaabff2ec7cc4f8fe73',1,'CharOps::isAlphabetic()'],['../namespaceStringOps.html#a13682664452439d4c2005220c14946f9',1,'StringOps::isAlphabetic()']]], + ['isdir_9',['isDir',['../namespaceIOutils.html#a695b1fc2014fb9dc767b5690436d37f4',1,'IOutils']]], + ['isfile_10',['isFile',['../namespaceIOutils.html#af195dcc9d110796912c816cbeedda278',1,'IOutils']]], + ['isfilenamevalid_11',['isFileNameValid',['../classCraplog.html#a46998f8199f8a1365936d987c1daf1da',1,'Craplog']]], + ['ishex_12',['isHex',['../namespaceCharOps.html#a88bd887bc63ac2cc0c88b466a0f4a2d3',1,'CharOps']]], + ['isip_13',['isIP',['../namespaceCharOps.html#a47f3afa460f1cb12069cd7c8c6799e55',1,'CharOps::isIP()'],['../namespaceStringOps.html#a4f83a6579215a78d99bac4b367ed83c8',1,'StringOps::isIP()']]], + ['isnumeric_14',['isNumeric',['../namespaceCharOps.html#a12f22034684a12e43fb72da646fbea1c',1,'CharOps::isNumeric()'],['../namespaceStringOps.html#a801d90518317ee836aa03d8766bb3387',1,'StringOps::isNumeric(QStringView str) noexcept'],['../namespaceStringOps.html#a45689ca5732555d9a4066774b7479024',1,'StringOps::isNumeric(std::string_view str) noexcept']]], + ['isparsing_15',['isParsing',['../classCraplog.html#a69fbed93fe20701bcc76ce4f4d852949',1,'Craplog']]], + ['isselected_16',['isSelected',['../structLogFile.html#a34d7d221b860109370b0e60d2d43f218',1,'LogFile']]], + ['isused_17',['isUsed',['../structBlacklists.html#a35b6a9697f0e48b3f8567de2db327595',1,'Blacklists::isUsed()'],['../structBlacklist.html#a2607de4b062d5c7afb40d38bebb5d271',1,'Blacklist::isUsed()'],['../structWarnlist.html#ad47ef0ce8ec314ad2e10e76c0cd398e9',1,'Warnlist::isUsed()'],['../structWarnlists.html#a8911f4b2daf8443c0dbe1e6cacc92ee3',1,'Warnlists::isUsed()']]] ]; diff --git a/docs/html/search/all_9.js b/docs/html/search/all_9.js index 414b9c22..df5d6dda 100644 --- a/docs/html/search/all_9.js +++ b/docs/html/search/all_9.js @@ -1,4 +1,4 @@ var searchData= [ - ['joinloglines_0',['joinloglines',['../classCraplogParser.html#a0cab0465f65175011235f09fa0ff281d',1,'CraplogParser::joinLogLines()'],['../classCraplogParserAsync.html#acd02045ed712c28cd006ace69b1e998e',1,'CraplogParserAsync::joinLogLines()']]] + ['joinloglines_0',['joinLogLines',['../classCraplogParser.html#a0cab0465f65175011235f09fa0ff281d',1,'CraplogParser']]] ]; diff --git a/docs/html/search/all_a.js b/docs/html/search/all_a.js index 2cd04de0..0f7ab555 100644 --- a/docs/html/search/all_a.js +++ b/docs/html/search/all_a.js @@ -1,5 +1,5 @@ var searchData= [ - ['key_5fevents_0',['key_events',['../classSnakeGame.html#a8be52d5a2a611f246af8631243d88663',1,'SnakeGame']]], - ['keypressevent_1',['keyPressEvent',['../classSnakeGame.html#a407dd2bae84d0f6572b94bb37feb87bc',1,'SnakeGame']]] + ['key_5fevents_0',['key_events',['../classSnakeGame.html#ae1802388d00cbe8b19787851f1b92135',1,'SnakeGame']]], + ['keypressevent_1',['keyPressEvent',['../classSnakeGame.html#a5fc9e82584755f43b5fc07302c9715b8',1,'SnakeGame']]] ]; diff --git a/docs/html/search/all_b.js b/docs/html/search/all_b.js index 4a4ac3c9..08bc7509 100644 --- a/docs/html/search/all_b.js +++ b/docs/html/search/all_b.js @@ -1,15 +1,18 @@ var searchData= [ - ['list_0',['list',['../structBWlist.html#ab213c296a3e2033565c4bfb052f4fde1',1,'BWlist']]], + ['list_0',['Todo List',['../todo.html',1,'']]], ['list2string_1',['list2string',['../classMainWindow.html#a827a4bc119f8008df7605feaaefaecc8',1,'MainWindow']]], - ['loadusedhasheslists_2',['loadUsedHashesLists',['../classHashOps.html#a1184284b059b2094b0fc5cbbd1a2050b',1,'HashOps']]], - ['logfile_3',['LogFile',['../classLogFile.html',1,'']]], - ['logfiletreewidgetitem_4',['LogFileTreeWidgetItem',['../classLogFileTreeWidgetItem.html',1,'']]], - ['logformatexception_5',['LogFormatException',['../classLogFormatException.html',1,'']]], - ['logname_6',['LogName',['../structCraplog_1_1LogName.html',1,'Craplog']]], - ['logops_7',['LogOps',['../namespaceLogOps.html',1,'']]], - ['logparserexception_8',['LogParserException',['../classLogParserException.html',1,'']]], - ['logsformat_9',['LogsFormat',['../classLogsFormat.html',1,'']]], - ['lstrip_10',['lstrip',['../namespaceStringOps.html#ac7a279927b232cce716d384ebf118301',1,'StringOps::lstrip(const std::string &str, const char chr)'],['../namespaceStringOps.html#a6f55e9f27e8933c6c8b982db99ec8cd0',1,'StringOps::lstrip(const std::string &str, std::string_view chars=" \n\t\b\r\v")']]], - ['lstripuntil_11',['lstripUntil',['../namespaceStringOps.html#a5bdf332c4414568e1e909703438ccccd',1,'StringOps']]] + ['loadusedhasheslists_2',['loadUsedHashesLists',['../classHashOps.html#ad0b62ddfa2ed968c27e7fbeb58c21571',1,'HashOps']]], + ['logdoctorexception_3',['LogDoctorException',['../classLogDoctorException.html',1,'']]], + ['logfieldslistmodel_4',['LogFieldsListModel',['../classLogFieldsListModel.html',1,'']]], + ['logfile_5',['LogFile',['../structLogFile.html',1,'']]], + ['logfiletreewidgetitem_6',['LogFileTreeWidgetItem',['../classLogFileTreeWidgetItem.html',1,'']]], + ['logformatexception_7',['LogFormatException',['../classLogFormatException.html',1,'']]], + ['loglinedata_8',['LogLineData',['../structLogLineData.html',1,'LogLineData'],['../structLogLineData.html#a1392bc417abc4977770559415e3d6787',1,'LogLineData::LogLineData()']]], + ['logname_9',['LogName',['../structCraplog_1_1LogName.html',1,'Craplog']]], + ['logops_10',['LogOps',['../namespaceLogOps.html',1,'']]], + ['logparserexception_11',['LogParserException',['../classLogParserException.html',1,'']]], + ['logsformat_12',['LogsFormat',['../structLogsFormat.html',1,'']]], + ['lstrip_13',['lstrip',['../namespaceStringOps.html#a280ef713ce56866656c018dcc2893c13',1,'StringOps::lstrip(const std::string &str, const char chr) noexcept'],['../namespaceStringOps.html#a2f035c3b92937b6417063843ae02bc10',1,'StringOps::lstrip(const std::string &str, const char *chars=" \n\t\b\r\v") noexcept']]], + ['lstripuntil_14',['lstripUntil',['../namespaceStringOps.html#a9a8a1c130c35c5746ec4b2288e338a6b',1,'StringOps']]] ]; diff --git a/docs/html/search/all_c.js b/docs/html/search/all_c.js index 045bcb3a..fcb73867 100644 --- a/docs/html/search/all_c.js +++ b/docs/html/search/all_c.js @@ -3,15 +3,21 @@ var searchData= ['mainslice_0',['MainSlice',['../classMainSlice.html',1,'']]], ['mainwindow_1',['MainWindow',['../classMainWindow.html',1,'']]], ['makechart_2',['makeChart',['../classCraplog.html#ae25af3f4bd279585cd28cd0c2b0785fc',1,'Craplog']]], - ['makedir_3',['makeDir',['../namespaceIOutils.html#a9f8aee8de3eeaca32a1b198c8befdd09',1,'IOutils']]], + ['makedir_3',['makeDir',['../namespaceIOutils.html#abe5347509aa1fcb426861343357e5eab',1,'IOutils']]], ['makeinitialchecks_4',['makeInitialChecks',['../classMainWindow.html#ae459fb4a3966975abe641c11c76e2c03',1,'MainWindow']]], - ['makepreview_5',['makePreview',['../classTextBrowser.html#a9678c99090d67310690f6a1146d70c06',1,'TextBrowser']]], - ['max_5fsnake_5flength_6',['MAX_SNAKE_LENGTH',['../classSnakeGame.html#ab359f92ba6a02621b131f3cdacd1260b',1,'SnakeGame']]], - ['memops_7',['MemOps',['../namespaceMemOps.html',1,'']]], - ['menu_5factionenglishgb_5ftriggered_8',['menu_actionEnglishGb_triggered',['../classMainWindow.html#a42ea06a6c166e5c8243944d4e5159514',1,'MainWindow']]], - ['movable_9',['movable',['../classFood.html#ab4ab28e75609c4872fc47563909c4c61',1,'Food']]], - ['move_10',['move',['../classFood.html#a840b4ae09993aea111403617f56988d1',1,'Food']]], - ['msgdatabasecreated_11',['msgDatabaseCreated',['../classDialogSec.html#ae916458257088da13a1a2bc885d5c71d',1,'DialogSec']]], - ['msgnofiletoparse_12',['msgNoFileToParse',['../classDialogSec.html#a38d096b5d4d6cae9d0af6224ff4b6ba9',1,'DialogSec']]], - ['msgnotenoughmemory_13',['msgNotEnoughMemory',['../classDialogSec.html#a9f29d5f5fc2b8dd92ab94942c6162026',1,'DialogSec']]] + ['makenewdatabase_5',['MakeNewDatabase',['../structMakeNewDatabase.html',1,'']]], + ['makepreview_6',['makePreview',['../classTextBrowser.html#ac00475774beaefffd6de8b256324e4a3',1,'TextBrowser']]], + ['max_5fsnake_5flength_7',['MAX_SNAKE_LENGTH',['../classSnakeGame.html#ab359f92ba6a02621b131f3cdacd1260b',1,'SnakeGame']]], + ['memops_8',['MemOps',['../namespaceMemOps.html',1,'']]], + ['menu_5factionenglishgb_5ftriggered_9',['menu_actionEnglishGb_triggered',['../classMainWindow.html#a42ea06a6c166e5c8243944d4e5159514',1,'MainWindow']]], + ['movable_10',['movable',['../classFood.html#ab4ab28e75609c4872fc47563909c4c61',1,'Food']]], + ['move_11',['move',['../classFood.html#a840b4ae09993aea111403617f56988d1',1,'Food']]], + ['movedown_12',['moveDown',['../structBlacklistItem.html#afafef5debfccc84bc91be9ff9a46b07e',1,'BlacklistItem::moveDown()'],['../structWarnlistItem.html#ad270f5384ea36f86cb327cfc31cf3746',1,'WarnlistItem::moveDown()']]], + ['movedownitem_13',['moveDownItem',['../structBlacklists.html#a246fcbea72644025fbf4ed292dfc335e',1,'Blacklists::moveDownItem()'],['../structWarnlists.html#ae18bc3cd0eade0fd26851ddf6e1c0517',1,'Warnlists::moveDownItem()']]], + ['moveup_14',['moveUp',['../structBlacklistItem.html#af9e76418fe25c114b537352456b5571b',1,'BlacklistItem::moveUp()'],['../structWarnlistItem.html#a0e9e4d4626ea03fcd8c115c3c030664f',1,'WarnlistItem::moveUp()']]], + ['moveupitem_15',['moveUpItem',['../structBlacklists.html#a7ccb7bae9be9103f15bd42f97d888794',1,'Blacklists::moveUpItem()'],['../structWarnlists.html#aab298472f4f55f7e9e1decbdb3cc27a8',1,'Warnlists::moveUpItem()']]], + ['msgdatabasecreated_16',['msgDatabaseCreated',['../classDialogSec.html#ae916458257088da13a1a2bc885d5c71d',1,'DialogSec']]], + ['msgnodataforstats_17',['msgNoDataForStats',['../classDialogSec.html#aea11eccbd5c524f3d97a44346a4f4ef1',1,'DialogSec']]], + ['msgnofiletoparse_18',['msgNoFileToParse',['../classDialogSec.html#a38d096b5d4d6cae9d0af6224ff4b6ba9',1,'DialogSec']]], + ['msgnotenoughmemory_19',['msgNotEnoughMemory',['../classDialogSec.html#a9f29d5f5fc2b8dd92ab94942c6162026',1,'DialogSec']]] ]; diff --git a/docs/html/search/all_d.js b/docs/html/search/all_d.js index 64b3be35..97b6703b 100644 --- a/docs/html/search/all_d.js +++ b/docs/html/search/all_d.js @@ -1,7 +1,7 @@ var searchData= [ - ['name_0',['name',['../classMainSlice.html#adda5fecbc9d60f8d6367f187fd4f6c0f',1,'MainSlice::name()'],['../classLogFile.html#a9f111ec006ab719abf8b0034dee3eb94',1,'LogFile::name()']]], - ['new_5flines_1',['new_lines',['../classLogsFormat.html#aa45ccadd15c0a3f44e7a02e9f48b5a0b',1,'LogsFormat']]], + ['name_0',['name',['../classMainSlice.html#adda5fecbc9d60f8d6367f187fd4f6c0f',1,'MainSlice::name()'],['../structLogFile.html#a25335833b38adfa35eacfc89364a10ae',1,'LogFile::name()'],['../classDatabaseWrapper.html#ade3b83c398b2c1858ab3e081ba211fd3',1,'DatabaseWrapper::name()']]], + ['new_5flines_1',['new_lines',['../structLogsFormat.html#aa45ccadd15c0a3f44e7a02e9f48b5a0b',1,'LogsFormat']]], ['nextturn_2',['nextTurn',['../classCrissCross.html#acb1ca7cc584c4c2e21e94d88c794c06a',1,'CrissCross']]], - ['nginx_5falf_3',['NGINX_ALF',['../classFormatOps.html#a0489127a5f5a7cca1ae9386a3935fa2d',1,'FormatOps']]] + ['nginx_5falf_3',['NGINX_ALF',['../classFormatOps.html#ac9f9f00076dc0b754368bcca5cc5dcba',1,'FormatOps']]] ]; diff --git a/docs/html/search/all_e.js b/docs/html/search/all_e.js index 1411cd4b..071876a1 100644 --- a/docs/html/search/all_e.js +++ b/docs/html/search/all_e.js @@ -6,8 +6,17 @@ var searchData= ['on_5fbutton_5ffontsize_5fplus_5fclicked_3',['on_button_FontSize_Plus_clicked',['../classCrapnote.html#a0939b6b9916b5719ea9c55d40659b83b',1,'Crapnote']]], ['on_5fbutton_5fignore_5fclicked_4',['on_button_IGNORE_clicked',['../classDialogIda.html#afa205f8d7ebff6aa954486623f869625',1,'DialogIda']]], ['on_5fbutton_5fno_5fclicked_5',['on_button_NO_clicked',['../classDialogBool.html#a718195dfd76ecefd349333cfd82dc1cc',1,'DialogBool']]], - ['on_5fbutton_5fok_5fclicked_6',['on_button_ok_clicked',['../classGameDialog.html#a4c8590ce276d5ead2a9e8b55ae0aaee9',1,'GameDialog::on_button_Ok_clicked()'],['../classDialogMsg.html#a14ce87023686cac4cf700e0283073058',1,'DialogMsg::on_button_Ok_clicked()']]], + ['on_5fbutton_5fok_5fclicked_6',['on_button_Ok_clicked',['../classGameDialog.html#a4c8590ce276d5ead2a9e8b55ae0aaee9',1,'GameDialog::on_button_Ok_clicked()'],['../classDialogMsg.html#a14ce87023686cac4cf700e0283073058',1,'DialogMsg::on_button_Ok_clicked()']]], ['on_5fbutton_5fshowadditional_5fclicked_7',['on_button_ShowAdditional_clicked',['../classDialogMsg.html#aa273ea069307de059183e8d2b7a2f7ef',1,'DialogMsg']]], ['on_5fbutton_5fyes_5fclicked_8',['on_button_YES_clicked',['../classDialogBool.html#a14f2fcaac67126b4411bd4a78768809e',1,'DialogBool']]], - ['on_5fspinbox_5ffontsize_5fvaluechanged_9',['on_spinBox_FontSize_valueChanged',['../classCrapnote.html#a3eb5f7525b474fb46c15d383ee9b1d6a',1,'Crapnote']]] + ['on_5fspinbox_5ffontsize_5fvaluechanged_9',['on_spinBox_FontSize_valueChanged',['../classCrapnote.html#a3eb5f7525b474fb46c15d383ee9b1d6a',1,'Crapnote']]], + ['open_10',['open',['../classDatabaseWrapper.html#ad11a5e3cae9ed434fe5a679bf5933959',1,'DatabaseWrapper']]], + ['opennew_11',['openNew',['../classDatabaseWrapper.html#abe1fe691a3db606548f5ff6f73d65fe6',1,'DatabaseWrapper']]], + ['operator_20bool_12',['operator bool',['../structFieldData.html#abfa6f1648c4d52d39a0e8f43b80b3f7e',1,'FieldData']]], + ['operator_28_29_13',['operator()',['../classQueryWrapper.html#aec4dfb7a80d9aec36558c0fe4fa1b965',1,'QueryWrapper::operator()()'],['../classQueryWrapper.html#a85cc8b57bcab826daa43259430459ea9',1,'QueryWrapper::operator()(const QString &text)']]], + ['operator_2a_14',['operator*',['../structFieldData.html#a853704911d3bcee3f3865fe722056610',1,'FieldData::operator*()'],['../classDatabaseWrapper.html#aeab87f7a742c3f012ee97301c4d9e15b',1,'DatabaseWrapper::operator*()']]], + ['operator_2b_15',['operator+',['../structFieldData.html#a257de3f5b462d2ff400026f96ad9419b',1,'FieldData::operator+(const FieldData &rhs) const noexcept'],['../structFieldData.html#af7b8913cf071ffac7cbaf2a515546959',1,'FieldData::operator+']]], + ['operator_2d_3e_16',['operator->',['../classDatabaseWrapper.html#a97a1a453df4e9e0b26fb63646e8e4042',1,'DatabaseWrapper::operator->()'],['../classQueryWrapper.html#a312022fbdf046f2ad0aa8275fb86a681',1,'QueryWrapper::operator->() noexcept']]], + ['operator_3c_3c_17',['operator<<',['../classQueryWrapper.html#a70470621ad3d09fdd03b6e34739e906c',1,'QueryWrapper::operator<<(const char *text) noexcept'],['../classQueryWrapper.html#a0db067a19a382998bcdd7c68802640fe',1,'QueryWrapper::operator<<(const QString &text) noexcept']]], + ['operator_5b_5d_18',['operator[]',['../classQueryWrapper.html#a9f10f5f05acc82ea4136143a2655df9d',1,'QueryWrapper']]] ]; diff --git a/docs/html/search/all_f.js b/docs/html/search/all_f.js index 479ae49e..838d7c3e 100644 --- a/docs/html/search/all_f.js +++ b/docs/html/search/all_f.js @@ -1,23 +1,24 @@ var searchData= [ ['parentpath_0',['parentPath',['../classMainWindow.html#ac3452e2e67a77eacb256b13a7c9da509',1,'MainWindow']]], - ['parsebooleanfilter_1',['parseBooleanFilter',['../namespaceFilterOps.html#a4b728f136c8d0a426d63a0623a1cb6ef',1,'FilterOps']]], - ['parseloglines_2',['parseloglines',['../classCraplogParserAsync.html#af5796e6a2496181cba67553b85eea75b',1,'CraplogParserAsync::parseLogLines()'],['../classCraplogParser.html#a4e19f3c1f8478b545da627339d5bd9c0',1,'CraplogParser::parseLogLines()']]], - ['parsenull_3',['parseNull',['../namespaceFilterOps.html#aa2fcb54edc4a3aaf714a93cce838e402',1,'FilterOps']]], - ['parsenumericfilter_4',['parseNumericFilter',['../namespaceFilterOps.html#a769cc8db3a66caa781f1202e240f63d9',1,'FilterOps']]], - ['parsetextualfilter_5',['parseTextualFilter',['../namespaceFilterOps.html#a96b7a20b1852856178c7acc77ed2dddc',1,'FilterOps']]], - ['path_6',['path',['../classLogFile.html#a8633ce15a023fa3a9635d6c5e3aa18ad',1,'LogFile']]], - ['prev_5fdirection_7',['prev_direction',['../structBodyPart.html#a98303c77db6b5550e20d472075c15bc6',1,'BodyPart']]], - ['printablebool_8',['printableBool',['../namespacePrintSec.html#a757da65e9e69fe92b1a677393bbd176c',1,'PrintSec']]], - ['printabledate_9',['printableDate',['../namespacePrintSec.html#aa08609bc4114a78ff8dc565a819ede9f',1,'PrintSec']]], - ['printablesize_10',['printableSize',['../namespacePrintSec.html#a9a6160d4d72a5764dc84e9cb41acf82d',1,'PrintSec']]], - ['printablespeed_11',['printableSpeed',['../namespacePrintSec.html#a69f00f7787fe0cd1f172675f345e7f3f',1,'PrintSec']]], - ['printabletime_12',['printabletime',['../namespacePrintSec.html#a6fa65a1ca094c1eeadea8afe24fc8342',1,'PrintSec::printableTime(const int hour, const int minute, const int second)'],['../namespacePrintSec.html#a0588ba76f1513953e3579c4d58dd49e6',1,'PrintSec::printableTime(const unsigned seconds)']]], - ['printsec_13',['PrintSec',['../namespacePrintSec.html',1,'']]], - ['processapacheformatstring_14',['processApacheFormatString',['../classFormatOps.html#a156fe7cba5df1112b3da21af52375105',1,'FormatOps']]], - ['processdatetime_15',['processDateTime',['../namespaceDateTimeOps.html#aafa474c70055cb7c0d3d41a3e13588c5',1,'DateTimeOps']]], - ['processgamelogic_16',['processGameLogic',['../classSnakeGame.html#aeaa13da59d09abc40e25fd769fb96963',1,'SnakeGame']]], - ['processiisformatstring_17',['processIisFormatString',['../classFormatOps.html#af13ee22fb0e76ca90fcc358622374f64',1,'FormatOps']]], - ['processnextkeyevent_18',['processNextKeyEvent',['../classSnakeGame.html#a0b0c9d7567a8e352449ddc7b31e09851',1,'SnakeGame']]], - ['processnginxformatstring_19',['processNginxFormatString',['../classFormatOps.html#afd175180e69aa5784bfb2ec2911bedc3',1,'FormatOps']]] + ['parseloglines_1',['parseLogLines',['../classCraplogParser.html#a4e19f3c1f8478b545da627339d5bd9c0',1,'CraplogParser']]], + ['parsenull_2',['parseNull',['../namespaceFilterOps.html#ad449b93d8e58de036346517703377b37',1,'FilterOps']]], + ['parsenumericfilter_3',['parseNumericFilter',['../namespaceFilterOps.html#a40ab225c11f101691f403a178f2ec40a',1,'FilterOps']]], + ['parsetextualfilter_4',['parseTextualFilter',['../namespaceFilterOps.html#a26985f50b033b0185b53d97d782777dc',1,'FilterOps']]], + ['path_5',['path',['../structLogFile.html#a66f157f5a1a8f589e3589ec4c6e1339d',1,'LogFile']]], + ['performancedata_6',['PerformanceData',['../structPerformanceData.html',1,'']]], + ['perfs_7',['Perfs',['../structPerfs.html',1,'']]], + ['prev_5fdirection_8',['prev_direction',['../structBodyPart.html#a98303c77db6b5550e20d472075c15bc6',1,'BodyPart']]], + ['printablebool_9',['printableBool',['../namespacePrintSec.html#a4740c8b66e8608489309d8aa11826d14',1,'PrintSec']]], + ['printabledate_10',['printableDate',['../namespacePrintSec.html#aafb3b1700d8287c148f731c8e996ce32',1,'PrintSec']]], + ['printablesize_11',['printableSize',['../namespacePrintSec.html#a403edb539662a165dd79f5756ded42e4',1,'PrintSec']]], + ['printablespeed_12',['printableSpeed',['../namespacePrintSec.html#a4a6a0bc389a6ffb47bfcc6c9dbb70602',1,'PrintSec']]], + ['printabletime_13',['printableTime',['../namespacePrintSec.html#aff2f11c41388c7bf69dd356e0c8ca684',1,'PrintSec::printableTime(const unsigned seconds) noexcept'],['../namespacePrintSec.html#a4effe535f84fd9f38c2103ff574def5c',1,'PrintSec::printableTime(const int hour, const int minute, const int second) noexcept']]], + ['printsec_14',['PrintSec',['../namespacePrintSec.html',1,'']]], + ['processapacheformatstring_15',['processApacheFormatString',['../classFormatOps.html#a156fe7cba5df1112b3da21af52375105',1,'FormatOps']]], + ['processdatetime_16',['processDateTime',['../namespaceDateTimeOps.html#ad17a4cbaa6d80857a134ecc9db50d761',1,'DateTimeOps']]], + ['processgamelogic_17',['processGameLogic',['../classSnakeGame.html#aeaa13da59d09abc40e25fd769fb96963',1,'SnakeGame']]], + ['processiisformatstring_18',['processIisFormatString',['../classFormatOps.html#a97dfe752848f74025a022ebea3e7cf8c',1,'FormatOps']]], + ['processnextkeyevent_19',['processNextKeyEvent',['../classSnakeGame.html#a1c5701b13d56599b6ece295a4a091e40',1,'SnakeGame']]], + ['processnginxformatstring_20',['processNginxFormatString',['../classFormatOps.html#afd175180e69aa5784bfb2ec2911bedc3',1,'FormatOps']]] ]; diff --git a/docs/html/search/classes_0.js b/docs/html/search/classes_0.js index f21ef3be..07e2e1b8 100644 --- a/docs/html/search/classes_0.js +++ b/docs/html/search/classes_0.js @@ -1,6 +1,8 @@ var searchData= [ - ['bodypart_0',['BodyPart',['../structBodyPart.html',1,'']]], - ['bwlist_1',['BWlist',['../structBWlist.html',1,'']]], - ['bwlistexception_2',['BWlistException',['../classBWlistException.html',1,'']]] + ['blacklist_0',['Blacklist',['../structBlacklist.html',1,'']]], + ['blacklistitem_1',['BlacklistItem',['../structBlacklistItem.html',1,'']]], + ['blacklists_2',['Blacklists',['../structBlacklists.html',1,'']]], + ['bodypart_3',['BodyPart',['../structBodyPart.html',1,'']]], + ['bwlistexception_4',['BWlistException',['../classBWlistException.html',1,'']]] ]; diff --git a/docs/html/search/classes_1.js b/docs/html/search/classes_1.js index 377206be..d9e2f65e 100644 --- a/docs/html/search/classes_1.js +++ b/docs/html/search/classes_1.js @@ -1,13 +1,13 @@ var searchData= [ - ['craphelp_0',['Craphelp',['../classCraphelp.html',1,'']]], - ['crapinfo_1',['Crapinfo',['../classCrapinfo.html',1,'']]], - ['craplog_2',['Craplog',['../classCraplog.html',1,'']]], - ['craploglister_3',['CraplogLister',['../classCraplogLister.html',1,'']]], - ['craplogparser_4',['CraplogParser',['../classCraplogParser.html',1,'']]], - ['craplogparserasync_5',['CraplogParserAsync',['../classCraplogParserAsync.html',1,'']]], - ['craplogparserinterface_6',['CraplogParserInterface',['../classCraplogParserInterface.html',1,'']]], - ['crapnote_7',['Crapnote',['../classCrapnote.html',1,'']]], + ['changelog_0',['Changelog',['../classChangelog.html',1,'']]], + ['craphelp_1',['Craphelp',['../classCraphelp.html',1,'']]], + ['crapinfo_2',['Crapinfo',['../classCrapinfo.html',1,'']]], + ['craplog_3',['Craplog',['../classCraplog.html',1,'']]], + ['craploglister_4',['CraplogLister',['../classCraplogLister.html',1,'']]], + ['craplogparser_5',['CraplogParser',['../classCraplogParser.html',1,'']]], + ['crapnote_6',['Crapnote',['../classCrapnote.html',1,'']]], + ['crappath_7',['Crappath',['../classCrappath.html',1,'']]], ['crapup_8',['Crapup',['../classCrapup.html',1,'']]], ['crapview_9',['Crapview',['../classCrapview.html',1,'']]], ['crisscross_10',['CrissCross',['../classCrissCross.html',1,'']]] diff --git a/docs/html/search/classes_10.js b/docs/html/search/classes_10.js new file mode 100644 index 00000000..81b3ed81 --- /dev/null +++ b/docs/html/search/classes_10.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['zippedarrays_0',['ZippedArrays',['../classZippedArrays.html',1,'']]], + ['zipperator_1',['Zipperator',['../structZipperator.html',1,'']]] +]; diff --git a/docs/html/search/classes_2.js b/docs/html/search/classes_2.js index d868e28e..0ade416d 100644 --- a/docs/html/search/classes_2.js +++ b/docs/html/search/classes_2.js @@ -1,10 +1,15 @@ var searchData= [ - ['datetimeexception_0',['DateTimeException',['../classDateTimeException.html',1,'']]], - ['dbquery_1',['DbQuery',['../classDbQuery.html',1,'']]], - ['dialogbool_2',['DialogBool',['../classDialogBool.html',1,'']]], - ['dialogida_3',['DialogIda',['../classDialogIda.html',1,'']]], - ['dialogmsg_4',['DialogMsg',['../classDialogMsg.html',1,'']]], - ['dialogsec_5',['DialogSec',['../classDialogSec.html',1,'']]], - ['donutbreakdown_6',['DonutBreakdown',['../classDonutBreakdown.html',1,'']]] + ['databaseexception_0',['DatabaseException',['../classDatabaseException.html',1,'']]], + ['databasehandler_1',['DatabaseHandler',['../structDatabaseHandler.html',1,'']]], + ['databasewrapper_2',['DatabaseWrapper',['../classDatabaseWrapper.html',1,'']]], + ['datetimeexception_3',['DateTimeException',['../classDateTimeException.html',1,'']]], + ['daytimelogfieldslistmodel_4',['DaytimeLogFieldsListModel',['../classDaytimeLogFieldsListModel.html',1,'']]], + ['dbquery_5',['DbQuery',['../classDbQuery.html',1,'']]], + ['dialogbool_6',['DialogBool',['../classDialogBool.html',1,'']]], + ['dialogida_7',['DialogIda',['../classDialogIda.html',1,'']]], + ['dialogmsg_8',['DialogMsg',['../classDialogMsg.html',1,'']]], + ['dialogsec_9',['DialogSec',['../classDialogSec.html',1,'']]], + ['donotcatchexception_10',['DoNotCatchException',['../structDoNotCatchException.html',1,'']]], + ['donutbreakdown_11',['DonutBreakdown',['../classDonutBreakdown.html',1,'']]] ]; diff --git a/docs/html/search/classes_3.js b/docs/html/search/classes_3.js index 9a441b31..4bb75d8a 100644 --- a/docs/html/search/classes_3.js +++ b/docs/html/search/classes_3.js @@ -1,5 +1,5 @@ var searchData= [ - ['food_0',['Food',['../classFood.html',1,'']]], - ['formatops_1',['FormatOps',['../classFormatOps.html',1,'']]] + ['enumeratdarray_0',['EnumeratdArray',['../classEnumeratdArray.html',1,'']]], + ['enumerator_1',['Enumerator',['../structEnumerator.html',1,'']]] ]; diff --git a/docs/html/search/classes_4.js b/docs/html/search/classes_4.js index 9edf18f4..43a9e94f 100644 --- a/docs/html/search/classes_4.js +++ b/docs/html/search/classes_4.js @@ -1,5 +1,7 @@ var searchData= [ - ['gamedialog_0',['GameDialog',['../classGameDialog.html',1,'']]], - ['genericexception_1',['GenericException',['../classGenericException.html',1,'']]] + ['fielddata_0',['FieldData',['../structFieldData.html',1,'']]], + ['filehandler_1',['FileHandler',['../classFileHandler.html',1,'']]], + ['food_2',['Food',['../classFood.html',1,'']]], + ['formatops_3',['FormatOps',['../classFormatOps.html',1,'']]] ]; diff --git a/docs/html/search/classes_5.js b/docs/html/search/classes_5.js index 035f4757..3acbab4c 100644 --- a/docs/html/search/classes_5.js +++ b/docs/html/search/classes_5.js @@ -1,4 +1,6 @@ var searchData= [ - ['hashops_0',['HashOps',['../classHashOps.html',1,'']]] + ['gamedialog_0',['GameDialog',['../classGameDialog.html',1,'']]], + ['genericexception_1',['GenericException',['../classGenericException.html',1,'']]], + ['globalsdata_2',['GlobalsData',['../structGlobalsData.html',1,'']]] ]; diff --git a/docs/html/search/classes_6.js b/docs/html/search/classes_6.js index 96a6d23f..035f4757 100644 --- a/docs/html/search/classes_6.js +++ b/docs/html/search/classes_6.js @@ -1,9 +1,4 @@ var searchData= [ - ['logfile_0',['LogFile',['../classLogFile.html',1,'']]], - ['logfiletreewidgetitem_1',['LogFileTreeWidgetItem',['../classLogFileTreeWidgetItem.html',1,'']]], - ['logformatexception_2',['LogFormatException',['../classLogFormatException.html',1,'']]], - ['logname_3',['LogName',['../structCraplog_1_1LogName.html',1,'Craplog']]], - ['logparserexception_4',['LogParserException',['../classLogParserException.html',1,'']]], - ['logsformat_5',['LogsFormat',['../classLogsFormat.html',1,'']]] + ['hashops_0',['HashOps',['../classHashOps.html',1,'']]] ]; diff --git a/docs/html/search/classes_7.js b/docs/html/search/classes_7.js index 82b5bb68..68745ba5 100644 --- a/docs/html/search/classes_7.js +++ b/docs/html/search/classes_7.js @@ -1,5 +1,12 @@ var searchData= [ - ['mainslice_0',['MainSlice',['../classMainSlice.html',1,'']]], - ['mainwindow_1',['MainWindow',['../classMainWindow.html',1,'']]] + ['logdoctorexception_0',['LogDoctorException',['../classLogDoctorException.html',1,'']]], + ['logfieldslistmodel_1',['LogFieldsListModel',['../classLogFieldsListModel.html',1,'']]], + ['logfile_2',['LogFile',['../structLogFile.html',1,'']]], + ['logfiletreewidgetitem_3',['LogFileTreeWidgetItem',['../classLogFileTreeWidgetItem.html',1,'']]], + ['logformatexception_4',['LogFormatException',['../classLogFormatException.html',1,'']]], + ['loglinedata_5',['LogLineData',['../structLogLineData.html',1,'']]], + ['logname_6',['LogName',['../structCraplog_1_1LogName.html',1,'Craplog']]], + ['logparserexception_7',['LogParserException',['../classLogParserException.html',1,'']]], + ['logsformat_8',['LogsFormat',['../structLogsFormat.html',1,'']]] ]; diff --git a/docs/html/search/classes_8.js b/docs/html/search/classes_8.js index 6546caa9..224eebb5 100644 --- a/docs/html/search/classes_8.js +++ b/docs/html/search/classes_8.js @@ -1,4 +1,6 @@ var searchData= [ - ['richtext_0',['RichText',['../classRichText.html',1,'']]] + ['mainslice_0',['MainSlice',['../classMainSlice.html',1,'']]], + ['mainwindow_1',['MainWindow',['../classMainWindow.html',1,'']]], + ['makenewdatabase_2',['MakeNewDatabase',['../structMakeNewDatabase.html',1,'']]] ]; diff --git a/docs/html/search/classes_9.js b/docs/html/search/classes_9.js index af41d5f0..d83d95c2 100644 --- a/docs/html/search/classes_9.js +++ b/docs/html/search/classes_9.js @@ -1,6 +1,5 @@ var searchData= [ - ['sha256_0',['SHA256',['../classSHA256.html',1,'']]], - ['snake_1',['Snake',['../classSnake.html',1,'']]], - ['snakegame_2',['SnakeGame',['../classSnakeGame.html',1,'']]] + ['performancedata_0',['PerformanceData',['../structPerformanceData.html',1,'']]], + ['perfs_1',['Perfs',['../structPerfs.html',1,'']]] ]; diff --git a/docs/html/search/classes_a.js b/docs/html/search/classes_a.js index 0c54d9f8..8c27d6e6 100644 --- a/docs/html/search/classes_a.js +++ b/docs/html/search/classes_a.js @@ -1,6 +1,4 @@ var searchData= [ - ['textbrowser_0',['TextBrowser',['../classTextBrowser.html',1,'']]], - ['tile_1',['Tile',['../structSnake_1_1Tile.html',1,'Snake']]], - ['tr_2',['TR',['../classTR.html',1,'']]] + ['querywrapper_0',['QueryWrapper',['../classQueryWrapper.html',1,'']]] ]; diff --git a/docs/html/search/classes_b.js b/docs/html/search/classes_b.js index 21b4e79f..8dfa45e7 100644 --- a/docs/html/search/classes_b.js +++ b/docs/html/search/classes_b.js @@ -1,4 +1,6 @@ var searchData= [ - ['webserverexception_0',['WebServerException',['../classWebServerException.html',1,'']]] + ['recurrencedata_0',['RecurrenceData',['../structRecurrenceData.html',1,'']]], + ['relationsllogfieldslistmodel_1',['RelationslLogFieldsListModel',['../classRelationslLogFieldsListModel.html',1,'']]], + ['richtext_2',['RichText',['../classRichText.html',1,'']]] ]; diff --git a/docs/html/search/classes_c.js b/docs/html/search/classes_c.js new file mode 100644 index 00000000..af41d5f0 --- /dev/null +++ b/docs/html/search/classes_c.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['sha256_0',['SHA256',['../classSHA256.html',1,'']]], + ['snake_1',['Snake',['../classSnake.html',1,'']]], + ['snakegame_2',['SnakeGame',['../classSnakeGame.html',1,'']]] +]; diff --git a/docs/html/search/classes_d.js b/docs/html/search/classes_d.js new file mode 100644 index 00000000..4c9db242 --- /dev/null +++ b/docs/html/search/classes_d.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['textbrowser_0',['TextBrowser',['../classTextBrowser.html',1,'']]], + ['tile_1',['Tile',['../structSnake_1_1Tile.html',1,'Snake']]], + ['tr_2',['TR',['../classTR.html',1,'']]], + ['trafficdata_3',['TrafficData',['../structTrafficData.html',1,'']]] +]; diff --git a/docs/html/search/classes_e.js b/docs/html/search/classes_e.js new file mode 100644 index 00000000..f52490f2 --- /dev/null +++ b/docs/html/search/classes_e.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['voidexception_0',['VoidException',['../classVoidException.html',1,'']]] +]; diff --git a/docs/html/search/classes_f.js b/docs/html/search/classes_f.js new file mode 100644 index 00000000..a659a7c6 --- /dev/null +++ b/docs/html/search/classes_f.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['warnlist_0',['Warnlist',['../structWarnlist.html',1,'']]], + ['warnlistitem_1',['WarnlistItem',['../structWarnlistItem.html',1,'']]], + ['warnlists_2',['Warnlists',['../structWarnlists.html',1,'']]] +]; diff --git a/docs/html/search/functions_0.js b/docs/html/search/functions_0.js index 32eda070..322dea34 100644 --- a/docs/html/search/functions_0.js +++ b/docs/html/search/functions_0.js @@ -1,10 +1,12 @@ var searchData= [ ['abortrequest_0',['abortRequest',['../classCrapup.html#aab00b3d7f06317c5ff2753821d2b67d7',1,'Crapup']]], - ['addbreakdownseries_1',['addBreakdownSeries',['../classDonutBreakdown.html#a161ef5e8ca88f2735a4971d1f66f7a72',1,'DonutBreakdown']]], - ['ai_5fmakechoice_2',['AI_makeChoice',['../classCrissCross.html#a6f329792d3f7f51f3334a84e1f1001ef',1,'CrissCross']]], - ['ai_5fplayturn_3',['AI_playTurn',['../classCrissCross.html#aefa21dcac38b6729af095fdc70be9ca9',1,'CrissCross']]], - ['ai_5fupdateweights_4',['AI_updateWeights',['../classCrissCross.html#a8c8798850707c8090bc8bf3d0f313109',1,'CrissCross']]], - ['applycharttheme_5',['applyChartTheme',['../namespaceColorSec.html#af2d0f21c73979f6b9363e1a47718628d',1,'ColorSec']]], - ['availablememory_6',['availableMemory',['../namespaceMemOps.html#ae86bbf78d7743f9b6b98da053bfcbd08',1,'MemOps']]] + ['add_1',['add',['../structBlacklistItem.html#a341214f4d4ee5d961db35fa06f956b38',1,'BlacklistItem::add()'],['../structWarnlistItem.html#aae8e8c1d366694d298db2b89038f1569',1,'WarnlistItem::add()']]], + ['addbreakdownseries_2',['addBreakdownSeries',['../classDonutBreakdown.html#a161ef5e8ca88f2735a4971d1f66f7a72',1,'DonutBreakdown']]], + ['additem_3',['addItem',['../structBlacklists.html#ab0e2168256dbdf32d1bdd55d023940da',1,'Blacklists::addItem()'],['../structWarnlists.html#a1c250a9862c7a9bbe5db346a7a580e5b',1,'Warnlists::addItem()']]], + ['ai_5fmakechoice_4',['AI_makeChoice',['../classCrissCross.html#aaa6af51d74e3c8250c0fdf8b734bff16',1,'CrissCross']]], + ['ai_5fplayturn_5',['AI_playTurn',['../classCrissCross.html#a9546863583b69a7246a216794b88d062',1,'CrissCross']]], + ['ai_5fupdateweights_6',['AI_updateWeights',['../classCrissCross.html#a2fc7d3a6f907718ea430e138681ba328',1,'CrissCross']]], + ['applycharttheme_7',['applyChartTheme',['../namespaceColorSec.html#af2d0f21c73979f6b9363e1a47718628d',1,'ColorSec']]], + ['availablememory_8',['availableMemory',['../namespaceMemOps.html#ae86bbf78d7743f9b6b98da053bfcbd08',1,'MemOps']]] ]; diff --git a/docs/html/search/functions_1.js b/docs/html/search/functions_1.js index 8e65cb64..b92642ec 100644 --- a/docs/html/search/functions_1.js +++ b/docs/html/search/functions_1.js @@ -1,9 +1,5 @@ var searchData= [ ['backupdatabase_0',['backupDatabase',['../classMainWindow.html#a40f3871eea9eaa252ed20a6808934844',1,'MainWindow']]], - ['blacklistadd_1',['blacklistAdd',['../classCraplog.html#a392faae3babb5182215a30c154ea8053',1,'Craplog']]], - ['blacklistmovedown_2',['blacklistMoveDown',['../classCraplog.html#a13c94304a2d250da355d7930f6d448cc',1,'Craplog']]], - ['blacklistmoveup_3',['blacklistMoveUp',['../classCraplog.html#aa2ea4289aa04a420cd16a1d4c6a1e5cc',1,'Craplog']]], - ['blacklistremove_4',['blacklistRemove',['../classCraplog.html#a9924c43afafe215b676877017c0365fd',1,'Craplog']]], - ['breakdownseries_5',['breakdownSeries',['../classMainSlice.html#af44c7a7a24e34fcd30da0ed8c3412e0d',1,'MainSlice']]] + ['breakdownseries_1',['breakdownSeries',['../classMainSlice.html#af44c7a7a24e34fcd30da0ed8c3412e0d',1,'MainSlice']]] ]; diff --git a/docs/html/search/functions_10.js b/docs/html/search/functions_10.js index 9af9209d..0713c7a0 100644 --- a/docs/html/search/functions_10.js +++ b/docs/html/search/functions_10.js @@ -1,39 +1,20 @@ var searchData= [ - ['sanitizebwitem_0',['sanitizeBWitem',['../classCraplog.html#a4998730f8e6e81dd911d12f129354eb6',1,'Craplog']]], - ['setapachelogformat_1',['setApacheLogFormat',['../classCraplog.html#a23aae84bc5b3eeda2be421b6a96dc43c',1,'Craplog']]], - ['setblacklist_2',['setBlacklist',['../classCraplog.html#aad346c6c09b48c1415fdd7f04181aa5f',1,'Craplog']]], - ['setblacklistused_3',['setBlacklistUsed',['../classCraplog.html#acbcf4bb6132f0fefe9551763c11496a1',1,'Craplog']]], - ['setcolorscheme_4',['setcolorscheme',['../classTextBrowser.html#a01d85d8805bd131c51da9fb3e1d2e070',1,'TextBrowser::setColorScheme()'],['../classCrapnote.html#a5981b895aa2298138e6153b1ff7d0370',1,'Crapnote::setColorScheme()']]], - ['setcurrentlogformat_5',['setCurrentLogFormat',['../classCraplog.html#a40e768bae158908993b467f9514aaab6',1,'Craplog']]], - ['setcurrentwsid_6',['setCurrentWSID',['../classCraplog.html#a1e014f540be7e6ac8f933c19cf8dc3a8',1,'Craplog']]], - ['setdbpath_7',['setdbpath',['../classCrapview.html#ac4f0e1215a892983b1c75f268bb1d60d',1,'Crapview::setDbPath()'],['../classDbQuery.html#a1e7cf5357869bc2c19053cb63afd6b67',1,'DbQuery::setDbPath()']]], - ['setdbworkingstate_8',['setDbWorkingState',['../classMainWindow.html#a8dc86c8568a64a7ab811956ba0be39dd',1,'MainWindow']]], - ['setdialoglevel_9',['setdialoglevel',['../classHashOps.html#aabc5c0547443d5245aadf23371f14daf',1,'HashOps::setDialogLevel()'],['../classDbQuery.html#ab2a129e8bb094401ad344ecbc1d15a57',1,'DbQuery::setDialogLevel()']]], - ['setdialogslevel_10',['setdialogslevel',['../classCraplog.html#a2474b6dc30efa50d0e7250d03ac829de',1,'Craplog::setDialogsLevel()'],['../classCrapview.html#a6926fe7c37e2f407e3846d0308546558',1,'Crapview::setDialogsLevel()']]], - ['setdirection_11',['setDirection',['../classSnake.html#a85d3b8250d5d26e3f23915c5bc43e372',1,'Snake']]], - ['setfont_12',['setFont',['../classTextBrowser.html#a1d47613908bacf424bb7bed38dac9b46',1,'TextBrowser']]], - ['setgeometryfromstring_13',['setGeometryFromString',['../classMainWindow.html#a0bca0aae0ee0e5dec7a671dbafb6a487',1,'MainWindow']]], - ['sethashesdatabasepath_14',['setHashesDatabasePath',['../classCraplog.html#ab5f943a6df16ccd491612b24e7007c5e',1,'Craplog']]], - ['setiislogformat_15',['setIisLogFormat',['../classCraplog.html#a478fc571718fd0bbd9d8f129e5121fad',1,'Craplog']]], - ['setlogfileselected_16',['setLogFileSelected',['../classCraplog.html#ac0d9729fcf0094d94f85e38e1a079f61',1,'Craplog']]], - ['setlogspath_17',['setLogsPath',['../classCraplog.html#afb1d1cb86cef2c8918a323285e3a222a',1,'Craplog']]], - ['setname_18',['setName',['../classMainSlice.html#a96fd7fc82e830b3b49c121e4b2081c44',1,'MainSlice']]], - ['setnginxlogformat_19',['setNginxLogFormat',['../classCraplog.html#a29ff6ef109e916a80b09f7ff6435334f',1,'Craplog']]], - ['setstatsdatabasepath_20',['setStatsDatabasePath',['../classCraplog.html#a3375c00b403ebfad353a55f30fe21445',1,'Craplog']]], - ['settextfont_21',['setTextFont',['../classCrapnote.html#a3c7b98a96114f8efdc06912ee3167e16',1,'Crapnote']]], - ['setwarningsize_22',['setWarningSize',['../classCraplog.html#a1e2d55bc0cd12ed0798e47e85067fa43',1,'Craplog']]], - ['setwarnlist_23',['setWarnlist',['../classCraplog.html#a7f57b917ae0f4567c77028014c494006',1,'Craplog']]], - ['setwarnlistused_24',['setWarnlistUsed',['../classCraplog.html#a13aca50203a4eec43bbfc8e441d09ee1',1,'Craplog']]], - ['setwidelinesusage_25',['setWideLinesUsage',['../classTextBrowser.html#a4a15c0db1622bcd312d29f1900e4428c',1,'TextBrowser']]], - ['shouldworkasync_26',['shouldWorkAsync',['../classCraplog.html#af33e7aac1888e01e8cd020b596d3e549',1,'Craplog']]], - ['size_27',['size',['../classLogFile.html#a47abeb2567129ecf680fa9779607c421',1,'LogFile']]], - ['spawn_28',['spawn',['../classFood.html#a4322893c4935e218345e6373082f2ca6',1,'Food']]], - ['split_29',['split',['../namespaceStringOps.html#adf152a1f72f20e4c6741d8e54f2945fb',1,'StringOps::split(std::vector< std::string > &list, const std::string &target_str, std::string_view separator)'],['../namespaceStringOps.html#ac6e367ab487e4c7b88988b452a454118',1,'StringOps::split(std::vector< std::string > &list, const std::string &target_str, const char separator='\n')']]], - ['splitrip_30',['splitrip',['../namespaceStringOps.html#a091e46362ee6e0e1d196a9c5a4a47ac3',1,'StringOps::splitrip(std::vector< std::string > &list, const std::string &target_str, std::string_view separator, std::string_view strips=" \n\t\b\r\v")'],['../namespaceStringOps.html#ac488bfd901b244955372575c89113cf1',1,'StringOps::splitrip(std::vector< std::string > &list, const std::string &target_str, const char separator='\n', std::string_view strips=" \n\t\b\r\v")']]], - ['startswith_31',['startswith',['../namespaceStringOps.html#aec3a544ce4d3bf4db42744a952ed0b1a',1,'StringOps::startsWith(std::string_view str, const char flag)'],['../namespaceStringOps.html#aebb197b47ac03286ec9011c931eaa9ce',1,'StringOps::startsWith(std::string_view str, std::string_view flag)']]], - ['storedata_32',['storedata',['../classCraplogParserAsync.html#a9b1a0530c706114b776e886d6c17d911',1,'CraplogParserAsync::storeData()'],['../classCraplogParser.html#a42c778719ee39b19095fb1b074451c14',1,'CraplogParser::storeData(QSqlDatabase &db)']]], - ['storeloglines_33',['storeloglines',['../classCraplogParser.html#ae867ec7dcef759f5758658d793b95f3f',1,'CraplogParser::storeLogLines()'],['../classCraplogParserAsync.html#a7bc816fb52cff3cf34d339b97fb67d11',1,'CraplogParserAsync::storeLogLines()']]], - ['string2list_34',['string2list',['../classMainWindow.html#afdfa84d1123cc32172b2881d9b86e9bb',1,'MainWindow']]], - ['strip_35',['strip',['../namespaceStringOps.html#aa6b00592df01e1358f1f5444c56ea586',1,'StringOps::strip(const std::string &str, const char chr)'],['../namespaceStringOps.html#ae85e90bca975fe7effd78f4647450ef8',1,'StringOps::strip(const std::string &str, std::string_view chars=" \n\t\b\r\v")']]] + ['randomlines_0',['randomLines',['../namespaceIOutils.html#aa52ebe237d181752064409cf0623a135',1,'IOutils']]], + ['readconfigs_1',['readConfigs',['../classMainWindow.html#aae306cbf256c5a686cc8d9f2a1dbb18b',1,'MainWindow']]], + ['readfile_2',['readFile',['../namespaceGZutils.html#a72f6960bddea2b816af84e7773d5c6b2',1,'GZutils::readFile()'],['../namespaceIOutils.html#a185c38eff9d9f4432c8138404941915e',1,'IOutils::readFile()']]], + ['recalculateangles_3',['recalculateAngles',['../classDonutBreakdown.html#acd747ee2bbd23ce84eaf9d4db57938e3',1,'DonutBreakdown']]], + ['refreshdates_4',['refreshDates',['../classCrapview.html#ac98b1cbc75604b5145b5cff36e96eb78',1,'Crapview::refreshDates()'],['../classDbQuery.html#adb3206452fd6f9a35e88e260e502c511',1,'DbQuery::refreshDates()']]], + ['refreshstatsdates_5',['refreshStatsDates',['../classMainWindow.html#ac8f4c84b43d14b6dcc6cb7b5f75ce343',1,'MainWindow']]], + ['remove_6',['remove',['../structBlacklistItem.html#a878fdb847386aadb0e09bc78f5782b09',1,'BlacklistItem::remove()'],['../structWarnlistItem.html#a7a6c5acd0e4fcb67257c0650d2d86d8f',1,'WarnlistItem::remove()']]], + ['removeitem_7',['removeItem',['../structBlacklists.html#a08effb45b137d0c65d0d14e0fa3563f0',1,'Blacklists::removeItem()'],['../structWarnlists.html#ac5677ce2a63277eef300c12b09a84702',1,'Warnlists::removeItem()']]], + ['renameascopy_8',['renameAsCopy',['../namespaceIOutils.html#afb035f2ec3192ce64657ba5bf81bd86e',1,'IOutils']]], + ['replace_9',['replace',['../namespaceStringOps.html#ace505bb48e614c431a434a843cae0f1c',1,'StringOps']]], + ['requesttimeout_10',['requestTimeout',['../classCrapup.html#afe79a787fc0820afbc4573ca7091d880',1,'Crapup']]], + ['resolvepath_11',['resolvePath',['../classMainWindow.html#a773ee8bffbac52d0d646fb91792bc3ae',1,'MainWindow']]], + ['richlogsdefault_12',['richLogsDefault',['../classRichText.html#a28bf0bdd659cc7b7a58eab9e5cfad495',1,'RichText']]], + ['richlogsfailure_13',['richLogsFailure',['../classRichText.html#a6e5fe6270e6fed0b9e7c42eafc9b4732',1,'RichText']]], + ['rollbacktransaction_14',['rollbackTransaction',['../classDatabaseWrapper.html#ab35901b0235ac94f29a4b90ef0ce1b0d',1,'DatabaseWrapper']]], + ['rotateimg_15',['rotateImg',['../classCrapup.html#a334624ab394fd773b0e6063e7baf7960',1,'Crapup']]], + ['rstrip_16',['rstrip',['../namespaceStringOps.html#a800fa9be19f7a5e05dea94f1d182a261',1,'StringOps::rstrip(const std::string &str, const char chr) noexcept'],['../namespaceStringOps.html#ab84d91c0a3990fcebcbce21a633f3539',1,'StringOps::rstrip(const std::string &str, const char *chars=" \n\t\b\r\v") noexcept']]] ]; diff --git a/docs/html/search/functions_11.js b/docs/html/search/functions_11.js index e8c0dfd5..b28c9c45 100644 --- a/docs/html/search/functions_11.js +++ b/docs/html/search/functions_11.js @@ -1,8 +1,48 @@ var searchData= [ - ['testcraplogmodules_0',['testCraplogModules',['../namespaceTesting.html#a26ca6af95ebd8bc1f45330d1f8e878ee',1,'Testing']]], - ['testcrapviewmodules_1',['testCrapviewModules',['../namespaceTesting.html#afda5137047f07a73c14a0da8a5ca35d6',1,'Testing']]], - ['testutilities_2',['testUtilities',['../namespaceTesting.html#a61e6bd9fb48a1af951cb365b46e49924',1,'Testing']]], - ['tolower_3',['toLower',['../namespaceStringOps.html#af2241555e2c9c57dd0575c491bfcd534',1,'StringOps']]], - ['toupper_4',['toUpper',['../namespaceStringOps.html#ab262a540cba212b1de09d19040732c73',1,'StringOps']]] + ['sanitized_0',['sanitized',['../structBlacklistItem.html#a99bfcaec421306f87fcb3b16556ffc46',1,'BlacklistItem::sanitized()'],['../structWarnlistItem.html#ad4aad2da114723b60e13bffd571c498f',1,'WarnlistItem::sanitized()']]], + ['sanitizedclient_1',['sanitizedClient',['../namespaceBWutils.html#a4f57c1c85b87ac43fb0bf96195c8731a',1,'BWutils']]], + ['sanitizedmethod_2',['sanitizedMethod',['../namespaceBWutils.html#a56a19fcd29b4ebaf6ab730746db367f8',1,'BWutils']]], + ['sanitizeduri_3',['sanitizedUri',['../namespaceBWutils.html#aa2b294e6841a4283f215fc3f2a3afd0e',1,'BWutils']]], + ['sanitizeduseragent_4',['sanitizedUserAgent',['../namespaceBWutils.html#a5d8e89d6418e0704bb4ed75b995b6c6a',1,'BWutils']]], + ['set_5',['set',['../structBlacklistItem.html#a9ffe06223bf2195a5a0742555b22dab6',1,'BlacklistItem::set()'],['../structWarnlistItem.html#a208abfc8a1198dc74d572012da111390',1,'WarnlistItem::set()']]], + ['setapachelogformat_6',['setApacheLogFormat',['../classCraplog.html#a0fb53209bcee846b313b1468eb1f4ef4',1,'Craplog']]], + ['setcolorscheme_7',['setColorScheme',['../classTextBrowser.html#a9b897ce28d694102d5cef543b61bd0c6',1,'TextBrowser::setColorScheme()'],['../classCrapnote.html#a43bdc4bb96d5e288952d8131d02e3986',1,'Crapnote::setColorScheme()']]], + ['setcurrentlogformat_8',['setCurrentLogFormat',['../classCraplog.html#a2386945ea571452e4df5e9aa88268500',1,'Craplog']]], + ['setcurrentwebserver_9',['setCurrentWebServer',['../classCraplog.html#ade26470751608e99a4d9f076d2d0180e',1,'Craplog']]], + ['setdbpath_10',['setDbPath',['../classCrapview.html#aa8547bac9eb6b66cdede0f35b7a9d30b',1,'Crapview::setDbPath()'],['../classDbQuery.html#a6924de3d7b44efca2d5e6d4304f908c2',1,'DbQuery::setDbPath()']]], + ['setdbworkingstate_11',['setDbWorkingState',['../classMainWindow.html#a8dc86c8568a64a7ab811956ba0be39dd',1,'MainWindow']]], + ['setdialoglevel_12',['setDialogLevel',['../classHashOps.html#ac665e43481570b6461cc93acee8c601c',1,'HashOps::setDialogLevel()'],['../classDbQuery.html#acf41fe954be10734fba229174584cbae',1,'DbQuery::setDialogLevel()']]], + ['setdialogslevel_13',['setDialogsLevel',['../classCraplog.html#a00530348740394414661af9c71889419',1,'Craplog::setDialogsLevel()'],['../classCrapview.html#a392219de8f5874e59110a5b0610e97a2',1,'Crapview::setDialogsLevel()']]], + ['setdialogslevelfromstring_14',['setDialogsLevelFromString',['../classMainWindow.html#a278e74d4bbad27b52a149f7d03762d0f',1,'MainWindow']]], + ['setdirection_15',['setDirection',['../classSnake.html#a53e877a0a363018be8a2413c53dac4c8',1,'Snake']]], + ['setfont_16',['setFont',['../classTextBrowser.html#a5dcd585592c6b2a3adac36fa96da2970',1,'TextBrowser']]], + ['setgeometryfromstring_17',['setGeometryFromString',['../classMainWindow.html#a0bca0aae0ee0e5dec7a671dbafb6a487',1,'MainWindow']]], + ['sethashesdatabasepath_18',['setHashesDatabasePath',['../classCraplog.html#a633fe017bc347ef3004e9eac511afc5b',1,'Craplog']]], + ['setiislogformat_19',['setIisLogFormat',['../classCraplog.html#a27ba3271bf87a184c1b79a042e621821',1,'Craplog']]], + ['setlist_20',['setList',['../structBlacklists.html#ac57455c5e48a2e8e26a6c66d2907cebf',1,'Blacklists::setList()'],['../structWarnlists.html#a4779c99824ca840974453dcd264cfa27',1,'Warnlists::setList()']]], + ['setlogfileselected_21',['setLogFileSelected',['../classCraplog.html#aec8a7956a162138dd85ba3ed642c3dc9',1,'Craplog']]], + ['setlogspath_22',['setLogsPath',['../classCraplog.html#a37ccf5b76180f5561440ec72844437ba',1,'Craplog']]], + ['setname_23',['setName',['../classMainSlice.html#a96fd7fc82e830b3b49c121e4b2081c44',1,'MainSlice']]], + ['setnginxlogformat_24',['setNginxLogFormat',['../classCraplog.html#ac09bc16c7cc4ad33fe0abfe5c6a92e67',1,'Craplog']]], + ['setselected_25',['setSelected',['../structLogFile.html#a8ae07ac34e6c49d34cfee9ae04be3418',1,'LogFile']]], + ['setstatsdatabasepath_26',['setStatsDatabasePath',['../classCraplog.html#a038ce1d76adea57e98b04100338446f2',1,'Craplog']]], + ['settextfont_27',['setTextFont',['../classChangelog.html#a270c384c56c6d479345f6895fa4d885e',1,'Changelog::setTextFont()'],['../classCrapnote.html#a1f757b30dcb1876a554ecf86261a9bd9',1,'Crapnote::setTextFont()']]], + ['setunselected_28',['setUnselected',['../structLogFile.html#aabb586c88ff9513b83de42cdfcdbd477',1,'LogFile']]], + ['setused_29',['setUsed',['../structBlacklists.html#a0cd18c7125b51ead34363697419b20bf',1,'Blacklists::setUsed()'],['../structBlacklist.html#afa58bc716010e8fcbd682f1af725643c',1,'Blacklist::setUsed()'],['../structWarnlist.html#ab47c503e8b24d1aa8f654e1add6141a8',1,'Warnlist::setUsed()'],['../structWarnlists.html#a616f74926f1d42ec639b7941de81b583',1,'Warnlists::setUsed()']]], + ['setwarningsize_30',['setWarningSize',['../classCraplog.html#a21616321aa234ae53204ffd413c99105',1,'Craplog']]], + ['setwebserverfromstring_31',['setWebServerFromString',['../classMainWindow.html#a6dc46a6a6eb4e30b8ec3b5be20b26949',1,'MainWindow']]], + ['setwidelinesusage_32',['setWideLinesUsage',['../classTextBrowser.html#a78ee628c68a60a59b3518281a913f7d6',1,'TextBrowser']]], + ['size_33',['size',['../structLogFile.html#a1205bc0634ff1893a55321ccf7cca666',1,'LogFile::size()'],['../structLogLineData.html#aef7f62bb9670423dbe88ffb72f19b04b',1,'LogLineData::size()'],['../classQueryWrapper.html#ac40628a1ff95c84f77625af40aa6d49e',1,'QueryWrapper::size()']]], + ['spawn_34',['spawn',['../classFood.html#a3af9975383d864fb2f5dae4dc3c549e8',1,'Food']]], + ['split_35',['split',['../namespaceStringOps.html#a1a6374c270d7b736af662973a032bcb1',1,'StringOps::split(std::vector< std::string > &list, const std::string &target_str, const char separator='\n') noexcept'],['../namespaceStringOps.html#a8d6fd8a79f5aa7adc1b385ae5287c14e',1,'StringOps::split(std::vector< std::string > &list, const std::string &target_str, std::string_view separator) noexcept']]], + ['splitrip_36',['splitrip',['../namespaceStringOps.html#a3102407f02c4b18073e595c00a733175',1,'StringOps::splitrip(std::vector< std::string > &list, const std::string &target_str, const char separator='\n', const char *strips=" \n\t\b\r\v") noexcept'],['../namespaceStringOps.html#adb2f084578c857a46287051a3e3f044b',1,'StringOps::splitrip(std::vector< std::string > &list, const std::string &target_str, const char *separator, const char *strips=" \n\t\b\r\v") noexcept']]], + ['startswith_37',['startsWith',['../namespaceStringOps.html#a4a7fe341a6c946f76c204d3ec7504319',1,'StringOps::startsWith(std::string_view str, const char flag) noexcept'],['../namespaceStringOps.html#ad65237bcace4d7816219c24b9696a2be',1,'StringOps::startsWith(std::string_view str, std::string_view flag) noexcept']]], + ['starttransaction_38',['startTransaction',['../classDatabaseWrapper.html#a987e29bdc153b8af1af6d7e7d3236373',1,'DatabaseWrapper']]], + ['storedata_39',['storeData',['../classCraplogParser.html#a42c778719ee39b19095fb1b074451c14',1,'CraplogParser']]], + ['storeloglines_40',['storeLogLines',['../classCraplogParser.html#a286be6fa72be8bbfe43066cc0d00c89b',1,'CraplogParser']]], + ['storemalformedrequestmultispace_41',['storeMalformedRequestMultiSpace',['../structLogLineData.html#a1c02deb8c2585b0d6492f8aaef07e4bf',1,'LogLineData']]], + ['storemalformedrequestonespace_42',['storeMalformedRequestOneSpace',['../structLogLineData.html#ac43fad13c4c9dbebab8e49f6b6c1592d',1,'LogLineData']]], + ['string2list_43',['string2list',['../classMainWindow.html#afdfa84d1123cc32172b2881d9b86e9bb',1,'MainWindow']]], + ['strip_44',['strip',['../namespaceStringOps.html#a2b1a5d7ca0d8e4b2b619ab0a9ad20614',1,'StringOps::strip(const std::string &str, const char chr) noexcept'],['../namespaceStringOps.html#a2e40c8c956a4d657e9096b01dce02a65',1,'StringOps::strip(const std::string &str, const char *chars=" \n\t\b\r\v") noexcept']]] ]; diff --git a/docs/html/search/functions_12.js b/docs/html/search/functions_12.js index 2c628aa7..dbf471e9 100644 --- a/docs/html/search/functions_12.js +++ b/docs/html/search/functions_12.js @@ -1,13 +1,9 @@ var searchData= [ - ['update_0',['update',['../classFood.html#a63d7fd88d5db54881de451b2429ed04d',1,'Food::update()'],['../structBodyPart.html#a6addb68ca5c7ac51dbb072e55ada5e33',1,'BodyPart::update()'],['../classSnake.html#ab3610a54cbc6b6ec8d44e24871d59301',1,'Snake::update()']]], - ['updategamescore_1',['updateGameScore',['../classSnakeGame.html#a420f3980fab86475ea4788a2e971597b',1,'SnakeGame']]], - ['updatelabel_2',['updateLabel',['../classMainSlice.html#aed2a6013aafca878143a8f05c391c590',1,'MainSlice']]], - ['updatelegendmarkers_3',['updateLegendMarkers',['../classDonutBreakdown.html#a682599f0fd4f13530b7bfe6dc3331578',1,'DonutBreakdown']]], - ['updateuifonts_4',['updateUiFonts',['../classMainWindow.html#a0b27c0bc56c7ffc801a32c90dbd529a6',1,'MainWindow']]], - ['updateuiicons_5',['updateUiIcons',['../classMainWindow.html#ab38da8951aefa2064b1e9d3bddd918ea',1,'MainWindow']]], - ['updateuilanguage_6',['updateUiLanguage',['../classMainWindow.html#a1f84f5977dc0d34a3f65f373be1214cd',1,'MainWindow']]], - ['updateuitheme_7',['updateUiTheme',['../classMainWindow.html#aa38e8aac36ede194803b378725fc123c',1,'MainWindow']]], - ['updatewarn_8',['updateWarn',['../classCrapview.html#a5936b20a36eb7293eb1ab7dffd5a28cf',1,'Crapview']]], - ['updatewarnings_9',['updateWarnings',['../classDbQuery.html#a6d86a91f0880d9d7ca27b6b9720257fd',1,'DbQuery']]] + ['testcraplogmodules_0',['testCraplogModules',['../namespaceTesting.html#a26ca6af95ebd8bc1f45330d1f8e878ee',1,'Testing']]], + ['testcrapviewmodules_1',['testCrapviewModules',['../namespaceTesting.html#afda5137047f07a73c14a0da8a5ca35d6',1,'Testing']]], + ['testoperators_2',['testOperators',['../namespaceTesting.html#a9ac32a7ffa8616455829bcf0f8496c3d',1,'Testing']]], + ['testutilities_3',['testUtilities',['../namespaceTesting.html#a61e6bd9fb48a1af951cb365b46e49924',1,'Testing']]], + ['tolower_4',['toLower',['../namespaceStringOps.html#a5061aaadb5290959f7e14d6c54a491c5',1,'StringOps']]], + ['toupper_5',['toUpper',['../namespaceStringOps.html#a10bc74b0c6b388437925d6bf6c0cf6d1',1,'StringOps']]] ]; diff --git a/docs/html/search/functions_13.js b/docs/html/search/functions_13.js index afe15d8f..f5caf6ba 100644 --- a/docs/html/search/functions_13.js +++ b/docs/html/search/functions_13.js @@ -1,5 +1,11 @@ var searchData= [ - ['versioncheck_0',['versionCheck',['../classCrapup.html#a6d982e763155f2d28dcd55931623bb58',1,'Crapup']]], - ['victory_1',['victory',['../classCrissCross.html#afa0a5b671afad8da3d071c5629c134b3',1,'CrissCross']]] + ['update_0',['update',['../classFood.html#ad6db3b26ba5f1199549e99bf1df7a6f6',1,'Food::update()'],['../structBodyPart.html#a471589b6e0e29b42e2701f673be4743f',1,'BodyPart::update()'],['../classSnake.html#ab3610a54cbc6b6ec8d44e24871d59301',1,'Snake::update()']]], + ['updategamescore_1',['updateGameScore',['../classSnakeGame.html#a420f3980fab86475ea4788a2e971597b',1,'SnakeGame']]], + ['updatelabel_2',['updateLabel',['../classMainSlice.html#aed2a6013aafca878143a8f05c391c590',1,'MainSlice']]], + ['updatelegendmarkers_3',['updateLegendMarkers',['../classDonutBreakdown.html#a682599f0fd4f13530b7bfe6dc3331578',1,'DonutBreakdown']]], + ['updateuifonts_4',['updateUiFonts',['../classMainWindow.html#a0b27c0bc56c7ffc801a32c90dbd529a6',1,'MainWindow']]], + ['updateuiicons_5',['updateUiIcons',['../classMainWindow.html#ab38da8951aefa2064b1e9d3bddd918ea',1,'MainWindow']]], + ['updateuilanguage_6',['updateUiLanguage',['../classMainWindow.html#a1f84f5977dc0d34a3f65f373be1214cd',1,'MainWindow']]], + ['updateuitheme_7',['updateUiTheme',['../classMainWindow.html#aa38e8aac36ede194803b378725fc123c',1,'MainWindow']]] ]; diff --git a/docs/html/search/functions_14.js b/docs/html/search/functions_14.js index 9c0dfef6..c5471ede 100644 --- a/docs/html/search/functions_14.js +++ b/docs/html/search/functions_14.js @@ -1,15 +1,5 @@ var searchData= [ - ['warnconffilenotfound_0',['warnConfFileNotFound',['../classDialogSec.html#a3b25c703b036517d3de43596809f1845',1,'DialogSec']]], - ['warndirnotreadable_1',['warnDirNotReadable',['../classDialogSec.html#a57e732827bbb8e58fb863bdd47318b5b',1,'DialogSec']]], - ['warndirnotwritable_2',['warnDirNotWritable',['../classDialogSec.html#ade3c5fd40c2b38b688bfce8a4f2bcd51',1,'DialogSec']]], - ['warnemptyfile_3',['warnEmptyFile',['../classDialogSec.html#a4a80026203e34ff692bc720d65f5c097',1,'DialogSec']]], - ['warnfilenotreadable_4',['warnFileNotReadable',['../classDialogSec.html#a2424ed3e4b1c9a98a0ca979764d004b9',1,'DialogSec']]], - ['warninvaliditembw_5',['warnInvalidItemBW',['../classDialogSec.html#ae9cf747999d28638f8bec00dba752271',1,'DialogSec']]], - ['warnlistadd_6',['warnlistAdd',['../classCraplog.html#a0b8a8e9c44dc4a8878c64a674d1b74aa',1,'Craplog']]], - ['warnlistmovedown_7',['warnlistMoveDown',['../classCraplog.html#a539d63af92fc3e678c56fca2507ea908',1,'Craplog']]], - ['warnlistmoveup_8',['warnlistMoveUp',['../classCraplog.html#ad9932170d3148f5f49f18b056b9eb3f9',1,'Craplog']]], - ['warnlistremove_9',['warnlistRemove',['../classCraplog.html#a88e7879cc0a759504dd0c87185c58b89',1,'Craplog']]], - ['writeconfigs_10',['writeConfigs',['../classMainWindow.html#a77e405bc3eb9a34a2517a45ed7dbabf0',1,'MainWindow']]], - ['writeonfile_11',['writeOnFile',['../namespaceIOutils.html#a88b18d0e0f947455640e1a3c9818f3db',1,'IOutils']]] + ['versioncheck_0',['versionCheck',['../classCrapup.html#a6d982e763155f2d28dcd55931623bb58',1,'Crapup']]], + ['victory_1',['victory',['../classCrissCross.html#a771c0a29f4e7d95f883c425f5d6ffa3f',1,'CrissCross']]] ]; diff --git a/docs/html/search/functions_15.js b/docs/html/search/functions_15.js index 66623584..22d5b7f3 100644 --- a/docs/html/search/functions_15.js +++ b/docs/html/search/functions_15.js @@ -1,4 +1,12 @@ var searchData= [ - ['x_0',['X',['../classFood.html#ae020ae6247a41acd4b8c701322a91a7a',1,'Food']]] + ['warnconffilenotfound_0',['warnConfFileNotFound',['../classDialogSec.html#a3b25c703b036517d3de43596809f1845',1,'DialogSec']]], + ['warndirnotreadable_1',['warnDirNotReadable',['../classDialogSec.html#a57e732827bbb8e58fb863bdd47318b5b',1,'DialogSec']]], + ['warndirnotwritable_2',['warnDirNotWritable',['../classDialogSec.html#ade3c5fd40c2b38b688bfce8a4f2bcd51',1,'DialogSec']]], + ['warnemptyfile_3',['warnEmptyFile',['../classDialogSec.html#a4a80026203e34ff692bc720d65f5c097',1,'DialogSec']]], + ['warnfilenotreadable_4',['warnFileNotReadable',['../classDialogSec.html#a2424ed3e4b1c9a98a0ca979764d004b9',1,'DialogSec']]], + ['warninvalidconfigslist_5',['warnInvalidConfigsList',['../classDialogSec.html#a2a07c686501d9f772499dc9ebb47c38c',1,'DialogSec']]], + ['warninvaliditembw_6',['warnInvalidItemBW',['../classDialogSec.html#ae9cf747999d28638f8bec00dba752271',1,'DialogSec']]], + ['writeconfigs_7',['writeConfigs',['../classMainWindow.html#a77e405bc3eb9a34a2517a45ed7dbabf0',1,'MainWindow']]], + ['writeonfile_8',['writeOnFile',['../namespaceIOutils.html#a88b18d0e0f947455640e1a3c9818f3db',1,'IOutils']]] ]; diff --git a/docs/html/search/functions_16.js b/docs/html/search/functions_16.js index c9c27a0d..cbbb2360 100644 --- a/docs/html/search/functions_16.js +++ b/docs/html/search/functions_16.js @@ -1,4 +1,4 @@ var searchData= [ - ['y_0',['Y',['../classFood.html#aa48eeda2151769eb75a41c6aa3f216be',1,'Food']]] + ['x_0',['X',['../classFood.html#a6f1549c041fe5445d0b96fa2d096c76e',1,'Food']]] ]; diff --git a/docs/html/search/functions_17.js b/docs/html/search/functions_17.js new file mode 100644 index 00000000..e0823b89 --- /dev/null +++ b/docs/html/search/functions_17.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['y_0',['Y',['../classFood.html#ae4485a82fc3b4bcc5b714342da459c0f',1,'Food']]] +]; diff --git a/docs/html/search/functions_18.js b/docs/html/search/functions_18.js new file mode 100644 index 00000000..fa3a5cae --- /dev/null +++ b/docs/html/search/functions_18.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['zip_0',['zip',['../namespaceArrayOps.html#a4acbd634bddcf1acd35cf7830e37f262',1,'ArrayOps']]] +]; diff --git a/docs/html/search/functions_2.js b/docs/html/search/functions_2.js index ae40a82d..d34073ce 100644 --- a/docs/html/search/functions_2.js +++ b/docs/html/search/functions_2.js @@ -1,37 +1,41 @@ var searchData= [ - ['calcglobals_0',['calcGlobals',['../classCrapview.html#a3fd5b734339c134768334bec9f94c8ba',1,'Crapview']]], - ['changeiislogsbasenames_1',['changeIisLogsBaseNames',['../classCraplog.html#aa3322c13abbee68d72eee2b1100c83f6',1,'Craplog']]], - ['checkcollectiondatabase_2',['checkCollectionDatabase',['../namespaceCheckSec.html#abaeae12b56acc24ef8f600814e3f280f',1,'CheckSec']]], + ['calcglobals_0',['calcGlobals',['../classCrapview.html#a350742e9b0ec2c5480fad7598fe73f58',1,'Crapview']]], + ['changeiislogsbasenames_1',['changeIisLogsBaseNames',['../classCraplog.html#a95a5c02d09527651335efa0cdec02973',1,'Craplog']]], + ['checkcollectiondatabase_2',['checkCollectionDatabase',['../namespaceCheckSec.html#a2c48d11d8fccf7141cd676977a9e7bd8',1,'CheckSec']]], ['checkcollision_3',['checkCollision',['../classSnakeGame.html#a937f69388e5c1dbf9d5f65ef7bf3b0d5',1,'SnakeGame']]], - ['checkdatabasefile_4',['checkDatabaseFile',['../namespaceCheckSec.html#a4ced4f1c9603e537b6ab5f22098dd229',1,'CheckSec']]], - ['checkdatadb_5',['checkDataDB',['../classMainWindow.html#af06cade6835503cbc7deeb6f23f93e3f',1,'MainWindow']]], - ['checkdir_6',['checkDir',['../namespaceIOutils.html#af5fcc130a1152a2fa5fca8308767db1a',1,'IOutils']]], - ['checkfile_7',['checkFile',['../namespaceIOutils.html#ad1d810e9f77d4755390e07c4011537b5',1,'IOutils']]], - ['checkhashesdatabase_8',['checkHashesDatabase',['../namespaceCheckSec.html#a012e382c91f035ced3c5868ad551a2ec',1,'CheckSec']]], - ['checkstuff_9',['checkStuff',['../classCraplog.html#a60452b1a4f33ec85128d96abfa65eb9c',1,'Craplog']]], - ['checkvictory_10',['checkVictory',['../classCrissCross.html#a502dc21b03a8c129d57493d2f3877d3c',1,'CrissCross']]], - ['choicedatabasemissingcolumn_11',['choiceDatabaseMissingColumn',['../classDialogSec.html#a52f90a8afacb290b67e2a7e523e9bea4',1,'DialogSec']]], - ['choicedatabasemissingtable_12',['choiceDatabaseMissingTable',['../classDialogSec.html#a1f0f600f2c65ab92d9d06421986652ac',1,'DialogSec']]], - ['choicedatabasenotfound_13',['choiceDatabaseNotFound',['../classDialogSec.html#a807ff1e2c7e990b7bc824e92709ce7a7',1,'DialogSec']]], - ['choicedatabaserenew_14',['choiceDatabaseRenew',['../classDialogSec.html#afbe18a768dd2b7bc50d1b26632792925',1,'DialogSec']]], - ['choicedatabasewrongcolumn_15',['choiceDatabaseWrongColumn',['../classDialogSec.html#a3f76ea2ac1a93f435777807917eb5300',1,'DialogSec']]], - ['choicedatabasewrongdatatype_16',['choiceDatabaseWrongDataType',['../classDialogSec.html#a8759bfa9a5a672982b6e8038fbd1b7b5',1,'DialogSec']]], - ['choicedatabasewrongtable_17',['choiceDatabaseWrongTable',['../classDialogSec.html#a28a45ef4f4b79d050ccb72b85a8ba4fc',1,'DialogSec']]], - ['choicedirnotdir_18',['choiceDirNotDir',['../classDialogSec.html#a12f1c605aac10164e61d4a4b867d962f',1,'DialogSec']]], - ['choiceduplicatefile_19',['choiceDuplicateFile',['../classDialogSec.html#ae0b81c32e3bf6c9e1d05816b24a6abc7',1,'DialogSec']]], - ['choicefilealreadyused_20',['choiceFileAlreadyUsed',['../classDialogSec.html#abf2378d24ab3e171645b6062b34a5737',1,'DialogSec']]], - ['choicefilenotfile_21',['choiceFileNotFile',['../classDialogSec.html#a7a8316a45f783c3e93507a0b0f60c350',1,'DialogSec']]], - ['choicefilesizewarning_22',['choiceFileSizeWarning',['../classDialogSec.html#a2b6f6a70833fddee1c826eab567d3337',1,'DialogSec']]], - ['choicefilesizewarning2_23',['choiceFileSizeWarning2',['../classDialogSec.html#a06f1e2d780a3927c4153ae5d3b6e1c08',1,'DialogSec']]], - ['choiceselectedfilenotfound_24',['choiceSelectedFileNotFound',['../classDialogSec.html#a29ded809542c2e742491300adff188cc',1,'DialogSec']]], - ['cleardates_25',['clearDates',['../classCrapview.html#ae0eb083eea7e2bef76345242da41bf69',1,'Crapview']]], - ['clearlogfilesselection_26',['clearLogFilesSelection',['../classCraplog.html#af712a3a0fce65fe3b46b63149dac35b4',1,'Craplog']]], - ['closeevent_27',['closeEvent',['../classCrapup.html#a1b3b1fa451669dc2791e5d14288a96e5',1,'Crapup']]], - ['contains_28',['contains',['../namespaceStringOps.html#a5a3390d7109b031815fc5f25ffb8c69c',1,'StringOps::contains()'],['../namespaceVecOps.html#ad35b2db7bf722499e7279b1e667fbd76',1,'VecOps::contains()']]], - ['count_29',['count',['../namespaceStringOps.html#a51bb7905e70cc59a5dc541cb9dfb995f',1,'StringOps::count(std::string_view str, const char flag)'],['../namespaceStringOps.html#aec7a32ac06839af8c9f5104014ee3d97',1,'StringOps::count(std::string_view str, std::string_view flag)']]], - ['countdays_30',['countDays',['../classDbQuery.html#a4d34cbd13cf2781e454c30e581bd2905',1,'DbQuery']]], - ['countmonths_31',['countMonths',['../classDbQuery.html#a4ae0b762331e5687bc412fa6f16b706f',1,'DbQuery']]], - ['crapinfo_32',['Crapinfo',['../classCrapinfo.html#a8dcb2ce3d5d374f14aef725e94971d7d',1,'Crapinfo']]], - ['crapup_33',['Crapup',['../classCrapup.html#adc4e169000cdeb4e82db0bddfc7778a7',1,'Crapup']]] + ['checkcurrentlogsformat_4',['checkCurrentLogsFormat',['../classCraplog.html#a739612f3e2d0c2e27b1e3a5644eb482b',1,'Craplog']]], + ['checkdatabasefile_5',['checkDatabaseFile',['../namespaceCheckSec.html#a5009d318005e5d2b3c6c23111a09dfaf',1,'CheckSec']]], + ['checkdatadb_6',['checkDataDB',['../classMainWindow.html#af06cade6835503cbc7deeb6f23f93e3f',1,'MainWindow']]], + ['checkdir_7',['checkDir',['../namespaceIOutils.html#a2936b801d69bae9a65c13659a70b955b',1,'IOutils']]], + ['checkdriver_8',['checkDriver',['../structDatabaseHandler.html#a8b45700dcf52e73c310ee6d10291b4a5',1,'DatabaseHandler']]], + ['checkfile_9',['checkFile',['../namespaceIOutils.html#a09f2bbd8752f07a411fc7d1476778b78',1,'IOutils']]], + ['checkhashesdatabase_10',['checkHashesDatabase',['../namespaceCheckSec.html#a24eeb17387886eaf114dcc86fc978dd9',1,'CheckSec']]], + ['checkstuff_11',['checkStuff',['../classCraplog.html#a60452b1a4f33ec85128d96abfa65eb9c',1,'Craplog']]], + ['checkvictory_12',['checkVictory',['../classCrissCross.html#adfd19bd142a7c0f4a76b84bab21189c1',1,'CrissCross']]], + ['choicedatabasemissingcolumn_13',['choiceDatabaseMissingColumn',['../classDialogSec.html#a52f90a8afacb290b67e2a7e523e9bea4',1,'DialogSec']]], + ['choicedatabasemissingtable_14',['choiceDatabaseMissingTable',['../classDialogSec.html#a1f0f600f2c65ab92d9d06421986652ac',1,'DialogSec']]], + ['choicedatabasenotfound_15',['choiceDatabaseNotFound',['../classDialogSec.html#a807ff1e2c7e990b7bc824e92709ce7a7',1,'DialogSec']]], + ['choicedatabaserenew_16',['choiceDatabaseRenew',['../classDialogSec.html#afbe18a768dd2b7bc50d1b26632792925',1,'DialogSec']]], + ['choicedatabasewrongcolumn_17',['choiceDatabaseWrongColumn',['../classDialogSec.html#a3f76ea2ac1a93f435777807917eb5300',1,'DialogSec']]], + ['choicedatabasewrongdatatype_18',['choiceDatabaseWrongDataType',['../classDialogSec.html#a8759bfa9a5a672982b6e8038fbd1b7b5',1,'DialogSec']]], + ['choicedatabasewrongtable_19',['choiceDatabaseWrongTable',['../classDialogSec.html#a28a45ef4f4b79d050ccb72b85a8ba4fc',1,'DialogSec']]], + ['choicedirnotdir_20',['choiceDirNotDir',['../classDialogSec.html#a12f1c605aac10164e61d4a4b867d962f',1,'DialogSec']]], + ['choiceduplicatefile_21',['choiceDuplicateFile',['../classDialogSec.html#ae0b81c32e3bf6c9e1d05816b24a6abc7',1,'DialogSec']]], + ['choicefailedapplyingconfigs_22',['choiceFailedApplyingConfigs',['../classDialogSec.html#a56772385898ba184142862cbcc47d370',1,'DialogSec']]], + ['choicefilealreadyused_23',['choiceFileAlreadyUsed',['../classDialogSec.html#abf2378d24ab3e171645b6062b34a5737',1,'DialogSec']]], + ['choicefilenotfile_24',['choiceFileNotFile',['../classDialogSec.html#a7a8316a45f783c3e93507a0b0f60c350',1,'DialogSec']]], + ['choicefilesizewarning_25',['choiceFileSizeWarning',['../classDialogSec.html#a2b6f6a70833fddee1c826eab567d3337',1,'DialogSec']]], + ['choicefilesizewarning2_26',['choiceFileSizeWarning2',['../classDialogSec.html#a06f1e2d780a3927c4153ae5d3b6e1c08',1,'DialogSec']]], + ['choiceselectedfilenotfound_27',['choiceSelectedFileNotFound',['../classDialogSec.html#a29ded809542c2e742491300adff188cc',1,'DialogSec']]], + ['cleardates_28',['clearDates',['../classCrapview.html#ab5731c52c4989cfe2258089bb80cfdce',1,'Crapview']]], + ['clearlist_29',['clearList',['../structBlacklists.html#af286a65648e285237340527db32829a1',1,'Blacklists::clearList()'],['../structWarnlists.html#ae8da97eb51cee2620b32428c2cff697d',1,'Warnlists::clearList()']]], + ['clearlogfilesselection_30',['clearLogFilesSelection',['../classCraplog.html#a0686f3a32665d6de378d1dc7408ab7a8',1,'Craplog']]], + ['closeevent_31',['closeEvent',['../classCrapup.html#a1b3b1fa451669dc2791e5d14288a96e5',1,'Crapup']]], + ['committransaction_32',['commitTransaction',['../classDatabaseWrapper.html#a8bbfd03f0576da556f23e1ffb2c07c8c',1,'DatabaseWrapper']]], + ['contains_33',['contains',['../namespaceStringOps.html#a3974d58d0986b5d1e48fdbbfadfca641',1,'StringOps::contains()'],['../namespaceVecOps.html#a129235247ff1fb66d875d2cec6869ccb',1,'VecOps::contains()']]], + ['count_34',['count',['../namespaceStringOps.html#ac316348ba7d81cdfaefe79fbaa9c8d72',1,'StringOps::count(std::string_view str, std::string_view flag) noexcept'],['../namespaceStringOps.html#a0447e69dc3208f2241085797859340fc',1,'StringOps::count(std::string_view str, const char flag) noexcept']]], + ['countdays_35',['countDays',['../classDbQuery.html#a4d34cbd13cf2781e454c30e581bd2905',1,'DbQuery']]], + ['countmonths_36',['countMonths',['../classDbQuery.html#ad271ebf5819d781bb6bfdfea2b4acf98',1,'DbQuery']]], + ['crapinfo_37',['Crapinfo',['../classCrapinfo.html#a8dcb2ce3d5d374f14aef725e94971d7d',1,'Crapinfo']]] ]; diff --git a/docs/html/search/functions_3.js b/docs/html/search/functions_3.js index 550b2263..81b07b10 100644 --- a/docs/html/search/functions_3.js +++ b/docs/html/search/functions_3.js @@ -1,18 +1,22 @@ var searchData= [ - ['definefiletype_0',['defineFileType',['../namespaceLogOps.html#a7d15efe4659c327d14bed3dfbec6949c',1,'LogOps']]], - ['defineosspec_1',['defineOSspec',['../classMainWindow.html#a190ea12a49c863423ebc169b1f8c92a2',1,'MainWindow']]], - ['deletereply_2',['deleteReply',['../classCrapup.html#a52cad2625d432f367ca6441ebd35e64b',1,'Crapup']]], - ['detecticonstheme_3',['detectIconsTheme',['../classMainWindow.html#a5684909fae2173eb30b7a77051042d0b',1,'MainWindow']]], - ['dialogbool_4',['DialogBool',['../classDialogBool.html#aed40fd288c983c07b3abb7188655cb95',1,'DialogBool']]], - ['dialogida_5',['DialogIda',['../classDialogIda.html#acb38348bcb6f6968f86a88948b1259d3',1,'DialogIda']]], - ['dialogmsg_6',['DialogMsg',['../classDialogMsg.html#ad8dfbc1525efc49207f912d451aa0fde',1,'DialogMsg']]], - ['digestfile_7',['digestFile',['../classHashOps.html#ac74504e76a2c8e20506e446d2887ab53',1,'HashOps']]], - ['direction_8',['direction',['../classSnake.html#a6152832ec0736c49fa6416ba30c46313',1,'Snake']]], - ['draw_9',['draw',['../classCrissCross.html#a9f957e38250d4c58f2b232620891cb47',1,'CrissCross']]], - ['drawcount_10',['drawCount',['../classCrapview.html#aca27d259093a187db1015a4d68a2ceee',1,'Crapview']]], - ['drawday_11',['drawDay',['../classCrapview.html#af80a9ccb827db918362f407141af5609',1,'Crapview']]], - ['drawrelat_12',['drawRelat',['../classCrapview.html#ad16992f42b9e6f4b5efc8a012db59482',1,'Crapview']]], - ['drawspeed_13',['drawSpeed',['../classCrapview.html#a7e0ecbd3f83e901d42cbbb823265cb61',1,'Crapview']]], - ['drawwarn_14',['drawWarn',['../classCrapview.html#a89977ee5957ce6e8aef8a7a6d37ef5a6',1,'Crapview']]] + ['data_0',['data',['../structLogLineData.html#a84bdb9ef42b40ef7a6361e51443a40a8',1,'LogLineData']]], + ['dbname_1',['dbName',['../classQueryWrapper.html#aa6335147eadf1fb2b360f7337c98d0f9',1,'QueryWrapper']]], + ['dbusable_2',['dbUsable',['../classMainWindow.html#a80500e8151b811a6bcca43882db17a14',1,'MainWindow']]], + ['definefiletype_3',['defineFileType',['../namespaceLogOps.html#aaeafb5040234133c1feca9fed4f4e5d2',1,'LogOps']]], + ['defineosspec_4',['defineOSspec',['../classMainWindow.html#a190ea12a49c863423ebc169b1f8c92a2',1,'MainWindow']]], + ['deletereply_5',['deleteReply',['../classCrapup.html#a52cad2625d432f367ca6441ebd35e64b',1,'Crapup']]], + ['detecticonstheme_6',['detectIconsTheme',['../classMainWindow.html#a5684909fae2173eb30b7a77051042d0b',1,'MainWindow']]], + ['dialogbool_7',['DialogBool',['../classDialogBool.html#aed40fd288c983c07b3abb7188655cb95',1,'DialogBool']]], + ['dialogida_8',['DialogIda',['../classDialogIda.html#acb38348bcb6f6968f86a88948b1259d3',1,'DialogIda']]], + ['dialogmsg_9',['DialogMsg',['../classDialogMsg.html#ad8dfbc1525efc49207f912d451aa0fde',1,'DialogMsg']]], + ['dialogslevelfromint_10',['dialogsLevelFromInt',['../classMainWindow.html#a810897f817b3c3e9828f8a23a508a6e8',1,'MainWindow']]], + ['digestfile_11',['digestFile',['../classHashOps.html#ac74504e76a2c8e20506e446d2887ab53',1,'HashOps']]], + ['direction_12',['direction',['../classSnake.html#aa497eee50dfe777501c9d398d133f672',1,'Snake']]], + ['draw_13',['draw',['../classCrissCross.html#acb0701307d815ab2c8bee7980bebf4bd',1,'CrissCross']]], + ['drawcount_14',['drawCount',['../classCrapview.html#ada344c04960f7b8dfa54d04bc7a59c8e',1,'Crapview']]], + ['drawday_15',['drawDay',['../classCrapview.html#aab468e4008724571d44d6244d918640d',1,'Crapview']]], + ['drawrelat_16',['drawRelat',['../classCrapview.html#a4e89a9a590435df939bc5edfac7dbb56',1,'Crapview']]], + ['drawspeed_17',['drawSpeed',['../classCrapview.html#ab569e9b9ab0f70a7620b5b78504175f5',1,'Crapview']]], + ['drawwarn_18',['drawWarn',['../classCrapview.html#a6ebee61566b688550e2e8074842fec7d',1,'Crapview']]] ]; diff --git a/docs/html/search/functions_4.js b/docs/html/search/functions_4.js index b42c4374..87dea9c4 100644 --- a/docs/html/search/functions_4.js +++ b/docs/html/search/functions_4.js @@ -1,41 +1,45 @@ var searchData= [ - ['editeddatabase_0',['editedDatabase',['../classCraplog.html#a68dd849eb25f6d0143c30676251dfc5f',1,'Craplog']]], - ['endswith_1',['endswith',['../namespaceStringOps.html#aa31fa90911d193832aab0bd2c337641c',1,'StringOps::endsWith(std::string_view str, const char flag)'],['../namespaceStringOps.html#a03327aaf5b652d05bdb4406611d6d00d',1,'StringOps::endsWith(std::string_view str, std::string_view flag)']]], + ['editeddatabase_0',['editedDatabase',['../classCraplog.html#aafa48706e27f79f5ba7d0bf8f8efaf2e',1,'Craplog']]], + ['endswith_1',['endsWith',['../namespaceStringOps.html#a56c64ca6806bc01d6592dcf252ae1aa1',1,'StringOps::endsWith(std::string_view str, const char flag) noexcept'],['../namespaceStringOps.html#a89aa4526794ce074d8a8ec199e817354',1,'StringOps::endsWith(std::string_view str, std::string_view flag) noexcept']]], ['endturn_2',['endTurn',['../classCrissCross.html#a3d3d3eeb2b7666c4411c89cf153048e0',1,'CrissCross']]], - ['enrichlogs_3',['enrichLogs',['../classRichText.html#a2afa546c743511aba5eb62f4bdc1da09',1,'RichText']]], - ['errconfdirnotwritable_4',['errConfDirNotWritable',['../classDialogSec.html#a2cfc4ee49a455ec10253c133308e5235',1,'DialogSec']]], - ['errconffailedwriting_5',['errConfFailedWriting',['../classDialogSec.html#a2dcb66d839d8a10574414d45011e1764',1,'DialogSec']]], - ['errconffilenotreadable_6',['errConfFileNotReadable',['../classDialogSec.html#ae2a40f972582a40f5c4533cc7e2b425b',1,'DialogSec']]], - ['errconffilenotwritable_7',['errConfFileNotWritable',['../classDialogSec.html#a7c220883836ee79764e7a55813cc0cc9',1,'DialogSec']]], - ['errdatabasefailedbackup_8',['errDatabaseFailedBackup',['../classDialogSec.html#a20a23916efa18bb1a8dd1e91250f8557',1,'DialogSec']]], - ['errdatabasefailedcreating_9',['errDatabaseFailedCreating',['../classDialogSec.html#a8483bdc26a89628a826e69c454a7a6cf',1,'DialogSec']]], - ['errdatabasefailedexecuting_10',['errDatabaseFailedExecuting',['../classDialogSec.html#a64cfe33e61b020676857f98618aeb944',1,'DialogSec']]], - ['errdatabasefailedopening_11',['errDatabaseFailedOpening',['../classDialogSec.html#adad767386ecd10161f0eabda70d6c5d5',1,'DialogSec']]], - ['errdatabasenotfile_12',['errDatabaseNotFile',['../classDialogSec.html#a587689e07a401f5b51491e017535fd1d',1,'DialogSec']]], - ['errdatabasenotfound_13',['errDatabaseNotFound',['../classDialogSec.html#a1477572025f8b0457c821e57f6c8c54e',1,'DialogSec']]], - ['errdatabasenotreadable_14',['errDatabaseNotReadable',['../classDialogSec.html#a8b88d0e707f4d0100069208fe6969a74',1,'DialogSec']]], - ['errdatabasenotwritable_15',['errDatabaseNotWritable',['../classDialogSec.html#a6fbd29bf1e96b182b396315cfb49ea49',1,'DialogSec']]], - ['errdirnotexists_16',['errDirNotExists',['../classDialogSec.html#a1624e24d4d7b04b5479970234368db0e',1,'DialogSec']]], - ['errdirnotreadable_17',['errDirNotReadable',['../classDialogSec.html#a89580421a70af819c57f480de24d8e77',1,'DialogSec']]], - ['errdirnotwritable_18',['errDirNotWritable',['../classDialogSec.html#a24cd2a3e54b2969d4f33ba500bd7509b',1,'DialogSec']]], - ['errfailedapplyingconfigs_19',['errFailedApplyingConfigs',['../classDialogSec.html#a636ea87efbab1f9bb75431a48380cd39',1,'DialogSec']]], - ['errfaileddefininglogtype_20',['errFailedDefiningLogType',['../classDialogSec.html#a37b210d2f9a087eaf395a45ff2095ed5',1,'DialogSec']]], - ['errfailedmakedir_21',['errFailedMakeDir',['../classDialogSec.html#af10077a5f3ebbf3683801999d8005f9a',1,'DialogSec']]], - ['errfailedparsinglogs_22',['errFailedParsingLogs',['../classDialogSec.html#a8bdf9d669f24bffd5d996ec18020194b',1,'DialogSec']]], - ['errfailedreadfile_23',['errFailedReadFile',['../classDialogSec.html#a475316d013f45940a1953af608fe3d3f',1,'DialogSec']]], - ['errfilenotfound_24',['errFileNotFound',['../classDialogSec.html#a12d801b9dbfc0fc340c4bda5e69a6002',1,'DialogSec']]], - ['errgeneric_25',['errGeneric',['../classDialogSec.html#a6b7e8089712ea78ba9e6b2440dde2d1a',1,'DialogSec']]], - ['errhelpfailed_26',['errHelpFailed',['../classDialogSec.html#abc275ca943e81edb5459da0afbe8c8c3',1,'DialogSec']]], - ['errhelpnotfound_27',['errHelpNotFound',['../classDialogSec.html#a910d3500df728c06173056a4eac0c358',1,'DialogSec']]], - ['errhelpnotreadable_28',['errHelpNotReadable',['../classDialogSec.html#aefdc8e73c551460720d8a58e7e5e18bb',1,'DialogSec']]], - ['errinvalidlogformatstring_29',['errInvalidLogFormatString',['../classDialogSec.html#a3cc898412f2debd5eff058aa8cd88c80',1,'DialogSec']]], - ['errlanglocaleinvalid_30',['errLangLocaleInvalid',['../classDialogSec.html#ab2c944dbd7d2857d6ec7b0eba8b614ae',1,'DialogSec']]], - ['errlangnotaccepted_31',['errLangNotAccepted',['../classDialogSec.html#a38406ffaaed868ab75be5b7e8f35a1c2',1,'DialogSec']]], - ['errlogformatnofields_32',['errLogFormatNoFields',['../classDialogSec.html#a48efa757e87889491d2d723749647c00',1,'DialogSec']]], - ['errlogformatnoseparators_33',['errLogFormatNoSeparators',['../classDialogSec.html#a5cc9c61fd5d5dea50b248366a6bd6e54',1,'DialogSec']]], - ['errlogformatnotset_34',['errLogFormatNotSet',['../classDialogSec.html#af9f19176ce2981bd3397b9d033490cb8',1,'DialogSec']]], - ['errrenaming_35',['errRenaming',['../classDialogSec.html#a93804c66ed89197dceb292926fceb690',1,'DialogSec']]], - ['errsqldrivernotfound_36',['errSqlDriverNotFound',['../classDialogSec.html#a41c7f8f921aff3ecfb876be3d89276b6',1,'DialogSec']]], - ['exists_37',['exists',['../namespaceIOutils.html#aca83a80f57ec7447988db335cea3f180',1,'IOutils']]] + ['enrichlogs_3',['enrichLogs',['../classRichText.html#a4b7aa4cd838e9ea6780740047cdfa474',1,'RichText']]], + ['enumerate_4',['enumerate',['../namespaceArrayOps.html#aec332afe52ccb712ba86f0a126702f49',1,'ArrayOps']]], + ['errconfdirnotwritable_5',['errConfDirNotWritable',['../classDialogSec.html#a2cfc4ee49a455ec10253c133308e5235',1,'DialogSec']]], + ['errconffailedwriting_6',['errConfFailedWriting',['../classDialogSec.html#a2dcb66d839d8a10574414d45011e1764',1,'DialogSec']]], + ['errconffilenotreadable_7',['errConfFileNotReadable',['../classDialogSec.html#ae2a40f972582a40f5c4533cc7e2b425b',1,'DialogSec']]], + ['errconffilenotwritable_8',['errConfFileNotWritable',['../classDialogSec.html#a7c220883836ee79764e7a55813cc0cc9',1,'DialogSec']]], + ['errconvertingdata_9',['errConvertingData',['../classDialogSec.html#ab571d3051c496c959274f21000750838',1,'DialogSec']]], + ['errdatabasefailedbackup_10',['errDatabaseFailedBackup',['../classDialogSec.html#a20a23916efa18bb1a8dd1e91250f8557',1,'DialogSec']]], + ['errdatabasefailedcreating_11',['errDatabaseFailedCreating',['../classDialogSec.html#a8483bdc26a89628a826e69c454a7a6cf',1,'DialogSec']]], + ['errdatabasefailedexecuting_12',['errDatabaseFailedExecuting',['../classDialogSec.html#a64cfe33e61b020676857f98618aeb944',1,'DialogSec']]], + ['errdatabasefailedopening_13',['errDatabaseFailedOpening',['../classDialogSec.html#adad767386ecd10161f0eabda70d6c5d5',1,'DialogSec']]], + ['errdatabasenotfile_14',['errDatabaseNotFile',['../classDialogSec.html#a587689e07a401f5b51491e017535fd1d',1,'DialogSec']]], + ['errdatabasenotfound_15',['errDatabaseNotFound',['../classDialogSec.html#a1477572025f8b0457c821e57f6c8c54e',1,'DialogSec']]], + ['errdatabasenotreadable_16',['errDatabaseNotReadable',['../classDialogSec.html#a8b88d0e707f4d0100069208fe6969a74',1,'DialogSec']]], + ['errdatabasenotwritable_17',['errDatabaseNotWritable',['../classDialogSec.html#a6fbd29bf1e96b182b396315cfb49ea49',1,'DialogSec']]], + ['errdirnotexists_18',['errDirNotExists',['../classDialogSec.html#a1624e24d4d7b04b5479970234368db0e',1,'DialogSec']]], + ['errdirnotreadable_19',['errDirNotReadable',['../classDialogSec.html#a89580421a70af819c57f480de24d8e77',1,'DialogSec']]], + ['errdirnotwritable_20',['errDirNotWritable',['../classDialogSec.html#a24cd2a3e54b2969d4f33ba500bd7509b',1,'DialogSec']]], + ['errfailedapplyingconfigsitem_21',['errFailedApplyingConfigsItem',['../classDialogSec.html#ab7e5f44cefc17e99cb3c91c21c0755b7',1,'DialogSec']]], + ['errfaileddefininglogtype_22',['errFailedDefiningLogType',['../classDialogSec.html#a37b210d2f9a087eaf395a45ff2095ed5',1,'DialogSec']]], + ['errfailedinsertusedhashes_23',['errFailedInsertUsedHashes',['../classDialogSec.html#a6668dbf080c96730fae96809a26d48d8',1,'DialogSec']]], + ['errfailedmakedir_24',['errFailedMakeDir',['../classDialogSec.html#af10077a5f3ebbf3683801999d8005f9a',1,'DialogSec']]], + ['errfailedparsinglogs_25',['errFailedParsingLogs',['../classDialogSec.html#a8bdf9d669f24bffd5d996ec18020194b',1,'DialogSec']]], + ['errfailedreadfile_26',['errFailedReadFile',['../classDialogSec.html#a475316d013f45940a1953af608fe3d3f',1,'DialogSec']]], + ['errfilenotfound_27',['errFileNotFound',['../classDialogSec.html#a12d801b9dbfc0fc340c4bda5e69a6002',1,'DialogSec']]], + ['errgeneric_28',['errGeneric',['../classDialogSec.html#a6b7e8089712ea78ba9e6b2440dde2d1a',1,'DialogSec']]], + ['errhelpfailed_29',['errHelpFailed',['../classDialogSec.html#abc275ca943e81edb5459da0afbe8c8c3',1,'DialogSec']]], + ['errhelpnotfound_30',['errHelpNotFound',['../classDialogSec.html#a910d3500df728c06173056a4eac0c358',1,'DialogSec']]], + ['errhelpnotreadable_31',['errHelpNotReadable',['../classDialogSec.html#aefdc8e73c551460720d8a58e7e5e18bb',1,'DialogSec']]], + ['errinvalidlogformatstring_32',['errInvalidLogFormatString',['../classDialogSec.html#a3cc898412f2debd5eff058aa8cd88c80',1,'DialogSec']]], + ['errlanglocaleinvalid_33',['errLangLocaleInvalid',['../classDialogSec.html#ab2c944dbd7d2857d6ec7b0eba8b614ae',1,'DialogSec']]], + ['errlangnotaccepted_34',['errLangNotAccepted',['../classDialogSec.html#a38406ffaaed868ab75be5b7e8f35a1c2',1,'DialogSec']]], + ['errlogformatnofields_35',['errLogFormatNoFields',['../classDialogSec.html#a48efa757e87889491d2d723749647c00',1,'DialogSec']]], + ['errlogformatnoseparators_36',['errLogFormatNoSeparators',['../classDialogSec.html#a5cc9c61fd5d5dea50b248366a6bd6e54',1,'DialogSec']]], + ['errlogformatnotset_37',['errLogFormatNotSet',['../classDialogSec.html#af9f19176ce2981bd3397b9d033490cb8',1,'DialogSec']]], + ['errprocessingstatsdata_38',['errProcessingStatsData',['../classDialogSec.html#af64324189aa2e42115afa0031dfc51c8',1,'DialogSec']]], + ['errrenaming_39',['errRenaming',['../classDialogSec.html#a93804c66ed89197dceb292926fceb690',1,'DialogSec']]], + ['errsqldrivernotfound_40',['errSqlDriverNotFound',['../classDialogSec.html#a41c7f8f921aff3ecfb876be3d89276b6',1,'DialogSec']]], + ['exists_41',['exists',['../namespaceIOutils.html#a4db5fef33faf62c104a7919c437a7725',1,'IOutils']]] ]; diff --git a/docs/html/search/functions_5.js b/docs/html/search/functions_5.js index c8dd4519..13ee6916 100644 --- a/docs/html/search/functions_5.js +++ b/docs/html/search/functions_5.js @@ -1,54 +1,4 @@ var searchData= [ - ['gamedialog_0',['GameDialog',['../classGameDialog.html#a64c49481c662dc6de69d7e3039d90218',1,'GameDialog']]], - ['gamedraw_1',['gameDraw',['../classCrissCross.html#a4dbb7fba7bd0c37423ec572b28dc05cb',1,'CrissCross']]], - ['geometrytostring_2',['geometryToString',['../classMainWindow.html#a6da24820c623e488217f8fdc3410b51e',1,'MainWindow']]], - ['getapachelogsample_3',['getApacheLogSample',['../classFormatOps.html#a2e0dfc31462771b5dbee807183021981',1,'FormatOps']]], - ['getblacklist_4',['getBlacklist',['../classCraplog.html#a8586cb34dddab990465c069deeb3b9d6',1,'Craplog']]], - ['getcolors_5',['getColors',['../namespaceColorSec.html#a1417a5b26652c4fbaceaf61b9477a3c4',1,'ColorSec']]], - ['getcolorscheme_6',['getColorScheme',['../classTextBrowser.html#a82cfa4f5053dc4220e2a11d97c677631',1,'TextBrowser']]], - ['getcolorschemeid_7',['getColorSchemeID',['../classTextBrowser.html#abd32a8479198b50ed84ada1fa79a6b95',1,'TextBrowser']]], - ['getcolorschemes_8',['getColorSchemes',['../namespaceColorSec.html#adf41ac920d56345d5340c20136b99445',1,'ColorSec']]], - ['getcurrentlogformat_9',['getCurrentLogFormat',['../classCraplog.html#a35da35fcca26354b017d339b9c25ccdd',1,'Craplog']]], - ['getcurrentwsid_10',['getCurrentWSID',['../classCraplog.html#add320174b7ae8f858d1c1e8bc5bb315a',1,'Craplog']]], - ['getdays_11',['getDays',['../classCrapview.html#a5c8cdc4ac91bd583d9b8a3d1aaea86c0',1,'Crapview']]], - ['getdaytimecounts_12',['getDaytimeCounts',['../classDbQuery.html#acf3ce4120be55f718298786c2865b73e',1,'DbQuery']]], - ['getdbfield_13',['getDbField',['../classDbQuery.html#a37720e27fdc817124b224f08aa9618ad',1,'DbQuery']]], - ['getdialogslevel_14',['getdialogslevel',['../classCraplog.html#a197c271fcf4ccb3ff13111dd7e42b091',1,'Craplog::getDialogsLevel()'],['../classCrapview.html#ac5bc1d50dc4d65ab3be5d85ce1010224',1,'Crapview::getDialogsLevel() const']]], - ['getfields_15',['getFields',['../classCrapview.html#a1ff83b4bda0d56e07163c8f9c30dd3ef',1,'Crapview']]], - ['getfont_16',['getFont',['../classTextBrowser.html#a04dda58a310e9f189224d5669c639df7',1,'TextBrowser']]], - ['getfontfamily_17',['getFontFamily',['../classTextBrowser.html#a10a6312d494fb85093d39687081b58d9',1,'TextBrowser']]], - ['getglobalcounts_18',['getGlobalCounts',['../classDbQuery.html#a278ca6ae98fe0de802927f909e40b79a',1,'DbQuery']]], - ['gethashesdatabasepath_19',['getHashesDatabasePath',['../classCraplog.html#ae4450126ded5f26a35379f165e6b29a6',1,'Craplog']]], - ['gethours_20',['getHours',['../classCrapview.html#a4e3937793d8ec572b0798dd1669bbff4',1,'Crapview']]], - ['getiislogsample_21',['getIisLogSample',['../classFormatOps.html#ac84d3f470507d50a9b70a158525342ba',1,'FormatOps']]], - ['getitemscount_22',['getItemsCount',['../classDbQuery.html#ac28b2a9352b50f537ec8e105e461277b',1,'DbQuery']]], - ['getlogfieldid_23',['getLogFieldID',['../classCrapview.html#a5469ce72afc57cd1c108172189031270',1,'Crapview']]], - ['getlogfieldstring_24',['getLogFieldString',['../classCrapview.html#ae103f35a46e97fc165edad43627b99a3',1,'Crapview']]], - ['getlogfileitem_25',['getLogFileItem',['../classCraplog.html#a03f799378a10ef054239a6ae807a8759',1,'Craplog']]], - ['getlogsformat_26',['getLogsFormat',['../classCraplog.html#accdb2181153cc63b6df29ac82a6749ac',1,'Craplog']]], - ['getlogsformatsample_27',['getLogsFormatSample',['../classCraplog.html#a95f8a07dcf1e0192e5c2c27bae4c93cc',1,'Craplog']]], - ['getlogsformatstring_28',['getLogsFormatString',['../classCraplog.html#a73ca3eb33066e39400b716fef18d2c32',1,'Craplog']]], - ['getlogslist_29',['getLogsList',['../classCraplog.html#ac15810ff1df0f2bf7c41dcbaefc52b4f',1,'Craplog']]], - ['getlogslistsize_30',['getLogsListSize',['../classCraplog.html#a8e240df009643dd3d385b20722161baf',1,'Craplog']]], - ['getlogspath_31',['getLogsPath',['../classCraplog.html#a404df4ad021c1f7e159617cddc0b18b7',1,'Craplog']]], - ['getminutegap_32',['getMinuteGap',['../classDbQuery.html#ad84db758810e989b8f61ac992d683f4a',1,'DbQuery']]], - ['getmonthdays_33',['getMonthDays',['../classDbQuery.html#a1ad1575ea0a9b5f3554e5d18bf0a3273',1,'DbQuery']]], - ['getmonthnumber_34',['getmonthnumber',['../classCrapview.html#acbeb5c6be095cf4c95f3cdbbf4c625de',1,'Crapview::getMonthNumber()'],['../classDbQuery.html#a9d619717133cedd8c1bf899b1004a4ce',1,'DbQuery::getMonthNumber()']]], - ['getmonths_35',['getMonths',['../classCrapview.html#a067eebbdf9166dbf0756c8bacdc8c5ca',1,'Crapview']]], - ['getnginxlogsample_36',['getNginxLogSample',['../classFormatOps.html#a60f1bba56a207556baf3bd0e577d524d',1,'FormatOps']]], - ['getparsedlines_37',['getParsedLines',['../classCraplog.html#ad30413632a8f83f04d62b39b40ca2bf8',1,'Craplog']]], - ['getparsedsize_38',['getParsedSize',['../classCraplog.html#aeae4e0cffef5cfd7520412e8140d9fcf',1,'Craplog']]], - ['getparsingspeed_39',['getParsingSpeed',['../classCraplog.html#a13abf90f6facb5f9304ed96cb0d60f49',1,'Craplog']]], - ['getrelationalcountsday_40',['getRelationalCountsDay',['../classDbQuery.html#ade63d90c7cf05115dac780d4d6884c6c',1,'DbQuery']]], - ['getrelationalcountsperiod_41',['getRelationalCountsPeriod',['../classDbQuery.html#a9dd64837bce2294c32866c85795db085',1,'DbQuery']]], - ['getspeeddata_42',['getSpeedData',['../classDbQuery.html#aab00855f73578e2cc83b4c2ffa2c04e9',1,'DbQuery']]], - ['getstatsdatabasepath_43',['getStatsDatabasePath',['../classCraplog.html#aa0740b5c11c9aa123bbb32326c494e31',1,'Craplog']]], - ['getstylesheet_44',['getStyleSheet',['../namespaceStyleSec.html#ac80ae7ce6ca669d26ca3ddca25e2398b',1,'StyleSec']]], - ['getwarncounts_45',['getWarnCounts',['../classDbQuery.html#a202b946c47e35d86f62e09cd1653479d',1,'DbQuery']]], - ['getwarningsize_46',['getWarningSize',['../classCraplog.html#a306e299ec33667ba0da257c842e39fc9',1,'Craplog']]], - ['getwarnlist_47',['getWarnlist',['../classCraplog.html#a8985d13c8fc2eed3b0d27f2f457f0c4e',1,'Craplog']]], - ['getwidelinesusage_48',['getWideLinesUsage',['../classTextBrowser.html#aa89d49d770f89a2b6ee438bcc39ce92b',1,'TextBrowser']]], - ['getyears_49',['getYears',['../classCrapview.html#a1c8e47e7ef3bb493b2876512df77998f',1,'Crapview']]], - ['grow_50',['grow',['../classSnake.html#abe575cf3bd5b5d86a50029485d259ac4',1,'Snake']]] + ['fieldname_0',['fieldName',['../structBlacklistItem.html#a3efe7a6ac33a4e64a95af8cd3491806a',1,'BlacklistItem::fieldName()'],['../structWarnlistItem.html#a214684525d4c0269ad6fc24b15710efc',1,'WarnlistItem::fieldName()']]] ]; diff --git a/docs/html/search/functions_6.js b/docs/html/search/functions_6.js index f69b993c..ffb62310 100644 --- a/docs/html/search/functions_6.js +++ b/docs/html/search/functions_6.js @@ -1,9 +1,56 @@ var searchData= [ - ['hasbeenused_0',['hasbeenused',['../classHashOps.html#acc0ec2920945173835b3489a1b95164b',1,'HashOps::hasBeenUsed()'],['../classLogFile.html#a84287037ed72866b55ece09ad946efe3',1,'LogFile::hasBeenUsed() const']]], - ['hash_1',['hash',['../classLogFile.html#a4099a83df4e95c689a36378442cc547c',1,'LogFile']]], - ['helplogsformat_2',['helpLogsFormat',['../classCraphelp.html#a311257a3a833ec2fa8fe262fbd0646cb',1,'Craphelp']]], - ['helplogsformatdefault_3',['helpLogsFormatDefault',['../classCraphelp.html#acf0dd64949a11297fb23aa97971e241a',1,'Craphelp']]], - ['hireasyncworker_4',['hireAsyncWorker',['../classCraplog.html#a290000f88b366470fbfa370eb6edf3ae',1,'Craplog']]], - ['hireworker_5',['hireWorker',['../classCraplog.html#a6b8118aa003315fb83fe7c7edac59d22',1,'Craplog']]] + ['gamedialog_0',['GameDialog',['../classGameDialog.html#a64c49481c662dc6de69d7e3039d90218',1,'GameDialog']]], + ['gamedraw_1',['gameDraw',['../classCrissCross.html#ae587a35271f93f0247c09f52c83a419d',1,'CrissCross']]], + ['geometrytostring_2',['geometryToString',['../classMainWindow.html#a6da24820c623e488217f8fdc3410b51e',1,'MainWindow']]], + ['get_3',['get',['../structBlacklists.html#aa45453bba09a2e32451149226bf74a74',1,'Blacklists::get(const WebServer ws)'],['../structBlacklists.html#ac2ce100ce6d845d6075fe51c15dba2c4',1,'Blacklists::get(const WebServer ws, const BlacklistField fld)'],['../structBlacklist.html#a1fadea47acfc9dc49d51d127a7c1b653',1,'Blacklist::get()'],['../structDatabaseHandler.html#a88e9b96f057bfc215feda12704bfc76a',1,'DatabaseHandler::get()'],['../structWarnlist.html#a25fb911f28a5643047823660a0c5f7ad',1,'Warnlist::get()'],['../structWarnlists.html#ae826377de88439372f26d4784986d7d6',1,'Warnlists::get(const WebServer ws)'],['../structWarnlists.html#a98654ec61c100bc6dae0514b091ea25b',1,'Warnlists::get(const WebServer ws, const WarnlistField fld)']]], + ['getapachelogsample_4',['getApacheLogSample',['../classFormatOps.html#a58b73f3dc433fea22315c178999d621c',1,'FormatOps']]], + ['getcolors_5',['getColors',['../namespaceColorSec.html#a084df7301f608504093007a90f867385',1,'ColorSec']]], + ['getcolorscheme_6',['getColorScheme',['../classTextBrowser.html#acae772fdaa45657ec122fe2a62cbea52',1,'TextBrowser']]], + ['getcolorschemeid_7',['getColorSchemeID',['../classTextBrowser.html#a70a2450945e1496ee285a3b7abd33c6c',1,'TextBrowser']]], + ['getcolorschemes_8',['getColorSchemes',['../namespaceColorSec.html#af087e0161d734f99e86fabde0e89814c',1,'ColorSec']]], + ['getconst_9',['getConst',['../structBlacklists.html#a278c426283cdf3128659a79a56613c5b',1,'Blacklists']]], + ['getcurrentlogformat_10',['getCurrentLogFormat',['../classCraplog.html#a0d35ae5254f94dafacb9416225ef9752',1,'Craplog']]], + ['getcurrentwebserver_11',['getCurrentWebServer',['../classCraplog.html#a3e63e280ac59d4712fab8ae529f8b919',1,'Craplog']]], + ['getdays_12',['getDays',['../classCrapview.html#a953574337d84ecc63082904b806f0149',1,'Crapview']]], + ['getdaytimecounts_13',['getDaytimeCounts',['../classDbQuery.html#aa2ef81698e34e36d20514823fa9d211b',1,'DbQuery']]], + ['getdbfield_14',['getDbField',['../classDbQuery.html#a5f652baa6d4a0af4177e5754edb99b21',1,'DbQuery::getDbField(const LogField fld) const'],['../classDbQuery.html#a5c6a8c4ea21e565c418e32eb90ff7d7c',1,'DbQuery::getDbField(QStringView tr_fld) const']]], + ['getdialogslevel_15',['getDialogsLevel',['../classCraplog.html#a8d70da9762053be0744d491c74a45c97',1,'Craplog::getDialogsLevel()'],['../classCrapview.html#a1501e7ecc7f0de57948a4d6ec73739e1',1,'Crapview::getDialogsLevel()']]], + ['getfont_16',['getFont',['../classTextBrowser.html#a6e31d189e6fa6f6b29d19b3b17a50f39',1,'TextBrowser']]], + ['getfontfamily_17',['getFontFamily',['../classTextBrowser.html#aea2b9d5a065ee625c2c530c3a833f8f2',1,'TextBrowser']]], + ['getglobalcounts_18',['getGlobalCounts',['../classDbQuery.html#a08061a6906bb027ebdee5a337482aba9',1,'DbQuery']]], + ['gethashesdatabasepath_19',['getHashesDatabasePath',['../classCraplog.html#a37cdeb09ed7af4c2c0072a2eeca01b1f',1,'Craplog']]], + ['gethours_20',['getHours',['../classCrapview.html#a7729561544e1a3d5e46748220843b678',1,'Crapview']]], + ['getiislogsample_21',['getIisLogSample',['../classFormatOps.html#ac2f8b6e0917e3393e2b3df3f1eefdb93',1,'FormatOps']]], + ['getitemscount_22',['getItemsCount',['../classDbQuery.html#a0199ea829fe90b7f9f392c35d9c73774',1,'DbQuery']]], + ['getlist_23',['getList',['../structBlacklists.html#a765e6fb9c9276dd9483002b73853da66',1,'Blacklists::getList()'],['../structWarnlists.html#ad66f3140dd314572780162c889c09910',1,'Warnlists::getList()']]], + ['getlistconst_24',['getListConst',['../structBlacklists.html#aaab71d2e4628a0b20302d580b8fb05ba',1,'Blacklists::getListConst()'],['../structWarnlists.html#a8b4dc9f42d6c40dc6fd457efa6120f7f',1,'Warnlists::getListConst()']]], + ['getlogfileitem_25',['getLogFileItem',['../classCraplog.html#a03f799378a10ef054239a6ae807a8759',1,'Craplog']]], + ['getlogsformat_26',['getLogsFormat',['../classCraplog.html#aac21533e0b7e0b679283eb705c0e02b6',1,'Craplog']]], + ['getlogsformatsample_27',['getLogsFormatSample',['../classCraplog.html#a12622a27780111b0b61c5e4d6abe8640',1,'Craplog']]], + ['getlogsformatstring_28',['getLogsFormatString',['../classCraplog.html#a16201b26843b82b44f0ea7bdca2640fb',1,'Craplog']]], + ['getlogslist_29',['getLogsList',['../classCraplog.html#a83c6473c9e3474eca227b55faca5eb32',1,'Craplog']]], + ['getlogslistsize_30',['getLogsListSize',['../classCraplog.html#a7a954060a71c18a515001b2f8dcb4a7e',1,'Craplog']]], + ['getlogspath_31',['getLogsPath',['../classCraplog.html#ae46e9afa61bb5ac8ed8d8af433a7eff6',1,'Craplog']]], + ['getminutegap_32',['getMinuteGap',['../classDbQuery.html#ad84db758810e989b8f61ac992d683f4a',1,'DbQuery']]], + ['getmonthdays_33',['getMonthDays',['../classDbQuery.html#a1ad1575ea0a9b5f3554e5d18bf0a3273',1,'DbQuery']]], + ['getmonthnumber_34',['getMonthNumber',['../classCrapview.html#a8cd3251788b5a81a024d67efedaa2787',1,'Crapview::getMonthNumber()'],['../classDbQuery.html#aab983801276d1ea9aca03390bc6e2ab1',1,'DbQuery::getMonthNumber()']]], + ['getmonths_35',['getMonths',['../classCrapview.html#ab04f8c6a4e5c057b8130127fc8b810dd',1,'Crapview']]], + ['getnginxlogsample_36',['getNginxLogSample',['../classFormatOps.html#a41c435c5a78c343059f57d4110cf2ac3',1,'FormatOps']]], + ['getparsedlines_37',['getParsedLines',['../classCraplog.html#a66861229e56b765a13f794f72072bb83',1,'Craplog']]], + ['getparsedsize_38',['getParsedSize',['../classCraplog.html#a75137d43a5b62838a2579417478656ec',1,'Craplog']]], + ['getparsingspeed_39',['getParsingSpeed',['../classCraplog.html#a044bc6cbc69da882b30a4ef6b6a7bd70',1,'Craplog']]], + ['getquery_40',['getQuery',['../classDatabaseWrapper.html#a2f2be3529a992ef261c3db9ae8a83776',1,'DatabaseWrapper']]], + ['getrelationalcountsday_41',['getRelationalCountsDay',['../classDbQuery.html#a40861d972e65c5c5ccdd7fab97b75352',1,'DbQuery']]], + ['getrelationalcountsperiod_42',['getRelationalCountsPeriod',['../classDbQuery.html#a39aec1ee108feecf392430e82a6bf339',1,'DbQuery']]], + ['getspeeddata_43',['getSpeedData',['../classDbQuery.html#a9b836475387a0ca70230d99b706ded6b',1,'DbQuery']]], + ['getspeedheadercolumns_44',['getSpeedHeaderColumns',['../classCrapview.html#a6138f094550da7542d144b10f77de54f',1,'Crapview']]], + ['getstatsdatabasepath_45',['getStatsDatabasePath',['../classCraplog.html#a2bae3469ee22f678bdbfa7d40b8cc384',1,'Craplog']]], + ['getstylesheet_46',['getStyleSheet',['../namespaceStyleSec.html#a04651d94220678bc33f38cbf25b52173',1,'StyleSec']]], + ['getwarnheadercolumns_47',['getWarnHeaderColumns',['../classCrapview.html#a05480368c32c29f19a10130bd7066f41',1,'Crapview']]], + ['getwarningsdata_48',['getWarningsData',['../classDbQuery.html#a803a3a10ec5318c337746928bfab4b98',1,'DbQuery']]], + ['getwarningsize_49',['getWarningSize',['../classCraplog.html#a02929f7e891c11b87549a052e9985fab',1,'Craplog']]], + ['getwidelinesusage_50',['getWideLinesUsage',['../classTextBrowser.html#a17ca5e2f3453ac5fcaf1643cbf6a2204',1,'TextBrowser']]], + ['getyears_51',['getYears',['../classCrapview.html#a73d54cba5cf55fe148ce2316f26343f9',1,'Crapview']]], + ['grow_52',['grow',['../classSnake.html#abe575cf3bd5b5d86a50029485d259ac4',1,'Snake']]] ]; diff --git a/docs/html/search/functions_7.js b/docs/html/search/functions_7.js index 5957f068..7773bca8 100644 --- a/docs/html/search/functions_7.js +++ b/docs/html/search/functions_7.js @@ -1,17 +1,8 @@ var searchData= [ - ['insertusedhashes_0',['insertUsedHashes',['../classHashOps.html#a01e13190474d56d18b6faa4f8a7f5cac',1,'HashOps']]], - ['intile_1',['intile',['../classFood.html#a1baa42d6f924ce2a37a2a97773fc57f6',1,'Food::inTile()'],['../classSnake.html#ab58698ed7c8d4c7b0a6cbfbb963c0225',1,'Snake::inTile()']]], - ['isalnum_2',['isalnum',['../namespaceStringOps.html#a19be2ecc13f0bacd98b5d2f5165ce8fd',1,'StringOps::isAlnum(std::string_view str)'],['../namespaceStringOps.html#ac2b7e457d07531e6e3d2ea90d2f7f88a',1,'StringOps::isAlnum(const char &chr)']]], - ['isalphabetic_3',['isalphabetic',['../namespaceStringOps.html#a4afc652a1086d1b90979623b2a00f46c',1,'StringOps::isAlphabetic(const char &chr)'],['../namespaceStringOps.html#a4796d3e899bf94b95b15c6b7ed732038',1,'StringOps::isAlphabetic(std::string_view str)']]], - ['isblacklistused_4',['isBlacklistUsed',['../classCraplog.html#a08bf8aba58cb6dd7a3c3058d5083c880',1,'Craplog']]], - ['isdir_5',['isDir',['../namespaceIOutils.html#ade1bc91ae81b60cf001fb3493e09bc80',1,'IOutils']]], - ['isfile_6',['isFile',['../namespaceIOutils.html#a3984b9eb866436c0c6774e95d2467dd4',1,'IOutils']]], - ['isfilenamevalid_7',['isFileNameValid',['../classCraplog.html#a46998f8199f8a1365936d987c1daf1da',1,'Craplog']]], - ['ishex_8',['isHex',['../namespaceStringOps.html#ab0a082513e31757e5d52e94ed10790c1',1,'StringOps']]], - ['isip_9',['isIP',['../namespaceStringOps.html#aec7605798fefecaf4a3085c536d96926',1,'StringOps']]], - ['isnumeric_10',['isnumeric',['../namespaceStringOps.html#a509440540926f13d148755e386991e12',1,'StringOps::isNumeric(const char &chr)'],['../namespaceStringOps.html#a1c268a2a07b9cf01bc1b64a19e531994',1,'StringOps::isNumeric(std::string_view str)']]], - ['isparsing_11',['isParsing',['../classCraplog.html#a500ecf845b2b7a3044ca7796efde7d17',1,'Craplog']]], - ['isselected_12',['isSelected',['../classLogFile.html#a53b9f791010c0f86e73189e8d3b03ec4',1,'LogFile']]], - ['iswarnlistused_13',['isWarnlistUsed',['../classCraplog.html#a92550bd6b6f85846d9c4db60e1a50316',1,'Craplog']]] + ['hasbeenused_0',['hasBeenUsed',['../classHashOps.html#a250921916c76fc68ec937efb51b2a320',1,'HashOps::hasBeenUsed()'],['../structLogFile.html#a9475b134af9544cbf64f77ac016fa76b',1,'LogFile::hasBeenUsed() const noexcept']]], + ['hash_1',['hash',['../structLogFile.html#aecc6fb679bf7597dfd468f1334d41bfa',1,'LogFile']]], + ['helplogsformat_2',['helpLogsFormat',['../classCraphelp.html#a8009bde7d0c58925bb8b9031fedf8429',1,'Craphelp']]], + ['helplogsformatdefault_3',['helpLogsFormatDefault',['../classCraphelp.html#a598d158441d903b6505b05c879f55aac',1,'Craphelp']]], + ['hireworker_4',['hireWorker',['../classCraplog.html#a138768b187a349bca1f92c5fbfe636e2',1,'Craplog']]] ]; diff --git a/docs/html/search/functions_8.js b/docs/html/search/functions_8.js index 414b9c22..d87aa9c6 100644 --- a/docs/html/search/functions_8.js +++ b/docs/html/search/functions_8.js @@ -1,4 +1,16 @@ var searchData= [ - ['joinloglines_0',['joinloglines',['../classCraplogParser.html#a0cab0465f65175011235f09fa0ff281d',1,'CraplogParser::joinLogLines()'],['../classCraplogParserAsync.html#acd02045ed712c28cd006ace69b1e998e',1,'CraplogParserAsync::joinLogLines()']]] + ['insertusedhashes_0',['insertUsedHashes',['../classHashOps.html#a1f1c1c6c832a9204c785e127f5963269',1,'HashOps']]], + ['intile_1',['inTile',['../classFood.html#a219ff9d1daabbb73146a10a8ed622489',1,'Food::inTile()'],['../classSnake.html#a9e3ab613da3b0d195b4524986c938824',1,'Snake::inTile()']]], + ['isalnum_2',['isAlnum',['../namespaceCharOps.html#a321f744c443f3bb74897f58ed727ae61',1,'CharOps::isAlnum()'],['../namespaceStringOps.html#ad454dc2033102bec1a8732f1a3f80924',1,'StringOps::isAlnum()']]], + ['isalphabetic_3',['isAlphabetic',['../namespaceCharOps.html#a445df1734b86daaabff2ec7cc4f8fe73',1,'CharOps::isAlphabetic()'],['../namespaceStringOps.html#a13682664452439d4c2005220c14946f9',1,'StringOps::isAlphabetic()']]], + ['isdir_4',['isDir',['../namespaceIOutils.html#a695b1fc2014fb9dc767b5690436d37f4',1,'IOutils']]], + ['isfile_5',['isFile',['../namespaceIOutils.html#af195dcc9d110796912c816cbeedda278',1,'IOutils']]], + ['isfilenamevalid_6',['isFileNameValid',['../classCraplog.html#a46998f8199f8a1365936d987c1daf1da',1,'Craplog']]], + ['ishex_7',['isHex',['../namespaceCharOps.html#a88bd887bc63ac2cc0c88b466a0f4a2d3',1,'CharOps']]], + ['isip_8',['isIP',['../namespaceCharOps.html#a47f3afa460f1cb12069cd7c8c6799e55',1,'CharOps::isIP()'],['../namespaceStringOps.html#a4f83a6579215a78d99bac4b367ed83c8',1,'StringOps::isIP()']]], + ['isnumeric_9',['isNumeric',['../namespaceCharOps.html#a12f22034684a12e43fb72da646fbea1c',1,'CharOps::isNumeric()'],['../namespaceStringOps.html#a801d90518317ee836aa03d8766bb3387',1,'StringOps::isNumeric(QStringView str) noexcept'],['../namespaceStringOps.html#a45689ca5732555d9a4066774b7479024',1,'StringOps::isNumeric(std::string_view str) noexcept']]], + ['isparsing_10',['isParsing',['../classCraplog.html#a69fbed93fe20701bcc76ce4f4d852949',1,'Craplog']]], + ['isselected_11',['isSelected',['../structLogFile.html#a34d7d221b860109370b0e60d2d43f218',1,'LogFile']]], + ['isused_12',['isUsed',['../structBlacklists.html#a35b6a9697f0e48b3f8567de2db327595',1,'Blacklists::isUsed()'],['../structBlacklist.html#a2607de4b062d5c7afb40d38bebb5d271',1,'Blacklist::isUsed()'],['../structWarnlist.html#ad47ef0ce8ec314ad2e10e76c0cd398e9',1,'Warnlist::isUsed()'],['../structWarnlists.html#a8911f4b2daf8443c0dbe1e6cacc92ee3',1,'Warnlists::isUsed()']]] ]; diff --git a/docs/html/search/functions_9.js b/docs/html/search/functions_9.js index 5119c199..df5d6dda 100644 --- a/docs/html/search/functions_9.js +++ b/docs/html/search/functions_9.js @@ -1,4 +1,4 @@ var searchData= [ - ['keypressevent_0',['keyPressEvent',['../classSnakeGame.html#a407dd2bae84d0f6572b94bb37feb87bc',1,'SnakeGame']]] + ['joinloglines_0',['joinLogLines',['../classCraplogParser.html#a0cab0465f65175011235f09fa0ff281d',1,'CraplogParser']]] ]; diff --git a/docs/html/search/functions_a.js b/docs/html/search/functions_a.js index f4f1a585..803cc175 100644 --- a/docs/html/search/functions_a.js +++ b/docs/html/search/functions_a.js @@ -1,7 +1,4 @@ var searchData= [ - ['list2string_0',['list2string',['../classMainWindow.html#a827a4bc119f8008df7605feaaefaecc8',1,'MainWindow']]], - ['loadusedhasheslists_1',['loadUsedHashesLists',['../classHashOps.html#a1184284b059b2094b0fc5cbbd1a2050b',1,'HashOps']]], - ['lstrip_2',['lstrip',['../namespaceStringOps.html#ac7a279927b232cce716d384ebf118301',1,'StringOps::lstrip(const std::string &str, const char chr)'],['../namespaceStringOps.html#a6f55e9f27e8933c6c8b982db99ec8cd0',1,'StringOps::lstrip(const std::string &str, std::string_view chars=" \n\t\b\r\v")']]], - ['lstripuntil_3',['lstripUntil',['../namespaceStringOps.html#a5bdf332c4414568e1e909703438ccccd',1,'StringOps']]] + ['keypressevent_0',['keyPressEvent',['../classSnakeGame.html#a5fc9e82584755f43b5fc07302c9715b8',1,'SnakeGame']]] ]; diff --git a/docs/html/search/functions_b.js b/docs/html/search/functions_b.js index 32d705fd..ad4e87ac 100644 --- a/docs/html/search/functions_b.js +++ b/docs/html/search/functions_b.js @@ -1,12 +1,8 @@ var searchData= [ - ['makechart_0',['makeChart',['../classCraplog.html#ae25af3f4bd279585cd28cd0c2b0785fc',1,'Craplog']]], - ['makedir_1',['makeDir',['../namespaceIOutils.html#a9f8aee8de3eeaca32a1b198c8befdd09',1,'IOutils']]], - ['makeinitialchecks_2',['makeInitialChecks',['../classMainWindow.html#ae459fb4a3966975abe641c11c76e2c03',1,'MainWindow']]], - ['makepreview_3',['makePreview',['../classTextBrowser.html#a9678c99090d67310690f6a1146d70c06',1,'TextBrowser']]], - ['menu_5factionenglishgb_5ftriggered_4',['menu_actionEnglishGb_triggered',['../classMainWindow.html#a42ea06a6c166e5c8243944d4e5159514',1,'MainWindow']]], - ['move_5',['move',['../classFood.html#a840b4ae09993aea111403617f56988d1',1,'Food']]], - ['msgdatabasecreated_6',['msgDatabaseCreated',['../classDialogSec.html#ae916458257088da13a1a2bc885d5c71d',1,'DialogSec']]], - ['msgnofiletoparse_7',['msgNoFileToParse',['../classDialogSec.html#a38d096b5d4d6cae9d0af6224ff4b6ba9',1,'DialogSec']]], - ['msgnotenoughmemory_8',['msgNotEnoughMemory',['../classDialogSec.html#a9f29d5f5fc2b8dd92ab94942c6162026',1,'DialogSec']]] + ['list2string_0',['list2string',['../classMainWindow.html#a827a4bc119f8008df7605feaaefaecc8',1,'MainWindow']]], + ['loadusedhasheslists_1',['loadUsedHashesLists',['../classHashOps.html#ad0b62ddfa2ed968c27e7fbeb58c21571',1,'HashOps']]], + ['loglinedata_2',['LogLineData',['../structLogLineData.html#a1392bc417abc4977770559415e3d6787',1,'LogLineData']]], + ['lstrip_3',['lstrip',['../namespaceStringOps.html#a280ef713ce56866656c018dcc2893c13',1,'StringOps::lstrip(const std::string &str, const char chr) noexcept'],['../namespaceStringOps.html#a2f035c3b92937b6417063843ae02bc10',1,'StringOps::lstrip(const std::string &str, const char *chars=" \n\t\b\r\v") noexcept']]], + ['lstripuntil_4',['lstripUntil',['../namespaceStringOps.html#a9a8a1c130c35c5746ec4b2288e338a6b',1,'StringOps']]] ]; diff --git a/docs/html/search/functions_c.js b/docs/html/search/functions_c.js index 2dc7651b..175a2559 100644 --- a/docs/html/search/functions_c.js +++ b/docs/html/search/functions_c.js @@ -1,5 +1,17 @@ var searchData= [ - ['name_0',['name',['../classMainSlice.html#adda5fecbc9d60f8d6367f187fd4f6c0f',1,'MainSlice::name()'],['../classLogFile.html#a9f111ec006ab719abf8b0034dee3eb94',1,'LogFile::name()']]], - ['nextturn_1',['nextTurn',['../classCrissCross.html#acb1ca7cc584c4c2e21e94d88c794c06a',1,'CrissCross']]] + ['makechart_0',['makeChart',['../classCraplog.html#ae25af3f4bd279585cd28cd0c2b0785fc',1,'Craplog']]], + ['makedir_1',['makeDir',['../namespaceIOutils.html#abe5347509aa1fcb426861343357e5eab',1,'IOutils']]], + ['makeinitialchecks_2',['makeInitialChecks',['../classMainWindow.html#ae459fb4a3966975abe641c11c76e2c03',1,'MainWindow']]], + ['makepreview_3',['makePreview',['../classTextBrowser.html#ac00475774beaefffd6de8b256324e4a3',1,'TextBrowser']]], + ['menu_5factionenglishgb_5ftriggered_4',['menu_actionEnglishGb_triggered',['../classMainWindow.html#a42ea06a6c166e5c8243944d4e5159514',1,'MainWindow']]], + ['move_5',['move',['../classFood.html#a840b4ae09993aea111403617f56988d1',1,'Food']]], + ['movedown_6',['moveDown',['../structBlacklistItem.html#afafef5debfccc84bc91be9ff9a46b07e',1,'BlacklistItem::moveDown()'],['../structWarnlistItem.html#ad270f5384ea36f86cb327cfc31cf3746',1,'WarnlistItem::moveDown()']]], + ['movedownitem_7',['moveDownItem',['../structBlacklists.html#a246fcbea72644025fbf4ed292dfc335e',1,'Blacklists::moveDownItem()'],['../structWarnlists.html#ae18bc3cd0eade0fd26851ddf6e1c0517',1,'Warnlists::moveDownItem()']]], + ['moveup_8',['moveUp',['../structBlacklistItem.html#af9e76418fe25c114b537352456b5571b',1,'BlacklistItem::moveUp()'],['../structWarnlistItem.html#a0e9e4d4626ea03fcd8c115c3c030664f',1,'WarnlistItem::moveUp()']]], + ['moveupitem_9',['moveUpItem',['../structBlacklists.html#a7ccb7bae9be9103f15bd42f97d888794',1,'Blacklists::moveUpItem()'],['../structWarnlists.html#aab298472f4f55f7e9e1decbdb3cc27a8',1,'Warnlists::moveUpItem()']]], + ['msgdatabasecreated_10',['msgDatabaseCreated',['../classDialogSec.html#ae916458257088da13a1a2bc885d5c71d',1,'DialogSec']]], + ['msgnodataforstats_11',['msgNoDataForStats',['../classDialogSec.html#aea11eccbd5c524f3d97a44346a4f4ef1',1,'DialogSec']]], + ['msgnofiletoparse_12',['msgNoFileToParse',['../classDialogSec.html#a38d096b5d4d6cae9d0af6224ff4b6ba9',1,'DialogSec']]], + ['msgnotenoughmemory_13',['msgNotEnoughMemory',['../classDialogSec.html#a9f29d5f5fc2b8dd92ab94942c6162026',1,'DialogSec']]] ]; diff --git a/docs/html/search/functions_d.js b/docs/html/search/functions_d.js index 1411cd4b..5b8054a5 100644 --- a/docs/html/search/functions_d.js +++ b/docs/html/search/functions_d.js @@ -1,13 +1,5 @@ var searchData= [ - ['on_5fbutton_5fabort_5fclicked_0',['on_button_ABORT_clicked',['../classDialogIda.html#abaa1d199027836036ec2c94b5929d646',1,'DialogIda']]], - ['on_5fbutton_5fdiscard_5fclicked_1',['on_button_DISCARD_clicked',['../classDialogIda.html#aae5be98bcf0b956fbf888d3a37e53ab4',1,'DialogIda']]], - ['on_5fbutton_5ffontsize_5fminus_5fclicked_2',['on_button_FontSize_Minus_clicked',['../classCrapnote.html#acdcd9cf3e007d9c60aa2f1449798a0ae',1,'Crapnote']]], - ['on_5fbutton_5ffontsize_5fplus_5fclicked_3',['on_button_FontSize_Plus_clicked',['../classCrapnote.html#a0939b6b9916b5719ea9c55d40659b83b',1,'Crapnote']]], - ['on_5fbutton_5fignore_5fclicked_4',['on_button_IGNORE_clicked',['../classDialogIda.html#afa205f8d7ebff6aa954486623f869625',1,'DialogIda']]], - ['on_5fbutton_5fno_5fclicked_5',['on_button_NO_clicked',['../classDialogBool.html#a718195dfd76ecefd349333cfd82dc1cc',1,'DialogBool']]], - ['on_5fbutton_5fok_5fclicked_6',['on_button_ok_clicked',['../classGameDialog.html#a4c8590ce276d5ead2a9e8b55ae0aaee9',1,'GameDialog::on_button_Ok_clicked()'],['../classDialogMsg.html#a14ce87023686cac4cf700e0283073058',1,'DialogMsg::on_button_Ok_clicked()']]], - ['on_5fbutton_5fshowadditional_5fclicked_7',['on_button_ShowAdditional_clicked',['../classDialogMsg.html#aa273ea069307de059183e8d2b7a2f7ef',1,'DialogMsg']]], - ['on_5fbutton_5fyes_5fclicked_8',['on_button_YES_clicked',['../classDialogBool.html#a14f2fcaac67126b4411bd4a78768809e',1,'DialogBool']]], - ['on_5fspinbox_5ffontsize_5fvaluechanged_9',['on_spinBox_FontSize_valueChanged',['../classCrapnote.html#a3eb5f7525b474fb46c15d383ee9b1d6a',1,'Crapnote']]] + ['name_0',['name',['../classMainSlice.html#adda5fecbc9d60f8d6367f187fd4f6c0f',1,'MainSlice::name()'],['../structLogFile.html#a25335833b38adfa35eacfc89364a10ae',1,'LogFile::name()'],['../classDatabaseWrapper.html#ade3b83c398b2c1858ab3e081ba211fd3',1,'DatabaseWrapper::name()']]], + ['nextturn_1',['nextTurn',['../classCrissCross.html#acb1ca7cc584c4c2e21e94d88c794c06a',1,'CrissCross']]] ]; diff --git a/docs/html/search/functions_e.js b/docs/html/search/functions_e.js index ca592384..22a32bfd 100644 --- a/docs/html/search/functions_e.js +++ b/docs/html/search/functions_e.js @@ -1,21 +1,22 @@ var searchData= [ - ['parentpath_0',['parentPath',['../classMainWindow.html#ac3452e2e67a77eacb256b13a7c9da509',1,'MainWindow']]], - ['parsebooleanfilter_1',['parseBooleanFilter',['../namespaceFilterOps.html#a4b728f136c8d0a426d63a0623a1cb6ef',1,'FilterOps']]], - ['parseloglines_2',['parseloglines',['../classCraplogParser.html#a4e19f3c1f8478b545da627339d5bd9c0',1,'CraplogParser::parseLogLines()'],['../classCraplogParserAsync.html#af5796e6a2496181cba67553b85eea75b',1,'CraplogParserAsync::parseLogLines()']]], - ['parsenull_3',['parseNull',['../namespaceFilterOps.html#aa2fcb54edc4a3aaf714a93cce838e402',1,'FilterOps']]], - ['parsenumericfilter_4',['parseNumericFilter',['../namespaceFilterOps.html#a769cc8db3a66caa781f1202e240f63d9',1,'FilterOps']]], - ['parsetextualfilter_5',['parseTextualFilter',['../namespaceFilterOps.html#a96b7a20b1852856178c7acc77ed2dddc',1,'FilterOps']]], - ['path_6',['path',['../classLogFile.html#a8633ce15a023fa3a9635d6c5e3aa18ad',1,'LogFile']]], - ['printablebool_7',['printableBool',['../namespacePrintSec.html#a757da65e9e69fe92b1a677393bbd176c',1,'PrintSec']]], - ['printabledate_8',['printableDate',['../namespacePrintSec.html#aa08609bc4114a78ff8dc565a819ede9f',1,'PrintSec']]], - ['printablesize_9',['printableSize',['../namespacePrintSec.html#a9a6160d4d72a5764dc84e9cb41acf82d',1,'PrintSec']]], - ['printablespeed_10',['printableSpeed',['../namespacePrintSec.html#a69f00f7787fe0cd1f172675f345e7f3f',1,'PrintSec']]], - ['printabletime_11',['printabletime',['../namespacePrintSec.html#a0588ba76f1513953e3579c4d58dd49e6',1,'PrintSec::printableTime(const unsigned seconds)'],['../namespacePrintSec.html#a6fa65a1ca094c1eeadea8afe24fc8342',1,'PrintSec::printableTime(const int hour, const int minute, const int second)']]], - ['processapacheformatstring_12',['processApacheFormatString',['../classFormatOps.html#a156fe7cba5df1112b3da21af52375105',1,'FormatOps']]], - ['processdatetime_13',['processDateTime',['../namespaceDateTimeOps.html#aafa474c70055cb7c0d3d41a3e13588c5',1,'DateTimeOps']]], - ['processgamelogic_14',['processGameLogic',['../classSnakeGame.html#aeaa13da59d09abc40e25fd769fb96963',1,'SnakeGame']]], - ['processiisformatstring_15',['processIisFormatString',['../classFormatOps.html#af13ee22fb0e76ca90fcc358622374f64',1,'FormatOps']]], - ['processnextkeyevent_16',['processNextKeyEvent',['../classSnakeGame.html#a0b0c9d7567a8e352449ddc7b31e09851',1,'SnakeGame']]], - ['processnginxformatstring_17',['processNginxFormatString',['../classFormatOps.html#afd175180e69aa5784bfb2ec2911bedc3',1,'FormatOps']]] + ['on_5fbutton_5fabort_5fclicked_0',['on_button_ABORT_clicked',['../classDialogIda.html#abaa1d199027836036ec2c94b5929d646',1,'DialogIda']]], + ['on_5fbutton_5fdiscard_5fclicked_1',['on_button_DISCARD_clicked',['../classDialogIda.html#aae5be98bcf0b956fbf888d3a37e53ab4',1,'DialogIda']]], + ['on_5fbutton_5ffontsize_5fminus_5fclicked_2',['on_button_FontSize_Minus_clicked',['../classCrapnote.html#acdcd9cf3e007d9c60aa2f1449798a0ae',1,'Crapnote']]], + ['on_5fbutton_5ffontsize_5fplus_5fclicked_3',['on_button_FontSize_Plus_clicked',['../classCrapnote.html#a0939b6b9916b5719ea9c55d40659b83b',1,'Crapnote']]], + ['on_5fbutton_5fignore_5fclicked_4',['on_button_IGNORE_clicked',['../classDialogIda.html#afa205f8d7ebff6aa954486623f869625',1,'DialogIda']]], + ['on_5fbutton_5fno_5fclicked_5',['on_button_NO_clicked',['../classDialogBool.html#a718195dfd76ecefd349333cfd82dc1cc',1,'DialogBool']]], + ['on_5fbutton_5fok_5fclicked_6',['on_button_Ok_clicked',['../classGameDialog.html#a4c8590ce276d5ead2a9e8b55ae0aaee9',1,'GameDialog::on_button_Ok_clicked()'],['../classDialogMsg.html#a14ce87023686cac4cf700e0283073058',1,'DialogMsg::on_button_Ok_clicked()']]], + ['on_5fbutton_5fshowadditional_5fclicked_7',['on_button_ShowAdditional_clicked',['../classDialogMsg.html#aa273ea069307de059183e8d2b7a2f7ef',1,'DialogMsg']]], + ['on_5fbutton_5fyes_5fclicked_8',['on_button_YES_clicked',['../classDialogBool.html#a14f2fcaac67126b4411bd4a78768809e',1,'DialogBool']]], + ['on_5fspinbox_5ffontsize_5fvaluechanged_9',['on_spinBox_FontSize_valueChanged',['../classCrapnote.html#a3eb5f7525b474fb46c15d383ee9b1d6a',1,'Crapnote']]], + ['open_10',['open',['../classDatabaseWrapper.html#ad11a5e3cae9ed434fe5a679bf5933959',1,'DatabaseWrapper']]], + ['opennew_11',['openNew',['../classDatabaseWrapper.html#abe1fe691a3db606548f5ff6f73d65fe6',1,'DatabaseWrapper']]], + ['operator_20bool_12',['operator bool',['../structFieldData.html#abfa6f1648c4d52d39a0e8f43b80b3f7e',1,'FieldData']]], + ['operator_28_29_13',['operator()',['../classQueryWrapper.html#aec4dfb7a80d9aec36558c0fe4fa1b965',1,'QueryWrapper::operator()()'],['../classQueryWrapper.html#a85cc8b57bcab826daa43259430459ea9',1,'QueryWrapper::operator()(const QString &text)']]], + ['operator_2a_14',['operator*',['../structFieldData.html#a853704911d3bcee3f3865fe722056610',1,'FieldData::operator*()'],['../classDatabaseWrapper.html#aeab87f7a742c3f012ee97301c4d9e15b',1,'DatabaseWrapper::operator*()']]], + ['operator_2b_15',['operator+',['../structFieldData.html#a257de3f5b462d2ff400026f96ad9419b',1,'FieldData']]], + ['operator_2d_3e_16',['operator->',['../classDatabaseWrapper.html#a97a1a453df4e9e0b26fb63646e8e4042',1,'DatabaseWrapper::operator->()'],['../classQueryWrapper.html#a312022fbdf046f2ad0aa8275fb86a681',1,'QueryWrapper::operator->() noexcept']]], + ['operator_3c_3c_17',['operator<<',['../classQueryWrapper.html#a70470621ad3d09fdd03b6e34739e906c',1,'QueryWrapper::operator<<(const char *text) noexcept'],['../classQueryWrapper.html#a0db067a19a382998bcdd7c68802640fe',1,'QueryWrapper::operator<<(const QString &text) noexcept']]], + ['operator_5b_5d_18',['operator[]',['../classQueryWrapper.html#a9f10f5f05acc82ea4136143a2655df9d',1,'QueryWrapper']]] ]; diff --git a/docs/html/search/functions_f.js b/docs/html/search/functions_f.js index fb5dc557..a92a7eeb 100644 --- a/docs/html/search/functions_f.js +++ b/docs/html/search/functions_f.js @@ -1,17 +1,20 @@ var searchData= [ - ['randomlines_0',['randomLines',['../namespaceIOutils.html#aa52ebe237d181752064409cf0623a135',1,'IOutils']]], - ['readconfigs_1',['readConfigs',['../classMainWindow.html#aae306cbf256c5a686cc8d9f2a1dbb18b',1,'MainWindow']]], - ['readfile_2',['readfile',['../namespaceGZutils.html#a72f6960bddea2b816af84e7773d5c6b2',1,'GZutils::readFile()'],['../namespaceIOutils.html#a185c38eff9d9f4432c8138404941915e',1,'IOutils::readFile()']]], - ['recalculateangles_3',['recalculateAngles',['../classDonutBreakdown.html#acd747ee2bbd23ce84eaf9d4db57938e3',1,'DonutBreakdown']]], - ['refreshdates_4',['refreshdates',['../classCrapview.html#ac98b1cbc75604b5145b5cff36e96eb78',1,'Crapview::refreshDates()'],['../classDbQuery.html#a6739efb23d825be9585b773685382e41',1,'DbQuery::refreshDates()']]], - ['refreshstatsdates_5',['refreshStatsDates',['../classMainWindow.html#ac8f4c84b43d14b6dcc6cb7b5f75ce343',1,'MainWindow']]], - ['renameascopy_6',['renameAsCopy',['../namespaceIOutils.html#a5d2d1f6669cc9d355add7a41adf38d81',1,'IOutils']]], - ['replace_7',['replace',['../namespaceStringOps.html#a93a957fa06709c3c66fdd331bbdfdcdc',1,'StringOps']]], - ['requesttimeout_8',['requestTimeout',['../classCrapup.html#afe79a787fc0820afbc4573ca7091d880',1,'Crapup']]], - ['resolvepath_9',['resolvePath',['../classMainWindow.html#ac456e2e1b4211836e83d3111a8bdf84e',1,'MainWindow']]], - ['richlogsdefault_10',['richLogsDefault',['../classRichText.html#a28bf0bdd659cc7b7a58eab9e5cfad495',1,'RichText']]], - ['richlogsfailure_11',['richLogsFailure',['../classRichText.html#a6e5fe6270e6fed0b9e7c42eafc9b4732',1,'RichText']]], - ['rotateimg_12',['rotateImg',['../classCrapup.html#a334624ab394fd773b0e6063e7baf7960',1,'Crapup']]], - ['rstrip_13',['rstrip',['../namespaceStringOps.html#a6ad9c0c897030d7c4c22f290348f9dd8',1,'StringOps::rstrip(const std::string &str, const char chr)'],['../namespaceStringOps.html#ae3109bdbff72270bc05d9e43cbf4ed63',1,'StringOps::rstrip(const std::string &str, std::string_view chars=" \n\t\b\r\v")']]] + ['parentpath_0',['parentPath',['../classMainWindow.html#ac3452e2e67a77eacb256b13a7c9da509',1,'MainWindow']]], + ['parseloglines_1',['parseLogLines',['../classCraplogParser.html#a4e19f3c1f8478b545da627339d5bd9c0',1,'CraplogParser']]], + ['parsenull_2',['parseNull',['../namespaceFilterOps.html#ad449b93d8e58de036346517703377b37',1,'FilterOps']]], + ['parsenumericfilter_3',['parseNumericFilter',['../namespaceFilterOps.html#a40ab225c11f101691f403a178f2ec40a',1,'FilterOps']]], + ['parsetextualfilter_4',['parseTextualFilter',['../namespaceFilterOps.html#a26985f50b033b0185b53d97d782777dc',1,'FilterOps']]], + ['path_5',['path',['../structLogFile.html#a66f157f5a1a8f589e3589ec4c6e1339d',1,'LogFile']]], + ['printablebool_6',['printableBool',['../namespacePrintSec.html#a4740c8b66e8608489309d8aa11826d14',1,'PrintSec']]], + ['printabledate_7',['printableDate',['../namespacePrintSec.html#aafb3b1700d8287c148f731c8e996ce32',1,'PrintSec']]], + ['printablesize_8',['printableSize',['../namespacePrintSec.html#a403edb539662a165dd79f5756ded42e4',1,'PrintSec']]], + ['printablespeed_9',['printableSpeed',['../namespacePrintSec.html#a4a6a0bc389a6ffb47bfcc6c9dbb70602',1,'PrintSec']]], + ['printabletime_10',['printableTime',['../namespacePrintSec.html#aff2f11c41388c7bf69dd356e0c8ca684',1,'PrintSec::printableTime(const unsigned seconds) noexcept'],['../namespacePrintSec.html#a4effe535f84fd9f38c2103ff574def5c',1,'PrintSec::printableTime(const int hour, const int minute, const int second) noexcept']]], + ['processapacheformatstring_11',['processApacheFormatString',['../classFormatOps.html#a156fe7cba5df1112b3da21af52375105',1,'FormatOps']]], + ['processdatetime_12',['processDateTime',['../namespaceDateTimeOps.html#ad17a4cbaa6d80857a134ecc9db50d761',1,'DateTimeOps']]], + ['processgamelogic_13',['processGameLogic',['../classSnakeGame.html#aeaa13da59d09abc40e25fd769fb96963',1,'SnakeGame']]], + ['processiisformatstring_14',['processIisFormatString',['../classFormatOps.html#a97dfe752848f74025a022ebea3e7cf8c',1,'FormatOps']]], + ['processnextkeyevent_15',['processNextKeyEvent',['../classSnakeGame.html#a1c5701b13d56599b6ece295a4a091e40',1,'SnakeGame']]], + ['processnginxformatstring_16',['processNginxFormatString',['../classFormatOps.html#afd175180e69aa5784bfb2ec2911bedc3',1,'FormatOps']]] ]; diff --git a/docs/html/search/namespaces_0.js b/docs/html/search/namespaces_0.js index 6d1bc83f..4120c37b 100644 --- a/docs/html/search/namespaces_0.js +++ b/docs/html/search/namespaces_0.js @@ -1,5 +1,4 @@ var searchData= [ - ['checksec_0',['CheckSec',['../namespaceCheckSec.html',1,'']]], - ['colorsec_1',['ColorSec',['../namespaceColorSec.html',1,'']]] + ['arrayops_0',['ArrayOps',['../namespaceArrayOps.html',1,'']]] ]; diff --git a/docs/html/search/namespaces_1.js b/docs/html/search/namespaces_1.js index c320c526..50c6f019 100644 --- a/docs/html/search/namespaces_1.js +++ b/docs/html/search/namespaces_1.js @@ -1,4 +1,4 @@ var searchData= [ - ['datetimeops_0',['DateTimeOps',['../namespaceDateTimeOps.html',1,'']]] + ['bwutils_0',['BWutils',['../namespaceBWutils.html',1,'']]] ]; diff --git a/docs/html/search/namespaces_2.js b/docs/html/search/namespaces_2.js index ff92c0c4..54e30cbc 100644 --- a/docs/html/search/namespaces_2.js +++ b/docs/html/search/namespaces_2.js @@ -1,4 +1,6 @@ var searchData= [ - ['filterops_0',['FilterOps',['../namespaceFilterOps.html',1,'']]] + ['charops_0',['CharOps',['../namespaceCharOps.html',1,'']]], + ['checksec_1',['CheckSec',['../namespaceCheckSec.html',1,'']]], + ['colorsec_2',['ColorSec',['../namespaceColorSec.html',1,'']]] ]; diff --git a/docs/html/search/namespaces_3.js b/docs/html/search/namespaces_3.js index 212fa9ea..176c8c58 100644 --- a/docs/html/search/namespaces_3.js +++ b/docs/html/search/namespaces_3.js @@ -1,5 +1,6 @@ var searchData= [ - ['globalconfigs_0',['GlobalConfigs',['../namespaceGlobalConfigs.html',1,'']]], - ['gzutils_1',['GZutils',['../namespaceGZutils.html',1,'']]] + ['databasesconnections_0',['DatabasesConnections',['../namespaceDatabasesConnections.html',1,'']]], + ['databasesnames_1',['DatabasesNames',['../namespaceDatabasesNames.html',1,'']]], + ['datetimeops_2',['DateTimeOps',['../namespaceDateTimeOps.html',1,'']]] ]; diff --git a/docs/html/search/namespaces_4.js b/docs/html/search/namespaces_4.js index bde872b6..ff92c0c4 100644 --- a/docs/html/search/namespaces_4.js +++ b/docs/html/search/namespaces_4.js @@ -1,4 +1,4 @@ var searchData= [ - ['ioutils_0',['IOutils',['../namespaceIOutils.html',1,'']]] + ['filterops_0',['FilterOps',['../namespaceFilterOps.html',1,'']]] ]; diff --git a/docs/html/search/namespaces_5.js b/docs/html/search/namespaces_5.js index 58eab990..212fa9ea 100644 --- a/docs/html/search/namespaces_5.js +++ b/docs/html/search/namespaces_5.js @@ -1,4 +1,5 @@ var searchData= [ - ['logops_0',['LogOps',['../namespaceLogOps.html',1,'']]] + ['globalconfigs_0',['GlobalConfigs',['../namespaceGlobalConfigs.html',1,'']]], + ['gzutils_1',['GZutils',['../namespaceGZutils.html',1,'']]] ]; diff --git a/docs/html/search/namespaces_6.js b/docs/html/search/namespaces_6.js index 9a9bc3ba..bde872b6 100644 --- a/docs/html/search/namespaces_6.js +++ b/docs/html/search/namespaces_6.js @@ -1,4 +1,4 @@ var searchData= [ - ['memops_0',['MemOps',['../namespaceMemOps.html',1,'']]] + ['ioutils_0',['IOutils',['../namespaceIOutils.html',1,'']]] ]; diff --git a/docs/html/search/namespaces_7.js b/docs/html/search/namespaces_7.js index 5759f924..58eab990 100644 --- a/docs/html/search/namespaces_7.js +++ b/docs/html/search/namespaces_7.js @@ -1,4 +1,4 @@ var searchData= [ - ['printsec_0',['PrintSec',['../namespacePrintSec.html',1,'']]] + ['logops_0',['LogOps',['../namespaceLogOps.html',1,'']]] ]; diff --git a/docs/html/search/namespaces_8.js b/docs/html/search/namespaces_8.js index 63e96435..9a9bc3ba 100644 --- a/docs/html/search/namespaces_8.js +++ b/docs/html/search/namespaces_8.js @@ -1,5 +1,4 @@ var searchData= [ - ['stringops_0',['StringOps',['../namespaceStringOps.html',1,'']]], - ['stylesec_1',['StyleSec',['../namespaceStyleSec.html',1,'']]] + ['memops_0',['MemOps',['../namespaceMemOps.html',1,'']]] ]; diff --git a/docs/html/search/namespaces_9.js b/docs/html/search/namespaces_9.js index 73c3b53f..5759f924 100644 --- a/docs/html/search/namespaces_9.js +++ b/docs/html/search/namespaces_9.js @@ -1,4 +1,4 @@ var searchData= [ - ['testing_0',['Testing',['../namespaceTesting.html',1,'']]] + ['printsec_0',['PrintSec',['../namespacePrintSec.html',1,'']]] ]; diff --git a/docs/html/search/namespaces_a.js b/docs/html/search/namespaces_a.js index 0dc43570..63e96435 100644 --- a/docs/html/search/namespaces_a.js +++ b/docs/html/search/namespaces_a.js @@ -1,4 +1,5 @@ var searchData= [ - ['vecops_0',['VecOps',['../namespaceVecOps.html',1,'']]] + ['stringops_0',['StringOps',['../namespaceStringOps.html',1,'']]], + ['stylesec_1',['StyleSec',['../namespaceStyleSec.html',1,'']]] ]; diff --git a/docs/html/search/namespaces_b.js b/docs/html/search/namespaces_b.js new file mode 100644 index 00000000..73c3b53f --- /dev/null +++ b/docs/html/search/namespaces_b.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['testing_0',['Testing',['../namespaceTesting.html',1,'']]] +]; diff --git a/docs/html/search/namespaces_c.js b/docs/html/search/namespaces_c.js new file mode 100644 index 00000000..0dc43570 --- /dev/null +++ b/docs/html/search/namespaces_c.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['vecops_0',['VecOps',['../namespaceVecOps.html',1,'']]] +]; diff --git a/docs/html/search/pages_0.js b/docs/html/search/pages_0.js new file mode 100644 index 00000000..feadd945 --- /dev/null +++ b/docs/html/search/pages_0.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['list_0',['Todo List',['../todo.html',1,'']]] +]; diff --git a/docs/html/search/pages_1.js b/docs/html/search/pages_1.js new file mode 100644 index 00000000..83220efb --- /dev/null +++ b/docs/html/search/pages_1.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['todo_20list_0',['Todo List',['../todo.html',1,'']]] +]; diff --git a/docs/html/search/related_0.js b/docs/html/search/related_0.js new file mode 100644 index 00000000..48aca297 --- /dev/null +++ b/docs/html/search/related_0.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['operator_2b_0',['operator+',['../structFieldData.html#af7b8913cf071ffac7cbaf2a515546959',1,'FieldData']]] +]; diff --git a/docs/html/search/search.js b/docs/html/search/search.js index 6fd40c67..666af01e 100644 --- a/docs/html/search/search.js +++ b/docs/html/search/search.js @@ -22,58 +22,9 @@ @licend The above is the entire license notice for the JavaScript code in this file */ -function convertToId(search) -{ - var result = ''; - for (i=0;i document.getElementById("MSearchField"); + this.DOMSearchSelect = () => document.getElementById("MSearchSelect"); + this.DOMSearchSelectWindow = () => document.getElementById("MSearchSelectWindow"); + this.DOMPopupSearchResults = () => document.getElementById("MSearchResults"); + this.DOMPopupSearchResultsWindow = () => document.getElementById("MSearchResultsWindow"); + this.DOMSearchClose = () => document.getElementById("MSearchClose"); + this.DOMSearchBox = () => document.getElementById("MSearchBox"); // ------------ Event Handlers // Called when focus is added or removed from the search field. - this.OnSearchFieldFocus = function(isActive) - { + this.OnSearchFieldFocus = function(isActive) { this.Activate(isActive); } - this.OnSearchSelectShow = function() - { - var searchSelectWindow = this.DOMSearchSelectWindow(); - var searchField = this.DOMSearchSelect(); + this.OnSearchSelectShow = function() { + const searchSelectWindow = this.DOMSearchSelectWindow(); + const searchField = this.DOMSearchSelect(); - var left = getXPos(searchField); - var top = getYPos(searchField); - top += searchField.offsetHeight; + const left = getXPos(searchField); + const top = getYPos(searchField) + searchField.offsetHeight; // show search selection popup searchSelectWindow.style.display='block'; @@ -146,55 +102,43 @@ function SearchBox(name, resultsPath, extension) searchSelectWindow.style.top = top + 'px'; // stop selection hide timer - if (this.hideTimeout) - { + if (this.hideTimeout) { clearTimeout(this.hideTimeout); this.hideTimeout=0; } return false; // to avoid "image drag" default event } - this.OnSearchSelectHide = function() - { + this.OnSearchSelectHide = function() { this.hideTimeout = setTimeout(this.CloseSelectionWindow.bind(this), this.closeSelectionTimeout); } // Called when the content of the search field is changed. - this.OnSearchFieldChange = function(evt) - { - if (this.keyTimeout) // kill running timer - { + this.OnSearchFieldChange = function(evt) { + if (this.keyTimeout) { // kill running timer clearTimeout(this.keyTimeout); this.keyTimeout = 0; } - var e = (evt) ? evt : window.event; // for IE - if (e.keyCode==40 || e.keyCode==13) - { - if (e.shiftKey==1) - { + const e = evt ? evt : window.event; // for IE + if (e.keyCode==40 || e.keyCode==13) { + if (e.shiftKey==1) { this.OnSearchSelectShow(); - var win=this.DOMSearchSelectWindow(); - for (i=0;i do a search - { + const searchValue = this.DOMSearchField().value.replace(/ +/g, ""); + if (searchValue!="" && this.searchActive) { // something was found -> do a search this.Search(); } } - this.OnSearchSelectKey = function(evt) - { - var e = (evt) ? evt : window.event; // for IE - if (e.keyCode==40 && this.searchIndex0) // Up - { + } else if (e.keyCode==38 && this.searchIndex>0) { // Up this.searchIndex--; this.OnSelectItem(this.searchIndex); - } - else if (e.keyCode==13 || e.keyCode==27) - { + } else if (e.keyCode==13 || e.keyCode==27) { e.stopPropagation(); this.OnSelectItem(this.searchIndex); this.CloseSelectionWindow(); @@ -301,82 +239,75 @@ function SearchBox(name, resultsPath, extension) // --------- Actions // Closes the results window. - this.CloseResultsWindow = function() - { + this.CloseResultsWindow = function() { this.DOMPopupSearchResultsWindow().style.display = 'none'; this.DOMSearchClose().style.display = 'none'; this.Activate(false); } - this.CloseSelectionWindow = function() - { + this.CloseSelectionWindow = function() { this.DOMSearchSelectWindow().style.display = 'none'; } // Performs a search. - this.Search = function() - { + this.Search = function() { this.keyTimeout = 0; // strip leading whitespace - var searchValue = this.DOMSearchField().value.replace(/^ +/, ""); + const searchValue = this.DOMSearchField().value.replace(/^ +/, ""); - var code = searchValue.toLowerCase().charCodeAt(0); - var idxChar = searchValue.substr(0, 1).toLowerCase(); - if ( 0xD800 <= code && code <= 0xDBFF && searchValue > 1) // surrogate pair - { + const code = searchValue.toLowerCase().charCodeAt(0); + let idxChar = searchValue.substr(0, 1).toLowerCase(); + if ( 0xD800 <= code && code <= 0xDBFF && searchValue > 1) { // surrogate pair idxChar = searchValue.substr(0, 2); } - var jsFile; - - var idx = indexSectionsWithContent[this.searchIndex].indexOf(idxChar); - if (idx!=-1) - { - var hexCode=idx.toString(16); - jsFile = this.resultsPath + indexSectionNames[this.searchIndex] + '_' + hexCode + '.js'; + let jsFile; + let idx = indexSectionsWithContent[this.searchIndex].indexOf(idxChar); + if (idx!=-1) { + const hexCode=idx.toString(16); + jsFile = this.resultsPath + indexSectionNames[this.searchIndex] + '_' + hexCode + '.js'; } - var loadJS = function(url, impl, loc){ - var scriptTag = document.createElement('script'); + const loadJS = function(url, impl, loc) { + const scriptTag = document.createElement('script'); scriptTag.src = url; scriptTag.onload = impl; scriptTag.onreadystatechange = impl; loc.appendChild(scriptTag); } - var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); - var domSearchBox = this.DOMSearchBox(); - var domPopupSearchResults = this.DOMPopupSearchResults(); - var domSearchClose = this.DOMSearchClose(); - var resultsPath = this.resultsPath; + const domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); + const domSearchBox = this.DOMSearchBox(); + const domPopupSearchResults = this.DOMPopupSearchResults(); + const domSearchClose = this.DOMSearchClose(); + const resultsPath = this.resultsPath; - var handleResults = function() { + const handleResults = function() { document.getElementById("Loading").style.display="none"; if (typeof searchData !== 'undefined') { createResults(resultsPath); document.getElementById("NoMatches").style.display="none"; } - + if (idx!=-1) { searchResults.Search(searchValue); } else { // no file with search results => force empty search results searchResults.Search('===='); } - if (domPopupSearchResultsWindow.style.display!='block') - { + if (domPopupSearchResultsWindow.style.display!='block') { domSearchClose.style.display = 'inline-block'; - var left = getXPos(domSearchBox) + 150; - var top = getYPos(domSearchBox) + 20; + let left = getXPos(domSearchBox) + 150; + let top = getYPos(domSearchBox) + 20; domPopupSearchResultsWindow.style.display = 'block'; left -= domPopupSearchResults.offsetWidth; - var maxWidth = document.body.clientWidth; - var maxHeight = document.body.clientHeight; - var width = 300; + const maxWidth = document.body.clientWidth; + const maxHeight = document.body.clientHeight; + let width = 300; if (left<10) left=10; if (width+left+8>maxWidth) width=maxWidth-left-8; - var height = 400; + let height = 400; if (height+top+8>maxHeight) height=maxHeight-top-8; domPopupSearchResultsWindow.style.top = top + 'px'; domPopupSearchResultsWindow.style.left = left + 'px'; @@ -398,17 +329,13 @@ function SearchBox(name, resultsPath, extension) // Activates or deactivates the search panel, resetting things to // their default values if necessary. - this.Activate = function(isActive) - { + this.Activate = function(isActive) { if (isActive || // open it - this.DOMPopupSearchResultsWindow().style.display == 'block' - ) - { + this.DOMPopupSearchResultsWindow().style.display == 'block' + ) { this.DOMSearchBox().className = 'MSearchBoxActive'; this.searchActive = true; - } - else if (!isActive) // directly remove the panel - { + } else if (!isActive) { // directly remove the panel this.DOMSearchBox().className = 'MSearchBoxInactive'; this.searchActive = false; this.lastSearchValue = '' @@ -421,409 +348,333 @@ function SearchBox(name, resultsPath, extension) // ----------------------------------------------------------------------- // The class that handles everything on the search results page. -function SearchResults(name) -{ - // The number of matches from the last run of . - this.lastMatchCount = 0; - this.lastKey = 0; - this.repeatOn = false; +function SearchResults() { - // Toggles the visibility of the passed element ID. - this.FindChildElement = function(id) - { - var parentElement = document.getElementById(id); - var element = parentElement.firstChild; + function convertToId(search) { + let result = ''; + for (let i=0;i. + this.lastMatchCount = 0; + this.lastKey = 0; + this.repeatOn = false; + + // Toggles the visibility of the passed element ID. + this.FindChildElement = function(id) { + const parentElement = document.getElementById(id); + let element = parentElement.firstChild; + + while (element && element!=parentElement) { + if (element.nodeName.toLowerCase() == 'div' && element.className == 'SRChildren') { + return element; + } + + if (element.nodeName.toLowerCase() == 'div' && element.hasChildNodes()) { + element = element.firstChild; + } else if (element.nextSibling) { + element = element.nextSibling; + } else { + do { + element = element.parentNode; } + while (element && element!=parentElement && !element.nextSibling); - if (element.nodeName.toLowerCase() == 'div' && element.hasChildNodes()) - { - element = element.firstChild; - } - else if (element.nextSibling) - { - element = element.nextSibling; - } - else - { - do - { - element = element.parentNode; - } - while (element && element!=parentElement && !element.nextSibling); - - if (element && element!=parentElement) - { - element = element.nextSibling; - } + if (element && element!=parentElement) { + element = element.nextSibling; } } } + } - this.Toggle = function(id) - { - var element = this.FindChildElement(id); - if (element) - { - if (element.style.display == 'block') - { - element.style.display = 'none'; - } - else - { - element.style.display = 'block'; - } + this.Toggle = function(id) { + const element = this.FindChildElement(id); + if (element) { + if (element.style.display == 'block') { + element.style.display = 'none'; + } else { + element.style.display = 'block'; } } + } - // Searches for the passed string. If there is no parameter, - // it takes it from the URL query. - // - // Always returns true, since other documents may try to call it - // and that may or may not be possible. - this.Search = function(search) - { - if (!search) // get search word from URL - { - search = window.location.search; - search = search.substring(1); // Remove the leading '?' - search = unescape(search); + // Searches for the passed string. If there is no parameter, + // it takes it from the URL query. + // + // Always returns true, since other documents may try to call it + // and that may or may not be possible. + this.Search = function(search) { + if (!search) { // get search word from URL + search = window.location.search; + search = search.substring(1); // Remove the leading '?' + search = unescape(search); + } + + search = search.replace(/^ +/, ""); // strip leading spaces + search = search.replace(/ +$/, ""); // strip trailing spaces + search = search.toLowerCase(); + search = convertToId(search); + + const resultRows = document.getElementsByTagName("div"); + let matches = 0; + + let i = 0; + while (i < resultRows.length) { + const row = resultRows.item(i); + if (row.className == "SRResult") { + let rowMatchName = row.id.toLowerCase(); + rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_' + + if (search.length<=rowMatchName.length && + rowMatchName.substr(0, search.length)==search) { + row.style.display = 'block'; + matches++; + } else { + row.style.display = 'none'; + } } + i++; + } + document.getElementById("Searching").style.display='none'; + if (matches == 0) { // no results + document.getElementById("NoMatches").style.display='block'; + } else { // at least one result + document.getElementById("NoMatches").style.display='none'; + } + this.lastMatchCount = matches; + return true; + } - search = search.replace(/^ +/, ""); // strip leading spaces - search = search.replace(/ +$/, ""); // strip trailing spaces - search = search.toLowerCase(); - search = convertToId(search); + // return the first item with index index or higher that is visible + this.NavNext = function(index) { + let focusItem; + for (;;) { + const focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') { + break; + } else if (!focusItem) { // last element + break; + } + focusItem=null; + index++; + } + return focusItem; + } - var resultRows = document.getElementsByTagName("div"); - var matches = 0; + this.NavPrev = function(index) { + let focusItem; + for (;;) { + const focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') { + break; + } else if (!focusItem) { // last element + break; + } + focusItem=null; + index--; + } + return focusItem; + } - var i = 0; - while (i < resultRows.length) - { - var row = resultRows.item(i); - if (row.className == "SRResult") - { - var rowMatchName = row.id.toLowerCase(); - rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_' + this.ProcessKeys = function(e) { + if (e.type == "keydown") { + this.repeatOn = false; + this.lastKey = e.keyCode; + } else if (e.type == "keypress") { + if (!this.repeatOn) { + if (this.lastKey) this.repeatOn = true; + return false; // ignore first keypress after keydown + } + } else if (e.type == "keyup") { + this.lastKey = 0; + this.repeatOn = false; + } + return this.lastKey!=0; + } - if (search.length<=rowMatchName.length && - rowMatchName.substr(0, search.length)==search) - { - row.style.display = 'block'; - matches++; - } - else - { - row.style.display = 'none'; + this.Nav = function(evt,itemIndex) { + const e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) { // Up + const newIndex = itemIndex-1; + let focusItem = this.NavPrev(newIndex); + if (focusItem) { + let child = this.FindChildElement(focusItem.parentNode.parentNode.id); + if (child && child.style.display == 'block') { // children visible + let n=0; + let tmpElem; + for (;;) { // search for last child + tmpElem = document.getElementById('Item'+newIndex+'_c'+n); + if (tmpElem) { + focusItem = tmpElem; + } else { // found it! + break; + } + n++; } } - i++; } - document.getElementById("Searching").style.display='none'; - if (matches == 0) // no results - { - document.getElementById("NoMatches").style.display='block'; + if (focusItem) { + focusItem.focus(); + } else { // return focus to search field + document.getElementById("MSearchField").focus(); } - else // at least one result - { - document.getElementById("NoMatches").style.display='none'; + } else if (this.lastKey==40) { // Down + const newIndex = itemIndex+1; + let focusItem; + const item = document.getElementById('Item'+itemIndex); + const elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem && elem.style.display == 'block') { // children visible + focusItem = document.getElementById('Item'+itemIndex+'_c0'); } - this.lastMatchCount = matches; + if (!focusItem) focusItem = this.NavNext(newIndex); + if (focusItem) focusItem.focus(); + } else if (this.lastKey==39) { // Right + const item = document.getElementById('Item'+itemIndex); + const elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'block'; + } else if (this.lastKey==37) { // Left + const item = document.getElementById('Item'+itemIndex); + const elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'none'; + } else if (this.lastKey==27) { // Escape + e.stopPropagation(); + searchBox.CloseResultsWindow(); + document.getElementById("MSearchField").focus(); + } else if (this.lastKey==13) { // Enter return true; } + return false; + } - // return the first item with index index or higher that is visible - this.NavNext = function(index) - { - var focusItem; - while (1) - { - var focusName = 'Item'+index; - focusItem = document.getElementById(focusName); - if (focusItem && focusItem.parentNode.parentNode.style.display=='block') - { - break; - } - else if (!focusItem) // last element - { - break; - } - focusItem=null; - index++; + this.NavChild = function(evt,itemIndex,childIndex) { + const e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) { // Up + if (childIndex>0) { + const newIndex = childIndex-1; + document.getElementById('Item'+itemIndex+'_c'+newIndex).focus(); + } else { // already at first child, jump to parent + document.getElementById('Item'+itemIndex).focus(); } - return focusItem; - } - - this.NavPrev = function(index) - { - var focusItem; - while (1) - { - var focusName = 'Item'+index; - focusItem = document.getElementById(focusName); - if (focusItem && focusItem.parentNode.parentNode.style.display=='block') - { - break; - } - else if (!focusItem) // last element - { - break; - } - focusItem=null; - index--; - } - return focusItem; - } - - this.ProcessKeys = function(e) - { - if (e.type == "keydown") - { - this.repeatOn = false; - this.lastKey = e.keyCode; - } - else if (e.type == "keypress") - { - if (!this.repeatOn) - { - if (this.lastKey) this.repeatOn = true; - return false; // ignore first keypress after keydown - } - } - else if (e.type == "keyup") - { - this.lastKey = 0; - this.repeatOn = false; - } - return this.lastKey!=0; - } - - this.Nav = function(evt,itemIndex) - { - var e = (evt) ? evt : window.event; // for IE - if (e.keyCode==13) return true; - if (!this.ProcessKeys(e)) return false; - - if (this.lastKey==38) // Up - { - var newIndex = itemIndex-1; - var focusItem = this.NavPrev(newIndex); - if (focusItem) - { - var child = this.FindChildElement(focusItem.parentNode.parentNode.id); - if (child && child.style.display == 'block') // children visible - { - var n=0; - var tmpElem; - while (1) // search for last child - { - tmpElem = document.getElementById('Item'+newIndex+'_c'+n); - if (tmpElem) - { - focusItem = tmpElem; - } - else // found it! - { - break; - } - n++; - } - } - } - if (focusItem) - { - focusItem.focus(); - } - else // return focus to search field - { - document.getElementById("MSearchField").focus(); - } - } - else if (this.lastKey==40) // Down - { - var newIndex = itemIndex+1; - var focusItem; - var item = document.getElementById('Item'+itemIndex); - var elem = this.FindChildElement(item.parentNode.parentNode.id); - if (elem && elem.style.display == 'block') // children visible - { - focusItem = document.getElementById('Item'+itemIndex+'_c0'); - } - if (!focusItem) focusItem = this.NavNext(newIndex); - if (focusItem) focusItem.focus(); - } - else if (this.lastKey==39) // Right - { - var item = document.getElementById('Item'+itemIndex); - var elem = this.FindChildElement(item.parentNode.parentNode.id); - if (elem) elem.style.display = 'block'; - } - else if (this.lastKey==37) // Left - { - var item = document.getElementById('Item'+itemIndex); - var elem = this.FindChildElement(item.parentNode.parentNode.id); - if (elem) elem.style.display = 'none'; - } - else if (this.lastKey==27) // Escape - { - e.stopPropagation(); - searchBox.CloseResultsWindow(); - document.getElementById("MSearchField").focus(); - } - else if (this.lastKey==13) // Enter - { - return true; - } - return false; - } - - this.NavChild = function(evt,itemIndex,childIndex) - { - var e = (evt) ? evt : window.event; // for IE - if (e.keyCode==13) return true; - if (!this.ProcessKeys(e)) return false; - - if (this.lastKey==38) // Up - { - if (childIndex>0) - { - var newIndex = childIndex-1; - document.getElementById('Item'+itemIndex+'_c'+newIndex).focus(); - } - else // already at first child, jump to parent - { - document.getElementById('Item'+itemIndex).focus(); - } - } - else if (this.lastKey==40) // Down - { - var newIndex = childIndex+1; - var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex); - if (!elem) // last child, jump to parent next parent - { - elem = this.NavNext(itemIndex+1); - } - if (elem) - { - elem.focus(); - } - } - else if (this.lastKey==27) // Escape - { - e.stopPropagation(); - searchBox.CloseResultsWindow(); - document.getElementById("MSearchField").focus(); - } - else if (this.lastKey==13) // Enter - { - return true; - } - return false; + } else if (this.lastKey==40) { // Down + const newIndex = childIndex+1; + let elem = document.getElementById('Item'+itemIndex+'_c'+newIndex); + if (!elem) { // last child, jump to parent next parent + elem = this.NavNext(itemIndex+1); + } + if (elem) { + elem.focus(); + } + } else if (this.lastKey==27) { // Escape + e.stopPropagation(); + searchBox.CloseResultsWindow(); + document.getElementById("MSearchField").focus(); + } else if (this.lastKey==13) { // Enter + return true; } + return false; + } } -function setKeyActions(elem,action) -{ - elem.setAttribute('onkeydown',action); - elem.setAttribute('onkeypress',action); - elem.setAttribute('onkeyup',action); -} +function createResults(resultsPath) { -function setClassAttr(elem,attr) -{ - elem.setAttribute('class',attr); - elem.setAttribute('className',attr); -} + function setKeyActions(elem,action) { + elem.setAttribute('onkeydown',action); + elem.setAttribute('onkeypress',action); + elem.setAttribute('onkeyup',action); + } -function createResults(resultsPath) -{ - var results = document.getElementById("SRResults"); + function setClassAttr(elem,attr) { + elem.setAttribute('class',attr); + elem.setAttribute('className',attr); + } + + const results = document.getElementById("SRResults"); results.innerHTML = ''; - for (var e=0; e { + const id = elem[0]; + const srResult = document.createElement('div'); srResult.setAttribute('id','SR_'+id); setClassAttr(srResult,'SRResult'); - var srEntry = document.createElement('div'); + const srEntry = document.createElement('div'); setClassAttr(srEntry,'SREntry'); - var srLink = document.createElement('a'); - srLink.setAttribute('id','Item'+e); - setKeyActions(srLink,'return searchResults.Nav(event,'+e+')'); + const srLink = document.createElement('a'); + srLink.setAttribute('id','Item'+index); + setKeyActions(srLink,'return searchResults.Nav(event,'+index+')'); setClassAttr(srLink,'SRSymbol'); - srLink.innerHTML = searchData[e][1][0]; + srLink.innerHTML = elem[1][0]; srEntry.appendChild(srLink); - if (searchData[e][1].length==2) // single result - { - srLink.setAttribute('href',resultsPath+searchData[e][1][1][0]); + if (elem[1].length==2) { // single result + srLink.setAttribute('href',resultsPath+elem[1][1][0]); srLink.setAttribute('onclick','searchBox.CloseResultsWindow()'); - if (searchData[e][1][1][1]) - { + if (elem[1][1][1]) { srLink.setAttribute('target','_parent'); - } - else - { + } else { srLink.setAttribute('target','_blank'); } - var srScope = document.createElement('span'); + const srScope = document.createElement('span'); setClassAttr(srScope,'SRScope'); - srScope.innerHTML = searchData[e][1][1][2]; + srScope.innerHTML = elem[1][1][2]; srEntry.appendChild(srScope); - } - else // multiple results - { + } else { // multiple results srLink.setAttribute('href','javascript:searchResults.Toggle("SR_'+id+'")'); - var srChildren = document.createElement('div'); + const srChildren = document.createElement('div'); setClassAttr(srChildren,'SRChildren'); - for (var c=0; c + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      +
      Blacklist Member List
      +
      +
      + +

      This is the complete list of members for Blacklist, including all inherited members.

      + + + + +
      get(const BlacklistField field)Blacklist
      isUsed(const BlacklistField field)Blacklistinline
      setUsed(const BlacklistField field, const bool used)Blacklistinline
      + + + + diff --git a/docs/html/structBlacklist.html b/docs/html/structBlacklist.html new file mode 100644 index 00000000..ef567b5f --- /dev/null +++ b/docs/html/structBlacklist.html @@ -0,0 +1,201 @@ + + + + + + + +LogDoctor: Blacklist Struct Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      Blacklist Struct Referencefinal
      +
      +
      + + + + + + + + + + + +

      +Public Member Functions

      BlacklistItemget (const BlacklistField field)
       Returns a reference to the requested blacklist item.
       
      bool isUsed (const BlacklistField field)
       Returns whether the requested blacklist is in use.
       
      void setUsed (const BlacklistField field, const bool used)
       Sets the requested blacklist in the given in-use condition.
       
      +

      Member Function Documentation

      + +

      ◆ get()

      + +
      +
      + + + + + + + +
      BlacklistItem & Blacklist::get (const BlacklistField field)
      +
      + +

      Returns a reference to the requested blacklist item.

      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ isUsed()

      + +
      +
      + + + + + +
      + + + + + + + +
      bool Blacklist::isUsed (const BlacklistField field)
      +
      +inline
      +
      + +

      Returns whether the requested blacklist is in use.

      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ setUsed()

      + +
      +
      + + + + + +
      + + + + + + + + + + + +
      void Blacklist::setUsed (const BlacklistField field,
      const bool used )
      +
      +inline
      +
      + +

      Sets the requested blacklist in the given in-use condition.

      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      +
      The documentation for this struct was generated from the following files:
        +
      • logdoctor/modules/blacklists/modules/blacklist.h
      • +
      • logdoctor/modules/blacklists/modules/blacklist.cpp
      • +
      +
      + + + + diff --git a/docs/html/structBlacklistItem-members.html b/docs/html/structBlacklistItem-members.html new file mode 100644 index 00000000..7cdd0e46 --- /dev/null +++ b/docs/html/structBlacklistItem-members.html @@ -0,0 +1,95 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      +
      BlacklistItem Member List
      +
      +
      + +

      This is the complete list of members for BlacklistItem, including all inherited members.

      + + + + + + + + +
      add(const std::string &item)BlacklistItem
      fieldName() constBlacklistItem
      moveDown(const std::string &item)BlacklistItem
      moveUp(const std::string &item)BlacklistItem
      remove(const std::string &item)BlacklistItem
      sanitized(const std::string &item) constBlacklistItemprivate
      set(const std::vector< std::string > &new_list)BlacklistItem
      + + + + diff --git a/docs/html/structBlacklistItem.html b/docs/html/structBlacklistItem.html new file mode 100644 index 00000000..7ef3f253 --- /dev/null +++ b/docs/html/structBlacklistItem.html @@ -0,0 +1,305 @@ + + + + + + + +LogDoctor: BlacklistItem Struct Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      BlacklistItem Struct Referencefinal
      +
      +
      + + + + + + + + + + + + + + + + + + + + +

      +Public Member Functions

      const char * fieldName () const
       Returns the name of the field to which the list is associated.
       
      void set (const std::vector< std::string > &new_list)
       Replaces the current list with the one provided.
       
      void add (const std::string &item)
       Adds the provided item to the list.
       
      void remove (const std::string &item)
       Remove the requested item from the list.
       
      int moveUp (const std::string &item)
       Moves the requested item one position up in the list.
       
      int moveDown (const std::string &item)
       Moves the requested item one position down in the list.
       
      + + + + +

      +Private Member Functions

      std::string sanitized (const std::string &item) const
       Returns a sanitized item.
       
      +

      Member Function Documentation

      + +

      ◆ add()

      + +
      +
      + + + + + + + +
      void BlacklistItem::add (const std::string & item)
      +
      + +

      Adds the provided item to the list.

      +

      The item will be sanitized before actually being added to the list

      Exceptions
      + + +
      BWlistException,DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ fieldName()

      + +
      +
      + + + + + + + +
      const char * BlacklistItem::fieldName () const
      +
      + +

      Returns the name of the field to which the list is associated.

      +

      The name is translatable

      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ moveDown()

      + +
      +
      + + + + + + + +
      int BlacklistItem::moveDown (const std::string & item)
      +
      + +

      Moves the requested item one position down in the list.

      +
      Exceptions
      + + +
      BWlistException
      +
      +
      + +
      +
      + +

      ◆ moveUp()

      + +
      +
      + + + + + + + +
      int BlacklistItem::moveUp (const std::string & item)
      +
      + +

      Moves the requested item one position up in the list.

      +
      Exceptions
      + + +
      BWlistException
      +
      +
      + +
      +
      + +

      ◆ remove()

      + +
      +
      + + + + + + + +
      void BlacklistItem::remove (const std::string & item)
      +
      + +

      Remove the requested item from the list.

      +
      Exceptions
      + + +
      BWlistException
      +
      +
      + +
      +
      + +

      ◆ sanitized()

      + +
      +
      + + + + + +
      + + + + + + + +
      std::string BlacklistItem::sanitized (const std::string & item) const
      +
      +private
      +
      + +

      Returns a sanitized item.

      +
      Exceptions
      + + +
      BWlistException,DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ set()

      + +
      +
      + + + + + + + +
      void BlacklistItem::set (const std::vector< std::string > & new_list)
      +
      + +

      Replaces the current list with the one provided.

      +

      All the items will be sanitized before actually becoming part of the list

      Exceptions
      + + +
      BWlistException,DoNotCatchException
      +
      +
      + +
      +
      +
      The documentation for this struct was generated from the following files:
        +
      • logdoctor/modules/blacklists/modules/blacklist_item.h
      • +
      • logdoctor/modules/blacklists/modules/blacklist_item.cpp
      • +
      +
      + + + + diff --git a/docs/html/structBlacklists-members.html b/docs/html/structBlacklists-members.html new file mode 100644 index 00000000..166642d7 --- /dev/null +++ b/docs/html/structBlacklists-members.html @@ -0,0 +1,101 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      +
      Blacklists Member List
      +
      +
      + +

      This is the complete list of members for Blacklists, including all inherited members.

      + + + + + + + + + + + + + + +
      addItem(const WebServer ws, const BlacklistField fld, const std::string &item)Blacklistsinline
      clearList(const WebServer ws, const BlacklistField fld)Blacklistsinline
      get(const WebServer ws)Blacklists
      get(const WebServer ws, const BlacklistField fld)Blacklistsinline
      getConst(const WebServer ws) constBlacklists
      getList(const WebServer ws, const BlacklistField fld)Blacklistsinline
      getListConst(const WebServer ws, const BlacklistField fld)Blacklistsinline
      isUsed(const WebServer ws, const BlacklistField fld)Blacklistsinline
      moveDownItem(const WebServer ws, const BlacklistField fld, const std::string &item)Blacklistsinline
      moveUpItem(const WebServer ws, const BlacklistField fld, const std::string &item)Blacklistsinline
      removeItem(const WebServer ws, const BlacklistField fld, const std::string &item)Blacklistsinline
      setList(const WebServer ws, const BlacklistField fld, const std::vector< std::string > &list)Blacklistsinline
      setUsed(const WebServer ws, const BlacklistField fld, const bool used)Blacklistsinline
      + + + + diff --git a/docs/html/structBlacklists.html b/docs/html/structBlacklists.html new file mode 100644 index 00000000..399d44ea --- /dev/null +++ b/docs/html/structBlacklists.html @@ -0,0 +1,623 @@ + + + + + + + +LogDoctor: Blacklists Struct Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      Blacklists Struct Referencefinal
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

      +Public Member Functions

      bool isUsed (const WebServer ws, const BlacklistField fld)
       Returns whether the requested blacklist is in use.
       
      void setUsed (const WebServer ws, const BlacklistField fld, const bool used)
       Sets the requested blacklist in the given in-use condition.
       
      const BlacklistgetConst (const WebServer ws) const
       Returns a const reference to the requested blacklist.
       
      Blacklistget (const WebServer ws)
       Returns a reference to the requested blacklist.
       
      BlacklistItemget (const WebServer ws, const BlacklistField fld)
       Returns a reference to the requested blacklist.
       
      std::vector< std::string > & getList (const WebServer ws, const BlacklistField fld)
       Returns a reference to the requested blacklist.
       
      const std::vector< std::string > & getListConst (const WebServer ws, const BlacklistField fld)
       Returns a const reference to the requested blacklist.
       
      void setList (const WebServer ws, const BlacklistField fld, const std::vector< std::string > &list)
       Replaces the requested blacklist with the one provided.
       
      void clearList (const WebServer ws, const BlacklistField fld)
       Clears the requested blacklist.
       
      void addItem (const WebServer ws, const BlacklistField fld, const std::string &item)
       Adds the provided item to the requested blacklist.
       
      void removeItem (const WebServer ws, const BlacklistField fld, const std::string &item)
       Remove the requested item from the requested blacklist.
       
      int moveUpItem (const WebServer ws, const BlacklistField fld, const std::string &item)
       Moves the requested item one position up in the requested blacklist.
       
      int moveDownItem (const WebServer ws, const BlacklistField fld, const std::string &item)
       Moves the requested item one position down in the requested blacklist.
       
      +

      Member Function Documentation

      + +

      ◆ addItem()

      + +
      +
      + + + + + +
      + + + + + + + + + + + + + + + + +
      void Blacklists::addItem (const WebServer ws,
      const BlacklistField fld,
      const std::string & item )
      +
      +inline
      +
      + +

      Adds the provided item to the requested blacklist.

      +
      Exceptions
      + + +
      BWlistException,DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ clearList()

      + +
      +
      + + + + + +
      + + + + + + + + + + + +
      void Blacklists::clearList (const WebServer ws,
      const BlacklistField fld )
      +
      +inline
      +
      + +

      Clears the requested blacklist.

      +
      Exceptions
      + + +
      BWlistException,DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ get() [1/2]

      + +
      +
      + + + + + + + +
      Blacklist & Blacklists::get (const WebServer ws)
      +
      + +

      Returns a reference to the requested blacklist.

      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ get() [2/2]

      + +
      +
      + + + + + +
      + + + + + + + + + + + +
      BlacklistItem & Blacklists::get (const WebServer ws,
      const BlacklistField fld )
      +
      +inline
      +
      + +

      Returns a reference to the requested blacklist.

      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ getConst()

      + +
      +
      + + + + + + + +
      const Blacklist & Blacklists::getConst (const WebServer ws) const
      +
      + +

      Returns a const reference to the requested blacklist.

      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ getList()

      + +
      +
      + + + + + +
      + + + + + + + + + + + +
      std::vector< std::string > & Blacklists::getList (const WebServer ws,
      const BlacklistField fld )
      +
      +inline
      +
      + +

      Returns a reference to the requested blacklist.

      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ getListConst()

      + +
      +
      + + + + + +
      + + + + + + + + + + + +
      const std::vector< std::string > & Blacklists::getListConst (const WebServer ws,
      const BlacklistField fld )
      +
      +inline
      +
      + +

      Returns a const reference to the requested blacklist.

      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ isUsed()

      + +
      +
      + + + + + +
      + + + + + + + + + + + +
      bool Blacklists::isUsed (const WebServer ws,
      const BlacklistField fld )
      +
      +inline
      +
      + +

      Returns whether the requested blacklist is in use.

      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ moveDownItem()

      + +
      +
      + + + + + +
      + + + + + + + + + + + + + + + + +
      int Blacklists::moveDownItem (const WebServer ws,
      const BlacklistField fld,
      const std::string & item )
      +
      +inline
      +
      + +

      Moves the requested item one position down in the requested blacklist.

      +
      Exceptions
      + + +
      BWlistException
      +
      +
      + +
      +
      + +

      ◆ moveUpItem()

      + +
      +
      + + + + + +
      + + + + + + + + + + + + + + + + +
      int Blacklists::moveUpItem (const WebServer ws,
      const BlacklistField fld,
      const std::string & item )
      +
      +inline
      +
      + +

      Moves the requested item one position up in the requested blacklist.

      +
      Exceptions
      + + +
      BWlistException
      +
      +
      + +
      +
      + +

      ◆ removeItem()

      + +
      +
      + + + + + +
      + + + + + + + + + + + + + + + + +
      void Blacklists::removeItem (const WebServer ws,
      const BlacklistField fld,
      const std::string & item )
      +
      +inline
      +
      + +

      Remove the requested item from the requested blacklist.

      +
      Exceptions
      + + +
      BWlistException
      +
      +
      + +
      +
      + +

      ◆ setList()

      + +
      +
      + + + + + +
      + + + + + + + + + + + + + + + + +
      void Blacklists::setList (const WebServer ws,
      const BlacklistField fld,
      const std::vector< std::string > & list )
      +
      +inline
      +
      + +

      Replaces the requested blacklist with the one provided.

      +
      Exceptions
      + + +
      BWlistException,DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ setUsed()

      + +
      +
      + + + + + +
      + + + + + + + + + + + + + + + + +
      void Blacklists::setUsed (const WebServer ws,
      const BlacklistField fld,
      const bool used )
      +
      +inline
      +
      + +

      Sets the requested blacklist in the given in-use condition.

      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      +
      The documentation for this struct was generated from the following files:
        +
      • logdoctor/modules/blacklists/blacklists.h
      • +
      • logdoctor/modules/blacklists/blacklists.cpp
      • +
      +
      + + + + diff --git a/docs/html/structBodyPart-members.html b/docs/html/structBodyPart-members.html index 2a5adfb3..4b4d3727 100644 --- a/docs/html/structBodyPart-members.html +++ b/docs/html/structBodyPart-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -80,13 +82,13 @@ $(function() { directionBodyPart imageBodyPart prev_directionBodyPart - update(const unsigned new_x, const unsigned new_y, const Direction &new_direction)BodyPart + update(const unsigned new_x, const unsigned new_y, const Direction &new_direction) noexceptBodyPart xBodyPart yBodyPart
      diff --git a/docs/html/structBodyPart.html b/docs/html/structBodyPart.html index ec3df4bf..fe736124 100644 --- a/docs/html/structBodyPart.html +++ b/docs/html/structBodyPart.html @@ -3,12 +3,14 @@ - + LogDoctor: BodyPart Struct Reference + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -75,21 +77,21 @@ $(function() { Public Member Functions | Public Attributes | List of all members
      -
      BodyPart Struct Reference
      +
      BodyPart Struct Referencefinal

      Instance of a part of the body of the snake. - More...

      + More...

      #include <snake.h>

      - - - + + +

      Public Member Functions

      -void update (const unsigned new_x, const unsigned new_y, const Direction &new_direction)
       Updates the position and direction of the part.
       
      +void update (const unsigned new_x, const unsigned new_y, const Direction &new_direction) noexcept
       Updates the position and direction of the part.
       
      @@ -109,7 +111,7 @@ Direction  - +

      Public Attributes

      directionprev_direction
       The previous direction of the part.
       
      QGraphicsPixmapItem * image
      QGraphicsPixmapItem * image
       

      Detailed Description

      @@ -137,7 +139,7 @@ Direction prev_direction diff --git a/docs/html/structCraplog_1_1LogName-members.html b/docs/html/structCraplog_1_1LogName-members.html index 05e42ec8..d3801230 100644 --- a/docs/html/structCraplog_1_1LogName-members.html +++ b/docs/html/structCraplog_1_1LogName-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -87,7 +89,7 @@ $(function() {
      diff --git a/docs/html/structCraplog_1_1LogName.html b/docs/html/structCraplog_1_1LogName.html index 416cb7b7..8708893a 100644 --- a/docs/html/structCraplog_1_1LogName.html +++ b/docs/html/structCraplog_1_1LogName.html @@ -3,12 +3,14 @@ - + LogDoctor: Craplog::LogName Struct Reference + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -78,12 +80,12 @@ $(function() { -
      Craplog::LogName Struct Reference
      +
      Craplog::LogName Struct Referencefinal

      Web Server specific file names criterions. - More...

      + More...

      @@ -109,7 +111,7 @@ std::string < diff --git a/docs/html/structDatabaseHandler-members.html b/docs/html/structDatabaseHandler-members.html new file mode 100644 index 00000000..559ef876 --- /dev/null +++ b/docs/html/structDatabaseHandler-members.html @@ -0,0 +1,90 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
      +
      +

      Public Attributes

      ends
      + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      +
      DatabaseHandler Member List
      +
      +
      + +

      This is the complete list of members for DatabaseHandler, including all inherited members.

      + + + +
      checkDriver() constDatabaseHandlerinline
      get(const DatabaseType db_type, const bool readonly=false)DatabaseHandlerstatic
      + + + + diff --git a/docs/html/structDatabaseHandler.html b/docs/html/structDatabaseHandler.html new file mode 100644 index 00000000..23840438 --- /dev/null +++ b/docs/html/structDatabaseHandler.html @@ -0,0 +1,151 @@ + + + + + + + +LogDoctor: DatabaseHandler Struct Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      DatabaseHandler Struct Reference
      +
      +
      + + + + + +

      +Public Member Functions

      +bool checkDriver () const
       Checks the presence of the QSQLITE driver.
       
      + + + + +

      +Static Public Member Functions

      static DatabaseWrapper get (const DatabaseType db_type, const bool readonly=false)
       Returns an instance of the requested database.
       
      +

      Member Function Documentation

      + +

      ◆ get()

      + +
      +
      + + + + + +
      + + + + + + + + + + + +
      DatabaseWrapper DatabaseHandler::get (const DatabaseType db_type,
      const bool readonly = false )
      +
      +static
      +
      + +

      Returns an instance of the requested database.

      +
      Parameters
      + + +
      readonlyWhether the database whould be initialized in readonly mode
      +
      +
      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      +
      The documentation for this struct was generated from the following files:
        +
      • logdoctor/modules/database/database.h
      • +
      • logdoctor/modules/database/database.cpp
      • +
      +
      + + + + diff --git a/docs/html/structDoNotCatchException-members.html b/docs/html/structDoNotCatchException-members.html new file mode 100644 index 00000000..01ca7257 --- /dev/null +++ b/docs/html/structDoNotCatchException-members.html @@ -0,0 +1,87 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      +
      DoNotCatchException Member List
      +
      +
      + +

      This is the complete list of members for DoNotCatchException, including all inherited members.

      +
      + + + + diff --git a/docs/html/structDoNotCatchException.html b/docs/html/structDoNotCatchException.html new file mode 100644 index 00000000..7e2a6c83 --- /dev/null +++ b/docs/html/structDoNotCatchException.html @@ -0,0 +1,99 @@ + + + + + + + +LogDoctor: DoNotCatchException Struct Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      DoNotCatchException Struct Referencefinal
      +
      +
      + +

      DoNotCatchException. + More...

      + +

      #include <exceptions.h>

      +

      Detailed Description

      +

      DoNotCatchException.

      +

      Thrown when something really unexptional happens. It's not supposed to be catched.

      +

      The documentation for this struct was generated from the following files:
        +
      • logdoctor/modules/exceptions.h
      • +
      • logdoctor/modules/exceptions.cpp
      • +
      +
      + + + + diff --git a/docs/html/structEnumerator-members.html b/docs/html/structEnumerator-members.html new file mode 100644 index 00000000..1fdd28fa --- /dev/null +++ b/docs/html/structEnumerator-members.html @@ -0,0 +1,87 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      +
      Enumerator< Array > Member List
      +
      +
      + +

      This is the complete list of members for Enumerator< Array >, including all inherited members.

      +
      + + + + diff --git a/docs/html/structEnumerator.html b/docs/html/structEnumerator.html new file mode 100644 index 00000000..5a20e71e --- /dev/null +++ b/docs/html/structEnumerator.html @@ -0,0 +1,90 @@ + + + + + + + +LogDoctor: Enumerator< Array > Struct Template Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      Enumerator< Array > Struct Template Reference
      +
      +
      +
      The documentation for this struct was generated from the following file:
        +
      • logdoctor/utilities/arrays.h
      • +
      +
      + + + + diff --git a/docs/html/classCraplogParserAsync-members.html b/docs/html/structFieldData-members.html similarity index 63% rename from docs/html/classCraplogParserAsync-members.html rename to docs/html/structFieldData-members.html index 6949c3b6..009d900e 100644 --- a/docs/html/classCraplogParserAsync-members.html +++ b/docs/html/structFieldData-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -71,20 +73,20 @@ $(function() {
      -
      CraplogParserAsync Member List
      +
      FieldData Member List
      -

      This is the complete list of members for CraplogParserAsync, including all inherited members.

      +

      This is the complete list of members for FieldData, including all inherited members.

      - - - - + + + +
      joinLogLines(std::promise< logs_lines_t > &log_lines, const logs_file_t &logs_file)CraplogParserAsyncprivate
      parseLogLines(std::future< logs_lines_t > &log_lines)CraplogParserAsyncprivate
      storeData(QSqlDatabase &db)CraplogParserAsyncprivate
      storeLogLines()CraplogParserAsyncprivate
      operator bool() const noexceptFieldDatainline
      operator*() const noexceptFieldDatainline
      operator+(const FieldData &rhs) const noexceptFieldDatainline
      operator+FieldDatafriend
      diff --git a/docs/html/structFieldData.html b/docs/html/structFieldData.html new file mode 100644 index 00000000..a3a9d4e4 --- /dev/null +++ b/docs/html/structFieldData.html @@ -0,0 +1,123 @@ + + + + + + + +LogDoctor: FieldData Struct Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      FieldData Struct Referencefinal
      +
      +
      + +

      FieldData. + More...

      + +

      #include <lib.h>

      + + + + + + + + + + + +

      +Public Member Functions

      operator bool () const noexcept
       Returns whether the field contains data.
       
      +const std::string & operator* () const noexcept
       Returns a reference to the field's data.
       
      +size_t operator+ (const FieldData &rhs) const noexcept
       Returns the sum of the field's data size with another field's data size.
       
      + + + + +

      +Friends

      +size_t operator+ (const size_t lhs, const FieldData &rhs) noexcept
       Returns the sum of the field's data size with the given size.
       
      +

      Detailed Description

      +

      FieldData.

      +

      Holds the data of a single field from a log line

      See also
      LogLineData
      +

      The documentation for this struct was generated from the following file:
        +
      • logdoctor/modules/craplog/modules/workers/lib.h
      • +
      +
      + + + + diff --git a/docs/html/structGlobalsData-members.html b/docs/html/structGlobalsData-members.html new file mode 100644 index 00000000..185a9b47 --- /dev/null +++ b/docs/html/structGlobalsData-members.html @@ -0,0 +1,87 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      +
      GlobalsData Member List
      +
      +
      + +

      This is the complete list of members for GlobalsData, including all inherited members.

      +
      + + + + diff --git a/docs/html/structGlobalsData.html b/docs/html/structGlobalsData.html new file mode 100644 index 00000000..070e36ba --- /dev/null +++ b/docs/html/structGlobalsData.html @@ -0,0 +1,90 @@ + + + + + + + +LogDoctor: GlobalsData Struct Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      GlobalsData Struct Referencefinal
      +
      +
      +
      The documentation for this struct was generated from the following file:
        +
      • logdoctor/modules/crapview/modules/lib.h
      • +
      +
      + + + + diff --git a/docs/html/structLogFile-members.html b/docs/html/structLogFile-members.html new file mode 100644 index 00000000..d0284714 --- /dev/null +++ b/docs/html/structLogFile-members.html @@ -0,0 +1,96 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      +
      LogFile Member List
      +
      +
      + +

      This is the complete list of members for LogFile, including all inherited members.

      + + + + + + + + + +
      hasBeenUsed() const noexceptLogFileinline
      hash() const noexceptLogFileinline
      isSelected() const noexceptLogFileinline
      name() const noexceptLogFileinline
      path() const noexceptLogFileinline
      setSelected() noexceptLogFileinline
      setUnselected() noexceptLogFileinline
      size() const noexceptLogFileinline
      + + + + diff --git a/docs/html/structLogFile.html b/docs/html/structLogFile.html new file mode 100644 index 00000000..3bd14e25 --- /dev/null +++ b/docs/html/structLogFile.html @@ -0,0 +1,134 @@ + + + + + + + +LogDoctor: LogFile Struct Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      LogFile Struct Referencefinal
      +
      +
      + +

      Holds informations about a log file. + More...

      + +

      #include <lib.h>

      + + + + + + + + + + + + + + + + + + + + + + + + + + +

      +Public Member Functions

      +bool isSelected () const noexcept
       Returns whether the file has been selected to be used or not.
       
      +void setSelected () noexcept
       Sets the file as selected.
       
      +void setUnselected () noexcept
       Sets the file as unselected.
       
      +bool hasBeenUsed () const noexcept
       Returns whether the file has been used already or not.
       
      +size_t size () const noexcept
       Returns the size of the file.
       
      +const QString & name () const noexcept
       Returns the name of the file, to be displayed in the list.
       
      +const std::string & hash () const noexcept
       Returns the sha256 hash of the content.
       
      +const std::string & path () const noexcept
       Returns the path of the file, including the file name.
       
      +

      Detailed Description

      +

      Holds informations about a log file.

      +

      The documentation for this struct was generated from the following file:
        +
      • logdoctor/modules/craplog/modules/lib.h
      • +
      +
      + + + + diff --git a/docs/html/classLogFile-members.html b/docs/html/structLogLineData-members.html similarity index 60% rename from docs/html/classLogFile-members.html rename to docs/html/structLogLineData-members.html index 9ce7ebe5..df1978ce 100644 --- a/docs/html/classLogFile-members.html +++ b/docs/html/structLogLineData-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -71,22 +73,21 @@ $(function() {
      -
      LogFile Member List
      +
      LogLineData Member List
      -

      This is the complete list of members for LogFile, including all inherited members.

      +

      This is the complete list of members for LogLineData, including all inherited members.

      - - - - - - + + + + +
      hasBeenUsed() constLogFileinline
      hash() constLogFileinline
      isSelected() constLogFileinline
      name() constLogFileinline
      path() constLogFileinline
      size() constLogFileinline
      data(const LogsFormatField id)LogLineDataprivate
      LogLineData(const std::string &line, const LogsFormat &logs_format)LogLineData
      size() const noexceptLogLineData
      storeMalformedRequestMultiSpace(std::string &&str) noexceptLogLineDataprivate
      storeMalformedRequestOneSpace(std::string &&str) noexceptLogLineDataprivate
      diff --git a/docs/html/structLogLineData.html b/docs/html/structLogLineData.html new file mode 100644 index 00000000..9f07a701 --- /dev/null +++ b/docs/html/structLogLineData.html @@ -0,0 +1,215 @@ + + + + + + + +LogDoctor: LogLineData Struct Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      LogLineData Struct Referencefinal
      +
      +
      + +

      LogLineData. + More...

      + +

      #include <lib.h>

      + + + + + + + +

      +Public Member Functions

       LogLineData (const std::string &line, const LogsFormat &logs_format)
       
      +size_t size () const noexcept
       Returns the total size of all the fields' data.
       
      + + + + + + + + +

      +Private Member Functions

      +FieldDatadata (const LogsFormatField id)
       Returns a reference to the field data corresponding to the given field identifier.
       
      void storeMalformedRequestOneSpace (std::string &&str) noexcept
       
      void storeMalformedRequestMultiSpace (std::string &&str) noexcept
       
      +

      Detailed Description

      +

      LogLineData.

      +

      Holds the data of a single log line

      +

      Constructor & Destructor Documentation

      + +

      ◆ LogLineData()

      + +
      +
      + + + + + + + + + + + +
      LogLineData::LogLineData (const std::string & line,
      const LogsFormat & logs_format )
      +
      +
      Exceptions
      + + +
      LogParserException
      +
      +
      + +
      +
      +

      Member Function Documentation

      + +

      ◆ storeMalformedRequestMultiSpace()

      + +
      +
      + + + + + +
      + + + + + + + +
      void LogLineData::storeMalformedRequestMultiSpace (std::string && str)
      +
      +privatenoexcept
      +
      +

      P\M 000 001 010 011 100 101 110 111

      +

      000 +U+ +UM +U+ +U+ MU+ +U+ +U+ +U+

      +

      001 +UP — UMP — MUP — +UP —

      +

      010 +U+ UPM — — MPU +U+ — —

      +

      011 +U+ — — — MU+ — — —

      +

      100 PU+ PUM PMU PU+ — — — —

      +

      101 +U+ — +U+ — — — — —

      +

      110 +U+ +UM — — — — — —

      +

      111 +U+ — — — — — — —

      + +
      +
      + +

      ◆ storeMalformedRequestOneSpace()

      + +
      +
      + + + + + +
      + + + + + + + +
      void LogLineData::storeMalformedRequestOneSpace (std::string && str)
      +
      +privatenoexcept
      +
      +

      P\M 00 01 10 11

      +

      00 U+ UM MU U+

      +

      01 UP – MP –

      +

      10 PU PM – –

      +

      11 U+ – – –

      + +
      +
      +
      The documentation for this struct was generated from the following files:
        +
      • logdoctor/modules/craplog/modules/workers/lib.h
      • +
      • logdoctor/modules/craplog/modules/workers/impl/loglinedata.cpp
      • +
      +
      + + + + diff --git a/docs/html/classLogsFormat-members.html b/docs/html/structLogsFormat-members.html similarity index 67% rename from docs/html/classLogsFormat-members.html rename to docs/html/structLogsFormat-members.html index a700600d..dabfffb4 100644 --- a/docs/html/classLogsFormat-members.html +++ b/docs/html/structLogsFormat-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -75,18 +77,18 @@ $(function() {
      -

      This is the complete list of members for LogsFormat, including all inherited members.

      +

      This is the complete list of members for LogsFormat, including all inherited members.

      - - - - - - + + + + + +
      fieldsLogsFormat
      finalLogsFormat
      initialLogsFormat
      new_linesLogsFormat
      separatorsLogsFormat
      stringLogsFormat
      fieldsLogsFormat
      finalLogsFormat
      initialLogsFormat
      new_linesLogsFormat
      separatorsLogsFormat
      stringLogsFormat
      diff --git a/docs/html/classLogsFormat.html b/docs/html/structLogsFormat.html similarity index 83% rename from docs/html/classLogsFormat.html rename to docs/html/structLogsFormat.html index f6d4e5b5..3d34edd5 100644 --- a/docs/html/classLogsFormat.html +++ b/docs/html/structLogsFormat.html @@ -3,12 +3,14 @@ - + -LogDoctor: LogsFormat Class Reference +LogDoctor: LogsFormat Struct Reference + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -73,13 +75,13 @@ $(function() {
      -
      LogsFormat Class Reference
      +List of all members
      +
      LogsFormat Struct Referencefinal

      Holds informations about a log format. - More...

      + More...

      #include <lib.h>

      @@ -101,24 +103,24 @@ std::string  std::vector< std::string >  - - - + + + - +
      finalseparators
       The separators in the middle.
       
      -std::vector< std::string > fields
       The fields.
       
      +std::vector< LogsFormatField > fields
       The logged fields.
       
      size_t new_lines
       The number of new lines.
       The number of new lines within the string.
       

      Detailed Description

      Holds informations about a log format.

      -

      The documentation for this class was generated from the following file:
        +

      The documentation for this struct was generated from the following file:
      • logdoctor/modules/craplog/modules/lib.h
      diff --git a/docs/html/structMakeNewDatabase.html b/docs/html/structMakeNewDatabase.html new file mode 100644 index 00000000..2d7d8f4b --- /dev/null +++ b/docs/html/structMakeNewDatabase.html @@ -0,0 +1,88 @@ + + + + + + + +LogDoctor: MakeNewDatabase Struct Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      +
      MakeNewDatabase Struct Reference
      +
      +
      +
      The documentation for this struct was generated from the following file:
        +
      • logdoctor/utilities/checks.cpp
      • +
      +
      + + + + diff --git a/docs/html/structPerformanceData-members.html b/docs/html/structPerformanceData-members.html new file mode 100644 index 00000000..29a50ae2 --- /dev/null +++ b/docs/html/structPerformanceData-members.html @@ -0,0 +1,87 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      +
      PerformanceData Member List
      +
      +
      + +

      This is the complete list of members for PerformanceData, including all inherited members.

      +
      + + + + diff --git a/docs/html/structPerformanceData.html b/docs/html/structPerformanceData.html new file mode 100644 index 00000000..a2df5d5a --- /dev/null +++ b/docs/html/structPerformanceData.html @@ -0,0 +1,90 @@ + + + + + + + +LogDoctor: PerformanceData Struct Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      PerformanceData Struct Referencefinal
      +
      +
      +
      The documentation for this struct was generated from the following file:
        +
      • logdoctor/modules/crapview/modules/lib.h
      • +
      +
      + + + + diff --git a/docs/html/classCraplogParserInterface-members.html b/docs/html/structPerfs-members.html similarity index 87% rename from docs/html/classCraplogParserInterface-members.html rename to docs/html/structPerfs-members.html index 7fa28ff6..c8c3230e 100644 --- a/docs/html/classCraplogParserInterface-members.html +++ b/docs/html/structPerfs-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -71,15 +73,15 @@ $(function() {
      -
      CraplogParserInterface Member List
      +
      Perfs Member List
      -

      This is the complete list of members for CraplogParserInterface, including all inherited members.

      +

      This is the complete list of members for Perfs, including all inherited members.

      diff --git a/docs/html/structPerfs.html b/docs/html/structPerfs.html new file mode 100644 index 00000000..b8a078aa --- /dev/null +++ b/docs/html/structPerfs.html @@ -0,0 +1,90 @@ + + + + + + + +LogDoctor: Perfs Struct Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      Perfs Struct Referencefinal
      +
      +
      +
      The documentation for this struct was generated from the following file:
        +
      • logdoctor/modules/crapview/modules/lib.h
      • +
      +
      + + + + diff --git a/docs/html/structRecurrenceData-members.html b/docs/html/structRecurrenceData-members.html new file mode 100644 index 00000000..ee337e10 --- /dev/null +++ b/docs/html/structRecurrenceData-members.html @@ -0,0 +1,87 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      +
      RecurrenceData Member List
      +
      +
      + +

      This is the complete list of members for RecurrenceData, including all inherited members.

      +
      + + + + diff --git a/docs/html/structRecurrenceData.html b/docs/html/structRecurrenceData.html new file mode 100644 index 00000000..66d7c611 --- /dev/null +++ b/docs/html/structRecurrenceData.html @@ -0,0 +1,90 @@ + + + + + + + +LogDoctor: RecurrenceData Struct Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      RecurrenceData Struct Referencefinal
      +
      +
      +
      The documentation for this struct was generated from the following file:
        +
      • logdoctor/modules/crapview/modules/lib.h
      • +
      +
      + + + + diff --git a/docs/html/structSnake_1_1Tile-members.html b/docs/html/structSnake_1_1Tile-members.html index 3e3e5cb7..7885f280 100644 --- a/docs/html/structSnake_1_1Tile-members.html +++ b/docs/html/structSnake_1_1Tile-members.html @@ -3,12 +3,14 @@ - + LogDoctor: Member List + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -83,7 +85,7 @@ $(function() { diff --git a/docs/html/structSnake_1_1Tile.html b/docs/html/structSnake_1_1Tile.html index 7fde2d94..2e1a8d66 100644 --- a/docs/html/structSnake_1_1Tile.html +++ b/docs/html/structSnake_1_1Tile.html @@ -3,12 +3,14 @@ - + LogDoctor: Snake::Tile Struct Reference + + @@ -22,7 +24,7 @@ Logo -
      LogDoctor 3.00 +
      LogDoctor 4.00
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      @@ -31,7 +33,7 @@
      - + @@ -77,7 +79,7 @@ $(function() {
      -
      Snake::Tile Struct Reference
      +
      Snake::Tile Struct Referencefinal

      The documentation for this struct was generated from the following file:
        @@ -86,7 +88,7 @@ $(function() {
      diff --git a/docs/html/structTrafficData-members.html b/docs/html/structTrafficData-members.html new file mode 100644 index 00000000..51eb9326 --- /dev/null +++ b/docs/html/structTrafficData-members.html @@ -0,0 +1,87 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      +
      TrafficData Member List
      +
      +
      + +

      This is the complete list of members for TrafficData, including all inherited members.

      +
      + + + + diff --git a/docs/html/structTrafficData.html b/docs/html/structTrafficData.html new file mode 100644 index 00000000..98623f7d --- /dev/null +++ b/docs/html/structTrafficData.html @@ -0,0 +1,90 @@ + + + + + + + +LogDoctor: TrafficData Struct Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      TrafficData Struct Referencefinal
      +
      +
      +
      The documentation for this struct was generated from the following file:
        +
      • logdoctor/modules/crapview/modules/lib.h
      • +
      +
      + + + + diff --git a/docs/html/structWarnlist-members.html b/docs/html/structWarnlist-members.html new file mode 100644 index 00000000..264cec92 --- /dev/null +++ b/docs/html/structWarnlist-members.html @@ -0,0 +1,91 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      +
      Warnlist Member List
      +
      +
      + +

      This is the complete list of members for Warnlist, including all inherited members.

      + + + + +
      get(const WarnlistField field)Warnlist
      isUsed(const WarnlistField field)Warnlistinline
      setUsed(const WarnlistField field, const bool used)Warnlistinline
      + + + + diff --git a/docs/html/structWarnlist.html b/docs/html/structWarnlist.html new file mode 100644 index 00000000..b1bf2347 --- /dev/null +++ b/docs/html/structWarnlist.html @@ -0,0 +1,201 @@ + + + + + + + +LogDoctor: Warnlist Struct Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      Warnlist Struct Referencefinal
      +
      +
      + + + + + + + + + + + +

      +Public Member Functions

      WarnlistItemget (const WarnlistField field)
       Returns a reference to the requested warnlist item.
       
      bool isUsed (const WarnlistField field)
       Returns whether the requested warnlist is in use.
       
      void setUsed (const WarnlistField field, const bool used)
       Sets the requested warnlist in the given in-use condition.
       
      +

      Member Function Documentation

      + +

      ◆ get()

      + +
      +
      + + + + + + + +
      WarnlistItem & Warnlist::get (const WarnlistField field)
      +
      + +

      Returns a reference to the requested warnlist item.

      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ isUsed()

      + +
      +
      + + + + + +
      + + + + + + + +
      bool Warnlist::isUsed (const WarnlistField field)
      +
      +inline
      +
      + +

      Returns whether the requested warnlist is in use.

      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ setUsed()

      + +
      +
      + + + + + +
      + + + + + + + + + + + +
      void Warnlist::setUsed (const WarnlistField field,
      const bool used )
      +
      +inline
      +
      + +

      Sets the requested warnlist in the given in-use condition.

      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      +
      The documentation for this struct was generated from the following files:
        +
      • logdoctor/modules/warnlists/modules/warnlist.h
      • +
      • logdoctor/modules/warnlists/modules/warnlist.cpp
      • +
      +
      + + + + diff --git a/docs/html/structWarnlistItem-members.html b/docs/html/structWarnlistItem-members.html new file mode 100644 index 00000000..da4277d9 --- /dev/null +++ b/docs/html/structWarnlistItem-members.html @@ -0,0 +1,95 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      +
      WarnlistItem Member List
      +
      +
      + +

      This is the complete list of members for WarnlistItem, including all inherited members.

      + + + + + + + + +
      add(const std::string &item)WarnlistItem
      fieldName() constWarnlistItem
      moveDown(const std::string &item)WarnlistItem
      moveUp(const std::string &item)WarnlistItem
      remove(const std::string &item)WarnlistItem
      sanitized(const std::string &item) constWarnlistItemprivate
      set(const std::vector< std::string > &new_list)WarnlistItem
      + + + + diff --git a/docs/html/structWarnlistItem.html b/docs/html/structWarnlistItem.html new file mode 100644 index 00000000..f88787bd --- /dev/null +++ b/docs/html/structWarnlistItem.html @@ -0,0 +1,305 @@ + + + + + + + +LogDoctor: WarnlistItem Struct Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      WarnlistItem Struct Referencefinal
      +
      +
      + + + + + + + + + + + + + + + + + + + + +

      +Public Member Functions

      const char * fieldName () const
       Returns the name of the field to which the list is associated.
       
      void set (const std::vector< std::string > &new_list)
       Replaces the current list with the one provided.
       
      void add (const std::string &item)
       Adds the provided item to the list.
       
      void remove (const std::string &item)
       Remove the requested item from the list.
       
      int moveUp (const std::string &item)
       Moves the requested item one position up in the list.
       
      int moveDown (const std::string &item)
       Moves the requested item one position down in the list.
       
      + + + + +

      +Private Member Functions

      std::string sanitized (const std::string &item) const
       Returns a sanitized item.
       
      +

      Member Function Documentation

      + +

      ◆ add()

      + +
      +
      + + + + + + + +
      void WarnlistItem::add (const std::string & item)
      +
      + +

      Adds the provided item to the list.

      +

      The item will be sanitized before actually being added to the list

      Exceptions
      + + +
      BWlistException,DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ fieldName()

      + +
      +
      + + + + + + + +
      const char * WarnlistItem::fieldName () const
      +
      + +

      Returns the name of the field to which the list is associated.

      +

      The name is translatable

      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ moveDown()

      + +
      +
      + + + + + + + +
      int WarnlistItem::moveDown (const std::string & item)
      +
      + +

      Moves the requested item one position down in the list.

      +
      Exceptions
      + + +
      BWlistException
      +
      +
      + +
      +
      + +

      ◆ moveUp()

      + +
      +
      + + + + + + + +
      int WarnlistItem::moveUp (const std::string & item)
      +
      + +

      Moves the requested item one position up in the list.

      +
      Exceptions
      + + +
      BWlistException
      +
      +
      + +
      +
      + +

      ◆ remove()

      + +
      +
      + + + + + + + +
      void WarnlistItem::remove (const std::string & item)
      +
      + +

      Remove the requested item from the list.

      +
      Exceptions
      + + +
      BWlistException
      +
      +
      + +
      +
      + +

      ◆ sanitized()

      + +
      +
      + + + + + +
      + + + + + + + +
      std::string WarnlistItem::sanitized (const std::string & item) const
      +
      +private
      +
      + +

      Returns a sanitized item.

      +
      Exceptions
      + + +
      BWlistException,DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ set()

      + +
      +
      + + + + + + + +
      void WarnlistItem::set (const std::vector< std::string > & new_list)
      +
      + +

      Replaces the current list with the one provided.

      +

      All the items will be sanitized before actually becoming part of the list

      Exceptions
      + + +
      BWlistException,DoNotCatchException
      +
      +
      + +
      +
      +
      The documentation for this struct was generated from the following files:
        +
      • logdoctor/modules/warnlists/modules/warnlist_item.h
      • +
      • logdoctor/modules/warnlists/modules/warnlist_item.cpp
      • +
      +
      + + + + diff --git a/docs/html/structWarnlists-members.html b/docs/html/structWarnlists-members.html new file mode 100644 index 00000000..7625a592 --- /dev/null +++ b/docs/html/structWarnlists-members.html @@ -0,0 +1,100 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      +
      Warnlists Member List
      +
      +
      + +

      This is the complete list of members for Warnlists, including all inherited members.

      + + + + + + + + + + + + + +
      addItem(const WebServer ws, const WarnlistField fld, const std::string &item)Warnlistsinline
      clearList(const WebServer ws, const WarnlistField fld)Warnlistsinline
      get(const WebServer ws)Warnlists
      get(const WebServer ws, const WarnlistField fld)Warnlistsinline
      getList(const WebServer ws, const WarnlistField fld)Warnlistsinline
      getListConst(const WebServer ws, const WarnlistField fld)Warnlistsinline
      isUsed(const WebServer ws, const WarnlistField fld)Warnlistsinline
      moveDownItem(const WebServer ws, const WarnlistField fld, const std::string &item)Warnlistsinline
      moveUpItem(const WebServer ws, const WarnlistField fld, const std::string &item)Warnlistsinline
      removeItem(const WebServer ws, const WarnlistField fld, const std::string &item)Warnlistsinline
      setList(const WebServer ws, const WarnlistField fld, const std::vector< std::string > &list)Warnlistsinline
      setUsed(const WebServer ws, const WarnlistField fld, const bool used)Warnlistsinline
      + + + + diff --git a/docs/html/structWarnlists.html b/docs/html/structWarnlists.html new file mode 100644 index 00000000..1b006d63 --- /dev/null +++ b/docs/html/structWarnlists.html @@ -0,0 +1,595 @@ + + + + + + + +LogDoctor: Warnlists Struct Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      Warnlists Struct Referencefinal
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

      +Public Member Functions

      bool isUsed (const WebServer ws, const WarnlistField fld)
       Returns whether the requested warnlist is in use.
       
      void setUsed (const WebServer ws, const WarnlistField fld, const bool used)
       Sets the requested warnlist in the given in-use condition.
       
      Warnlistget (const WebServer ws)
       Returns a reference to the requested warnlist.
       
      WarnlistItemget (const WebServer ws, const WarnlistField fld)
       Returns a reference to the requested warnlist.
       
      std::vector< std::string > & getList (const WebServer ws, const WarnlistField fld)
       Returns a reference to the requested warnlist.
       
      const std::vector< std::string > & getListConst (const WebServer ws, const WarnlistField fld)
       Returns a const reference to the requested warnlist.
       
      void setList (const WebServer ws, const WarnlistField fld, const std::vector< std::string > &list)
       Replaces the requested warnlist with the one provided.
       
      void clearList (const WebServer ws, const WarnlistField fld)
       Clears the requested warnlist.
       
      void addItem (const WebServer ws, const WarnlistField fld, const std::string &item)
       Adds the provided item to the requested warnlist.
       
      void removeItem (const WebServer ws, const WarnlistField fld, const std::string &item)
       Remove the requested item from the requested warnlist.
       
      int moveUpItem (const WebServer ws, const WarnlistField fld, const std::string &item)
       Moves the requested item one position up in the requested warnlist.
       
      int moveDownItem (const WebServer ws, const WarnlistField fld, const std::string &item)
       Moves the requested item one position down in the requested warnlist.
       
      +

      Member Function Documentation

      + +

      ◆ addItem()

      + +
      +
      + + + + + +
      + + + + + + + + + + + + + + + + +
      void Warnlists::addItem (const WebServer ws,
      const WarnlistField fld,
      const std::string & item )
      +
      +inline
      +
      + +

      Adds the provided item to the requested warnlist.

      +
      Exceptions
      + + +
      BWlistException,DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ clearList()

      + +
      +
      + + + + + +
      + + + + + + + + + + + +
      void Warnlists::clearList (const WebServer ws,
      const WarnlistField fld )
      +
      +inline
      +
      + +

      Clears the requested warnlist.

      +
      Exceptions
      + + +
      BWlistException,DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ get() [1/2]

      + +
      +
      + + + + + + + +
      Warnlist & Warnlists::get (const WebServer ws)
      +
      + +

      Returns a reference to the requested warnlist.

      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ get() [2/2]

      + +
      +
      + + + + + +
      + + + + + + + + + + + +
      WarnlistItem & Warnlists::get (const WebServer ws,
      const WarnlistField fld )
      +
      +inline
      +
      + +

      Returns a reference to the requested warnlist.

      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ getList()

      + +
      +
      + + + + + +
      + + + + + + + + + + + +
      std::vector< std::string > & Warnlists::getList (const WebServer ws,
      const WarnlistField fld )
      +
      +inline
      +
      + +

      Returns a reference to the requested warnlist.

      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ getListConst()

      + +
      +
      + + + + + +
      + + + + + + + + + + + +
      const std::vector< std::string > & Warnlists::getListConst (const WebServer ws,
      const WarnlistField fld )
      +
      +inline
      +
      + +

      Returns a const reference to the requested warnlist.

      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ isUsed()

      + +
      +
      + + + + + +
      + + + + + + + + + + + +
      bool Warnlists::isUsed (const WebServer ws,
      const WarnlistField fld )
      +
      +inline
      +
      + +

      Returns whether the requested warnlist is in use.

      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ moveDownItem()

      + +
      +
      + + + + + +
      + + + + + + + + + + + + + + + + +
      int Warnlists::moveDownItem (const WebServer ws,
      const WarnlistField fld,
      const std::string & item )
      +
      +inline
      +
      + +

      Moves the requested item one position down in the requested warnlist.

      +
      Exceptions
      + + +
      BWlistException
      +
      +
      + +
      +
      + +

      ◆ moveUpItem()

      + +
      +
      + + + + + +
      + + + + + + + + + + + + + + + + +
      int Warnlists::moveUpItem (const WebServer ws,
      const WarnlistField fld,
      const std::string & item )
      +
      +inline
      +
      + +

      Moves the requested item one position up in the requested warnlist.

      +
      Exceptions
      + + +
      BWlistException
      +
      +
      + +
      +
      + +

      ◆ removeItem()

      + +
      +
      + + + + + +
      + + + + + + + + + + + + + + + + +
      void Warnlists::removeItem (const WebServer ws,
      const WarnlistField fld,
      const std::string & item )
      +
      +inline
      +
      + +

      Remove the requested item from the requested warnlist.

      +
      Exceptions
      + + +
      BWlistException
      +
      +
      + +
      +
      + +

      ◆ setList()

      + +
      +
      + + + + + +
      + + + + + + + + + + + + + + + + +
      void Warnlists::setList (const WebServer ws,
      const WarnlistField fld,
      const std::vector< std::string > & list )
      +
      +inline
      +
      + +

      Replaces the requested warnlist with the one provided.

      +
      Exceptions
      + + +
      BWlistException,DoNotCatchException
      +
      +
      + +
      +
      + +

      ◆ setUsed()

      + +
      +
      + + + + + +
      + + + + + + + + + + + + + + + + +
      void Warnlists::setUsed (const WebServer ws,
      const WarnlistField fld,
      const bool used )
      +
      +inline
      +
      + +

      Sets the requested warnlist in the given in-use condition.

      +
      Exceptions
      + + +
      DoNotCatchException
      +
      +
      + +
      +
      +
      The documentation for this struct was generated from the following files:
        +
      • logdoctor/modules/warnlists/warnlists.h
      • +
      • logdoctor/modules/warnlists/warnlists.cpp
      • +
      +
      + + + + diff --git a/docs/html/structZipperator-members.html b/docs/html/structZipperator-members.html new file mode 100644 index 00000000..3fa3159d --- /dev/null +++ b/docs/html/structZipperator-members.html @@ -0,0 +1,87 @@ + + + + + + + +LogDoctor: Member List + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      +
      Zipperator< Array > Member List
      +
      +
      + +

      This is the complete list of members for Zipperator< Array >, including all inherited members.

      +
      + + + + diff --git a/docs/html/structZipperator.html b/docs/html/structZipperator.html new file mode 100644 index 00000000..0b787200 --- /dev/null +++ b/docs/html/structZipperator.html @@ -0,0 +1,90 @@ + + + + + + + +LogDoctor: Zipperator< Array > Struct Template Reference + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      + +
      Zipperator< Array > Struct Template Reference
      +
      +
      +
      The documentation for this struct was generated from the following file:
        +
      • logdoctor/utilities/arrays.h
      • +
      +
      + + + + diff --git a/docs/html/tabs.css b/docs/html/tabs.css index 71c8a470..fe4854aa 100644 --- a/docs/html/tabs.css +++ b/docs/html/tabs.css @@ -1 +1 @@ -.sm{position:relative;z-index:9999}.sm,.sm ul,.sm li{display:block;list-style:none;margin:0;padding:0;line-height:normal;direction:ltr;text-align:left;-webkit-tap-highlight-color:rgba(0,0,0,0)}.sm-rtl,.sm-rtl ul,.sm-rtl li{direction:rtl;text-align:right}.sm>li>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0}.sm ul{display:none}.sm li,.sm a{position:relative}.sm a{display:block}.sm a.disabled{cursor:not-allowed}.sm:after{content:"\00a0";display:block;height:0;font:0/0 serif;clear:both;visibility:hidden;overflow:hidden}.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.main-menu-btn{position:relative;display:inline-block;width:36px;height:36px;text-indent:36px;margin-left:8px;white-space:nowrap;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0)}.main-menu-btn-icon,.main-menu-btn-icon:before,.main-menu-btn-icon:after{position:absolute;top:50%;left:2px;height:2px;width:24px;background:var(--nav-menu-button-color);-webkit-transition:all .25s;transition:all .25s}.main-menu-btn-icon:before{content:'';top:-7px;left:0}.main-menu-btn-icon:after{content:'';top:7px;left:0}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon{height:0}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:before{top:0;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:after{top:0;-webkit-transform:rotate(45deg);transform:rotate(45deg)}#main-menu-state{position:absolute;width:1px;height:1px;margin:-1px;border:0;padding:0;overflow:hidden;clip:rect(1px,1px,1px,1px)}#main-menu-state:not(:checked) ~ #main-menu{display:none}#main-menu-state:checked ~ #main-menu{display:block}@media(min-width:768px){.main-menu-btn{position:absolute;top:-99999px}#main-menu-state:not(:checked) ~ #main-menu{display:block}}.sm-dox{background-image:var(--nav-gradient-image)}.sm-dox a,.sm-dox a:focus,.sm-dox a:hover,.sm-dox a:active{padding:0 12px;padding-right:43px;font-family:var(--font-family-nav);font-size:13px;font-weight:bold;line-height:36px;text-decoration:none;text-shadow:var(--nav-text-normal-shadow);color:var(--nav-text-normal-color);outline:0}.sm-dox a:hover{background-image:var(--nav-gradient-active-image);background-repeat:repeat-x;color:var(--nav-text-hover-color);text-shadow:var(--nav-text-hover-shadow)}.sm-dox a.current{color:#d23600}.sm-dox a.disabled{color:#bbb}.sm-dox a span.sub-arrow{position:absolute;top:50%;margin-top:-14px;left:auto;right:3px;width:28px;height:28px;overflow:hidden;font:bold 12px/28px monospace !important;text-align:center;text-shadow:none;background:var(--nav-menu-toggle-color);-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox a span.sub-arrow:before{display:block;content:'+'}.sm-dox a.highlighted span.sub-arrow:before{display:block;content:'-'}.sm-dox>li:first-child>a,.sm-dox>li:first-child>:not(ul) a{-moz-border-radius:5px 5px 0 0;-webkit-border-radius:5px;border-radius:5px 5px 0 0}.sm-dox>li:last-child>a,.sm-dox>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul{-moz-border-radius:0 0 5px 5px;-webkit-border-radius:0;border-radius:0 0 5px 5px}.sm-dox>li:last-child>a.highlighted,.sm-dox>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox ul{background:var(--nav-menu-background-color)}.sm-dox ul a,.sm-dox ul a:focus,.sm-dox ul a:hover,.sm-dox ul a:active{font-size:12px;border-left:8px solid transparent;line-height:36px;text-shadow:none;background-color:var(--nav-menu-background-color);background-image:none}.sm-dox ul a:hover{background-image:var(--nav-gradient-active-image);background-repeat:repeat-x;color:var(--nav-text-hover-color);text-shadow:0 1px 1px black}.sm-dox ul ul a,.sm-dox ul ul a:hover,.sm-dox ul ul a:focus,.sm-dox ul ul a:active{border-left:16px solid transparent}.sm-dox ul ul ul a,.sm-dox ul ul ul a:hover,.sm-dox ul ul ul a:focus,.sm-dox ul ul ul a:active{border-left:24px solid transparent}.sm-dox ul ul ul ul a,.sm-dox ul ul ul ul a:hover,.sm-dox ul ul ul ul a:focus,.sm-dox ul ul ul ul a:active{border-left:32px solid transparent}.sm-dox ul ul ul ul ul a,.sm-dox ul ul ul ul ul a:hover,.sm-dox ul ul ul ul ul a:focus,.sm-dox ul ul ul ul ul a:active{border-left:40px solid transparent}@media(min-width:768px){.sm-dox ul{position:absolute;width:12em}.sm-dox li{float:left}.sm-dox.sm-rtl li{float:right}.sm-dox ul li,.sm-dox.sm-rtl ul li,.sm-dox.sm-vertical li{float:none}.sm-dox a{white-space:nowrap}.sm-dox ul a,.sm-dox.sm-vertical a{white-space:normal}.sm-dox .sm-nowrap>li>a,.sm-dox .sm-nowrap>li>:not(ul) a{white-space:nowrap}.sm-dox{padding:0 10px;background-image:var(--nav-gradient-image);line-height:36px}.sm-dox a span.sub-arrow{top:50%;margin-top:-2px;right:12px;width:0;height:0;border-width:4px;border-style:solid dashed dashed dashed;border-color:var(--nav-text-normal-color) transparent transparent transparent;background:transparent;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted{padding:0 12px;background-image:var(--nav-separator-image);background-repeat:no-repeat;background-position:right;-moz-border-radius:0 !important;-webkit-border-radius:0;border-radius:0 !important}.sm-dox a:hover{background-image:var(--nav-gradient-active-image);background-repeat:repeat-x;color:var(--nav-text-hover-color);text-shadow:var(--nav-text-hover-shadow)}.sm-dox a:hover span.sub-arrow{border-color:var(--nav-text-hover-color) transparent transparent transparent}.sm-dox a.has-submenu{padding-right:24px}.sm-dox li{border-top:0}.sm-dox>li>ul:before,.sm-dox>li>ul:after{content:'';position:absolute;top:-18px;left:30px;width:0;height:0;overflow:hidden;border-width:9px;border-style:dashed dashed solid dashed;border-color:transparent transparent #bbb transparent}.sm-dox>li>ul:after{top:-16px;left:31px;border-width:8px;border-color:transparent transparent var(--nav-menu-background-color) transparent}.sm-dox ul{border:1px solid #bbb;padding:5px 0;background:var(--nav-menu-background-color);-moz-border-radius:5px !important;-webkit-border-radius:5px;border-radius:5px !important;-moz-box-shadow:0 5px 9px rgba(0,0,0,0.2);-webkit-box-shadow:0 5px 9px rgba(0,0,0,0.2);box-shadow:0 5px 9px rgba(0,0,0,0.2)}.sm-dox ul a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent var(--nav-menu-foreground-color);border-style:dashed dashed dashed solid}.sm-dox ul a,.sm-dox ul a:hover,.sm-dox ul a:focus,.sm-dox ul a:active,.sm-dox ul a.highlighted{color:var(--nav-menu-foreground-color);background-image:none;border:0 !important;color:var(--nav-menu-foreground-color);background-image:none}.sm-dox ul a:hover{background-image:var(--nav-gradient-active-image);background-repeat:repeat-x;color:var(--nav-text-hover-color);text-shadow:var(--nav-text-hover-shadow)}.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent var(--nav-text-hover-color)}.sm-dox span.scroll-up,.sm-dox span.scroll-down{position:absolute;display:none;visibility:hidden;overflow:hidden;background:var(--nav-menu-background-color);height:36px}.sm-dox span.scroll-up:hover,.sm-dox span.scroll-down:hover{background:#eee}.sm-dox span.scroll-up:hover span.scroll-up-arrow,.sm-dox span.scroll-up:hover span.scroll-down-arrow{border-color:transparent transparent #d23600 transparent}.sm-dox span.scroll-down:hover span.scroll-down-arrow{border-color:#d23600 transparent transparent transparent}.sm-dox span.scroll-up-arrow,.sm-dox span.scroll-down-arrow{position:absolute;top:0;left:50%;margin-left:-6px;width:0;height:0;overflow:hidden;border-width:6px;border-style:dashed dashed solid dashed;border-color:transparent transparent var(--nav-menu-foreground-color) transparent}.sm-dox span.scroll-down-arrow{top:8px;border-style:solid dashed dashed dashed;border-color:var(--nav-menu-foreground-color) transparent transparent transparent}.sm-dox.sm-rtl a.has-submenu{padding-right:12px;padding-left:24px}.sm-dox.sm-rtl a span.sub-arrow{right:auto;left:12px}.sm-dox.sm-rtl.sm-vertical a.has-submenu{padding:10px 20px}.sm-dox.sm-rtl.sm-vertical a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-rtl>li>ul:before{left:auto;right:30px}.sm-dox.sm-rtl>li>ul:after{left:auto;right:31px}.sm-dox.sm-rtl ul a.has-submenu{padding:10px 20px !important}.sm-dox.sm-rtl ul a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-vertical{padding:10px 0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox.sm-vertical a{padding:10px 20px}.sm-dox.sm-vertical a:hover,.sm-dox.sm-vertical a:focus,.sm-dox.sm-vertical a:active,.sm-dox.sm-vertical a.highlighted{background:#fff}.sm-dox.sm-vertical a.disabled{background-image:var(--nav-gradient-image)}.sm-dox.sm-vertical a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-style:dashed dashed dashed solid;border-color:transparent transparent transparent #555}.sm-dox.sm-vertical>li>ul:before,.sm-dox.sm-vertical>li>ul:after{display:none}.sm-dox.sm-vertical ul a{padding:10px 20px}.sm-dox.sm-vertical ul a:hover,.sm-dox.sm-vertical ul a:focus,.sm-dox.sm-vertical ul a:active,.sm-dox.sm-vertical ul a.highlighted{background:#eee}.sm-dox.sm-vertical ul a.disabled{background:var(--nav-menu-background-color)}} \ No newline at end of file +.sm{position:relative;z-index:9999}.sm,.sm ul,.sm li{display:block;list-style:none;margin:0;padding:0;line-height:normal;direction:ltr;text-align:left;-webkit-tap-highlight-color:rgba(0,0,0,0)}.sm-rtl,.sm-rtl ul,.sm-rtl li{direction:rtl;text-align:right}.sm>li>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0}.sm ul{display:none}.sm li,.sm a{position:relative}.sm a{display:block}.sm a.disabled{cursor:not-allowed}.sm:after{content:"\00a0";display:block;height:0;font:0/0 serif;clear:both;visibility:hidden;overflow:hidden}.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.main-menu-btn{position:relative;display:inline-block;width:36px;height:36px;text-indent:36px;margin-left:8px;white-space:nowrap;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0)}.main-menu-btn-icon,.main-menu-btn-icon:before,.main-menu-btn-icon:after{position:absolute;top:50%;left:2px;height:2px;width:24px;background:var(--nav-menu-button-color);-webkit-transition:all .25s;transition:all .25s}.main-menu-btn-icon:before{content:'';top:-7px;left:0}.main-menu-btn-icon:after{content:'';top:7px;left:0}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon{height:0}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:before{top:0;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:after{top:0;-webkit-transform:rotate(45deg);transform:rotate(45deg)}#main-menu-state{position:absolute;width:1px;height:1px;margin:-1px;border:0;padding:0;overflow:hidden;clip:rect(1px,1px,1px,1px)}#main-menu-state:not(:checked) ~ #main-menu{display:none}#main-menu-state:checked ~ #main-menu{display:block}@media(min-width:768px){.main-menu-btn{position:absolute;top:-99999px}#main-menu-state:not(:checked) ~ #main-menu{display:block}}.sm-dox{background-image:var(--nav-gradient-image)}.sm-dox a,.sm-dox a:focus,.sm-dox a:hover,.sm-dox a:active{padding:0 12px;padding-right:43px;font-family:var(--font-family-nav);font-size:13px;font-weight:bold;line-height:36px;text-decoration:none;text-shadow:var(--nav-text-normal-shadow);color:var(--nav-text-normal-color);outline:0}.sm-dox a:hover{background-image:var(--nav-gradient-active-image);background-repeat:repeat-x;color:var(--nav-text-hover-color);text-shadow:var(--nav-text-hover-shadow)}.sm-dox a.current{color:#d23600}.sm-dox a.disabled{color:#bbb}.sm-dox a span.sub-arrow{position:absolute;top:50%;margin-top:-14px;left:auto;right:3px;width:28px;height:28px;overflow:hidden;font:bold 12px/28px monospace !important;text-align:center;text-shadow:none;background:var(--nav-menu-toggle-color);-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox a span.sub-arrow:before{display:block;content:'+'}.sm-dox a.highlighted span.sub-arrow:before{display:block;content:'-'}.sm-dox>li:first-child>a,.sm-dox>li:first-child>:not(ul) a{-moz-border-radius:5px 5px 0 0;-webkit-border-radius:5px;border-radius:5px 5px 0 0}.sm-dox>li:last-child>a,.sm-dox>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul{-moz-border-radius:0 0 5px 5px;-webkit-border-radius:0;border-radius:0 0 5px 5px}.sm-dox>li:last-child>a.highlighted,.sm-dox>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox ul{background:var(--nav-menu-background-color)}.sm-dox ul a,.sm-dox ul a:focus,.sm-dox ul a:hover,.sm-dox ul a:active{font-size:12px;border-left:8px solid transparent;line-height:36px;text-shadow:none;background-color:var(--nav-menu-background-color);background-image:none}.sm-dox ul a:hover{background-image:var(--nav-gradient-active-image);background-repeat:repeat-x;color:var(--nav-text-hover-color);text-shadow:0 1px 1px black}.sm-dox ul ul a,.sm-dox ul ul a:hover,.sm-dox ul ul a:focus,.sm-dox ul ul a:active{border-left:16px solid transparent}.sm-dox ul ul ul a,.sm-dox ul ul ul a:hover,.sm-dox ul ul ul a:focus,.sm-dox ul ul ul a:active{border-left:24px solid transparent}.sm-dox ul ul ul ul a,.sm-dox ul ul ul ul a:hover,.sm-dox ul ul ul ul a:focus,.sm-dox ul ul ul ul a:active{border-left:32px solid transparent}.sm-dox ul ul ul ul ul a,.sm-dox ul ul ul ul ul a:hover,.sm-dox ul ul ul ul ul a:focus,.sm-dox ul ul ul ul ul a:active{border-left:40px solid transparent}@media(min-width:768px){.sm-dox ul{position:absolute;width:12em}.sm-dox li{float:left}.sm-dox.sm-rtl li{float:right}.sm-dox ul li,.sm-dox.sm-rtl ul li,.sm-dox.sm-vertical li{float:none}.sm-dox a{white-space:nowrap}.sm-dox ul a,.sm-dox.sm-vertical a{white-space:normal}.sm-dox .sm-nowrap>li>a,.sm-dox .sm-nowrap>li>:not(ul) a{white-space:nowrap}.sm-dox{padding:0 10px;background-image:var(--nav-gradient-image);line-height:36px}.sm-dox a span.sub-arrow{top:50%;margin-top:-2px;right:12px;width:0;height:0;border-width:4px;border-style:solid dashed dashed dashed;border-color:var(--nav-text-normal-color) transparent transparent transparent;background:transparent;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted{padding:0 12px;background-image:var(--nav-separator-image);background-repeat:no-repeat;background-position:right;-moz-border-radius:0 !important;-webkit-border-radius:0;border-radius:0 !important}.sm-dox a:hover{background-image:var(--nav-gradient-active-image);background-repeat:repeat-x;color:var(--nav-text-hover-color);text-shadow:var(--nav-text-hover-shadow)}.sm-dox a:hover span.sub-arrow{border-color:var(--nav-text-hover-color) transparent transparent transparent}.sm-dox a.has-submenu{padding-right:24px}.sm-dox li{border-top:0}.sm-dox>li>ul:before,.sm-dox>li>ul:after{content:'';position:absolute;top:-18px;left:30px;width:0;height:0;overflow:hidden;border-width:9px;border-style:dashed dashed solid dashed;border-color:transparent transparent #bbb transparent}.sm-dox>li>ul:after{top:-16px;left:31px;border-width:8px;border-color:transparent transparent var(--nav-menu-background-color) transparent}.sm-dox ul{border:1px solid #bbb;padding:5px 0;background:var(--nav-menu-background-color);-moz-border-radius:5px !important;-webkit-border-radius:5px;border-radius:5px !important;-moz-box-shadow:0 5px 9px rgba(0,0,0,0.2);-webkit-box-shadow:0 5px 9px rgba(0,0,0,0.2);box-shadow:0 5px 9px rgba(0,0,0,0.2)}.sm-dox ul a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent var(--nav-menu-foreground-color);border-style:dashed dashed dashed solid}.sm-dox ul a,.sm-dox ul a:hover,.sm-dox ul a:focus,.sm-dox ul a:active,.sm-dox ul a.highlighted{color:var(--nav-menu-foreground-color);background-image:none;border:0 !important}.sm-dox ul a:hover{background-image:var(--nav-gradient-active-image);background-repeat:repeat-x;color:var(--nav-text-hover-color);text-shadow:var(--nav-text-hover-shadow)}.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent var(--nav-text-hover-color)}.sm-dox span.scroll-up,.sm-dox span.scroll-down{position:absolute;display:none;visibility:hidden;overflow:hidden;background:var(--nav-menu-background-color);height:36px}.sm-dox span.scroll-up:hover,.sm-dox span.scroll-down:hover{background:#eee}.sm-dox span.scroll-up:hover span.scroll-up-arrow,.sm-dox span.scroll-up:hover span.scroll-down-arrow{border-color:transparent transparent #d23600 transparent}.sm-dox span.scroll-down:hover span.scroll-down-arrow{border-color:#d23600 transparent transparent transparent}.sm-dox span.scroll-up-arrow,.sm-dox span.scroll-down-arrow{position:absolute;top:0;left:50%;margin-left:-6px;width:0;height:0;overflow:hidden;border-width:6px;border-style:dashed dashed solid dashed;border-color:transparent transparent var(--nav-menu-foreground-color) transparent}.sm-dox span.scroll-down-arrow{top:8px;border-style:solid dashed dashed dashed;border-color:var(--nav-menu-foreground-color) transparent transparent transparent}.sm-dox.sm-rtl a.has-submenu{padding-right:12px;padding-left:24px}.sm-dox.sm-rtl a span.sub-arrow{right:auto;left:12px}.sm-dox.sm-rtl.sm-vertical a.has-submenu{padding:10px 20px}.sm-dox.sm-rtl.sm-vertical a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-rtl>li>ul:before{left:auto;right:30px}.sm-dox.sm-rtl>li>ul:after{left:auto;right:31px}.sm-dox.sm-rtl ul a.has-submenu{padding:10px 20px !important}.sm-dox.sm-rtl ul a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-vertical{padding:10px 0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox.sm-vertical a{padding:10px 20px}.sm-dox.sm-vertical a:hover,.sm-dox.sm-vertical a:focus,.sm-dox.sm-vertical a:active,.sm-dox.sm-vertical a.highlighted{background:#fff}.sm-dox.sm-vertical a.disabled{background-image:var(--nav-gradient-image)}.sm-dox.sm-vertical a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-style:dashed dashed dashed solid;border-color:transparent transparent transparent #555}.sm-dox.sm-vertical>li>ul:before,.sm-dox.sm-vertical>li>ul:after{display:none}.sm-dox.sm-vertical ul a{padding:10px 20px}.sm-dox.sm-vertical ul a:hover,.sm-dox.sm-vertical ul a:focus,.sm-dox.sm-vertical ul a:active,.sm-dox.sm-vertical ul a.highlighted{background:#eee}.sm-dox.sm-vertical ul a.disabled{background:var(--nav-menu-background-color)}} \ No newline at end of file diff --git a/docs/html/todo.html b/docs/html/todo.html new file mode 100644 index 00000000..cf763dd9 --- /dev/null +++ b/docs/html/todo.html @@ -0,0 +1,92 @@ + + + + + + + +LogDoctor: Todo List + + + + + + + + + + + +
      +
      + + + + + + + +
      +
      LogDoctor 4.00 +
      +
      Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
      +
      +
      + + + + + + + + +
      +
      + + +
      +
      +
      +
      +
      +
      Loading...
      +
      Searching...
      +
      No Matches
      +
      +
      +
      +
      + +
      +
      +
      Todo List
      +
      +
      +
      +
      Member ArrayOps::enumerate (const Array &array)
      +
      Replace with std::views::enumerate when clang will fully support it
      +
      Member ArrayOps::zip (Array &l_array, Array &r_array)
      +
      Replace with std::views::zip when clang will fully support it
      +
      +
      +
      + + + + diff --git a/installation_stuff/logdoctor.conf b/installation_stuff/logdoctor.conf index c16b105f..7222ded4 100644 --- a/installation_stuff/logdoctor.conf +++ b/installation_stuff/logdoctor.conf @@ -6,7 +6,7 @@ WindowTheme=0 IconsTheme=0 ChartsTheme=0 MainDialogsLevel=1 -DefaultWebServer=11 +DefaultWebServer=Apache DatabaseDataPath= DatabaseHashesPath= DatabaseDoBackup=true @@ -23,9 +23,9 @@ HideUsedFiles=true WarningSize=52428801 [Apache2] -ApacheLogsPath=/var/log/apache2 -ApacheLogsFormat=%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i" -ApacheWarnlistMethod=DELETE HEAD OPTIONS PUT PATCH +ApacheLogsPath= +ApacheLogsFormat= +ApacheWarnlistMethod=DELETE HEAD OPTIONS PUT PATCH TRACE ApacheWarnlistMethodUsed=false ApacheWarnlistURI=/robots.txt /../ /./ /.env /.htaccess /phpmyadmin /wp-admin /wp-content /wp-config.php /config.py /views.py /routes.py /stepu.cgi /cgi-bin ApacheWarnlistURIUsed=true @@ -37,9 +37,9 @@ ApacheBlacklistClient=::1 ApacheBlacklistClientUsed=true [Nginx] -NginxLogsPath=/var/log/nginx -NginxLogsFormat=$remote_addr - $remote_user [$time_local] "$request" $status $bytes_sent "$http_referer" "$http_user_agent" -NginxWarnlistMethod=DELETE HEAD OPTIONS PUT PATCH +NginxLogsPath= +NginxLogsFormat= +NginxWarnlistMethod=DELETE HEAD OPTIONS PUT PATCH TRACE NginxWarnlistMethodUsed=false NginxWarnlistURI=/robots.txt /../ /./ /.env /.htaccess /phpmyadmin /wp-admin /wp-content /wp-config.php /config.py /views.py /routes.py /stepu.cgi /cgi-bin NginxWarnlistURIUsed=true @@ -51,10 +51,10 @@ NginxBlacklistClient=::1 NginxBlacklistClientUsed=true [IIS] -IisLogsPath=C:/inetpub/logs/LogFiles/ +IisLogsPath= IisLogsModule=0 -IisLogsFormat=date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken -IisWarnlistMethod=DELETE HEAD OPTIONS PUT PATCH +IisLogsFormat= +IisWarnlistMethod=DELETE HEAD OPTIONS PUT PATCH TRACE IisWarnlistMethodUsed=false IisWarnlistURI=/robots.txt /../ /./ /.env /.htaccess /phpmyadmin /wp-admin /wp-content /wp-config.php /config.py /views.py /routes.py /stepu.cgi /cgi-bin IisWarnlistURIUsed=true diff --git a/installation_stuff/osx_bundle/Info.plist b/installation_stuff/osx_bundle/Info.plist index 40fdb3ee..4abadcc5 100644 --- a/installation_stuff/osx_bundle/Info.plist +++ b/installation_stuff/osx_bundle/Info.plist @@ -13,9 +13,9 @@ CFBundleIdentifier com.logdoctor.LogDoctor CFBundleShortVersionString - 3.00 + 4.00 CFBundleVersion - 3.00 + 4.00 CFBundleExecutable LogDoctor CFBundleIconFile diff --git a/logdoctor/CMakeLists.txt b/logdoctor/CMakeLists.txt index 5b8a1b0a..31708621 100644 --- a/logdoctor/CMakeLists.txt +++ b/logdoctor/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.5) -project(LogDoctor VERSION 3.00 LANGUAGES CXX) +project(LogDoctor VERSION 4.00 LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -46,13 +46,21 @@ set(PROJECT_SOURCES mainwindow.h mainwindow.cpp + main_lib.h + + globals/db_names.h + globals/db_names.cpp globals/global_configs.h globals/global_configs.cpp - defines/web_servers.h - - customs/treewidgetitems.h + customs/logfile_treewidgetitem.h + customs/models/logfields_listmodel.h + customs/models/logfields_listmodel.cpp + utilities/arrays.h + utilities/bwlists.h + utilities/bwutils.cpp + utilities/chars.h utilities/checks.h utilities/checks.cpp utilities/colors.h @@ -74,13 +82,15 @@ set(PROJECT_SOURCES utilities/vectors.h modules/shared.h - modules/shared.cpp modules/exceptions.h modules/exceptions.cpp modules/tb.h modules/tb.cpp + modules/database/database.h + modules/database/database.cpp + modules/dialogs.h modules/dialogs.cpp modules/dialogs/message_dialog.ui @@ -93,6 +103,23 @@ set(PROJECT_SOURCES modules/dialogs/ida_dialog.h modules/dialogs/ida_dialog.cpp + modules/blacklists/blacklists.h + modules/blacklists/blacklists.cpp + modules/blacklists/modules/lib.h + modules/blacklists/modules/blacklist.h + modules/blacklists/modules/blacklist.cpp + modules/blacklists/modules/blacklist_item.h + modules/blacklists/modules/blacklist_item.cpp + + modules/warnlists/warnlists.h + modules/warnlists/warnlists.cpp + modules/warnlists/modules/lib.h + modules/warnlists/modules/warnlist.h + modules/warnlists/modules/warnlist.cpp + modules/warnlists/modules/warnlist_item.h + modules/warnlists/modules/warnlist_item.cpp + + modules/craplog/lib.h modules/craplog/craplog.h modules/craplog/craplog.cpp modules/craplog/modules/lib.h @@ -111,15 +138,14 @@ set(PROJECT_SOURCES modules/craplog/modules/workers/lib.h modules/craplog/modules/workers/lister.h modules/craplog/modules/workers/lister.cpp - modules/craplog/modules/workers/parser_interface.h - modules/craplog/modules/workers/parser_interface.cpp modules/craplog/modules/workers/parser.h modules/craplog/modules/workers/parser.cpp - modules/craplog/modules/workers/parser_async.h - modules/craplog/modules/workers/parser_async.cpp + modules/craplog/modules/workers/impl/loglinedata.cpp + modules/crapview/lib.h modules/crapview/crapview.h modules/crapview/crapview.cpp + modules/crapview/modules/lib.h modules/crapview/modules/filters.h modules/crapview/modules/filters.cpp modules/crapview/modules/query.h @@ -141,9 +167,20 @@ set(PROJECT_SOURCES modules/crapinfo/modules/stylesheets.h modules/crapinfo/modules/stylesheets.cpp + modules/changelog/changelog.ui + modules/changelog/changelog.h + modules/changelog/changelog.cpp + modules/changelog/modules/stylesheets.h + modules/changelog/modules/stylesheets.cpp + + tools/crappath/crappath.h + tools/crappath/crappath.cpp + tools/crapnote/crapnote.ui tools/crapnote/crapnote.h tools/crapnote/crapnote.cpp + tools/crapnote/modules/stylesheets.h + tools/crapnote/modules/stylesheets.cpp games/game_dialog.ui games/game_dialog.h @@ -229,6 +266,8 @@ add_executable(LogDocTester modules/exceptions.h modules/exceptions.cpp modules/craplog/modules/lib.h + modules/craplog/modules/workers/lib.h + modules/craplog/modules/workers/impl/loglinedata.cpp utilities/gzip.h utilities/gzip.cpp utilities/io.h diff --git a/logdoctor/customs/logfile_treewidgetitem.h b/logdoctor/customs/logfile_treewidgetitem.h new file mode 100644 index 00000000..366ebdde --- /dev/null +++ b/logdoctor/customs/logfile_treewidgetitem.h @@ -0,0 +1,39 @@ +#ifndef LOGDOCTOR__CUSTOMS__LOGFILE_TREEWIDGETITEM_H +#define LOGDOCTOR__CUSTOMS__LOGFILE_TREEWIDGETITEM_H + + +#include + + +class LogFileTreeWidgetItem final : public QTreeWidgetItem { +public: + LogFileTreeWidgetItem(QTreeWidget*parent=nullptr):QTreeWidgetItem(parent){} + bool operator < (const QTreeWidgetItem& other) const { + const int sort_column{ this->treeWidget()->sortColumn() }; + const QString s_str{ this->text(sort_column) }; + const QString o_str{ other.text(sort_column) }; + if ( sort_column == 0 ) { + // sort by file name + const qsizetype s_sz{ s_str.size() }; + const qsizetype o_sz{ o_str.size() }; + if ( s_sz != o_sz ) { + return s_sz < o_sz; + } + return s_str < o_str; + } else { + // sort by file size + std::vector s_items; + StringOps::splitrip( s_items, s_str.toStdString(), ' ' ); + std::vector o_items; + StringOps::splitrip( o_items, o_str.toStdString(), ' ' ); + if ( s_items[1] != o_items[1] ) { + return s_items[1] < o_items[1]; + } + return std::stof( s_items[0] ) < std::stof( o_items[0] ); + } + return true; + } +}; + + +#endif // LOGDOCTOR__CUSTOMS__LOGFILE_TREEWIDGETITEM_H diff --git a/logdoctor/customs/models/logfields_listmodel.cpp b/logdoctor/customs/models/logfields_listmodel.cpp new file mode 100644 index 00000000..defea9cd --- /dev/null +++ b/logdoctor/customs/models/logfields_listmodel.cpp @@ -0,0 +1,92 @@ + +#include "logfields_listmodel.h" + +#include "modules/shared.h" + +#include "modules/crapview/lib.h" + +#include + + +LogFieldsListModel::LogFieldsListModel( real_data_t&& new_data, QObject* parent ) + : QAbstractListModel{ parent } + , real_data{ std::move(new_data) } + , view_data( this->real_data.size() ) +{ + this->translate(); +} + +void LogFieldsListModel::translate() +{ + if ( this->real_data.empty() ) { + return; + } + + std::transform( this->real_data.cbegin(), this->real_data.cend(), this->view_data.begin(), + [](const data_pair_t& p){ return TR::tr( p.second.c_str() ); } ); +} + +int LogFieldsListModel::rowCount( const QModelIndex& parent ) const +{ + Q_UNUSED(parent) + return this->view_data.count(); +} + +QVariant LogFieldsListModel::data( const QModelIndex& index, int role ) const +{ + if ( !index.isValid() || index.row() >= this->view_data.count() ) { + return QVariant{}; + } + + switch ( role ) { + case Qt::DisplayRole: + return this->view_data.at( index.row() ); + case Qt::UserRole: + return QVariant::fromValue( this->real_data.at( index.row() ).first ); + default: + return QVariant{}; + } +} + + + +DaytimeLogFieldsListModel::DaytimeLogFieldsListModel( QObject* parent ) + : LogFieldsListModel( + { + {LogField::Protocol, FIELDS__PROTOCOL}, + {LogField::Method, FIELDS__METHOD}, + {LogField::Uri, FIELDS__URI}, + {LogField::Query, FIELDS__QUERY}, + {LogField::ResponseCode, FIELDS__RESPONSE_CODE}, + {LogField::UserAgent, FIELDS__USER_AGENT}, + {LogField::Client, FIELDS__CLIENT}, + {LogField::Cookie, FIELDS__COOKIE}, + {LogField::Referrer, FIELDS__REFERRER} + }, + parent ) +{ + +} + + + +RelationslLogFieldsListModel::RelationslLogFieldsListModel( QObject* parent ) + : LogFieldsListModel( + { + {LogField::Protocol, FIELDS__PROTOCOL}, + {LogField::Method, FIELDS__METHOD}, + {LogField::Uri, FIELDS__URI}, + {LogField::Query, FIELDS__QUERY}, + {LogField::ResponseCode, FIELDS__RESPONSE_CODE}, + {LogField::TimeTaken, FIELDS__TIME_TAKEN}, + {LogField::BytesSent, FIELDS__BYTES_SENT}, + {LogField::BytesReceived, FIELDS__BYTES_RECEIVED}, + {LogField::UserAgent, FIELDS__USER_AGENT}, + {LogField::Client, FIELDS__CLIENT}, + {LogField::Cookie, FIELDS__COOKIE}, + {LogField::Referrer, FIELDS__REFERRER} + }, + parent ) +{ + +} diff --git a/logdoctor/customs/models/logfields_listmodel.h b/logdoctor/customs/models/logfields_listmodel.h new file mode 100644 index 00000000..1cf35d85 --- /dev/null +++ b/logdoctor/customs/models/logfields_listmodel.h @@ -0,0 +1,50 @@ +#ifndef LOGDOCTOR__CUSTOMS__LOGFIELDS_LISTMODEL_H +#define LOGDOCTOR__CUSTOMS__LOGFIELDS_LISTMODEL_H + + +#include + +enum class LogField; + + +class LogFieldsListModel : public QAbstractListModel +{ + Q_OBJECT + +protected: + using data_pair_t = std::pair; + using real_data_t = std::vector; + +public: + explicit LogFieldsListModel( real_data_t&& new_data, QObject* parent=nullptr ); + virtual ~LogFieldsListModel() = default; + + void translate(); + + int rowCount( const QModelIndex& parent=QModelIndex() ) const override; + QVariant data( const QModelIndex& index, int role ) const override; + +private: + real_data_t real_data; + QVector view_data; + +}; + + +class DaytimeLogFieldsListModel final : public LogFieldsListModel +{ + Q_OBJECT +public: + DaytimeLogFieldsListModel( QObject* parent=nullptr ); +}; + + +class RelationslLogFieldsListModel final : public LogFieldsListModel +{ + Q_OBJECT +public: + RelationslLogFieldsListModel( QObject* parent=nullptr ); +}; + + +#endif // LOGDOCTOR__CUSTOMS__LOGFIELDS_LISTMODEL_H diff --git a/logdoctor/customs/treewidgetitems.h b/logdoctor/customs/treewidgetitems.h deleted file mode 100644 index aed252d0..00000000 --- a/logdoctor/customs/treewidgetitems.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef LOGDOCTOR__CUSTOMS__TREEWIDGETITEMS_H -#define LOGDOCTOR__CUSTOMS__TREEWIDGETITEMS_H - - -#include - - -class LogFileTreeWidgetItem : public QTreeWidgetItem { -public: - LogFileTreeWidgetItem(QTreeWidget*parent=nullptr):QTreeWidgetItem(parent){} - bool operator < (const QTreeWidgetItem& other) const { - const int sort_column{ this->treeWidget()->sortColumn() }; - const std::string s_str{ this->text(sort_column).toStdString() }; - const std::string o_str{ other.text(sort_column).toStdString() }; - if ( sort_column == 0 ) { - // sort by file name - const size_t s_sz{ s_str.size() - 1ul }; - const size_t o_sz{ o_str.size() - 1ul }; - if ( s_sz != o_sz ) { - return s_sz < o_sz; - } - for (size_t i{0ul}; i<=s_sz; i++) { - if ( s_str[i] != o_str[i] ) { - return s_str[i] < o_str[i]; - } - } - } else { - // sort by file size - const std::unordered_map cmp{ - {"B", 0}, - {"KiB",1}, - {"MiB",2} - }; - std::vector s_items; - StringOps::splitrip( s_items, s_str, ' ' ); - std::vector o_items; - StringOps::splitrip( o_items, o_str, ' ' ); - if ( s_items[1] != o_items[1] ) { - return cmp.at( s_items[1] ) < cmp.at( o_items[1] ); - } - return std::stof( s_items[0] ) < std::stof( o_items[0] ); - } - return true; - } -}; - - -#endif // LOGDOCTOR__CUSTOMS__TREEWIDGETITEMS_H diff --git a/logdoctor/defines/web_servers.h b/logdoctor/defines/web_servers.h deleted file mode 100644 index fb26f1ff..00000000 --- a/logdoctor/defines/web_servers.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef LOGDOCTOR__DEFINES__WEB_SERVERS_H -#define LOGDOCTOR__DEFINES__WEB_SERVERS_H - - -//! ID of the Apache2 Web Server -#define APACHE_ID 11u -//! ID of the Nginx Web Server -#define NGINX_ID 12u -//! ID of the IIS Web Server -#define IIS_ID 13u - - -#endif // LOGDOCTOR__DEFINES__WEBSERVERS_H diff --git a/logdoctor/games/crisscross/game.cpp b/logdoctor/games/crisscross/game.cpp index 4fea9da4..26fc031b 100644 --- a/logdoctor/games/crisscross/game.cpp +++ b/logdoctor/games/crisscross/game.cpp @@ -17,9 +17,7 @@ CrissCross::CrissCross( QWidget* parent ) { this->ui->setupUi(this); - QString stylesheet; - StyleSec::Games::CrissCross::getStyleSheet( stylesheet ); - this->setStyleSheet( stylesheet ); + this->setStyleSheet( StyleSec::Games::CrissCross::getStyleSheet() ); // verify that one player is human and the other is not if ( !(p1_human^p2_human) ) { @@ -181,7 +179,7 @@ void CrissCross::nextTurn() } -bool CrissCross::checkVictory() +bool CrissCross::checkVictory() noexcept { bool result{ false }; unsigned streak; @@ -189,7 +187,7 @@ bool CrissCross::checkVictory() streak = 0; for ( const auto& index : sequence ) { if ( this->board[ index ] == this->p_turn ) { - streak ++; + ++streak; this->victory_sequence.push_back( index ); } else { break; @@ -206,11 +204,11 @@ bool CrissCross::checkVictory() return result; } -void CrissCross::victory() +void CrissCross::victory() noexcept { // disable all buttons except the victory sequence ones bool disable{ true }; - for ( unsigned i=0; i<9; i++ ) { + for ( unsigned i=0; i<9; ++i ) { disable |= true; for ( const auto& j : this->victory_sequence ) { if ( i == j ) { @@ -246,13 +244,13 @@ void CrissCross::victory() } -bool CrissCross::gameDraw() const +bool CrissCross::gameDraw() const noexcept { bool result{ false }; unsigned empty_tiles{ 9 }; for ( const auto& tile : this->board ) { if ( tile > 0 ) { - empty_tiles --; + -- empty_tiles; } } if ( empty_tiles == 0 ) { @@ -262,7 +260,7 @@ bool CrissCross::gameDraw() const return result; } -void CrissCross::draw() +void CrissCross::draw() noexcept { // disable all buttons for ( const auto& button : this->board_buttons ) { @@ -281,16 +279,16 @@ void CrissCross::draw() //////////// //// AI //// -void CrissCross::AI_playTurn() +void CrissCross::AI_playTurn() noexcept { this->AI_updateWeights(); emit this->board_buttons[ this->AI_makeChoice() ]->clicked(); } -void CrissCross::AI_updateWeights() +void CrissCross::AI_updateWeights() noexcept { // reset the weights - for ( size_t i{0ul}; i<9ul; i++ ) { + for ( size_t i{0ul}; i<9ul; ++i ) { this->board_weights[ i ] = 0; } // calculate the new weights @@ -303,9 +301,9 @@ void CrissCross::AI_updateWeights() // check the tiles in the sequence for ( const auto index : sequence ) { if ( this->board[ index ] == this->p_turn ) { - win_streak ++; + ++ win_streak; } else if ( this->board[ index ] > 0 ) { - lose_streak ++; + ++ lose_streak; } else { empty_tiles.emplace_back( std::move(index) ); } @@ -322,7 +320,7 @@ void CrissCross::AI_updateWeights() } } -unsigned CrissCross::AI_makeChoice() const +unsigned CrissCross::AI_makeChoice() const noexcept { // get a list of the heaviest tiles std::vector moves; @@ -341,7 +339,7 @@ unsigned CrissCross::AI_makeChoice() const // lighter weight ; }*/ - index ++; + ++ index; } // decide the movement (or better, randomly pick one) unsigned next_move; diff --git a/logdoctor/games/crisscross/game.h b/logdoctor/games/crisscross/game.h index d4d2fb13..0f6062db 100644 --- a/logdoctor/games/crisscross/game.h +++ b/logdoctor/games/crisscross/game.h @@ -17,7 +17,7 @@ namespace Ui { /*! Player vs AI criss-cross game */ -class CrissCross : public QWidget +class CrissCross final : public QWidget { Q_OBJECT @@ -97,36 +97,36 @@ private: //! Checks whether somebody won or not - bool checkVictory(); + bool checkVictory() noexcept; //! Checks whether the game is draw or not - bool gameDraw() const; + bool gameDraw() const noexcept; //! Someone won, process the victory - void victory(); + void victory() noexcept; //! The match is over but nobody won, the game is draw - void draw(); + void draw() noexcept; //////////// //// AI //// //! Main function for the AI to play its turn - void AI_playTurn(); + void AI_playTurn() noexcept; //! Updates the weights of the tiles /*! \see AI_playTurn(); */ - void AI_updateWeights(); + void AI_updateWeights() noexcept; //! Makes the choice depending on the weights /*! \return The tile to select \see AI_playTurn(); */ - unsigned AI_makeChoice() const; + unsigned AI_makeChoice() const noexcept; }; diff --git a/logdoctor/games/crisscross/modules/stylesheets.cpp b/logdoctor/games/crisscross/modules/stylesheets.cpp index 6ab2f4b5..58fa5af0 100644 --- a/logdoctor/games/crisscross/modules/stylesheets.cpp +++ b/logdoctor/games/crisscross/modules/stylesheets.cpp @@ -6,6 +6,7 @@ #include "modules/exceptions.h" #include +#include #include @@ -23,7 +24,7 @@ enum StyleId : uint32_t { using StyleMap = std::unordered_map; -const StyleMap makeStyleMap() +StyleMap makeStyleMap() { switch ( GlobalConfigs::window_theme ) { case WindowTheme::Light: @@ -39,7 +40,6 @@ const StyleMap makeStyleMap() {LINES_BORDER, "rgb( 230, 230, 230 )"} }; - break; case WindowTheme::Dark: return { {WINDOW_BASE, @@ -53,10 +53,8 @@ const StyleMap makeStyleMap() {LINES_BORDER, "rgb( 27, 30, 33 )"} }; - break; default: - throw GenericException( "Unexpected WindowTheme: "+std::to_string(static_cast(GlobalConfigs::window_theme)), true ); - break; + throw DoNotCatchException( "Unexpected WindowTheme", std::to_string(static_cast(GlobalConfigs::window_theme)) ); } } @@ -66,67 +64,68 @@ const StyleMap makeStyleMap() namespace StyleSec::Games::CrissCross { -void getStyleSheet( QString& stylesheet ) +QString getStyleSheet() { - if ( GlobalConfigs::window_theme != WindowTheme::Native ) { - const StyleMap style{ makeStyleMap() }; - stylesheet = - "QWidget#CrissCross {" - " background-color: "+style.at(WINDOW_BASE)+";" - "}" - "QPushButton#button_NE," - "QPushButton#button_N," - "QPushButton#button_NW," - "QPushButton#button_E," - "QPushButton#button_C," - "QPushButton#button_W," - "QPushButton#button_SE," - "QPushButton#button_S," - "QPushButton#button_SW {" - " border-radius: 4px;" - " border: 1px solid "+style.at(WINDOW_BASE)+";" - " background-color: "+style.at(WINDOW_BASE)+";" - "}" - "QPushButton#button_NE:hover," - "QPushButton#button_N:hover," - "QPushButton#button_NW:hover," - "QPushButton#button_E:hover," - "QPushButton#button_C:hover," - "QPushButton#button_W:hover," - "QPushButton#button_SE:hover," - "QPushButton#button_S:hover," - "QPushButton#button_SW:hover {" - " border-color: "+style.at(TILES_BORDER_HOVER)+";" - " background-color: "+style.at(TILES_BASE_HOVER)+";" - "}" - "QPushButton#button_NE::flat," - "QPushButton#button_N::flat," - "QPushButton#button_NW::flat," - "QPushButton#button_E::flat," - "QPushButton#button_C::flat," - "QPushButton#button_W::flat," - "QPushButton#button_SE::flat," - "QPushButton#button_S::flat," - "QPushButton#button_SW::flat {" - " border-color: "+style.at(WINDOW_BASE)+";" - " background-color: "+style.at(WINDOW_BASE)+";" - "}" - "QFrame#line_1," - "QFrame#line_2," - "QFrame#line_3," - "QFrame#line_4," - "QFrame#line_5," - "QFrame#line_6," - "QFrame#line_7," - "QFrame#line_8," - "QFrame#line_9," - "QFrame#line_10," - "QFrame#line_11," - "QFrame#line_12 {" - " border: 1px solid "+style.at(LINES_BORDER)+";" - " background-color: "+style.at(LINES_BASE)+";" - "}"; + if ( GlobalConfigs::window_theme == WindowTheme::Native ) { + return ""; } + const StyleMap style{ makeStyleMap() }; + return + "QWidget#CrissCross {" + " background-color: "% style.at(WINDOW_BASE) %";" + "}" + "QPushButton#button_NE," + "QPushButton#button_N," + "QPushButton#button_NW," + "QPushButton#button_E," + "QPushButton#button_C," + "QPushButton#button_W," + "QPushButton#button_SE," + "QPushButton#button_S," + "QPushButton#button_SW {" + " border-radius: 4px;" + " border: 1px solid "% style.at(WINDOW_BASE) %";" + " background-color: "% style.at(WINDOW_BASE) %";" + "}" + "QPushButton#button_NE:hover," + "QPushButton#button_N:hover," + "QPushButton#button_NW:hover," + "QPushButton#button_E:hover," + "QPushButton#button_C:hover," + "QPushButton#button_W:hover," + "QPushButton#button_SE:hover," + "QPushButton#button_S:hover," + "QPushButton#button_SW:hover {" + " border-color: "% style.at(TILES_BORDER_HOVER) %";" + " background-color: "% style.at(TILES_BASE_HOVER) %";" + "}" + "QPushButton#button_NE::flat," + "QPushButton#button_N::flat," + "QPushButton#button_NW::flat," + "QPushButton#button_E::flat," + "QPushButton#button_C::flat," + "QPushButton#button_W::flat," + "QPushButton#button_SE::flat," + "QPushButton#button_S::flat," + "QPushButton#button_SW::flat {" + " border-color: "% style.at(WINDOW_BASE) %";" + " background-color: "% style.at(WINDOW_BASE) %";" + "}" + "QFrame#line_1," + "QFrame#line_2," + "QFrame#line_3," + "QFrame#line_4," + "QFrame#line_5," + "QFrame#line_6," + "QFrame#line_7," + "QFrame#line_8," + "QFrame#line_9," + "QFrame#line_10," + "QFrame#line_11," + "QFrame#line_12 {" + " border: 1px solid "% style.at(LINES_BORDER) %";" + " background-color: "% style.at(LINES_BASE) %";" + "}"; } } // namespace StyleSec::Games::CrissCross diff --git a/logdoctor/games/crisscross/modules/stylesheets.h b/logdoctor/games/crisscross/modules/stylesheets.h index 8acb8949..8fe8a1f5 100644 --- a/logdoctor/games/crisscross/modules/stylesheets.h +++ b/logdoctor/games/crisscross/modules/stylesheets.h @@ -8,7 +8,11 @@ class QString; namespace StyleSec::Games::CrissCross { -void getStyleSheet( QString& stylesheet ); +//! Returns the proper style sheet +/*! + \throw DoNotCatchException +*/ +QString getStyleSheet(); } // namespace StyleSec::Games::CrissCross diff --git a/logdoctor/games/game_dialog.cpp b/logdoctor/games/game_dialog.cpp index a079b75d..5bbcf8be 100644 --- a/logdoctor/games/game_dialog.cpp +++ b/logdoctor/games/game_dialog.cpp @@ -48,7 +48,7 @@ QString getStylesheet() }; break; default: - throw GenericException( "Unexpected WindowTheme: "+std::to_string(static_cast(GlobalConfigs::window_theme)), true ); + throw DoNotCatchException( "Unexpected WindowTheme", std::to_string(static_cast(GlobalConfigs::window_theme)) ); break; } diff --git a/logdoctor/games/game_dialog.h b/logdoctor/games/game_dialog.h index dda912bd..83efa134 100644 --- a/logdoctor/games/game_dialog.h +++ b/logdoctor/games/game_dialog.h @@ -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 diff --git a/logdoctor/games/snake/food.cpp b/logdoctor/games/snake/food.cpp index 2224297f..cd43ccaa 100644 --- a/logdoctor/games/snake/food.cpp +++ b/logdoctor/games/snake/food.cpp @@ -13,51 +13,49 @@ Food::Food( const bool can_move ) , y{ 0 } { } -Food::Food( const Food& other ) - : image{ new QGraphicsPixmapItem( (other.movable) ? this->img_rat : this->img_egg ) } +Food::Food( Food&& other ) noexcept + : image{ other.image } , movable{ other.movable } , x{ other.x } , y{ other.y } { + other.image = nullptr; } -const Food& Food::operator=( const Food& other ) +Food& Food::operator=( Food&& other ) noexcept { - if ( this == &other ) return other; + if ( this == &other ) return *this; this->x = other.x; this->y = other.y; this->movable = other.movable; - this->image = new QGraphicsPixmapItem( (this->movable) ? this->img_rat : this->img_egg ); + this->image = other.image; + other.image = nullptr; return *this; } -unsigned Food::X() const +unsigned Food::X() const noexcept { return this->x; } -unsigned Food::Y() const +unsigned Food::Y() const noexcept { return this->y; } -QGraphicsPixmapItem* Food::getImageItem() const +QGraphicsPixmapItem* Food::getImageItem() const noexcept { return this->image; } -bool Food::inTile( const unsigned x, const unsigned y ) const +bool Food::inTile( const unsigned x, const unsigned y ) const noexcept { - if ( this->x == x && this->y == y ) { - return true; - } else { - return false; - } + return this->x == x && this->y == y; } -void Food::update( const unsigned new_x, const unsigned new_y ) +void Food::update( const unsigned new_x, const unsigned new_y ) noexcept { this->x = new_x; this->y = new_y; @@ -65,7 +63,7 @@ void Food::update( const unsigned new_x, const unsigned new_y ) } -void Food::spawn( const Snake& snake, const Snake& snake_ ) +void Food::spawn( const Snake& snake, const Snake& snake_ ) noexcept { // pick a new random position unsigned new_x, new_y; diff --git a/logdoctor/games/snake/food.h b/logdoctor/games/snake/food.h index d433c49d..1f5373b6 100644 --- a/logdoctor/games/snake/food.h +++ b/logdoctor/games/snake/food.h @@ -8,32 +8,33 @@ class Snake; class QGraphicsPixmapItem; -class Food +class Food final { public: explicit Food( const bool can_move=false ); - explicit Food( const Food& other ); - const Food& operator=( const Food& other ); + explicit Food( Food&& other ) noexcept; + Food& operator=( Food&& other ) noexcept; + Q_DISABLE_COPY(Food) //! Returns the position on the X-axis - unsigned X() const; + unsigned X() const noexcept; //! Returns the position on the Y-axis - unsigned Y() const; + unsigned Y() const noexcept; //!< Returns the image - QGraphicsPixmapItem* getImageItem() const; + QGraphicsPixmapItem* getImageItem() const noexcept; //! Checks whether is there a part of the snake in the given position - bool inTile( const unsigned x, const unsigned y ) const; + bool inTile( const unsigned x, const unsigned y ) const noexcept; //! Spawns the egg/rat in a new position - void spawn( const Snake& snake, const Snake& snake_ ); + void spawn( const Snake& snake, const Snake& snake_ ) noexcept; //! Moves the rat void move( const Snake& snake ); //! Updates the position and direction of the entity - void update( const unsigned new_x, const unsigned new_y ); + void update( const unsigned new_x, const unsigned new_y ) noexcept; private: @@ -43,7 +44,7 @@ private: const QPixmap img_rat{ ":/games/games/snake/rat.png" }; //!< The image which graphically represents the food - QGraphicsPixmapItem* image = nullptr; + QGraphicsPixmapItem* image = nullptr; // QGraphicsScene takes ownerhips of it //!< Whether the food is a rat or an egg bool movable; diff --git a/logdoctor/games/snake/game.cpp b/logdoctor/games/snake/game.cpp index be932f4a..1a8e8733 100644 --- a/logdoctor/games/snake/game.cpp +++ b/logdoctor/games/snake/game.cpp @@ -18,9 +18,7 @@ SnakeGame::SnakeGame( const QFont& term_font, QWidget* parent ) { this->ui->setupUi(this); - QString stylesheet; - StyleSec::Games::Snake::getStyleSheet( stylesheet ); - this->setStyleSheet( stylesheet ); + this->setStyleSheet( StyleSec::Games::Snake::getStyleSheet() ); QFont font{ term_font }; font.setPointSize( 64 ); @@ -48,44 +46,39 @@ void SnakeGame::closeEvent( QCloseEvent* event ) } -void SnakeGame::keyPressEvent( QKeyEvent* event ) +void SnakeGame::keyPressEvent( QKeyEvent* event ) noexcept { // store the key pressed if needed - if ( this->playing ) { - switch ( event->key() ) { - case Qt::Key_Up: - case Qt::Key_W: - if ( this->key_events.empty() ) { // leave me here - this->key_events.push( 0 ); - } else if ( this->key_events.back() != 0 ) { - this->key_events.push( 0 ); - } - break; - case Qt::Key_Down: - case Qt::Key_S: - if ( this->key_events.empty() ) { - this->key_events.push( 1 ); - } else if ( this->key_events.back() != 1 ) { - this->key_events.push( 1 ); - } - break; - case Qt::Key_Left: - case Qt::Key_A: - if ( this->key_events.empty() ) { - this->key_events.push( 2 ); - } else if ( this->key_events.back() != 2 ) { - this->key_events.push( 2 ); - } - break; - case Qt::Key_Right: - case Qt::Key_D: - if ( this->key_events.empty() ) { - this->key_events.push( 3 ); - } else if ( this->key_events.back() != 3 ) { - this->key_events.push( 3 ); - } - break; - } + if ( ! this->playing ) { + return; + } + switch ( event->key() ) { + case Qt::Key_Up: + case Qt::Key_W: + if ( this->key_events.empty() || this->key_events.back() != Direction::UP ) { + this->key_events.push( Direction::UP ); + } + break; + case Qt::Key_Down: + case Qt::Key_S: + if ( this->key_events.empty() || this->key_events.back() != Direction::DOWN ) { + this->key_events.push( Direction::DOWN ); + } + break; + case Qt::Key_Left: + case Qt::Key_A: + if ( this->key_events.empty() || this->key_events.back() != Direction::LEFT ) { + this->key_events.push( Direction::LEFT ); + } + break; + case Qt::Key_Right: + case Qt::Key_D: + if ( this->key_events.empty() || this->key_events.back() != Direction::RIGHT ) { + this->key_events.push( Direction::RIGHT ); + } + break; + default: + return; } } @@ -136,19 +129,16 @@ void SnakeGame::newSnake() } // snake initial direction - const unsigned short rand_d{ static_cast( rand()%4 ) }; + const Direction rand_d{ static_cast( rand()%4 ) }; switch ( rand_d ) { - case 0: - this->snake.setDirection( Direction::UP ); - break; - case 1: - this->snake.setDirection( Direction::DOWN ); - break; - case 2: - this->snake.setDirection( Direction::LEFT ); - break; - case 3: - this->snake.setDirection( Direction::RIGHT ); + case Direction::UP: + [[fallthrough]]; + case Direction::DOWN: + [[fallthrough]]; + case Direction::LEFT: + [[fallthrough]]; + case Direction::RIGHT: + this->snake.setDirection( rand_d ); break; default: // should be unreachable @@ -157,10 +147,10 @@ void SnakeGame::newSnake() this->key_events.push( rand_d ); // build the body with a head - this->snake.push_back( - { head_x, head_y, - this->snake.direction(), this->snake.direction(), - new QGraphicsPixmapItem( this->snake.getHeadImage() ) } + this->snake.emplace_back( + head_x, head_y, + this->snake.direction(), this->snake.direction(), + new QGraphicsPixmapItem( this->snake.getHeadImage() ) ); this->field_scene->addItem( this->snake.front().image ); this->snake.front().update( head_x, head_y, this->snake.direction() ); @@ -185,17 +175,17 @@ void SnakeGame::newSnake_() case Direction::UP: case Direction::DOWN: if ( rnd ) { - head_x ++; + ++ head_x; } else { - head_x --; + -- head_x; } break; case Direction::LEFT: case Direction::RIGHT: if ( rnd ) { - head_y ++; + ++ head_y; } else { - head_y --; + -- head_y; } break; default: @@ -204,10 +194,10 @@ void SnakeGame::newSnake_() } // build the body with a head - this->snake_.push_back( - { head_x, head_y, - this->snake_.direction(), this->snake_.direction(), - new QGraphicsPixmapItem( this->snake_.getHeadImage() ) } + this->snake_.emplace_back( + head_x, head_y, + this->snake_.direction(), this->snake_.direction(), + new QGraphicsPixmapItem( this->snake_.getHeadImage() ) ); this->field_scene->addItem( this->snake_.front().image ); this->snake_.front().update( head_x, head_y, this->snake_.direction() ); @@ -219,7 +209,7 @@ void SnakeGame::newSnake_() this->snake_.update( this->field_scene.get(), true, true ); } -void SnakeGame::newFood( const bool& movable ) +void SnakeGame::newFood( const bool movable ) noexcept { // put some food on the field for it to eat this->food = Food( movable ); @@ -272,7 +262,7 @@ void SnakeGame::processGameLogic() this->moving_countdown = this->moving_rate; } } else if ( this->game_mode == GameMode::Hunt ) { - this->moving_countdown --; + -- this->moving_countdown; if ( this->moving_countdown == 0u ) { this->moving_countdown = this->moving_rate; this->food.move( this->snake ); @@ -283,26 +273,26 @@ void SnakeGame::processGameLogic() } -void SnakeGame::processNextKeyEvent() +void SnakeGame::processNextKeyEvent() noexcept { // update direction if needed switch ( this->key_events.front() ) { - case 0: // up + case Direction::UP: if ( this->snake.direction() != Direction::DOWN ) { this->snake.setDirection( Direction::UP ); } break; - case 1: // down + case Direction::DOWN: if ( this->snake.direction() != Direction::UP ) { this->snake.setDirection( Direction::DOWN ); } break; - case 2: // left + case Direction::LEFT: if ( this->snake.direction() != Direction::RIGHT ) { this->snake.setDirection( Direction::LEFT ); } break; - case 3: // right + case Direction::RIGHT: if ( this->snake.direction() != Direction::LEFT ) { this->snake.setDirection( Direction::RIGHT ); } @@ -327,16 +317,16 @@ void SnakeGame::checkCollision( Snake& snake, Snake& adv_snake, const bool is_ad unsigned x_, y_; switch ( snake.direction() ) { case Direction::UP: - y--; + --y; break; case Direction::DOWN: - y++; + ++y; break; case Direction::LEFT: - x--; + --x; break; case Direction::RIGHT: - x++; + ++x; break; default: // should be unreachable @@ -348,16 +338,16 @@ void SnakeGame::checkCollision( Snake& snake, Snake& adv_snake, const bool is_ad y_ = adv_snake.front().y; switch ( adv_snake.direction() ) { case Direction::UP: - y_--; + --y_; break; case Direction::DOWN: - y_++; + ++y_; break; case Direction::LEFT: - x_--; + --x_; break; case Direction::RIGHT: - x_++; + ++x_; break; default: // should be unreachable diff --git a/logdoctor/games/snake/game.h b/logdoctor/games/snake/game.h index 120b6862..1f9e48fb 100644 --- a/logdoctor/games/snake/game.h +++ b/logdoctor/games/snake/game.h @@ -23,7 +23,7 @@ namespace Ui { /*! A reproduction of the timeless classic game */ -class SnakeGame : public QWidget +class SnakeGame final : public QWidget { Q_OBJECT @@ -55,16 +55,16 @@ private: and W/S/A/D letters \see key_events, processNextKeyEvent() */ - void keyPressEvent( QKeyEvent* event ) override; + void keyPressEvent( QKeyEvent* event ) noexcept override; //! Stores the key events - std::queue key_events; + std::queue key_events; //! Processes the key events in the queue /*! \see key_events, keyPressEvent() */ - void processNextKeyEvent(); + void processNextKeyEvent() noexcept; ////////////////// @@ -119,7 +119,7 @@ private: //! Instance of the egg/rat which will be eat by the snake Food food; - void newFood( const bool& movable ); + void newFood( const bool movable ) noexcept; bool spawn_food{ false }; diff --git a/logdoctor/games/snake/modules/stylesheets.cpp b/logdoctor/games/snake/modules/stylesheets.cpp index 906215b3..4de8396d 100644 --- a/logdoctor/games/snake/modules/stylesheets.cpp +++ b/logdoctor/games/snake/modules/stylesheets.cpp @@ -6,6 +6,7 @@ #include "modules/exceptions.h" #include +#include #include @@ -33,7 +34,7 @@ enum StyleId : uint32_t { using StyleMap = std::unordered_map; -const StyleMap makeStyleMap() +StyleMap makeStyleMap() { switch ( GlobalConfigs::window_theme ) { case WindowTheme::Light: @@ -69,7 +70,6 @@ const StyleMap makeStyleMap() {SCORE_BORDER, "transparent"} }; - break; case WindowTheme::Dark: return { {TEXT, @@ -103,25 +103,23 @@ const StyleMap makeStyleMap() {SCORE_BORDER, "transparent"} }; - break; default: - throw GenericException( "Unexpected WindowTheme: "+std::to_string(static_cast(GlobalConfigs::window_theme)), true ); - break; + throw DoNotCatchException( "Unexpected WindowTheme", std::to_string(static_cast(GlobalConfigs::window_theme)) ); } } -} // namespace (private) +} //namespace (private) namespace StyleSec::Games::Snake { -void getStyleSheet( QString& stylesheet ) +QString getStyleSheet() { QString icons_theme; switch ( GlobalConfigs::window_theme ) { case WindowTheme::Native: - return; + return ""; case WindowTheme::Light: icons_theme = "dark"; break; @@ -129,36 +127,35 @@ void getStyleSheet( QString& stylesheet ) icons_theme = "light"; break; default: - throw GenericException( "Unexpected WindowTheme: "+std::to_string(static_cast(GlobalConfigs::window_theme)), true ); - break; + throw DoNotCatchException( "Unexpected WindowTheme", std::to_string(static_cast(GlobalConfigs::window_theme)) ); } const StyleMap style{ makeStyleMap() }; - stylesheet = + return "* {" - " color: "+style.at(TEXT)+";" + " color: "% style.at(TEXT) %";" "}" "QWidget#SnakeGame {" - " background-color: "+style.at(WINDOW_BASE_SECONDARY)+";" + " background-color: "% style.at(WINDOW_BASE_SECONDARY) %";" "}" "QWidget#stackedWidget_GameDisplay {" - " border: 1px solid "+style.at(WINDOW_BORDER)+";" + " border: 1px solid "% style.at(WINDOW_BORDER) %";" "}" "QWidget#stackedPage_GameMenu {" " border-radius: 16px;" - " background-color: "+style.at(WINDOW_BASE_PRIMARY)+";" + " background-color: "% style.at(WINDOW_BASE_PRIMARY) %";" "}" "QWidget#stackedPage_GameBoard {" " border-radius: 6px;" - " background-color: "+style.at(WINDOW_BASE_PRIMARY)+";" + " background-color: "% style.at(WINDOW_BASE_PRIMARY) %";" "}" "QComboBox {" " border-radius: 8px;" - " background-color: "+style.at(BOXES_BASE_PRIMARY)+";" + " background-color: "% style.at(BOXES_BASE_PRIMARY) %";" "}" "QComboBox:on {" " border-bottom-left-radius: 0px;" - " border-bottom: 2px solid "+style.at(BOXES_DECO)+";" - " background-color: "+style.at(BOXES_BASE_SECONDARY)+";" + " border-bottom: 2px solid "% style.at(BOXES_DECO) %";" + " background-color: "% style.at(BOXES_BASE_SECONDARY) %";" "}" "QComboBox::drop-down {" " border-top-right-radius: 8px;" @@ -166,21 +163,21 @@ void getStyleSheet( QString& stylesheet ) " border-left: 3px solid" " QLinearGradient(" " x0:0, y0:0, x1:0, y1:1," - " stop:0 "+style.at(BOXES_BASE_PRIMARY)+"," - " stop:0.1 "+style.at(BOXES_BASE_PRIMARY)+"," - " stop:0.5 "+style.at(BOXES_DECO)+"," - " stop:0.9 "+style.at(BOXES_BASE_PRIMARY)+"," - " stop:1 "+style.at(BOXES_BASE_PRIMARY)+");" - " background-color: "+style.at(BOXES_BASE_PRIMARY)+";" - " selection-background-color: "+style.at(BOXES_BASE_PRIMARY)+";" + " stop:0 "% style.at(BOXES_BASE_PRIMARY) %"," + " stop:0.1 "% style.at(BOXES_BASE_PRIMARY) %"," + " stop:0.5 "% style.at(BOXES_DECO) %"," + " stop:0.9 "% style.at(BOXES_BASE_PRIMARY) %"," + " stop:1 "% style.at(BOXES_BASE_PRIMARY) %");" + " background-color: "% style.at(BOXES_BASE_PRIMARY) %";" + " selection-background-color: "% style.at(BOXES_BASE_PRIMARY) %";" "}" "QComboBox::drop-down:on {" " border-bottom-right-radius: 0px;" " border-left-color: transparent;" - " background-color: "+style.at(BOXES_BASE_SECONDARY)+";" + " background-color: "% style.at(BOXES_BASE_SECONDARY) %";" "}" "QComboBox::down-arrow {" - " image: url(:/icons/icons/"+icons_theme+"/combobox_arrow.png);" + " image: url(:/icons/icons/"% icons_theme %"/combobox_arrow.png);" "}" "QComboBox::down-arrow:on {" " image: url();" @@ -188,26 +185,26 @@ void getStyleSheet( QString& stylesheet ) "QComboBox QAbstractItemView {" " border-bottom-left-radius: 8px;" " border-bottom-right-radius: 8px;" - " background-color: "+style.at(BOXES_BASE_PRIMARY)+";" - " selection-background-color: "+style.at(BOXES_BASE_SELECTION)+";" + " background-color: "% style.at(BOXES_BASE_PRIMARY) %";" + " selection-background-color: "% style.at(BOXES_BASE_SELECTION) %";" "}" "QPushButton#button_Play {" " border-radius: 8px;" " border: 0px;" - " background-color: "+style.at(PLAY_BUTTON_BASE)+";" + " background-color: "% style.at(PLAY_BUTTON_BASE) %";" "}" "QPushButton#button_Play:hover {" - " background-color: "+style.at(PLAY_BUTTON_BASE_HOVER)+";" + " background-color: "% style.at(PLAY_BUTTON_BASE_HOVER) %";" "}" "QFrame#frame_Score {" " border-radius: 4px;" - " border: 1px solid "+style.at(SCORE_FRAME_BORDER)+";" - " background-color: "+style.at(SCORE_FRAME_BASE)+";" + " border: 1px solid "% style.at(SCORE_FRAME_BORDER) %";" + " background-color: "% style.at(SCORE_FRAME_BASE) %";" "}" "QLCDNumber#lcd_Score {" - " border: 1px solid "+style.at(SCORE_BORDER)+";" - " color: "+style.at(SCORE_TEXT)+";" - " background-color: "+style.at(SCORE_BASE)+";" + " border: 1px solid "% style.at(SCORE_BORDER) %";" + " color: "% style.at(SCORE_TEXT) %";" + " background-color: "% style.at(SCORE_BASE) %";" "}"; } diff --git a/logdoctor/games/snake/modules/stylesheets.h b/logdoctor/games/snake/modules/stylesheets.h index 0a19ee90..ade68e97 100644 --- a/logdoctor/games/snake/modules/stylesheets.h +++ b/logdoctor/games/snake/modules/stylesheets.h @@ -8,7 +8,11 @@ class QString; namespace StyleSec::Games::Snake { -void getStyleSheet( QString& stylesheet ); +//! Returns the proper style sheet +/*! + \throw DoNotCatchException +*/ +QString getStyleSheet(); } // namespace StyleSec::Games::Snake diff --git a/logdoctor/games/snake/snake.cpp b/logdoctor/games/snake/snake.cpp index 83317e24..e70ba196 100644 --- a/logdoctor/games/snake/snake.cpp +++ b/logdoctor/games/snake/snake.cpp @@ -4,8 +4,36 @@ #include #include +BodyPart::BodyPart( const unsigned x, const unsigned y, const Direction d, const Direction pd, QGraphicsPixmapItem*const img ) noexcept + : x{ x } + , y{ y } + , direction{ d } + , prev_direction{ pd } + , image{ img } +{ -void BodyPart::update( const unsigned new_x, const unsigned new_y, const Direction& new_direction ) { +} +BodyPart::BodyPart( BodyPart&& other ) noexcept + : x{ other.x } + , y{ other.y } + , direction{ other.direction } + , prev_direction{ other.prev_direction } + , image{ other.image } +{ + other.image = nullptr; +} +BodyPart& BodyPart::operator=( BodyPart&& other ) noexcept +{ + if ( this == &other ) return *this; + this->x = other.x; + this->y = other.y; + this->direction = other.direction; + this->prev_direction = other.prev_direction; + this->image = other.image; + other.image = nullptr; + return *this; +} +void BodyPart::update( const unsigned new_x, const unsigned new_y, const Direction& new_direction ) noexcept { this->x = new_x; this->y = new_y; this->image->setOffset( 16+(new_x*32), 16+(new_y*32) ); @@ -14,7 +42,7 @@ void BodyPart::update( const unsigned new_x, const unsigned new_y, const Directi } -Snake::Snake( const bool is_adversary ) +Snake::Snake( const bool is_adversary ) noexcept : adversary( is_adversary ) { if ( is_adversary ) { @@ -24,7 +52,7 @@ Snake::Snake( const bool is_adversary ) } -const QPixmap& Snake::getHeadImage() const +const QPixmap& Snake::getHeadImage() const noexcept { if ( this->adversary ) { return this->img_snakeHead_; @@ -34,19 +62,19 @@ const QPixmap& Snake::getHeadImage() const } -bool Snake::inTile( const unsigned x, const unsigned y, const bool avoid_tail ) const +bool Snake::inTile( const unsigned x, const unsigned y, const bool avoid_tail ) const noexcept { if ( this->size() > 0 ) { size_t i{ 0 }; size_t max{ this->size()-1ul }; if ( !avoid_tail ) { - max ++; + ++ max; } for ( auto bp{ this->cbegin() }; bp != this->cend(); ++bp ) { if ( bp->x == x && bp->y == y ) { return true; } - i++; + ++i; if ( i >= max ) { break; } @@ -56,16 +84,16 @@ bool Snake::inTile( const unsigned x, const unsigned y, const bool avoid_tail ) } -void Snake::setDirection( const Direction new_direction ) +void Snake::setDirection( const Direction new_direction ) noexcept { this->head_direction = new_direction; } -const Direction& Snake::direction() const +const Direction& Snake::direction() const noexcept { return this->head_direction; } -void Snake::willGrow() +void Snake::willGrow() noexcept { this->will_grow |= true; } @@ -81,26 +109,26 @@ void Snake::grow( const bool is_borning ) // one tile behind switch ( d ) { case Direction::UP: - y ++; + ++ y; break; case Direction::DOWN: - y --; + -- y; break; case Direction::LEFT: - x ++; + ++ x; break; case Direction::RIGHT: - x --; + -- x; break; default: // should be unreachable throw("Unexpected direction: "+std::to_string(d)); } } - this->push_back( - { x, y, - d, ld, - new QGraphicsPixmapItem( (this->adversary) ? this->img_snakeTail_ : this->img_snakeTail ) } + this->emplace_back( + x, y, + d, ld, + new QGraphicsPixmapItem( (this->adversary) ? this->img_snakeTail_ : this->img_snakeTail ) ); this->update( nullptr, true ); this->back().update( x, y, d ); @@ -366,7 +394,7 @@ void Snake::update( QGraphicsScene* field_scene, const bool dry , const bool is_ throw("Unexpected direction: "+std::to_string(bp->direction)); } prev_body_d = bp->direction; - i++; + ++i; } } @@ -399,7 +427,7 @@ void Snake::move( const Snake& adv_snake, const unsigned food_x, const unsigned this->updateFieldMap( adv_snake, food_x, food_y ); - for ( size_t i{0}; i<4ul; i++ ) { + for ( size_t i{0}; i<4ul; ++i ) { this->collectData( dataset.at(i), classes.at(i), adv_snake, food_x, food_y ); } @@ -408,17 +436,17 @@ void Snake::move( const Snake& adv_snake, const unsigned food_x, const unsigned } -Direction Snake::predictDirection( const std::array,4>& data, const std::array& weights, const std::array& classes ) const +Direction Snake::predictDirection( const std::array,4>& data, const std::array& weights, const std::array& classes ) const noexcept { float results[]{ 1.f, 1.f, 1.f, 1.f }; bool keep_current{ false }; - Direction class_label; + Direction class_label{ this->head_direction }; // process data - for ( size_t i{0}; i<4ul; i++ ) { + for ( size_t i{0}; i<4ul; ++i ) { const std::array& d = data.at(i); float& r = results[i]; - for ( size_t j{0}; j<7ul; j++ ) { + for ( size_t j{0}; j<7ul; ++j ) { r += d.at(j) * weights.at(j); } } @@ -434,22 +462,20 @@ Direction Snake::predictDirection( const std::array,4>& data } } if ( max != min ) { - for ( size_t i{0}; i<4ul; i++ ) { + for ( size_t i{0}; i<4ul; ++i ) { results[i] = (results[i]-min) / (max-min); } } else { keep_current |= true; - for ( size_t i{0}; i<4ul; i++ ) { + for ( size_t i{0}; i<4ul; ++i ) { results[i] = 0.f; } } // choose the best result - if ( keep_current ) { - class_label = this->head_direction; - } else { + if ( ! keep_current ) { max = 0.f; - for ( size_t i{0}; i<4ul; i++ ) { + for ( size_t i{0}; i<4ul; ++i ) { if ( results[i] > max ) { class_label = classes.at(i); max = results[i]; @@ -728,11 +754,11 @@ void Snake::collectData( std::array& data, const Direction& direction, } -void Snake::updateFieldMap( const Snake& adv_snake, const unsigned& food_x, const unsigned& food_y ) +void Snake::updateFieldMap( const Snake& adv_snake, const unsigned& food_x, const unsigned& food_y ) noexcept { // reset to default state - for ( size_t x{0}; x<16ul; x++ ) { - for ( size_t y{0}; y<16ul; y++ ) { + for ( size_t x{0}; x<16ul; ++x ) { + for ( size_t y{0}; y<16ul; ++y ) { Tile& t = this->field_map.at(x).at(y); t.entity = Entity::N; t.s_index = 0u; @@ -746,7 +772,7 @@ void Snake::updateFieldMap( const Snake& adv_snake, const unsigned& food_x, cons Tile& t = this->field_map.at(bp->x).at(bp->y); t.entity = Entity::S; t.s_index = i; - i--; + --i; } // update adversary i = static_cast( adv_snake.size() ); @@ -754,12 +780,12 @@ void Snake::updateFieldMap( const Snake& adv_snake, const unsigned& food_x, cons Tile& t = this->field_map.at(bp.x).at(bp.y); t.entity = Entity::A; t.s_index = i; - i--; + --i; } } -bool Snake::inTileAdv(const unsigned x, const unsigned y ) const +bool Snake::inTileAdv(const unsigned x, const unsigned y ) const noexcept { if ( x < 16 && y < 16 ) { switch ( this->field_map.at(x).at(y).entity ) { @@ -772,7 +798,7 @@ bool Snake::inTileAdv(const unsigned x, const unsigned y ) const return false; } -bool Snake::inTileMinusSteps(const unsigned x, const unsigned y, const unsigned steps ) const +bool Snake::inTileMinusSteps(const unsigned x, const unsigned y, const unsigned steps ) const noexcept { switch ( this->field_map.at(x).at(y).entity ) { case Entity::S: @@ -836,7 +862,7 @@ std::array Snake::checkAround( const Direction& direction, const uns } unsigned x_, y_; - for ( size_t i{0}; i<8ul; i++ ) { + for ( size_t i{0}; i<8ul; ++i ) { x_ = x; x_ += x_pattern.at(i); y_ = y; @@ -1104,7 +1130,7 @@ unsigned Snake::isDeadHole( const unsigned start_x, const unsigned start_y, cons result = true; break; } else { - steps ++; + ++ steps; if ( steps >= max_steps ) { break; } @@ -1121,7 +1147,7 @@ unsigned Snake::isDeadHole( const unsigned start_x, const unsigned start_y, cons if ( !result ) { steps = 0; } - i ++; + ++ i; if ( i == 2u ) { break; } diff --git a/logdoctor/games/snake/snake.h b/logdoctor/games/snake/snake.h index 2ab65153..105ce6fc 100644 --- a/logdoctor/games/snake/snake.h +++ b/logdoctor/games/snake/snake.h @@ -12,7 +12,7 @@ class QGraphicsScene; //! Enumerates the possible directions -enum Direction { +enum Direction : uint8_t { UP, //!< Up DOWN, //!< Down LEFT, //!< Left @@ -21,38 +21,43 @@ enum Direction { //! Instance of a part of the body of the snake -struct BodyPart { +struct BodyPart final { + explicit BodyPart( const unsigned x, const unsigned y, const Direction d, const Direction pd, QGraphicsPixmapItem*const img ) noexcept; + explicit BodyPart( BodyPart&& other ) noexcept; + BodyPart& operator=( BodyPart&& other ) noexcept; + Q_DISABLE_COPY(BodyPart) + // QGraphicsScene takes ownerhips of the image unsigned x; //!< The position on the X-axis unsigned y; //!< The position on the Y-axis Direction direction; //!< The current direction of the part Direction prev_direction; //!< The previous direction of the part QGraphicsPixmapItem* image; //!< The image which graphically represents the part //! Updates the position and direction of the part - void update( const unsigned new_x, const unsigned new_y, const Direction& new_direction ); + void update( const unsigned new_x, const unsigned new_y, const Direction& new_direction ) noexcept; }; -class Snake : public std::vector +class Snake final : public std::vector { public: - explicit Snake( const bool is_adversary=false ); + explicit Snake( const bool is_adversary=false ) noexcept; - const QPixmap& getHeadImage() const; + const QPixmap& getHeadImage() const noexcept; //! Checks whether is there a part of the snake in the given position - bool inTile( const unsigned x, const unsigned y, const bool avoid_tail=true ) const; + bool inTile( const unsigned x, const unsigned y, const bool avoid_tail=true ) const noexcept; //! Sets the new direction (of the head) - void setDirection( const Direction new_direction ); + void setDirection( const Direction new_direction ) noexcept; //! Returns the current direction (of the head) - const Direction& direction() const; + const Direction& direction() const noexcept; //! Updates the position and direction of the entire snake void update( QGraphicsScene* field_scene=nullptr, const bool dry=false, const bool is_borning=false ); // Schedules to grow the snake on the next update - void willGrow(); + void willGrow() noexcept; // [AI] Chooses a new direction for the snake void move( const Snake& adv_snake, const unsigned food_x, const unsigned food_y ); @@ -90,7 +95,7 @@ private: F, // food }; - struct Tile { + struct Tile final { Entity entity; unsigned s_index; }; @@ -98,13 +103,13 @@ private: std::array, 16> field_map; // [AI] Updates the map of the field - void updateFieldMap( const Snake& adv_snake, const unsigned& food_x, const unsigned& food_y ); + void updateFieldMap( const Snake& adv_snake, const unsigned& food_x, const unsigned& food_y ) noexcept; // [AI] As inTile(), but works on the field_map and only checks the adersary - bool inTileAdv( const unsigned x, const unsigned y ) const; + bool inTileAdv( const unsigned x, const unsigned y ) const noexcept; // [AI] Checks whether is there a snake in the tile, without counting as much trailing BodyParts as the number of steps - bool inTileMinusSteps( const unsigned x, const unsigned y, const unsigned steps ) const; + bool inTileMinusSteps( const unsigned x, const unsigned y, const unsigned steps ) const noexcept; // [AI] Checks which of the surrounding positions are blocked std::array checkAround( const Direction& direction, const unsigned x, const unsigned y ) const; @@ -116,7 +121,7 @@ private: void collectData( std::array& data, const Direction& direction, const Snake& adv_snake, const unsigned food_x, const unsigned food_y ) const; // [AI] Processes the collected data to predict the best movement - Direction predictDirection( const std::array, 4>& data, const std::array& weights, const std::array& classes ) const; + Direction predictDirection( const std::array, 4>& data, const std::array& weights, const std::array& classes ) const noexcept; }; diff --git a/logdoctor/globals/db_names.cpp b/logdoctor/globals/db_names.cpp new file mode 100644 index 00000000..88e05d89 --- /dev/null +++ b/logdoctor/globals/db_names.cpp @@ -0,0 +1,22 @@ + +#include "db_names.h" + +#include + + +namespace DatabasesNames { + +const char* data{ "collection.db" }; + +const char* hashes{ "hashes.db" }; + +} // namespace DatabasesNames + + +namespace DatabasesConnections { + +const QString data{ "LogsData" }; + +const QString hashes{ "FilesHashes" }; + +} // namespace DatabasesConnections diff --git a/logdoctor/globals/db_names.h b/logdoctor/globals/db_names.h new file mode 100644 index 00000000..f1e64223 --- /dev/null +++ b/logdoctor/globals/db_names.h @@ -0,0 +1,36 @@ +#ifndef LOGDOCTOR__GLOBALS__DB_NAMES_H +#define LOGDOCTOR__GLOBALS__DB_NAMES_H + + +class QString; + + +//! DatabasesNames +/*! + Names of the databases +*/ +namespace DatabasesNames { + +extern const char* data; + +extern const char* hashes; + +} // namespace DatabasesNames + + +//! DatabasesConnections +/*! + Names of the databases connections +*/ +namespace DatabasesConnections { + + extern const QString data; + + extern const QString hashes; + + extern const char* cdata; + +} // namespace DatabasesConnections + + +#endif // LOGDOCTOR__GLOBALS__DB_NAMES_H diff --git a/logdoctor/globals/global_configs.cpp b/logdoctor/globals/global_configs.cpp index 1a1ba31b..e0c09505 100644 --- a/logdoctor/globals/global_configs.cpp +++ b/logdoctor/globals/global_configs.cpp @@ -1,13 +1,20 @@ #include "global_configs.h" +#include -namespace GlobalConfigs { + +namespace GlobalConfigs +{ WindowTheme window_theme = WindowTheme::Native; -IconsTheme icons_theme = IconsTheme::Auto; + +IconsTheme icons_theme = IconsTheme::Auto; + ChartsTheme charts_theme = ChartsTheme::Light; -QString icons_set = "light_native"; +QString icons_set = ""; -} +ColorsScheme colors_scheme = ColorsScheme::Breeze; + +} // namespace GlobalConfigs diff --git a/logdoctor/globals/global_configs.h b/logdoctor/globals/global_configs.h index 5f04c814..d5c2b5ab 100644 --- a/logdoctor/globals/global_configs.h +++ b/logdoctor/globals/global_configs.h @@ -2,7 +2,7 @@ #define LOGDOCTOR__GLOBALS__GLOBAL_CONFIGS_H -#include +class QString; typedef unsigned char themes_t; @@ -27,20 +27,31 @@ enum class ChartsTheme : themes_t { Dark = 1 }; +//! Available color schemes for the text browsers +enum class ColorsScheme : themes_t { + None = 0, + Breeze = 1, + Monokai = 2, + Radical = 3 +}; + //! GlobalConfigs /*! Globally shared configurations */ -namespace GlobalConfigs { +namespace GlobalConfigs +{ - extern WindowTheme window_theme; +extern WindowTheme window_theme; - extern IconsTheme icons_theme; +extern IconsTheme icons_theme; - extern ChartsTheme charts_theme; +extern ChartsTheme charts_theme; - extern QString icons_set; +extern QString icons_set; + +extern ColorsScheme colors_scheme; } // namespace GlobalConfigs diff --git a/logdoctor/main.cpp b/logdoctor/main.cpp index 00848b70..546aa876 100644 --- a/logdoctor/main.cpp +++ b/logdoctor/main.cpp @@ -10,7 +10,9 @@ int main(int argc, char *argv[]) qRegisterMetaType(); qRegisterMetaType(); + qRegisterMetaType(); qRegisterMetaType(); + qRegisterMetaType(); MainWindow w; w.show(); diff --git a/logdoctor/main_lib.h b/logdoctor/main_lib.h new file mode 100644 index 00000000..f8be6b8b --- /dev/null +++ b/logdoctor/main_lib.h @@ -0,0 +1,85 @@ +#ifndef LOGDOCTOR__LIB_H +#define LOGDOCTOR__LIB_H + + +#include "modules/exceptions.h" + +#include + + +enum class WebServer { + Apache, + Nginx, + IIS +}; + + +enum class DialogsLevel { + Essential, + Normal, + Explanatory +}; + + + +inline bool operator<(const DialogsLevel lhs, const DialogsLevel rhs) +{ + switch (lhs) { + case DialogsLevel::Essential: + return rhs == DialogsLevel::Normal || rhs == DialogsLevel::Explanatory; + case DialogsLevel::Normal: + return rhs == DialogsLevel::Explanatory; + case DialogsLevel::Explanatory: + return false; + default: + return false; + } +} +inline bool operator>=(const DialogsLevel lhs, const DialogsLevel rhs) +{ + return lhs == rhs || !(lhs < rhs); +} + + + +inline std::string toString(const WebServer ws) +{ + switch (ws) { + case WebServer::Apache: + return "Apache"; + case WebServer::Nginx: + return "Nginx"; + case WebServer::IIS: + return "IIS"; + default: + throw DoNotCatchException( "Unexpected WebServer", std::to_string(static_cast(ws)) ); + } +} + + +inline std::string toString(const DialogsLevel lvl) +{ + switch (lvl) { + case DialogsLevel::Essential: + return "0"; + case DialogsLevel::Normal: + return "1"; + case DialogsLevel::Explanatory: + return "2"; + default: + throw DoNotCatchException( "Unexpected DialogsLevel", std::to_string(static_cast(lvl)) ); + } +} + + +#define WS_APACHE WebServer::Apache +#define WS_NGINX WebServer::Nginx +#define WS_IIS WebServer::IIS + + +#define DL_ESSENTIAL DialogsLevel::Essential +#define DL_NORMAL DialogsLevel::Normal +#define DL_EXPLANATORY DialogsLevel::Explanatory + + +#endif // LOGDOCTOR__LIB_H diff --git a/logdoctor/mainwindow.cpp b/logdoctor/mainwindow.cpp index 57a8f618..b6a8b4e3 100644 --- a/logdoctor/mainwindow.cpp +++ b/logdoctor/mainwindow.cpp @@ -2,11 +2,13 @@ #include "mainwindow.h" #include "ui_mainwindow.h" +#include "main_lib.h" + +#include "globals/db_names.h" #include "globals/global_configs.h" -#include "defines/web_servers.h" - -#include "customs/treewidgetitems.h" +#include "customs/logfile_treewidgetitem.h" +#include "customs/models/logfields_listmodel.h" #include "utilities/checks.h" #include "utilities/colors.h" @@ -23,8 +25,15 @@ #include "modules/craphelp/craphelp.h" #include "modules/crapup/crapup.h" #include "modules/crapinfo/crapinfo.h" + +#include "modules/changelog/changelog.h" + +#include "modules/craplog/lib.h" + +#include "modules/crapview/lib.h" #include "modules/crapview/modules/filters.h" +#include "tools/crappath/crappath.h" #include "tools/crapnote/crapnote.h" #include "games/crisscross/game.h" @@ -35,7 +44,6 @@ #include #include #include -#include #include #include @@ -46,16 +54,13 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow{ parent } , ui{ new Ui::MainWindow } + , tb_colors_schemes{ ColorSec::getColorSchemes() } + , colors{ ColorSec::getColors() } { ////////////////// //// GRAPHICS //// this->ui->setupUi(this); - // initialize the color-schemes map - this->TB_COLOR_SCHEMES = ColorSec::getColorSchemes(); - // initialize the colors map - this->COLORS = ColorSec::getColors(); - // load the main font this->main_font_family = QFontDatabase::applicationFontFamilies( QFontDatabase::addApplicationFont(":/fonts/Metropolis")).at(0); @@ -66,36 +71,36 @@ MainWindow::MainWindow(QWidget *parent) this->script_font_family = QFontDatabase::applicationFontFamilies( QFontDatabase::addApplicationFont(":/fonts/3270")).at(0); // initialize the fonts map - this->FONTS.emplace( "main", QFont( + this->fonts.emplace( "main", QFont( this->main_font_family, this->font_size ) ); - this->FONTS.emplace( "main_italic", QFont( + this->fonts.emplace( "main_italic", QFont( this->main_font_family, this->font_size, -1, true ) ); - this->FONTS.emplace( "main_bold", QFont( + this->fonts.emplace( "main_bold", QFont( this->main_font_family, this->font_size, 1 ) ); - this->FONTS.emplace( "main_big", QFont( + this->fonts.emplace( "main_big", QFont( this->main_font_family, this->font_size_big ) ); - this->FONTS.emplace( "main_small", QFont( + this->fonts.emplace( "main_small", QFont( this->main_font_family, this->font_size_small ) ); - this->FONTS.emplace( "alternative", QFont( + this->fonts.emplace( "alternative", QFont( this->alternative_font_family, this->font_size ) ); - this->FONTS.emplace( "script", QFont( + this->fonts.emplace( "script", QFont( this->script_font_family, this->font_size ) ); // parent fonts - this->ui->mainwidget->setFont( this->FONTS.at( "main_big" ) ); + this->ui->mainwidget->setFont( this->fonts.at( "main_big" ) ); // TextBrowser for the LogFiles - this->TB.setColorScheme( 1, this->TB_COLOR_SCHEMES.at( 1 ) ); - this->TB.setFont( this->FONTS.at( "main" ) ); + this->TB.setColorScheme( ColorsScheme::Breeze, this->tb_colors_schemes.at( ColorsScheme::Breeze ) ); + this->TB.setFont( this->fonts.at( "main" ) ); this->ui->textLogFiles->setFont( this->TB.getFont() ); // adjust LogsList headers width @@ -124,6 +129,7 @@ MainWindow::MainWindow(QWidget *parent) connect( this->ui->actionBlockNote, &QAction::triggered, this, &MainWindow::menu_actionBlockNote_triggered ); // utilities connect( this->ui->actionInfos, &QAction::triggered, this, &MainWindow::menu_actionInfos_triggered ); + connect( this->ui->actionChangelog, &QAction::triggered, this, &MainWindow::menu_actionChangelog_triggered ); connect( this->ui->actionCheckUpdates, &QAction::triggered, this, &MainWindow::menu_actionCheckUpdates_triggered ); // games connect( this->ui->actionCrissCross, &QAction::triggered, this, &MainWindow::menu_actionCrissCross_triggered ); @@ -145,6 +151,13 @@ MainWindow::MainWindow(QWidget *parent) connect( &this->craplog, &Craplog::finishedWorking, this, &MainWindow::craplogFinished); + ////////////////// + //// CRAPVIEW //// + this->ui->box_StatsDay_LogsField->setModel( new DaytimeLogFieldsListModel() ); + this->ui->box_StatsRelat_LogsField_1->setModel( new RelationslLogFieldsListModel() ); + this->ui->box_StatsRelat_LogsField_2->setModel( new RelationslLogFieldsListModel() ); + + /////////////////// //// POLISHING //// // default tabs @@ -168,24 +181,24 @@ MainWindow::MainWindow(QWidget *parent) } // set the default WS as the current one - switch ( this->default_ws ) { - case APACHE_ID: + switch ( this->default_web_server ) { + case WS_APACHE: this->ui->button_LogFiles_Apache->setFlat( false ); this->ui->radio_ConfDefaults_Apache->setChecked( true ); break; - case NGINX_ID: + case WS_NGINX: this->ui->button_LogFiles_Nginx->setFlat( false ); this->ui->radio_ConfDefaults_Nginx->setChecked( true ); break; - case IIS_ID: + case WS_IIS: this->ui->button_LogFiles_Iis->setFlat( false ); this->ui->radio_ConfDefaults_Iis->setChecked( true ); break; default: // shouldn't be here - throw WebServerException( "Unexpected WebServer ID: "+std::to_string( this->default_ws ) ); + throw DoNotCatchException( "Unexpected WebServer", std::to_string(static_cast(this->default_web_server)) ); } - this->craplog.setCurrentWSID( this->default_ws ); + this->craplog.setCurrentWebServer( this->default_web_server ); // initialize the Configs @@ -197,13 +210,13 @@ MainWindow::MainWindow(QWidget *parent) this->ui->box_ConfWindow_Theme->setCurrentIndex( static_cast(GlobalConfigs::window_theme) ); this->ui->box_ConfWindow_Icons->setCurrentIndex( static_cast(GlobalConfigs::icons_theme) ); // dialogs - this->ui->slider_ConfDialogs_General->setValue( this->dialogs_level ); - this->ui->slider_ConfDialogs_Logs->setValue( this->craplog.getDialogsLevel() ); - this->ui->slider_ConfDialogs_Stats->setValue( this->crapview.getDialogsLevel() ); + this->ui->slider_ConfDialogs_General->setValue( static_cast(this->dialogs_level) ); + this->ui->slider_ConfDialogs_Logs->setValue( static_cast(this->craplog.getDialogsLevel()) ); + this->ui->slider_ConfDialogs_Stats->setValue( static_cast(this->crapview.getDialogsLevel()) ); // text browser this->ui->box_ConfTextBrowser_Font->setCurrentText( this->TB.getFontFamily() ); this->ui->checkBox_ConfTextBrowser_WideLines->setChecked( this->TB.getWideLinesUsage() ); - this->ui->box_ConfTextBrowser_ColorScheme->setCurrentIndex( this->TB.getColorSchemeID() ); + this->ui->box_ConfTextBrowser_ColorScheme->setCurrentIndex( static_cast(this->TB.getColorSchemeID()) ); this->refreshTextBrowserPreview(); // charts this->ui->box_ConfCharts_Theme->setCurrentIndex( static_cast(GlobalConfigs::charts_theme) ); @@ -224,30 +237,30 @@ MainWindow::MainWindow(QWidget *parent) this->ui->checkBox_ConfControl_Size->setChecked( false ); } // apache paths - this->ui->inLine_ConfApache_Path_String->setText( QString::fromStdString(this->craplog.getLogsPath( APACHE_ID )) ); + this->ui->inLine_ConfApache_Path_String->setText( QString::fromStdString(this->craplog.getLogsPath( WS_APACHE )) ); this->ui->button_ConfApache_Path_Save->setEnabled( false ); // apache formats - this->ui->inLine_ConfApache_Format_String->setText( QString::fromStdString( this->craplog.getLogsFormatString( APACHE_ID ) ) ); + this->ui->inLine_ConfApache_Format_String->setText( QString::fromStdString( this->craplog.getLogsFormatString( WS_APACHE ) ) ); this->ui->button_ConfApache_Format_Save->setEnabled( false ); // apache warnlists this->on_box_ConfApache_Warnlist_Field_currentTextChanged( this->ui->box_ConfApache_Warnlist_Field->currentText() ); // apache blacklists this->on_box_ConfApache_Blacklist_Field_currentTextChanged( this->ui->box_ConfApache_Blacklist_Field->currentText() ); // nginx paths - this->ui->inLine_ConfNginx_Path_String->setText( QString::fromStdString(this->craplog.getLogsPath( NGINX_ID )) ); + this->ui->inLine_ConfNginx_Path_String->setText( QString::fromStdString(this->craplog.getLogsPath( WS_NGINX )) ); this->ui->button_ConfNginx_Path_Save->setEnabled( false ); // nginx formats - this->ui->inLine_ConfNginx_Format_String->setText( QString::fromStdString( this->craplog.getLogsFormatString( NGINX_ID ) ) ); + this->ui->inLine_ConfNginx_Format_String->setText( QString::fromStdString( this->craplog.getLogsFormatString( WS_NGINX ) ) ); this->ui->button_ConfNginx_Format_Save->setEnabled( false ); // nginx warnlists this->on_box_ConfNginx_Warnlist_Field_currentTextChanged( this->ui->box_ConfNginx_Warnlist_Field->currentText() ); // nginx blacklists this->on_box_ConfNginx_Blacklist_Field_currentTextChanged( this->ui->box_ConfNginx_Blacklist_Field->currentText() ); // iis paths - this->ui->inLine_ConfIis_Path_String->setText( QString::fromStdString(this->craplog.getLogsPath( IIS_ID )) ); + this->ui->inLine_ConfIis_Path_String->setText( QString::fromStdString(this->craplog.getLogsPath( WS_IIS )) ); this->ui->button_ConfIis_Path_Save->setEnabled( false ); // iis formats - this->ui->inLine_ConfIis_Format_String->setText( QString::fromStdString( this->craplog.getLogsFormatString( IIS_ID ) ) ); + this->ui->inLine_ConfIis_Format_String->setText( QString::fromStdString( this->craplog.getLogsFormatString( WS_IIS ) ) ); this->ui->button_ConfIis_Format_Save->setEnabled( false ); // iis warnlists this->on_box_ConfIis_Warnlist_Field_currentTextChanged( this->ui->box_ConfIis_Warnlist_Field->currentText() ); @@ -270,7 +283,7 @@ MainWindow::MainWindow(QWidget *parent) }; for ( auto chart : charts ) { ColorSec::applyChartTheme( - this->FONTS, chart ); + this->fonts, chart ); } this->ui->listLogFiles->sortByColumn( 0, Qt::SortOrder::AscendingOrder ); @@ -324,7 +337,7 @@ void MainWindow::defineOSspec() #else // shouldn't be here - throw GenericException( "Unexpected OS", true ); + static_assert( false, "Unexpected OS" ); #endif } @@ -345,7 +358,7 @@ void MainWindow::readConfigs() if ( err.value() ) { proceed &= false; QString file; - if ( this->dialogs_level > 0 ) { + if ( this->dialogs_level > DL_ESSENTIAL ) { file = QString::fromStdString( this->configs_path ); err_msg = QString::fromStdString( err.message() ); } @@ -359,7 +372,7 @@ void MainWindow::readConfigs() proceed = IOutils::renameAsCopy( this->configs_path, err ); if ( ! proceed ) { QString path; - if ( this->dialogs_level > 0 ) { + if ( this->dialogs_level > DL_ESSENTIAL ) { path = QString::fromStdString( this->configs_path ); if ( err.value() ) { err_msg = QString::fromStdString( err.message() ); @@ -373,7 +386,7 @@ void MainWindow::readConfigs() // configuration file not found proceed &= false; QString file; - if ( this->dialogs_level == 2 ) { + if ( this->dialogs_level == DL_EXPLANATORY ) { file = QString::fromStdString( this->configs_path ); } DialogSec::warnConfFileNotFound( file ); @@ -381,16 +394,21 @@ void MainWindow::readConfigs() if ( proceed ) { err_msg.clear(); - QString aux_err_msg; + QStringList invalid_lines; std::vector aux, configs; try { - // reset the lists when a config file is found - for ( unsigned w=APACHE_ID; w<=IIS_ID; w++ ) { - for ( const int& f : {11,12,20,21} ) { - this->craplog.setWarnlist( w, f, {} ); + bool iis_module_set{ false }; + std::string iis_format_w3c; + const std::string iis_format_ncsa{ "c-ip s-sitename s-computername [date:time] sc-status sc-bytes" }; + const std::string iis_format_iis{ "c-ip, cs-username, date, time, s-sitename, s-computername, s-ip, time-taken, cs-bytes, sc-bytes, sc-status, sc-win32-status, cs-method, cs-uri-stem, cs-uri-query," }; + const auto apply_iis_format{ [this,&invalid_lines](const std::string& line, const std::string& format, const IISLogsModule module) + { + if ( ! this->craplog.setIisLogFormat( format, module ) ) { + invalid_lines.append( QString::fromStdString( line ) ); + } } - this->craplog.setBlacklist( w, 20, {} ); - } + }; + std::string content; IOutils::readFile( this->configs_path, content ); StringOps::splitrip( configs, content ); @@ -417,225 +435,417 @@ void MainWindow::readConfigs() if ( var == "Language" ) { if ( val.size() != 5 ) { // not a valid locale, keep the default + invalid_lines.append( QString::fromStdString( line ) ); DialogSec::errLangLocaleInvalid( QString::fromStdString( val ) ); } else { if ( val == "en_GB" || val == "es_ES" || val == "fr_FR" || val == "it_IT" || val == "ja_JP" || val == "pt_BR" ) { this->language = val; } else { + invalid_lines.append( QString::fromStdString( line ) ); DialogSec::errLangNotAccepted( QString::fromStdString( val ) ); } } } else if ( var == "RememberGeometry" ) { - this->remember_window = this->s2b.at( val ); + try { + this->remember_window = this->s2b.at( val ); + } catch ( const std::exception& ) { + invalid_lines.append( QString::fromStdString( line ) ); + } } else if ( var == "Geometry" ) { this->setGeometryFromString( val ); } else if ( var == "WindowTheme" ) { - GlobalConfigs::window_theme = static_cast( std::stoi( val ) ); + try { + GlobalConfigs::window_theme = static_cast( std::stoi( val ) ); + } catch ( const std::exception& ) { + invalid_lines.append( QString::fromStdString( line ) ); + } } else if ( var == "IconsTheme" ) { - GlobalConfigs::icons_theme = static_cast( std::stoi( val ) ); + try { + GlobalConfigs::icons_theme = static_cast( std::stoi( val ) ); + } catch ( const std::exception& ) { + invalid_lines.append( QString::fromStdString( line ) ); + } } else if ( var == "ChartsTheme" ) { - GlobalConfigs::charts_theme = static_cast( std::stoi( val ) ); + try { + GlobalConfigs::charts_theme = static_cast( std::stoi( val ) ); + } catch ( const std::exception& ) { + invalid_lines.append( QString::fromStdString( line ) ); + } } else if ( var == "MainDialogsLevel" ) { - this->dialogs_level = std::stoi( val ); + try { + this->setDialogsLevelFromString( val ); + } catch ( const std::exception& ) { + invalid_lines.append( QString::fromStdString( line ) ); + } } else if ( var == "DefaultWebServer" ) { - this->default_ws = std::stoi( val ); + try { + this->setWebServerFromString( val ); + } catch ( const GenericException& ) { + invalid_lines.append( QString::fromStdString( line ) ); + DialogSec::errFailedApplyingConfigsItem( QStringLiteral("%1:\n%2").arg( + TR::tr("Unexpected WebServer"), + QString::fromStdString( val ) ) ); + } } else if ( var == "DatabaseDataPath" ) { this->db_data_path = this->resolvePath( val ); + if ( this->db_data_path.empty() ) { + invalid_lines.append( QString::fromStdString( line ) ); + } } else if ( var == "DatabaseHashesPath" ) { this->db_hashes_path = this->resolvePath( val ); + if ( this->db_hashes_path.empty() ) { + invalid_lines.append( QString::fromStdString( line ) ); + } } else if ( var == "DatabaseDoBackup" ) { - this->db_do_backup = this->s2b.at( val ); + try { + this->db_do_backup = this->s2b.at( val ); + } catch ( const std::exception& ) { + invalid_lines.append( QString::fromStdString( line ) ); + } } else if ( var == "DatabaseBackupsNumber" ) { - this->db_backups_number = std::stoi( val ); + try { + this->db_backups_number = std::stoi( val ); + } catch ( const std::exception& ) { + invalid_lines.append( QString::fromStdString( line ) ); + } } else if ( var == "Font" ) { - this->on_box_ConfTextBrowser_Font_currentIndexChanged( std::stoi( val ) ); + try { + this->on_box_ConfTextBrowser_Font_currentIndexChanged( std::stoi( val ) ); + } catch ( const std::exception& ) { + invalid_lines.append( QString::fromStdString( line ) ); + } } else if ( var == "WideLines" ) { - this->TB.setWideLinesUsage( this->s2b.at( val ) ); + try { + this->TB.setWideLinesUsage( this->s2b.at( val ) ); + } catch ( const std::exception& ) { + invalid_lines.append( QString::fromStdString( line ) ); + } } else if ( var == "ColorScheme" ) { - this->on_box_ConfTextBrowser_ColorScheme_currentIndexChanged( std::stoi( val ) ); + try { + const int v{ std::stoi( val ) }; + GlobalConfigs::colors_scheme = static_cast( v ); + this->on_box_ConfTextBrowser_ColorScheme_currentIndexChanged( v ); + } catch ( const std::exception& ) { + invalid_lines.append( QString::fromStdString( line ) ); + } } else if ( var == "CraplogDialogsLevel" ) { - this->craplog.setDialogsLevel( std::stoi( val ) ); + try { + this->craplog.setDialogsLevel( this->dialogsLevelFromInt( std::stoi( val ) ) ); + } catch ( ... ) { // std::exception / GenericException + invalid_lines.append( QString::fromStdString( line ) ); + } } else if ( var == "HideUsedFiles" ) { - hide_used_files = this->s2b.at( val ); + try { + hide_used_files = this->s2b.at( val ); + } catch ( const std::exception& ) { + invalid_lines.append( QString::fromStdString( line ) ); + } } else if ( var == "WarningSize" ) { - this->craplog.setWarningSize( std::stoul( val ) ); + try { + this->craplog.setWarningSize( std::stoul( val ) ); + } catch ( const std::exception& ) { + invalid_lines.append( QString::fromStdString( line ) ); + } } else if ( var == "ApacheLogsPath" ) { - this->craplog.setLogsPath( APACHE_ID, this->resolvePath( val ) ); + this->craplog.setLogsPath( WS_APACHE, this->resolvePath( val ) ); + if ( this->craplog.getLogsPath( WS_APACHE ).empty() ) { + invalid_lines.append( QString::fromStdString( line ) ); + } } else if ( var == "ApacheLogsFormat" ) { if ( ! this->craplog.setApacheLogFormat( val ) ) { - throw(""); + invalid_lines.append( QString::fromStdString( line ) ); } } else if ( var == "ApacheWarnlistMethod" ) { - aux_err_msg = QString("Apache -> %1 (%2)") - .arg( TR::tr(FIELDS__METHOD.c_str()), MainWindow::tr("warnlist") ); - this->craplog.setWarnlist( APACHE_ID, 11, this->string2list( val ) ); + try { + this->warnlists.setList( WS_APACHE, WarnlistField::Method, this->string2list( val ) ); + } catch ( const BWlistException& ) { + invalid_lines.append( QString::fromStdString( line ) ); + DialogSec::errFailedApplyingConfigsItem( QStringLiteral("%1:\n%2").arg( + DialogSec::tr("One of the lists has an invalid item"), + QStringLiteral("Apache -> %1 (%2)").arg( + TR::tr(FIELDS__METHOD.c_str()), MainWindow::tr("warnlist") ) ) ); + } } else if ( var == "ApacheWarnlistMethodUsed" ) { - this->craplog.setWarnlistUsed( APACHE_ID, 11, this->s2b.at( val ) ); + this->warnlists.setUsed( WS_APACHE, WarnlistField::Method, this->s2b.at( val ) ); } else if ( var == "ApacheWarnlistURI" ) { - aux_err_msg = QString("Apache -> %1 (%2)") - .arg( TR::tr(FIELDS__URI.c_str()), MainWindow::tr("warnlist") ); - this->craplog.setWarnlist( APACHE_ID, 12, this->string2list( val ) ); + try { + this->warnlists.setList( WS_APACHE, WarnlistField::Uri, this->string2list( val ) ); + } catch ( const BWlistException& ) { + invalid_lines.append( QString::fromStdString( line ) ); + DialogSec::errFailedApplyingConfigsItem( QStringLiteral("%1:\n%2").arg( + DialogSec::tr("One of the lists has an invalid item"), + QStringLiteral("Apache -> %1 (%2)").arg( + TR::tr(FIELDS__URI.c_str()), MainWindow::tr("warnlist") ) ) ); + } } else if ( var == "ApacheWarnlistURIUsed" ) { - this->craplog.setWarnlistUsed( APACHE_ID, 12, this->s2b.at( val ) ); + this->warnlists.setUsed( WS_APACHE, WarnlistField::Uri, this->s2b.at( val ) ); } else if ( var == "ApacheWarnlistClient" ) { - aux_err_msg = QString("Apache -> %1 (%2)") - .arg( TR::tr(FIELDS__CLIENT.c_str()), MainWindow::tr("warnlist") ); - this->craplog.setWarnlist( APACHE_ID, 20, this->string2list( val ) ); + try { + this->warnlists.setList( WS_APACHE, WarnlistField::Client, this->string2list( val ) ); + } catch ( const BWlistException& ) { + invalid_lines.append( QString::fromStdString( line ) ); + DialogSec::errFailedApplyingConfigsItem( QStringLiteral("%1:\n%2").arg( + DialogSec::tr("One of the lists has an invalid item"), + QStringLiteral("Apache -> %1 (%2)").arg( + TR::tr(FIELDS__CLIENT.c_str()), MainWindow::tr("warnlist") ) ) ); + } } else if ( var == "ApacheWarnlistClientUsed" ) { - this->craplog.setWarnlistUsed( APACHE_ID, 20, this->s2b.at( val ) ); + this->warnlists.setUsed( WS_APACHE, WarnlistField::Client, this->s2b.at( val ) ); } else if ( var == "ApacheWarnlistUserAgent" ) { - aux_err_msg = QString("Apache -> %1 (%2)") - .arg( TR::tr(FIELDS__USER_AGENT.c_str()), MainWindow::tr("warnlist") ); - this->craplog.setWarnlist( APACHE_ID, 21, this->string2list( val, true ) ); + try { + this->warnlists.setList( WS_APACHE, WarnlistField::UserAgent, this->string2list( val, true ) ); + } catch ( const BWlistException& ) { + invalid_lines.append( QString::fromStdString( line ) ); + DialogSec::errFailedApplyingConfigsItem( QStringLiteral("%1:\n%2").arg( + DialogSec::tr("One of the lists has an invalid item"), + QStringLiteral("Apache -> %1 (%2)").arg( + TR::tr(FIELDS__USER_AGENT.c_str()), MainWindow::tr("warnlist") ) ) ); + } } else if ( var == "ApacheWarnlistUserAgentUsed" ) { - this->craplog.setWarnlistUsed( APACHE_ID, 21, this->s2b.at( val ) ); + this->warnlists.setUsed( WS_APACHE, WarnlistField::UserAgent, this->s2b.at( val ) ); } else if ( var == "ApacheBlacklistClient" ) { - aux_err_msg = QString("Apache -> %1 (%2)") - .arg( TR::tr(FIELDS__CLIENT.c_str()), MainWindow::tr("blacklist") ); - this->craplog.setBlacklist( APACHE_ID, 20, this->string2list( val ) ); + try { + this->blacklists.setList( WS_APACHE, BlacklistField::Client, this->string2list( val ) ); + } catch ( const BWlistException& ) { + invalid_lines.append( QString::fromStdString( line ) ); + DialogSec::errFailedApplyingConfigsItem( QStringLiteral("%1:\n%2").arg( + DialogSec::tr("One of the lists has an invalid item"), + QStringLiteral("Apache -> %1 (%2)").arg( + TR::tr(FIELDS__CLIENT.c_str()), MainWindow::tr("blacklist") ) ) ); + } } else if ( var == "ApacheBlacklistClientUsed" ) { - this->craplog.setBlacklistUsed( APACHE_ID, 20, this->s2b.at( val ) ); + this->blacklists.setUsed( WS_APACHE, BlacklistField::Client, this->s2b.at( val ) ); } else if ( var == "NginxLogsPath" ) { - this->craplog.setLogsPath( NGINX_ID, this->resolvePath( val ) ); + this->craplog.setLogsPath( WS_NGINX, this->resolvePath( val ) ); + if ( this->craplog.getLogsPath( WS_NGINX ).empty() ) { + invalid_lines.append( QString::fromStdString( line ) ); + } } else if ( var == "NginxLogsFormat" ) { if ( ! this->craplog.setNginxLogFormat( val ) ) { - throw(""); + invalid_lines.append( QString::fromStdString( line ) ); } } else if ( var == "NginxWarnlistMethod" ) { - aux_err_msg = QString("Nginx -> %1 (%2)") - .arg( TR::tr(FIELDS__METHOD.c_str()), MainWindow::tr("warnlist") ); - this->craplog.setWarnlist( NGINX_ID, 11, this->string2list( val ) ); + try { + this->warnlists.setList( WS_NGINX, WarnlistField::Method, this->string2list( val ) ); + } catch ( const BWlistException& ) { + invalid_lines.append( QString::fromStdString( line ) ); + DialogSec::errFailedApplyingConfigsItem( QStringLiteral("%1:\n%2").arg( + DialogSec::tr("One of the lists has an invalid item"), + QStringLiteral("Nginx -> %1 (%2)").arg( + TR::tr(FIELDS__METHOD.c_str()), MainWindow::tr("warnlist") ) ) ); + } } else if ( var == "NginxWarnlistMethodUsed" ) { - this->craplog.setWarnlistUsed( NGINX_ID, 11, this->s2b.at( val ) ); + this->warnlists.setUsed( WS_NGINX, WarnlistField::Method, this->s2b.at( val ) ); } else if ( var == "NginxWarnlistURI" ) { - aux_err_msg = QString("Nginx -> %1 (%2)") - .arg( TR::tr(FIELDS__URI.c_str()), MainWindow::tr("warnlist") ); - this->craplog.setWarnlist( NGINX_ID, 12, this->string2list( val ) ); + try { + this->warnlists.setList( WS_NGINX, WarnlistField::Uri, this->string2list( val ) ); + } catch ( const BWlistException& ) { + invalid_lines.append( QString::fromStdString( line ) ); + DialogSec::errFailedApplyingConfigsItem( QStringLiteral("%1:\n%2").arg( + DialogSec::tr("One of the lists has an invalid item"), + QStringLiteral("Nginx -> %1 (%2)").arg( + TR::tr(FIELDS__URI.c_str()), MainWindow::tr("warnlist") ) ) ); + } } else if ( var == "NginxWarnlistURIUsed" ) { - this->craplog.setWarnlistUsed( NGINX_ID, 12, this->s2b.at( val ) ); + this->warnlists.setUsed( WS_NGINX, WarnlistField::Uri, this->s2b.at( val ) ); } else if ( var == "NginxWarnlistClient" ) { - aux_err_msg = QString("Nginx -> %1 (%2)") - .arg( TR::tr(FIELDS__CLIENT.c_str()), MainWindow::tr("warnlist") ); - this->craplog.setWarnlist( NGINX_ID, 20, this->string2list( val ) ); + try { + this->warnlists.setList( WS_NGINX, WarnlistField::Client, this->string2list( val ) ); + } catch ( const BWlistException& ) { + invalid_lines.append( QString::fromStdString( line ) ); + DialogSec::errFailedApplyingConfigsItem( QStringLiteral("%1:\n%2").arg( + DialogSec::tr("One of the lists has an invalid item"), + QStringLiteral("Nginx -> %1 (%2)").arg( + TR::tr(FIELDS__CLIENT.c_str()), MainWindow::tr("warnlist") ) ) ); + } } else if ( var == "NginxWarnlistClientUsed" ) { - this->craplog.setWarnlistUsed( NGINX_ID, 20, this->s2b.at( val ) ); + this->warnlists.setUsed( WS_NGINX, WarnlistField::Client, this->s2b.at( val ) ); } else if ( var == "NginxWarnlistUserAgent" ) { - aux_err_msg = QString("Nginx -> %1 (%2)") - .arg( TR::tr(FIELDS__USER_AGENT.c_str()), MainWindow::tr("warnlist") ); - this->craplog.setWarnlist( NGINX_ID, 21, this->string2list( val, true ) ); + try { + this->warnlists.setList( WS_NGINX, WarnlistField::UserAgent, this->string2list( val, true ) ); + } catch ( const BWlistException& ) { + invalid_lines.append( QString::fromStdString( line ) ); + DialogSec::errFailedApplyingConfigsItem( QStringLiteral("%1:\n%2").arg( + DialogSec::tr("One of the lists has an invalid item"), + QStringLiteral("Nginx -> %1 (%2)").arg( + TR::tr(FIELDS__USER_AGENT.c_str()), MainWindow::tr("warnlist") ) ) ); + } } else if ( var == "NginxWarnlistUserAgentUsed" ) { - this->craplog.setWarnlistUsed( NGINX_ID, 21, this->s2b.at( val ) ); + this->warnlists.setUsed( WS_NGINX, WarnlistField::UserAgent, this->s2b.at( val ) ); } else if ( var == "NginxBlacklistClient" ) { - aux_err_msg = QString("Nginx -> %1 (%2)") - .arg( TR::tr(FIELDS__CLIENT.c_str()), MainWindow::tr("blacklist") ); - this->craplog.setBlacklist( NGINX_ID, 20, this->string2list( val ) ); + try { + this->blacklists.setList( WS_NGINX, BlacklistField::Client, this->string2list( val ) ); + } catch ( const BWlistException& ) { + invalid_lines.append( QString::fromStdString( line ) ); + DialogSec::errFailedApplyingConfigsItem( QStringLiteral("%1:\n%2").arg( + DialogSec::tr("One of the lists has an invalid item"), + QStringLiteral("Nginx -> %1 (%2)").arg( + TR::tr(FIELDS__CLIENT.c_str()), MainWindow::tr("blacklist") ) ) ); + } } else if ( var == "NginxBlacklistClientUsed" ) { - this->craplog.setBlacklistUsed( NGINX_ID, 20, this->s2b.at( val ) ); + this->blacklists.setUsed( WS_NGINX, BlacklistField::Client, this->s2b.at( val ) ); } else if ( var == "IisLogsPath" ) { - this->craplog.setLogsPath( IIS_ID, this->resolvePath( val ) ); + this->craplog.setLogsPath( WS_IIS, this->resolvePath( val ) ); + if ( this->craplog.getLogsPath( WS_IIS ).empty() ) { + invalid_lines.append( QString::fromStdString( line ) ); + } } else if ( var == "IisLogsModule" ) { - if ( val == "1" ) { + if ( val == "0" ) { + this->ui->radio_ConfIis_Format_W3C->setChecked( true ); + if ( ! iis_format_w3c.empty() ) { + apply_iis_format( line, iis_format_w3c, IISLogsModule::W3C ); + } + } else if ( val == "1" ) { + iis_format_w3c.clear(); this->ui->radio_ConfIis_Format_NCSA->setChecked( true ); + apply_iis_format( line, iis_format_ncsa, IISLogsModule::NCSA ); } else if ( val == "2" ) { + iis_format_w3c.clear(); this->ui->radio_ConfIis_Format_IIS->setChecked( true ); + apply_iis_format( line, iis_format_iis, IISLogsModule::IIS ); + } else { + invalid_lines.append( QString::fromStdString( line ) ); + iis_module_set &= false; + continue; } + iis_module_set |= true; } else if ( var == "IisLogsFormat" ) { - int module = 0; - if ( this->ui->radio_ConfIis_Format_NCSA->isChecked() ) { - module = 1; - } else if ( this->ui->radio_ConfIis_Format_IIS->isChecked() ) { - module = 2; - } - if ( ! this->craplog.setIisLogFormat( val, module ) ) { - throw(""); + iis_format_w3c = val; + if ( iis_module_set ) { + if ( this->ui->radio_ConfIis_Format_W3C->isChecked() ) { + apply_iis_format( line, iis_format_w3c, IISLogsModule::W3C ); + } else if ( this->ui->radio_ConfIis_Format_NCSA->isChecked() ) { + iis_format_w3c.clear(); + apply_iis_format( line, iis_format_ncsa, IISLogsModule::NCSA ); + } else if ( this->ui->radio_ConfIis_Format_IIS->isChecked() ) { + iis_format_w3c.clear(); + apply_iis_format( line, iis_format_iis, IISLogsModule::IIS ); + } else { + // ... wtf? + throw("No radio button checked for the IIS logs module"); + } } } else if ( var == "IisWarnlistMethod" ) { - aux_err_msg = QString("IIS -> %1 (%2)") - .arg( TR::tr(FIELDS__METHOD.c_str()), MainWindow::tr("warnlist") ); - this->craplog.setWarnlist( IIS_ID, 11, this->string2list( val ) ); + try { + this->warnlists.setList( WS_IIS, WarnlistField::Method, this->string2list( val ) ); + } catch ( const BWlistException& ) { + invalid_lines.append( QString::fromStdString( line ) ); + DialogSec::errFailedApplyingConfigsItem( QStringLiteral("%1:\n%2").arg( + DialogSec::tr("One of the lists has an invalid item"), + QStringLiteral("IIS -> %1 (%2)").arg( + TR::tr(FIELDS__METHOD.c_str()), MainWindow::tr("warnlist") ) ) ); + } } else if ( var == "IisWarnlistMethodUsed" ) { - this->craplog.setWarnlistUsed( IIS_ID, 11, this->s2b.at( val ) ); + this->warnlists.setUsed( WS_IIS, WarnlistField::Method, this->s2b.at( val ) ); } else if ( var == "IisWarnlistURI" ) { - aux_err_msg = QString("IIS -> %1 (%2)") - .arg( TR::tr(FIELDS__URI.c_str()), MainWindow::tr("warnlist") ); - this->craplog.setWarnlist( IIS_ID, 12, this->string2list( val ) ); + try { + this->warnlists.setList( WS_IIS, WarnlistField::Uri, this->string2list( val ) ); + } catch ( const BWlistException& ) { + invalid_lines.append( QString::fromStdString( line ) ); + DialogSec::errFailedApplyingConfigsItem( QStringLiteral("%1:\n%2").arg( + DialogSec::tr("One of the lists has an invalid item"), + QStringLiteral("IIS -> %1 (%2)").arg( + TR::tr(FIELDS__URI.c_str()), MainWindow::tr("warnlist") ) ) ); + } } else if ( var == "IisWarnlistURIUsed" ) { - this->craplog.setWarnlistUsed( IIS_ID, 12, this->s2b.at( val ) ); + this->warnlists.setUsed( WS_IIS, WarnlistField::Uri, this->s2b.at( val ) ); } else if ( var == "IisWarnlistClient" ) { - aux_err_msg = QString("IIS -> %1 (%2)") - .arg( TR::tr(FIELDS__CLIENT.c_str()), MainWindow::tr("warnlist") ); - this->craplog.setWarnlist( IIS_ID, 20, this->string2list( val ) ); + try { + this->warnlists.setList( WS_IIS, WarnlistField::Client, this->string2list( val ) ); + } catch ( const BWlistException& ) { + invalid_lines.append( QString::fromStdString( line ) ); + DialogSec::errFailedApplyingConfigsItem( QStringLiteral("%1:\n%2").arg( + DialogSec::tr("One of the lists has an invalid item"), + QStringLiteral("IIS -> %1 (%2)").arg( + TR::tr(FIELDS__CLIENT.c_str()), MainWindow::tr("warnlist") ) ) ); + } } else if ( var == "IisWarnlistClientUsed" ) { - this->craplog.setWarnlistUsed( IIS_ID, 20, this->s2b.at( val ) ); + this->warnlists.setUsed( WS_IIS, WarnlistField::Client, this->s2b.at( val ) ); } else if ( var == "IisWarnlistUserAgent" ) { - aux_err_msg = QString("IIS -> %1 (%2)") - .arg( TR::tr(FIELDS__USER_AGENT.c_str()), MainWindow::tr("warnlist") ); - this->craplog.setWarnlist( IIS_ID, 21, this->string2list( val, true ) ); + try { + this->warnlists.setList( WS_IIS, WarnlistField::UserAgent, this->string2list( val, true ) ); + } catch ( const BWlistException& ) { + invalid_lines.append( QString::fromStdString( line ) ); + DialogSec::errFailedApplyingConfigsItem( QStringLiteral("%1:\n%2").arg( + DialogSec::tr("One of the lists has an invalid item"), + QStringLiteral("IIS -> %1 (%2)").arg( + TR::tr(FIELDS__USER_AGENT.c_str()), MainWindow::tr("warnlist") ) ) ); + } } else if ( var == "IisWarnlistUserAgentUsed" ) { - this->craplog.setWarnlistUsed( IIS_ID, 21, this->s2b.at( val ) ); + this->warnlists.setUsed( WS_IIS, WarnlistField::UserAgent, this->s2b.at( val ) ); } else if ( var == "IisBlacklistClient" ) { - aux_err_msg = QString("IIS -> %1 (%2)") - .arg( TR::tr(FIELDS__CLIENT.c_str()), MainWindow::tr("blacklist") ); - this->craplog.setBlacklist( IIS_ID, 20, this->string2list( val ) ); + try { + this->blacklists.setList( WS_IIS, BlacklistField::Client, this->string2list( val ) ); + } catch ( const BWlistException& ) { + invalid_lines.append( QString::fromStdString( line ) ); + DialogSec::errFailedApplyingConfigsItem( QStringLiteral("%1:\n%2").arg( + DialogSec::tr("One of the lists has an invalid item"), + QStringLiteral("IIS -> %1 (%2)").arg( + TR::tr(FIELDS__CLIENT.c_str()), MainWindow::tr("blacklist") ) ) ); + } } else if ( var == "IisBlacklistClientUsed" ) { - this->craplog.setBlacklistUsed( IIS_ID, 20, this->s2b.at( val ) ); + this->blacklists.setUsed( WS_IIS, BlacklistField::Client, this->s2b.at( val ) ); } else if ( var == "CrapviewDialogsLevel" ) { - this->crapview.setDialogsLevel( std::stoi( val ) ); + try { + this->crapview.setDialogsLevel( this->dialogsLevelFromInt( std::stoi( val ) ) ); + } catch ( ... ) { // std::exception / GenericException + invalid_lines.append( QString::fromStdString( line ) ); + } }/* else { // not valid @@ -645,22 +855,25 @@ void MainWindow::readConfigs() } catch ( const std::ios_base::failure& ) { // failed reading proceed &= false; + invalid_lines.clear(); err_msg = DialogSec::tr("An error occured while reading the configuration file"); - } catch ( const LogFormatException& ) { - proceed &= false; // message already shown - } catch ( const BWlistException& ) { - proceed &= false; - err_msg = QString("%1:\n%2").arg( - DialogSec::tr("One of the lists has an invalid item"), - aux_err_msg ); - } catch (...) { + } catch ( const LogDoctorException& ) { // something failed proceed &= false; + invalid_lines.clear(); + err_msg = DialogSec::tr("An error occured while parsing configuration file's data"); + } + + if ( ! invalid_lines.isEmpty() ) { + proceed &= false; + DialogSec::warnInvalidConfigsList( invalid_lines ); err_msg = DialogSec::tr("An error occured while parsing configuration file's data"); } if ( ! proceed ) { - DialogSec::errFailedApplyingConfigs( err_msg ); - this->closeEvent( new QCloseEvent() ); + if ( ! DialogSec::choiceFailedApplyingConfigs( err_msg ) ) { + // choosed to abort + std::exit( 1 ); + } } } } @@ -682,7 +895,7 @@ void MainWindow::writeConfigs() if ( err.value() ) { proceed &= false; QString file; - if ( this->dialogs_level > 0 ) { + if ( this->dialogs_level > DL_ESSENTIAL ) { file = QString::fromStdString( this->configs_path ); err_msg = QString::fromStdString( err.message() ); } @@ -697,7 +910,7 @@ void MainWindow::writeConfigs() proceed = IOutils::renameAsCopy( this->configs_path, err ); if ( ! proceed ) { QString path; - if ( this->dialogs_level > 0 ) { + if ( this->dialogs_level > DL_ESSENTIAL ) { path = QString::fromStdString( this->configs_path ); if ( err.value() ) { err_msg = QString::fromStdString( err.message() ); @@ -722,7 +935,7 @@ void MainWindow::writeConfigs() if ( err.value() ) { proceed &= false; QString file; - if ( this->dialogs_level > 0 ) { + if ( this->dialogs_level > DL_ESSENTIAL ) { file = QString::fromStdString( base_path ); err_msg = QString::fromStdString( err.message() ); } @@ -737,7 +950,7 @@ void MainWindow::writeConfigs() proceed = IOutils::renameAsCopy( base_path, err ); if ( ! proceed ) { QString path; - if ( this->dialogs_level > 0 ) { + if ( this->dialogs_level > DL_ESSENTIAL ) { path = QString::fromStdString( base_path ); err_msg = QString::fromStdString( err.message() ); } @@ -748,7 +961,7 @@ void MainWindow::writeConfigs() proceed = IOutils::makeDir( base_path, err ); if ( ! proceed ) { msg = DialogSec::tr("Failed to create the configuration file's directory"); - if ( this->dialogs_level > 0 ) { + if ( this->dialogs_level > DL_ESSENTIAL ) { msg += ":\n"+QString::fromStdString( base_path ); err_msg = QString::fromStdString( err.message() ); } @@ -761,7 +974,7 @@ void MainWindow::writeConfigs() proceed = IOutils::makeDir( base_path, err ); if ( ! proceed ) { msg = DialogSec::tr("Failed to create the configuration file's directory"); - if ( this->dialogs_level > 0 ) { + if ( this->dialogs_level > DL_ESSENTIAL ) { msg += ":\n"+QString::fromStdString( base_path ); err_msg = QString::fromStdString( err.message() ); } @@ -782,8 +995,8 @@ void MainWindow::writeConfigs() configs += "\nWindowTheme=" + std::to_string( static_cast(GlobalConfigs::window_theme) ); configs += "\nIconsTheme=" + std::to_string( static_cast(GlobalConfigs::icons_theme) ); configs += "\nChartsTheme=" + std::to_string( static_cast(GlobalConfigs::charts_theme) ); - configs += "\nMainDialogsLevel=" + std::to_string( this->dialogs_level ); - configs += "\nDefaultWebServer=" + std::to_string( this->default_ws ); + configs += "\nMainDialogsLevel=" + toString( this->dialogs_level ); + configs += "\nDefaultWebServer=" + toString( this->default_web_server ); configs += "\nDatabaseDataPath=" + this->db_data_path; configs += "\nDatabaseHashesPath=" + this->db_hashes_path; configs += "\nDatabaseDoBackup=" + this->b2s.at( this->db_do_backup ); @@ -792,43 +1005,43 @@ void MainWindow::writeConfigs() configs += "\n\n[TextBrowser]"; configs += "\nFont=" + std::to_string( this->ui->box_ConfTextBrowser_Font->currentIndex() ); configs += "\nWideLines=" + this->b2s.at( this->TB.getWideLinesUsage() ); - configs += "\nColorScheme=" + std::to_string( this->TB.getColorSchemeID() ); + configs += "\nColorScheme=" + std::to_string( static_cast(GlobalConfigs::colors_scheme) ); //// CRAPLOG //// configs += "\n\n[Craplog]"; - configs += "\nCraplogDialogsLevel=" + std::to_string( this->craplog.getDialogsLevel() ); + configs += "\nCraplogDialogsLevel=" + toString( this->craplog.getDialogsLevel() ); configs += "\nHideUsedFiles=" + this->b2s.at( this->hide_used_files ); configs += "\nWarningSize=" + std::to_string( this->craplog.getWarningSize() ); //// APACHE2 //// configs += "\n\n[Apache2]"; - configs += "\nApacheLogsPath=" + this->craplog.getLogsPath( APACHE_ID ); - configs += "\nApacheLogsFormat=" + this->craplog.getLogsFormatString( APACHE_ID ); - configs += "\nApacheWarnlistMethod=" + this->list2string( this->craplog.getWarnlist( APACHE_ID, 11 ) ); - configs += "\nApacheWarnlistMethodUsed=" + this->b2s.at( this->craplog.isWarnlistUsed( APACHE_ID, 11 ) ); - configs += "\nApacheWarnlistURI=" + this->list2string( this->craplog.getWarnlist( APACHE_ID, 12 ) ); - configs += "\nApacheWarnlistURIUsed=" + this->b2s.at( this->craplog.isWarnlistUsed( APACHE_ID, 12 ) ); - configs += "\nApacheWarnlistClient=" + this->list2string( this->craplog.getWarnlist( APACHE_ID, 20 ) ); - configs += "\nApacheWarnlistClientUsed=" + this->b2s.at( this->craplog.isWarnlistUsed( APACHE_ID, 20 ) ); - configs += "\nApacheWarnlistUserAgent=" + this->list2string( this->craplog.getWarnlist( APACHE_ID, 21 ), true ); - configs += "\nApacheWarnlistUserAgentUsed=" + this->b2s.at( this->craplog.isWarnlistUsed( APACHE_ID, 21 ) ); - configs += "\nApacheBlacklistClient=" + this->list2string( this->craplog.getBlacklist( APACHE_ID, 20 ) ); - configs += "\nApacheBlacklistClientUsed=" + this->b2s.at( this->craplog.isBlacklistUsed( APACHE_ID, 20 ) ); + configs += "\nApacheLogsPath=" + this->craplog.getLogsPath( WS_APACHE ); + configs += "\nApacheLogsFormat=" + this->craplog.getLogsFormatString( WS_APACHE ); + configs += "\nApacheWarnlistMethod=" + this->list2string( this->warnlists.getListConst( WS_APACHE, WarnlistField::Method ) ); + configs += "\nApacheWarnlistMethodUsed=" + this->b2s.at( this->warnlists.isUsed( WS_APACHE, WarnlistField::Method ) ); + configs += "\nApacheWarnlistURI=" + this->list2string( this->warnlists.getListConst( WS_APACHE, WarnlistField::Uri ) ); + configs += "\nApacheWarnlistURIUsed=" + this->b2s.at( this->warnlists.isUsed( WS_APACHE, WarnlistField::Uri ) ); + configs += "\nApacheWarnlistClient=" + this->list2string( this->warnlists.getListConst( WS_APACHE, WarnlistField::Client ) ); + configs += "\nApacheWarnlistClientUsed=" + this->b2s.at( this->warnlists.isUsed( WS_APACHE, WarnlistField::Client ) ); + configs += "\nApacheWarnlistUserAgent=" + this->list2string( this->warnlists.getListConst( WS_APACHE, WarnlistField::UserAgent ), true ); + configs += "\nApacheWarnlistUserAgentUsed=" + this->b2s.at( this->warnlists.isUsed( WS_APACHE, WarnlistField::UserAgent ) ); + configs += "\nApacheBlacklistClient=" + this->list2string( this->blacklists.getListConst( WS_APACHE, BlacklistField::Client ) ); + configs += "\nApacheBlacklistClientUsed=" + this->b2s.at( this->blacklists.isUsed( WS_APACHE, BlacklistField::Client ) ); //// NGINX //// configs += "\n\n[Nginx]"; - configs += "\nNginxLogsPath=" + this->craplog.getLogsPath( NGINX_ID ); - configs += "\nNginxLogsFormat=" + this->craplog.getLogsFormatString( NGINX_ID ); - configs += "\nNginxWarnlistMethod=" + this->list2string( this->craplog.getWarnlist( NGINX_ID, 11 ) ); - configs += "\nNginxWarnlistMethodUsed=" + this->b2s.at( this->craplog.isWarnlistUsed( NGINX_ID, 11 ) ); - configs += "\nNginxWarnlistURI=" + this->list2string( this->craplog.getWarnlist( NGINX_ID, 12 ) ); - configs += "\nNginxWarnlistURIUsed=" + this->b2s.at( this->craplog.isWarnlistUsed( NGINX_ID, 12 ) ); - configs += "\nNginxWarnlistClient=" + this->list2string( this->craplog.getWarnlist( NGINX_ID, 20 ) ); - configs += "\nNginxWarnlistClientUsed=" + this->b2s.at( this->craplog.isWarnlistUsed( NGINX_ID, 20 ) ); - configs += "\nNginxWarnlistUserAgent=" + this->list2string( this->craplog.getWarnlist( NGINX_ID, 21 ), true ); - configs += "\nNginxWarnlistUserAgentUsed=" + this->b2s.at( this->craplog.isWarnlistUsed( NGINX_ID, 21 ) ); - configs += "\nNginxBlacklistClient=" + this->list2string( this->craplog.getBlacklist( NGINX_ID, 20 ) ); - configs += "\nNginxBlacklistClientUsed=" + this->b2s.at( this->craplog.isBlacklistUsed( NGINX_ID, 20 ) ); + configs += "\nNginxLogsPath=" + this->craplog.getLogsPath( WS_NGINX ); + configs += "\nNginxLogsFormat=" + this->craplog.getLogsFormatString( WS_NGINX ); + configs += "\nNginxWarnlistMethod=" + this->list2string( this->warnlists.getListConst( WS_NGINX, WarnlistField::Method ) ); + configs += "\nNginxWarnlistMethodUsed=" + this->b2s.at( this->warnlists.isUsed( WS_NGINX, WarnlistField::Method ) ); + configs += "\nNginxWarnlistURI=" + this->list2string( this->warnlists.getListConst( WS_NGINX, WarnlistField::Uri ) ); + configs += "\nNginxWarnlistURIUsed=" + this->b2s.at( this->warnlists.isUsed( WS_NGINX, WarnlistField::Uri ) ); + configs += "\nNginxWarnlistClient=" + this->list2string( this->warnlists.getListConst( WS_NGINX, WarnlistField::Client ) ); + configs += "\nNginxWarnlistClientUsed=" + this->b2s.at( this->warnlists.isUsed( WS_NGINX, WarnlistField::Client ) ); + configs += "\nNginxWarnlistUserAgent=" + this->list2string( this->warnlists.getListConst( WS_NGINX, WarnlistField::UserAgent ), true ); + configs += "\nNginxWarnlistUserAgentUsed=" + this->b2s.at( this->warnlists.isUsed( WS_NGINX, WarnlistField::UserAgent ) ); + configs += "\nNginxBlacklistClient=" + this->list2string( this->blacklists.getListConst( WS_NGINX, BlacklistField::Client ) ); + configs += "\nNginxBlacklistClientUsed=" + this->b2s.at( this->blacklists.isUsed( WS_NGINX, BlacklistField::Client ) ); //// IIS //// configs += "\n\n[IIS]"; - configs += "\nIisLogsPath=" + this->craplog.getLogsPath( IIS_ID ); + configs += "\nIisLogsPath=" + this->craplog.getLogsPath( WS_IIS ); std::string module{ "0" }; if ( this->ui->radio_ConfIis_Format_NCSA->isChecked() ) { module = "1"; @@ -836,20 +1049,20 @@ void MainWindow::writeConfigs() module = "2"; } configs += "\nIisLogsModule=" + module; - configs += "\nIisLogsFormat=" + this->craplog.getLogsFormatString( IIS_ID ); - configs += "\nIisWarnlistMethod=" + this->list2string( this->craplog.getWarnlist( IIS_ID, 11 ) ); - configs += "\nIisWarnlistMethodUsed=" + this->b2s.at( this->craplog.isWarnlistUsed( IIS_ID, 11 ) ); - configs += "\nIisWarnlistURI=" + this->list2string( this->craplog.getWarnlist( IIS_ID, 12 ) ); - configs += "\nIisWarnlistURIUsed=" + this->b2s.at( this->craplog.isWarnlistUsed( IIS_ID, 12 ) ); - configs += "\nIisWarnlistClient=" + this->list2string( this->craplog.getWarnlist( IIS_ID, 20 ) ); - configs += "\nIisWarnlistClientUsed=" + this->b2s.at( this->craplog.isWarnlistUsed( IIS_ID, 20 ) ); - configs += "\nIisWarnlistUserAgent=" + this->list2string( this->craplog.getWarnlist( IIS_ID, 21 ), true ); - configs += "\nIisWarnlistUserAgentUsed=" + this->b2s.at( this->craplog.isWarnlistUsed( IIS_ID, 21 ) ); - configs += "\nIisBlacklistClient=" + this->list2string( this->craplog.getBlacklist( IIS_ID, 20 ) ); - configs += "\nIisBlacklistClientUsed=" + this->b2s.at( this->craplog.isBlacklistUsed( IIS_ID, 20 ) ); + configs += "\nIisLogsFormat=" + this->craplog.getLogsFormatString( WS_IIS ); + configs += "\nIisWarnlistMethod=" + this->list2string( this->warnlists.getListConst( WS_IIS, WarnlistField::Method ) ); + configs += "\nIisWarnlistMethodUsed=" + this->b2s.at( this->warnlists.isUsed( WS_IIS, WarnlistField::Method ) ); + configs += "\nIisWarnlistURI=" + this->list2string( this->warnlists.getListConst( WS_IIS, WarnlistField::Uri ) ); + configs += "\nIisWarnlistURIUsed=" + this->b2s.at( this->warnlists.isUsed( WS_IIS, WarnlistField::Uri ) ); + configs += "\nIisWarnlistClient=" + this->list2string( this->warnlists.getListConst( WS_IIS, WarnlistField::Client ) ); + configs += "\nIisWarnlistClientUsed=" + this->b2s.at( this->warnlists.isUsed( WS_IIS, WarnlistField::Client ) ); + configs += "\nIisWarnlistUserAgent=" + this->list2string( this->warnlists.getListConst( WS_IIS, WarnlistField::UserAgent ), true ); + configs += "\nIisWarnlistUserAgentUsed=" + this->b2s.at( this->warnlists.isUsed( WS_IIS, WarnlistField::UserAgent ) ); + configs += "\nIisBlacklistClient=" + this->list2string( this->blacklists.getListConst( WS_IIS, BlacklistField::Client ) ); + configs += "\nIisBlacklistClientUsed=" + this->b2s.at( this->blacklists.isUsed( WS_IIS, BlacklistField::Client ) ); //// CRAPVIEW //// configs += "\n\n[Crapview]"; - configs += "\nCrapviewDialogsLevel=" + std::to_string( this->crapview.getDialogsLevel() ); + configs += "\nCrapviewDialogsLevel=" + toString( this->crapview.getDialogsLevel() ); // write on file try { @@ -871,7 +1084,7 @@ void MainWindow::backupDatabase() const bool proceed{ true }; std::error_code err; QString err_msg; - if ( IOutils::checkFile( this->db_data_path+"/collection.db" ) ) { + if ( IOutils::checkFile( this->db_data_path+"/"+DatabasesNames::data ) ) { // db exists and is a file const std::string path{ this->db_data_path+"/backups" }; if ( std::filesystem::exists( path ) ) { @@ -882,7 +1095,7 @@ void MainWindow::backupDatabase() const proceed = IOutils::renameAsCopy( path, err ); if ( ! proceed ) { QString p; - if ( this->dialogs_level > 0 ) { + if ( this->dialogs_level > DL_ESSENTIAL ) { p = QString::fromStdString( path ); if ( err.value() ) { err_msg = QString::fromStdString( err.message() ); @@ -894,7 +1107,7 @@ void MainWindow::backupDatabase() const proceed = IOutils::makeDir( path, err ); if ( ! proceed ) { QString msg = DialogSec::tr("Failed to create the database backups' directory"); - if ( this->dialogs_level > 0 ) { + if ( this->dialogs_level > DL_ESSENTIAL ) { msg += ":\n"+QString::fromStdString( path ); if ( err.value() ) { err_msg = QString::fromStdString( err.message() ); @@ -910,7 +1123,7 @@ void MainWindow::backupDatabase() const proceed = IOutils::makeDir( path, err ); if ( ! proceed ) { QString msg = DialogSec::tr("Failed to create the database backups' directory"); - if ( this->dialogs_level > 0 ) { + if ( this->dialogs_level > DL_ESSENTIAL ) { msg += ":\n"+QString::fromStdString( path ); if ( err.value() ) { err_msg = QString::fromStdString( err.message() ); @@ -927,8 +1140,8 @@ void MainWindow::backupDatabase() const if ( proceed ) { // copy the database to a new file proceed = std::filesystem::copy_file( - this->db_data_path+"/collection.db", - this->db_data_path+"/backups/collection.db.0", + this->db_data_path+"/"+DatabasesNames::data, + this->db_data_path+"/backups/"+DatabasesNames::data+".0", std::filesystem::copy_options::update_existing, err ); if ( ! proceed ) { @@ -939,7 +1152,7 @@ void MainWindow::backupDatabase() const DialogSec::errDatabaseFailedBackup( DialogSec::tr( "Failed to copy the database file" ), err_msg ); } else { // succesfully copied, now rename the already existing copies (up to the choosen number of copies) - std::string path{ this->db_data_path+"/backups/collection.db."+std::to_string(this->db_backups_number) }; + std::string path{ this->db_data_path+"/backups/"+DatabasesNames::data+"."+std::to_string(this->db_backups_number) }; std::string new_path; if ( std::filesystem::exists( path ) ) { std::ignore = std::filesystem::remove_all( path, err ); @@ -955,10 +1168,10 @@ void MainWindow::backupDatabase() const } if ( proceed ) { // cascade rename - for ( int n=this->db_backups_number-1; n>=0; n-- ) { - path = this->db_data_path+"/backups/collection.db."+std::to_string( n ); + for ( int n=this->db_backups_number-1; n>=0; --n ) { + path = this->db_data_path+"/backups/"+DatabasesNames::data+"."+std::to_string( n ); if ( std::filesystem::exists( path ) ) { - new_path = this->db_data_path+"/backups/collection.db."+std::to_string( n+1 ); + new_path = this->db_data_path+"/backups/"+DatabasesNames::data+"."+std::to_string( n+1 ); std::filesystem::rename( path, new_path, err ); if ( err.value() ) { err_msg = QString::fromStdString( err.message() ); @@ -1006,6 +1219,33 @@ void MainWindow::setGeometryFromString( const std::string& geometry ) } } +void MainWindow::setDialogsLevelFromString( const std::string& dialogs_level ) +{ + this->dialogs_level = this->dialogsLevelFromInt( std::stoi( dialogs_level ) ); +} +DialogsLevel MainWindow::dialogsLevelFromInt( const int dialogs_level ) +{ + if ( dialogs_level >= 0 && dialogs_level <= 2) { + return static_cast( dialogs_level ); + } else { + throw DoNotCatchException( "Unexpected DialogsLevel", std::to_string(dialogs_level) ); + } +} + +void MainWindow::setWebServerFromString(const std::string& web_server ) +{ + // 11,12,13 are kept for retro-compatibility, to be removed in a later stage + if ( web_server == "Apache" || web_server == "11" ) { + this->default_web_server = WebServer::Apache; + } else if ( web_server == "Nginx" || web_server == "12" ) { + this->default_web_server = WebServer::Nginx; + } else if ( web_server == "IIS" || web_server == "13" ) { + this->default_web_server = WebServer::IIS; + } else { + throw DoNotCatchException( "Unexpected WebServer", web_server ); + } +} + std::string MainWindow::list2string( const std::vector& list, const bool user_agent ) const { @@ -1060,7 +1300,7 @@ void MainWindow::detectIconsTheme() GlobalConfigs::icons_set = "light"; break; default: - throw GenericException( "Unexpected WindowTheme: "+std::to_string(static_cast(GlobalConfigs::window_theme)), true ); + throw DoNotCatchException( "Unexpected WindowTheme", std::to_string(static_cast(GlobalConfigs::window_theme)) ); break; } } @@ -1077,19 +1317,16 @@ void MainWindow::updateUiTheme() this->updateUiIcons(); break; case WindowTheme::Light: + [[fallthrough]]; case WindowTheme::Dark: - { // icons first this->updateUiIcons(); // window last - QString ss; - StyleSec::getStyleSheet( ss ); - this->setStyleSheet( ss ); + this->setStyleSheet( StyleSec::getStyleSheet() ); break; - } default: // wrong - throw GenericException( "Unexpected WindowTheme: "+std::to_string(static_cast(GlobalConfigs::window_theme)), true ); + throw DoNotCatchException( "Unexpected WindowTheme", std::to_string(static_cast(GlobalConfigs::window_theme)) ); break; } // fallback stylesheets @@ -1116,7 +1353,7 @@ void MainWindow::updateUiIcons() : "dark"; break; default: - throw GenericException( "Unexpected IconsTheme index: "+std::to_string(static_cast(GlobalConfigs::icons_theme)), true ); + throw DoNotCatchException( "Unexpected IconsTheme", std::to_string(static_cast(GlobalConfigs::icons_theme)) ); break; } @@ -1124,71 +1361,69 @@ void MainWindow::updateUiIcons() // main tabs const int m_index{ this->ui->stackedPages_Sections->currentIndex() }; this->ui->button_Tab_Log->setIcon( - QIcon(QString(":/icons/icons/%1/log_%2.png").arg( + QIcon(QStringLiteral(":/icons/icons/%1/log_%2.png").arg( GlobalConfigs::icons_set, (m_index==0) ? "on" : "off" )) ); this->ui->button_Tab_View->setIcon( - QIcon(QString(":/icons/icons/%1/view_%2.png").arg( + QIcon(QStringLiteral(":/icons/icons/%1/view_%2.png").arg( GlobalConfigs::icons_set, (m_index==1) ? "on" : "off" )) ); this->ui->button_Tab_Conf->setIcon( - QIcon(QString(":/icons/icons/%1/conf_%2.png").arg( + QIcon(QStringLiteral(":/icons/icons/%1/conf_%2.png").arg( GlobalConfigs::icons_set, (m_index==2) ? "on" : "off" )) ); // view logs this->ui->button_LogFiles_ViewFile->setIcon( - QIcon(QString(":/icons/icons/%1/show_file.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/show_file.png").arg(GlobalConfigs::icons_set)) ); this->ui->button_LogFiles_RefreshList->setIcon( - QIcon(QString(":/icons/icons/%1/refresh.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/refresh.png").arg(GlobalConfigs::icons_set)) ); // parse logs this->ui->icon_MakeStats_Size->setPixmap( - QPixmap(QString(":/icons/icons/%1/mk_size.png").arg(GlobalConfigs::icons_set)) ); + QPixmap(QStringLiteral(":/icons/icons/%1/mk_size.png").arg(GlobalConfigs::icons_set)) ); this->ui->icon_MakeStats_Lines->setPixmap( - QPixmap(QString(":/icons/icons/%1/mk_lines.png").arg(GlobalConfigs::icons_set)) ); + QPixmap(QStringLiteral(":/icons/icons/%1/mk_lines.png").arg(GlobalConfigs::icons_set)) ); this->ui->icon_MakeStats_Time->setPixmap( - QPixmap(QString(":/icons/icons/%1/mk_time.png").arg(GlobalConfigs::icons_set)) ); + QPixmap(QStringLiteral(":/icons/icons/%1/mk_time.png").arg(GlobalConfigs::icons_set)) ); this->ui->icon_MakeStats_Speed->setPixmap( - QPixmap(QString(":/icons/icons/%1/mk_speed.png").arg(GlobalConfigs::icons_set)) ); + QPixmap(QStringLiteral(":/icons/icons/%1/mk_speed.png").arg(GlobalConfigs::icons_set)) ); // stats const int s_index{ this->ui->stackedPages_Stats->currentIndex() }; // stats warn this->ui->button_Tab_StatsWarn->setIcon( - QIcon(QString(":/icons/icons/%1/warn_%2.png").arg( + QIcon(QStringLiteral(":/icons/icons/%1/warn_%2.png").arg( GlobalConfigs::icons_set, (s_index==0) ? "on" : "off" )) ); this->ui->button_StatsWarn_Draw->setIcon( - QIcon(QString(":/icons/icons/%1/draw.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_StatsWarn_Update->setIcon( - QIcon(QString(":/icons/icons/%1/save.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/draw.png").arg(GlobalConfigs::icons_set)) ); // stats speed this->ui->button_Tab_StatsSpeed->setIcon( - QIcon(QString(":/icons/icons/%1/speed_%2.png").arg( + QIcon(QStringLiteral(":/icons/icons/%1/speed_%2.png").arg( GlobalConfigs::icons_set, (s_index==1) ? "on" : "off" )) ); this->ui->button_StatsSpeed_Draw->setIcon( - QIcon(QString(":/icons/icons/%1/draw.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/draw.png").arg(GlobalConfigs::icons_set)) ); // stats count this->ui->button_Tab_StatsCount->setIcon( - QIcon(QString(":/icons/icons/%1/count_%2.png").arg( + QIcon(QStringLiteral(":/icons/icons/%1/count_%2.png").arg( GlobalConfigs::icons_set, (s_index==2) ? "on" : "off" )) ); // stats daytime this->ui->button_Tab_StatsDay->setIcon( - QIcon(QString(":/icons/icons/%1/daytime_%2.png").arg( + QIcon(QStringLiteral(":/icons/icons/%1/daytime_%2.png").arg( GlobalConfigs::icons_set, (s_index==3) ? "on" : "off" )) ); this->ui->button_StatsDay_Draw->setIcon( - QIcon(QString(":/icons/icons/%1/draw.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/draw.png").arg(GlobalConfigs::icons_set)) ); // stats relational this->ui->button_Tab_StatsRelat->setIcon( - QIcon(QString(":/icons/icons/%1/relational_%2.png").arg( + QIcon(QStringLiteral(":/icons/icons/%1/relational_%2.png").arg( GlobalConfigs::icons_set, (s_index==4) ? "on" : "off" )) ); this->ui->button_StatsRelat_Draw->setIcon( - QIcon(QString(":/icons/icons/%1/draw.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/draw.png").arg(GlobalConfigs::icons_set)) ); // stats globals this->ui->button_Tab_StatsGlob->setIcon( - QIcon(QString(":/icons/icons/%1/global_%2.png").arg( + QIcon(QStringLiteral(":/icons/icons/%1/global_%2.png").arg( GlobalConfigs::icons_set, (s_index==5) ? "on" : "off" )) ); // configs tree @@ -1197,128 +1432,136 @@ void MainWindow::updateUiIcons() QString icon_name; const QString text{ (*it)->text(0) }; if ( text == tr("General") ) { - icon_name = "conf_general"; + icon_name += "conf_general"; } else if ( text == tr("Window") ) { - icon_name = "conf_window"; + icon_name += "conf_window"; } else if ( text == tr("Dialogs") ) { - icon_name = "conf_dialogs"; + icon_name += "conf_dialogs"; } else if ( text == tr("Charts") ) { - icon_name = "conf_charts"; + icon_name += "conf_charts"; } else if ( text == tr("TextBrowser") ) { - icon_name = "conf_textbrowser"; + icon_name += "conf_textbrowser"; } else if ( text == tr("Databases") ) { - icon_name = "conf_databases"; + icon_name += "conf_databases"; } else if ( text == tr("Logs") ) { - icon_name = "conf_logs"; + icon_name += "conf_logs"; } else if ( text == tr("Defaults") ) { - icon_name = "conf_defaults"; + icon_name += "conf_defaults"; } else if ( text == tr("Control") ) { - icon_name = "conf_control"; + icon_name += "conf_control"; } else if ( text == tr("Path") ) { - icon_name = "conf_path"; + icon_name += "conf_path"; } else if ( text == tr("Format") ) { - icon_name = "conf_format"; + icon_name += "conf_format"; } else if ( text == tr("Warnlists") ) { - icon_name = "conf_warnlists"; + icon_name += "conf_warnlists"; } else if ( text == tr("Blacklists") ) { - icon_name = "conf_blacklists"; + icon_name += "conf_blacklists"; } else if ( text == tr("Apache2") || text == tr("Nginx") || text == tr("IIS") ) { - icon_name = "conf_webservers"; + icon_name += "conf_webservers"; } else { - throw GenericException( "Unexpected Configs section: "+text.toStdString(), true ); + throw DoNotCatchException( "Unexpected Configs section", text.toStdString() ); } (*it)->setIcon(0, - QIcon(QString(":/icons/icons/%1/%2.png").arg(GlobalConfigs::icons_set, icon_name)) ); + QIcon(QStringLiteral(":/icons/icons/%1/%2.png").arg(GlobalConfigs::icons_set, icon_name)) ); ++it; } // conf databases - this->ui->button_ConfDatabases_Data_Save->setIcon( - QIcon(QString(":/icons/icons/%1/save.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfDatabases_Hashes_Save->setIcon( - QIcon(QString(":/icons/icons/%1/save.png").arg(GlobalConfigs::icons_set)) ); - // conf apache - this->ui->button_ConfApache_Path_Save->setIcon( - QIcon(QString(":/icons/icons/%1/save.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfApache_Format_Save->setIcon( - QIcon(QString(":/icons/icons/%1/save.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfApache_Format_Help->setIcon( - QIcon(QString(":/icons/icons/%1/help.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfApache_Warnlist_Add->setIcon( - QIcon(QString(":/icons/icons/%1/list_add.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfApache_Warnlist_Remove->setIcon( - QIcon(QString(":/icons/icons/%1/list_rem.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfApache_Warnlist_Up->setIcon( - QIcon(QString(":/icons/icons/%1/list_up.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfApache_Warnlist_Down->setIcon( - QIcon(QString(":/icons/icons/%1/list_down.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfApache_Blacklist_Add->setIcon( - QIcon(QString(":/icons/icons/%1/list_add.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfApache_Blacklist_Remove->setIcon( - QIcon(QString(":/icons/icons/%1/list_rem.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfApache_Blacklist_Up->setIcon( - QIcon(QString(":/icons/icons/%1/list_up.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfApache_Blacklist_Down->setIcon( - QIcon(QString(":/icons/icons/%1/list_down.png").arg(GlobalConfigs::icons_set)) ); - // conf nginx - this->ui->button_ConfNginx_Path_Save->setIcon( - QIcon(QString(":/icons/icons/%1/save.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfNginx_Format_Save->setIcon( - QIcon(QString(":/icons/icons/%1/save.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfNginx_Format_Help->setIcon( - QIcon(QString(":/icons/icons/%1/help.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfNginx_Warnlist_Add->setIcon( - QIcon(QString(":/icons/icons/%1/list_add.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfNginx_Warnlist_Remove->setIcon( - QIcon(QString(":/icons/icons/%1/list_rem.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfNginx_Warnlist_Up->setIcon( - QIcon(QString(":/icons/icons/%1/list_up.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfNginx_Warnlist_Down->setIcon( - QIcon(QString(":/icons/icons/%1/list_down.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfNginx_Blacklist_Add->setIcon( - QIcon(QString(":/icons/icons/%1/list_add.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfNginx_Blacklist_Remove->setIcon( - QIcon(QString(":/icons/icons/%1/list_rem.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfNginx_Blacklist_Up->setIcon( - QIcon(QString(":/icons/icons/%1/list_up.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfNginx_Blacklist_Down->setIcon( - QIcon(QString(":/icons/icons/%1/list_down.png").arg(GlobalConfigs::icons_set)) ); - // conf iis - this->ui->button_ConfIis_Path_Save->setIcon( - QIcon(QString(":/icons/icons/%1/save.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfIis_Format_Save->setIcon( - QIcon(QString(":/icons/icons/%1/save.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfIis_Format_Help->setIcon( - QIcon(QString(":/icons/icons/%1/help.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfIis_Warnlist_Add->setIcon( - QIcon(QString(":/icons/icons/%1/list_add.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfIis_Warnlist_Remove->setIcon( - QIcon(QString(":/icons/icons/%1/list_rem.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfIis_Warnlist_Up->setIcon( - QIcon(QString(":/icons/icons/%1/list_up.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfIis_Warnlist_Down->setIcon( - QIcon(QString(":/icons/icons/%1/list_down.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfIis_Blacklist_Add->setIcon( - QIcon(QString(":/icons/icons/%1/list_add.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfIis_Blacklist_Remove->setIcon( - QIcon(QString(":/icons/icons/%1/list_rem.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfIis_Blacklist_Up->setIcon( - QIcon(QString(":/icons/icons/%1/list_up.png").arg(GlobalConfigs::icons_set)) ); - this->ui->button_ConfIis_Blacklist_Down->setIcon( - QIcon(QString(":/icons/icons/%1/list_down.png").arg(GlobalConfigs::icons_set)) ); + { + const QString save_template{ QStringLiteral(":/icons/icons/%1/save.png") }; + const QString help_template{ QStringLiteral(":/icons/icons/%1/help.png") }; + const QString add_template{ QStringLiteral(":/icons/icons/%1/list_add.png") }; + const QString rem_template{ QStringLiteral(":/icons/icons/%1/list_rem.png") }; + const QString up_template{ QStringLiteral(":/icons/icons/%1/list_up.png") }; + const QString down_template{ QStringLiteral(":/icons/icons/%1/list_down.png") }; + this->ui->button_ConfDatabases_Data_Save->setIcon( + QIcon(save_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfDatabases_Hashes_Save->setIcon( + QIcon(save_template.arg(GlobalConfigs::icons_set)) ); + // conf apache + this->ui->button_ConfApache_Path_Save->setIcon( + QIcon(save_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfApache_Format_Save->setIcon( + QIcon(save_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfApache_Format_Help->setIcon( + QIcon(help_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfApache_Warnlist_Add->setIcon( + QIcon(add_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfApache_Warnlist_Remove->setIcon( + QIcon(rem_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfApache_Warnlist_Up->setIcon( + QIcon(up_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfApache_Warnlist_Down->setIcon( + QIcon(down_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfApache_Blacklist_Add->setIcon( + QIcon(add_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfApache_Blacklist_Remove->setIcon( + QIcon(rem_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfApache_Blacklist_Up->setIcon( + QIcon(up_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfApache_Blacklist_Down->setIcon( + QIcon(down_template.arg(GlobalConfigs::icons_set)) ); + // conf nginx + this->ui->button_ConfNginx_Path_Save->setIcon( + QIcon(save_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfNginx_Format_Save->setIcon( + QIcon(save_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfNginx_Format_Help->setIcon( + QIcon(help_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfNginx_Warnlist_Add->setIcon( + QIcon(add_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfNginx_Warnlist_Remove->setIcon( + QIcon(rem_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfNginx_Warnlist_Up->setIcon( + QIcon(up_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfNginx_Warnlist_Down->setIcon( + QIcon(down_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfNginx_Blacklist_Add->setIcon( + QIcon(add_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfNginx_Blacklist_Remove->setIcon( + QIcon(rem_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfNginx_Blacklist_Up->setIcon( + QIcon(up_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfNginx_Blacklist_Down->setIcon( + QIcon(down_template.arg(GlobalConfigs::icons_set)) ); + // conf iis + this->ui->button_ConfIis_Path_Save->setIcon( + QIcon(save_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfIis_Format_Save->setIcon( + QIcon(save_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfIis_Format_Help->setIcon( + QIcon(help_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfIis_Warnlist_Add->setIcon( + QIcon(add_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfIis_Warnlist_Remove->setIcon( + QIcon(rem_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfIis_Warnlist_Up->setIcon( + QIcon(up_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfIis_Warnlist_Down->setIcon( + QIcon(down_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfIis_Blacklist_Add->setIcon( + QIcon(add_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfIis_Blacklist_Remove->setIcon( + QIcon(rem_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfIis_Blacklist_Up->setIcon( + QIcon(up_template.arg(GlobalConfigs::icons_set)) ); + this->ui->button_ConfIis_Blacklist_Down->setIcon( + QIcon(down_template.arg(GlobalConfigs::icons_set)) ); + } } } void MainWindow::updateUiFonts() { - const QFont& small_font{ this->FONTS.at( "main_small" ) }; - const QFont& font{ this->FONTS.at( "main" ) }; - const QFont& big_font{ this->FONTS.at( "main_big" ) }; - QFont menu_font{ this->FONTS.at( "main_small" ) }; + const QFont& small_font{ this->fonts.at( "main_small" ) }; + const QFont& font{ this->fonts.at( "main" ) }; + const QFont& big_font{ this->fonts.at( "main_big" ) }; + QFont menu_font{ this->fonts.at( "main_small" ) }; menu_font.setPointSizeF( this->font_size_small+1.5 ); - QFont header_font{ this->FONTS.at( "main_small" ) }; + QFont header_font{ this->fonts.at( "main_small" ) }; header_font.setPointSizeF( this->font_size_small+2 ); // menu this->ui->menuLanguage->setFont( menu_font ); @@ -1332,6 +1575,7 @@ void MainWindow::updateUiFonts() this->ui->actionBlockNote->setFont( menu_font ); this->ui->menuUtilities->setFont( menu_font ); this->ui->actionInfos->setFont( menu_font ); + this->ui->actionChangelog->setFont( menu_font ); this->ui->actionCheckUpdates->setFont( menu_font ); this->ui->menuGames->setFont( menu_font ); this->ui->actionCrissCross->setFont( menu_font ); @@ -1588,55 +1832,37 @@ void MainWindow::updateUiLanguage() { // remove the old translator QCoreApplication::removeTranslator( &this->translator ); - if ( this->translator.load( QString(":/translations/%1").arg(QString::fromStdString( this->language )) ) ) { + if ( this->translator.load( QStringLiteral(":/translations/%1").arg(QString::fromStdString( this->language )) ) ) { // apply the new translator QCoreApplication::installTranslator( &this->translator ); this->ui->retranslateUi( this ); // stats warn table header { - const QStringList h{ - this->crapview.getLogFieldString(0), - TR::tr( WORDS__DATE.c_str() ), - TR::tr( WORDS__TIME.c_str() ), - this->crapview.getLogFieldString(10), - this->crapview.getLogFieldString(11), - this->crapview.getLogFieldString(12), - this->crapview.getLogFieldString(13), - this->crapview.getLogFieldString(14), - this->crapview.getLogFieldString(18), - this->crapview.getLogFieldString(22), - this->crapview.getLogFieldString(21), - this->crapview.getLogFieldString(20), - this->crapview.getLogFieldString(17), - this->crapview.getLogFieldString(16), - this->crapview.getLogFieldString(15), - "rowid" }; + const QStringList h{ this->crapview.getWarnHeaderColumns() }; this->ui->table_StatsWarn->setColumnCount( h.size() ); this->ui->table_StatsWarn->setHorizontalHeaderLabels( h ); } // stats speed table header { - const QStringList h{ - this->crapview.getLogFieldString(15), - this->crapview.getLogFieldString(12), - this->crapview.getLogFieldString(13), - this->crapview.getLogFieldString(11), - this->crapview.getLogFieldString(10), - this->crapview.getLogFieldString(14), - TR::tr( WORDS__TIME.c_str() ) }; + const QStringList h{ this->crapview.getSpeedHeaderColumns() }; this->ui->table_StatsSpeed->setColumnCount( h.size() ); this->ui->table_StatsSpeed->setHorizontalHeaderLabels( h ); } // stats count buttons - this->ui->button_StatsCount_Protocol->setText( this->crapview.getLogFieldString( 10 ) ); - this->ui->button_StatsCount_Method->setText( this->crapview.getLogFieldString( 11 ) ); - this->ui->button_StatsCount_Uri->setText( this->crapview.getLogFieldString( 12 ) ); - this->ui->button_StatsCount_Query->setText( this->crapview.getLogFieldString( 13 ) ); - this->ui->button_StatsCount_Response->setText( this->crapview.getLogFieldString( 14 ) ); - this->ui->button_StatsCount_Referrer->setText( this->crapview.getLogFieldString( 18 ) ); - this->ui->button_StatsCount_Cookie->setText( this->crapview.getLogFieldString( 22 ) ); - this->ui->button_StatsCount_UserAgent->setText( this->crapview.getLogFieldString( 21 ) ); - this->ui->button_StatsCount_Client->setText( this->crapview.getLogFieldString( 20 ) ); + this->ui->button_StatsCount_Protocol->setText( TR::tr( FIELDS__PROTOCOL.c_str() ) ); + this->ui->button_StatsCount_Method->setText( TR::tr( FIELDS__METHOD.c_str() ) ); + this->ui->button_StatsCount_Uri->setText( TR::tr( FIELDS__URI.c_str() ) ); + this->ui->button_StatsCount_Query->setText( TR::tr( FIELDS__QUERY.c_str() ) ); + this->ui->button_StatsCount_Response->setText( TR::tr( FIELDS__RESPONSE_CODE.c_str() ) ); + this->ui->button_StatsCount_Referrer->setText( TR::tr( FIELDS__REFERRER.c_str() ) ); + this->ui->button_StatsCount_Cookie->setText( TR::tr( FIELDS__COOKIE.c_str() ) ); + this->ui->button_StatsCount_UserAgent->setText( TR::tr( FIELDS__USER_AGENT.c_str() ) ); + this->ui->button_StatsCount_Client->setText( TR::tr( FIELDS__CLIENT.c_str() ) ); + // stats day log fields + dynamic_cast(this->ui->box_StatsDay_LogsField->model())->translate(); + // stats relat log fields + dynamic_cast(this->ui->box_StatsRelat_LogsField_1->model())->translate(); + dynamic_cast(this->ui->box_StatsRelat_LogsField_2->model())->translate(); // configs { QTreeWidgetItemIterator it( this->ui->tree_ConfSections ); @@ -1649,12 +1875,12 @@ void MainWindow::updateUiLanguage() // configs warn/black-lists { const QStringList wl{ - this->crapview.getLogFieldString( 11 ), - this->crapview.getLogFieldString( 12 ), - this->crapview.getLogFieldString( 21 ), - this->crapview.getLogFieldString( 20 ) }; + TR::tr( FIELDS__METHOD.c_str() ), + TR::tr( FIELDS__URI.c_str() ), + TR::tr( FIELDS__USER_AGENT.c_str() ), + TR::tr( FIELDS__CLIENT.c_str() ) }; const QStringList bl{ - this->crapview.getLogFieldString( 20 ) }; + TR::tr( FIELDS__CLIENT.c_str() ) }; // set this->ui->box_ConfApache_Warnlist_Field->clear(); this->ui->box_ConfApache_Warnlist_Field->addItems( wl ); @@ -1697,7 +1923,7 @@ void MainWindow::makeInitialChecks() std::error_code err; QString err_msg; // check that the sqlite plugin is available - if ( ! QSqlDatabase::drivers().contains("QSQLITE") ) { + if ( ! this->dbHandler.checkDriver() ) { // checks failed, abort DialogSec::errSqlDriverNotFound( "QSQLITE" ); ok &= false; @@ -1742,7 +1968,7 @@ void MainWindow::makeInitialChecks() ok = IOutils::renameAsCopy( path, err ); if ( ! ok ) { QString p; - if ( this->dialogs_level > 0 ) { + if ( this->dialogs_level > DL_ESSENTIAL ) { p = QString::fromStdString( path ); if ( err.value() ) { err_msg = QString::fromStdString( err.message() ); @@ -1753,7 +1979,7 @@ void MainWindow::makeInitialChecks() ok = IOutils::makeDir( path, err ); if ( ! ok ) { QString msg = DialogSec::tr("Failed to create the directory"); - if ( this->dialogs_level > 0 ) { + if ( this->dialogs_level > DL_ESSENTIAL ) { msg += ":\n"+QString::fromStdString( path ); if ( err.value() ) { err_msg = QString::fromStdString( err.message() ); @@ -1769,7 +1995,7 @@ void MainWindow::makeInitialChecks() ok = IOutils::makeDir( path, err ); if ( ! ok ) { QString msg = DialogSec::tr("Failed to create the directory"); - if ( this->dialogs_level > 0 ) { + if ( this->dialogs_level > DL_ESSENTIAL ) { msg += ":\n"+QString::fromStdString( path ); if ( err.value() ) { err_msg = QString::fromStdString( err.message() ); @@ -1786,22 +2012,19 @@ void MainWindow::makeInitialChecks() if ( ok ) { // statistics' database - if ( ! CheckSec::checkCollectionDatabase( this->db_data_path + "/collection.db" ) ) { + if ( ! CheckSec::checkCollectionDatabase( this->db_data_path + "/" + DatabasesNames::data ) ) { // checks failed, abort ok &= false; } else { this->crapview.setDbPath( this->db_data_path ); this->craplog.setStatsDatabasePath( this->db_data_path ); // used-files' hashes' database - if ( ! CheckSec::checkHashesDatabase( this->db_hashes_path + "/hashes.db" ) ) { + if ( ! CheckSec::checkHashesDatabase( this->db_hashes_path + "/" + DatabasesNames::hashes ) ) { // checks failed, abort ok &= false; } else { this->craplog.setHashesDatabasePath( this->db_hashes_path ); - if ( ! this->craplog.hashOps.loadUsedHashesLists( this->db_hashes_path + "/hashes.db" ) ) { - // failed to load the list, abort - ok &= false; - } + this->craplog.hashOps.loadUsedHashesLists( this->db_hashes_path + "/" + DatabasesNames::hashes ); } } } @@ -1815,22 +2038,22 @@ void MainWindow::makeInitialChecks() // get a fresh list of log files this->on_button_LogFiles_RefreshList_clicked(); // set the default WS as the current one - switch ( this->craplog.getCurrentWSID() ) { - case APACHE_ID: + switch ( this->craplog.getCurrentWebServer() ) { + case WS_APACHE: this->ui->box_StatsWarn_WebServer->setCurrentIndex( 0 ); this->ui->box_StatsCount_WebServer->setCurrentIndex( 0 ); this->ui->box_StatsSpeed_WebServer->setCurrentIndex( 0 ); this->ui->box_StatsDay_WebServer->setCurrentIndex( 0 ); this->ui->box_StatsRelat_WebServer->setCurrentIndex( 0 ); break; - case NGINX_ID: + case WS_NGINX: this->ui->box_StatsWarn_WebServer->setCurrentIndex( 1 ); this->ui->box_StatsCount_WebServer->setCurrentIndex( 1 ); this->ui->box_StatsSpeed_WebServer->setCurrentIndex( 1 ); this->ui->box_StatsDay_WebServer->setCurrentIndex( 1 ); this->ui->box_StatsRelat_WebServer->setCurrentIndex( 1 ); break; - case IIS_ID: + case WS_IIS: this->ui->box_StatsWarn_WebServer->setCurrentIndex( 2 ); this->ui->box_StatsCount_WebServer->setCurrentIndex( 2 ); this->ui->box_StatsSpeed_WebServer->setCurrentIndex( 2 ); @@ -1839,7 +2062,7 @@ void MainWindow::makeInitialChecks() break; default: // shouldn't be here - throw WebServerException( "Unexpected WebServer ID: "+std::to_string( this->default_ws ) ); + throw DoNotCatchException( "Unexpected WebServer", std::to_string(static_cast(this->default_web_server)) ); } this->initiating &= false; // effectively check if draw buttons can be enabled @@ -1854,68 +2077,71 @@ void MainWindow::makeInitialChecks() bool MainWindow::checkDataDB() { - bool ok{ false }; - if ( ! this->initiating ) { // avoid recursions - // check the db - const std::string path{ this->db_data_path + "/collection.db" }; - ok = IOutils::checkFile( path, true ); - if ( ! ok ) { - // database file not found, make a new one - ok = CheckSec::checkCollectionDatabase( path ); - // update ui stuff - if ( ! ok ) { - // checks failed - this->crapview.clearDates(); - this->ui->box_StatsWarn_Year->clear(); - this->ui->box_StatsSpeed_Year->clear(); - this->ui->box_StatsCount_Year->clear(); - this->ui->box_StatsDay_FromYear->clear(); - if ( this->ui->checkBox_StatsDay_Period->isChecked() ) { - this->ui->box_StatsDay_ToYear->clear(); - } - this->ui->box_StatsRelat_FromYear->clear(); - this->ui->box_StatsRelat_ToYear->clear(); - } - } - if ( ok && !this->db_ok ) { - this->db_ok = ok; - this->initiating |= true; - this->refreshStatsDates(); - this->initiating &= false; - } else { - this->db_ok = ok; - } + if ( this->initiating ) { // avoid recursions + return false; } - return ok; + + const std::string path{ this->db_data_path + "/" + DatabasesNames::data }; + if ( ! CheckSec::checkCollectionDatabase( path ) ) { + // db invalid and failed to create a new one or user refused to do so + this->crapview.clearDates(); + this->ui->box_StatsWarn_Year->clear(); + this->ui->box_StatsSpeed_Year->clear(); + this->ui->box_StatsCount_Year->clear(); + this->ui->box_StatsDay_FromYear->clear(); + if ( this->ui->checkBox_StatsDay_Period->isChecked() ) { + this->ui->box_StatsDay_ToYear->clear(); + } + this->ui->box_StatsRelat_FromYear->clear(); + this->ui->box_StatsRelat_ToYear->clear(); + this->db_ok &= false; + + } else if ( ! this->db_ok ) { + // db was invalid but is now fine and ready to use + this->db_ok |= true; + } + + return this->db_ok; } ///////////////////// //// GENERAL USE //// ///////////////////// -QString MainWindow::wsFromIndex(const int index ) const +QString MainWindow::wsFromIndex( const int index ) const { switch (index) { - case 0: - return QString("apache"); - case 1: - return QString("nginx"); - case 2: - return QString("iis"); - default: - throw WebServerException( "Unexpected WebServer index: "+std::to_string( index ) ); + case 0: + return QStringLiteral("apache"); + case 1: + return QStringLiteral("nginx"); + case 2: + return QStringLiteral("iis"); + default: + throw DoNotCatchException( "Unexpected WebServer index", std::to_string(index) ); + } +} +WebServer MainWindow::wsEnumFromIndex( const int index ) const +{ + switch (index) { + case 0: + return WS_APACHE; + case 1: + return WS_NGINX; + case 2: + return WS_IIS; + default: + throw DoNotCatchException( "Unexpected WebServer index", std::to_string(index) ); } } -std::string MainWindow::resolvePath( const std::string& path ) const +std::string MainWindow::resolvePath( const std::string& path ) const noexcept { - std::string p; try { - p = std::filesystem::canonical( StringOps::strip( path ) ).string(); + return std::filesystem::canonical( StringOps::strip( path ) ).string(); } catch (...) { - ; + return std::string(); } - return p; } std::string MainWindow::parentPath( const std::string& path ) const { @@ -1975,6 +2201,28 @@ void MainWindow::showHelp( const std::string& file_name ) } } +BlacklistField MainWindow::blacklistFieldFromString( const QString& str ) +{ + if ( TR::tr(FIELDS__CLIENT.c_str()) == str ) { + return BlacklistField::Client; + } + throw DoNotCatchException( "Unexpected BlacklistField string", str.toStdString() ); +} + +WarnlistField MainWindow::warnlistFieldFromString( const QString& str ) +{ + if ( TR::tr(FIELDS__METHOD.c_str()) == str ) { + return WarnlistField::Method; + } else if ( TR::tr(FIELDS__URI.c_str()) == str ) { + return WarnlistField::Uri; + } else if ( TR::tr(FIELDS__CLIENT.c_str()) == str ) { + return WarnlistField::Client; + } else if ( TR::tr(FIELDS__USER_AGENT.c_str()) == str ) { + return WarnlistField::UserAgent; + } + throw DoNotCatchException( "Unexpected WarnlistField string", str.toStdString() ); +} + /*************************************************************** @@ -2060,21 +2308,37 @@ void MainWindow::menu_actionBlockNote_triggered() this->crapnote->activateWindow(); } else { - this->crapnote.reset( new Crapnote() ); - this->crapnote->setTextFont( this->TB.getFont() ); - this->crapnote->setColorScheme( this->TB.getColorSchemeID() ); + this->crapnote.reset( new Crapnote( this->TB.getColorSchemeID(), this->TB.getFont() ) ); this->crapnote->show(); } } void MainWindow::menu_actionInfos_triggered() { - this->crapinfo.reset( new Crapinfo( - QString::number( this->version ), - QString::fromStdString( this->resolvePath( "./" ) ), - QString::fromStdString( this->configs_path ), - QString::fromStdString( this->logdoc_path ) ) ); - this->crapinfo->show(); + if ( !this->crapinfo.isNull() && this->crapinfo->isVisible() ) { + this->crapinfo->activateWindow(); + + } else { + this->crapinfo.reset( new Crapinfo( + QString::number( this->version ), + QString::fromStdString( this->resolvePath( "./" ) ), + QString::fromStdString( this->configs_path ), + QString::fromStdString( this->logdoc_path ) ) ); + this->crapinfo->show(); + } +} + +void MainWindow::menu_actionChangelog_triggered() +{ + if ( !this->changelog.isNull() && this->changelog->isVisible() ) { + this->changelog->activateWindow(); + + } else { + this->changelog.reset( new Changelog( + this->fonts.at( "main" ), + this->TB.getFont() ) ); + this->changelog->show(); + } } void MainWindow::menu_actionCheckUpdates_triggered() @@ -2108,7 +2372,7 @@ void MainWindow::menu_actionSnake_triggered() } else { this->snake.reset( new SnakeGame( - this->FONTS.at("script") ) ); + this->fonts.at("script") ) ); this->snake->show(); } } @@ -2127,19 +2391,19 @@ void MainWindow::switchMainTab( const int new_index ) // make this->ui->button_Tab_Log->setFlat( true ); this->ui->button_Tab_Log->setIcon( - QIcon(QString(":/icons/icons/%1/log_off.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/log_off.png").arg(GlobalConfigs::icons_set)) ); break; case 1: // view this->ui->button_Tab_View->setFlat( true ); this->ui->button_Tab_View->setIcon( - QIcon(QString(":/icons/icons/%1/view_off.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/view_off.png").arg(GlobalConfigs::icons_set)) ); break; case 2: // config this->ui->button_Tab_Conf->setFlat( true ); this->ui->button_Tab_Conf->setIcon( - QIcon(QString(":/icons/icons/%1/conf_off.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/conf_off.png").arg(GlobalConfigs::icons_set)) ); break; default: throw("Unexpected Tabs index: "+std::to_string(old_index)); @@ -2151,19 +2415,19 @@ void MainWindow::switchMainTab( const int new_index ) // make this->ui->button_Tab_Log->setFlat( false ); this->ui->button_Tab_Log->setIcon( - QIcon(QString(":/icons/icons/%1/log_on.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/log_on.png").arg(GlobalConfigs::icons_set)) ); break; case 1: // view this->ui->button_Tab_View->setFlat( false ); this->ui->button_Tab_View->setIcon( - QIcon(QString(":/icons/icons/%1/view_on.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/view_on.png").arg(GlobalConfigs::icons_set)) ); break; case 2: // config this->ui->button_Tab_Conf->setFlat( false ); this->ui->button_Tab_Conf->setIcon( - QIcon(QString(":/icons/icons/%1/conf_on.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/conf_on.png").arg(GlobalConfigs::icons_set)) ); break; default: throw("Unexpected MainTabs index: "+std::to_string(new_index)); @@ -2199,37 +2463,37 @@ void MainWindow::switchStatsTab( const int new_index ) // warning this->ui->button_Tab_StatsWarn->setFlat( true ); this->ui->button_Tab_StatsWarn->setIcon( - QIcon(QString(":/icons/icons/%1/warn_off.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/warn_off.png").arg(GlobalConfigs::icons_set)) ); break; case 1: // speed this->ui->button_Tab_StatsSpeed->setFlat( true ); this->ui->button_Tab_StatsSpeed->setIcon( - QIcon(QString(":/icons/icons/%1/speed_off.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/speed_off.png").arg(GlobalConfigs::icons_set)) ); break; case 2: // counts this->ui->button_Tab_StatsCount->setFlat( true ); this->ui->button_Tab_StatsCount->setIcon( - QIcon(QString(":/icons/icons/%1/count_off.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/count_off.png").arg(GlobalConfigs::icons_set)) ); break; case 3: // daytime this->ui->button_Tab_StatsDay->setFlat( true ); this->ui->button_Tab_StatsDay->setIcon( - QIcon(QString(":/icons/icons/%1/daytime_off.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/daytime_off.png").arg(GlobalConfigs::icons_set)) ); break; case 4: // relational this->ui->button_Tab_StatsRelat->setFlat( true ); this->ui->button_Tab_StatsRelat->setIcon( - QIcon(QString(":/icons/icons/%1/relational_off.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/relational_off.png").arg(GlobalConfigs::icons_set)) ); break; case 5: // globals this->ui->button_Tab_StatsGlob->setFlat( true ); this->ui->button_Tab_StatsGlob->setIcon( - QIcon(QString(":/icons/icons/%1/global_off.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/global_off.png").arg(GlobalConfigs::icons_set)) ); break; default: throw("Unexpected StatsTabs index: "+std::to_string(old_index)); @@ -2241,37 +2505,37 @@ void MainWindow::switchStatsTab( const int new_index ) // warning this->ui->button_Tab_StatsWarn->setFlat( false ); this->ui->button_Tab_StatsWarn->setIcon( - QIcon(QString(":/icons/icons/%1/warn_on.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/warn_on.png").arg(GlobalConfigs::icons_set)) ); break; case 1: // speed this->ui->button_Tab_StatsSpeed->setFlat( false ); this->ui->button_Tab_StatsSpeed->setIcon( - QIcon(QString(":/icons/icons/%1/speed_on.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/speed_on.png").arg(GlobalConfigs::icons_set)) ); break; case 2: // counts this->ui->button_Tab_StatsCount->setFlat( false ); this->ui->button_Tab_StatsCount->setIcon( - QIcon(QString(":/icons/icons/%1/count_on.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/count_on.png").arg(GlobalConfigs::icons_set)) ); break; case 3: // daytime this->ui->button_Tab_StatsDay->setFlat( false ); this->ui->button_Tab_StatsDay->setIcon( - QIcon(QString(":/icons/icons/%1/daytime_on.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/daytime_on.png").arg(GlobalConfigs::icons_set)) ); break; case 4: // relational this->ui->button_Tab_StatsRelat->setFlat( false ); this->ui->button_Tab_StatsRelat->setIcon( - QIcon(QString(":/icons/icons/%1/relational_on.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/relational_on.png").arg(GlobalConfigs::icons_set)) ); break; case 5: // globals this->ui->button_Tab_StatsGlob->setFlat( false ); this->ui->button_Tab_StatsGlob->setIcon( - QIcon(QString(":/icons/icons/%1/global_on.png").arg(GlobalConfigs::icons_set)) ); + QIcon(QStringLiteral(":/icons/icons/%1/global_on.png").arg(GlobalConfigs::icons_set)) ); break; default: throw("Unexpected StatsTabs index: "+std::to_string(new_index)); @@ -2312,7 +2576,6 @@ void MainWindow::on_button_Tab_StatsGlob_clicked() } - //////////// //// DB //// //////////// @@ -2321,9 +2584,6 @@ void MainWindow::setDbWorkingState( const bool working ) this->db_working = working; if ( ! working ) { this->checkMakeStats_Makable(); - if ( this->ui->table_StatsWarn->rowCount() > 0 ) { - this->ui->button_StatsWarn_Update->setEnabled( true ); - } this->checkStatsWarnDrawable(); this->checkStatsCountDrawable(); this->checkStatsSpeedDrawable(); @@ -2335,7 +2595,6 @@ void MainWindow::setDbWorkingState( const bool working ) this->ui->page_Section_Conf->setEnabled( true ); } else { this->ui->button_MakeStats_Start->setEnabled( false ); - this->ui->button_StatsWarn_Update->setEnabled( false ); this->ui->button_StatsWarn_Draw->setEnabled( false ); this->ui->scrollArea_StatsCount->setEnabled( false ); this->ui->button_StatsSpeed_Draw->setEnabled( false ); @@ -2350,8 +2609,13 @@ void MainWindow::setDbWorkingState( const bool working ) bool MainWindow::dbUsable() { - if ( !this->db_working ) { - return this->checkDataDB(); + if ( ! this->db_working ) { + if ( this->db_ok ) { + const std::string path{ this->db_data_path + "/" + DatabasesNames::data }; + return IOutils::checkFile( path, true ); + } else { + return this->checkDataDB(); // db is invalid, attempt to renew + } } return false; } @@ -2393,6 +2657,9 @@ void MainWindow::checkMakeStats_Makable() } ++i; } + if ( ! state ) { + this->ui->checkBox_LogFiles_CheckAll->setTristate( false ); + } } } this->ui->button_MakeStats_Start->setEnabled( state ); @@ -2402,13 +2669,13 @@ void MainWindow::checkMakeStats_Makable() // switch to apache web server void MainWindow::on_button_LogFiles_Apache_clicked() { - if ( this->craplog.getCurrentWSID() != APACHE_ID ) { + if ( this->craplog.getCurrentWebServer() != WS_APACHE ) { // flat/unflat this->ui->button_LogFiles_Apache->setFlat( false ); this->ui->button_LogFiles_Nginx->setFlat( true ); this->ui->button_LogFiles_Iis->setFlat( true ); // set the WebServer - this->craplog.setCurrentWSID( APACHE_ID ); + this->craplog.setCurrentWebServer( WS_APACHE ); // reset the log files viewer { QString rich_text; @@ -2423,13 +2690,13 @@ void MainWindow::on_button_LogFiles_Apache_clicked() // switch to nginx web server void MainWindow::on_button_LogFiles_Nginx_clicked() { - if ( this->craplog.getCurrentWSID() != NGINX_ID ) { + if ( this->craplog.getCurrentWebServer() != WS_NGINX ) { // flat/unflat this->ui->button_LogFiles_Nginx->setFlat( false ); this->ui->button_LogFiles_Apache->setFlat( true ); this->ui->button_LogFiles_Iis->setFlat( true ); // set the WebServer - this->craplog.setCurrentWSID( NGINX_ID ); + this->craplog.setCurrentWebServer( WS_NGINX ); // reset the log files viewer { QString rich_text; @@ -2444,13 +2711,13 @@ void MainWindow::on_button_LogFiles_Nginx_clicked() // switch to iis web server void MainWindow::on_button_LogFiles_Iis_clicked() { - if ( this->craplog.getCurrentWSID() != IIS_ID ) { + if ( this->craplog.getCurrentWebServer() != WS_IIS ) { // flat/unflat this->ui->button_LogFiles_Iis->setFlat( false ); this->ui->button_LogFiles_Apache->setFlat( true ); this->ui->button_LogFiles_Nginx->setFlat( true ); // set the WebServer - this->craplog.setCurrentWSID( IIS_ID ); + this->craplog.setCurrentWebServer( WS_IIS ); // reset the log files viewer { QString rich_text; @@ -2497,20 +2764,20 @@ void MainWindow::appendToLogsList( const LogFile& log_file ) return; } // display with red foreground - item->setForeground( 0, this->COLORS.at( "red" ) ); + item->setForeground( 0, this->colors.at( "red" ) ); } // preliminary check on file size - item->setForeground( 1, this->COLORS.at( (log_file.size() > this->craplog.getWarningSize()) + item->setForeground( 1, this->colors.at( (log_file.size() > this->craplog.getWarningSize()) ? "orange" : "grey" ) ); // set the name item->setText( 0, log_file.name() ); - item->setFont( 0, this->FONTS.at("main") ); + item->setFont( 0, this->fonts.at("main") ); // set the size item->setText( 1, PrintSec::printableSize( log_file.size() ) ); - item->setFont( 1, this->FONTS.at("main_italic") ); + item->setFont( 1, this->fonts.at("main_italic") ); // append the item (on top, forced) item->setCheckState(0, Qt::CheckState::Unchecked ); this->ui->listLogFiles->addTopLevelItem( item ); @@ -2578,12 +2845,12 @@ void MainWindow::on_button_LogFiles_ViewFile_clicked() if ( item.size() > warn_size ) { // exceeds the warning size QString msg{ item.name() }; - if ( this->dialogs_level >= 1 ) { - msg += QString("\n\n%1:\n%2").arg( + if ( this->dialogs_level >= DL_NORMAL ) { + msg += QStringLiteral("\n\n%1:\n%2").arg( DialogSec::tr("Size of the file"), PrintSec::printableSize( item.size() ) ); - if ( this->dialogs_level == 2 ) { - msg += QString("\n\n%1:\n%2").arg( + if ( this->dialogs_level == DL_EXPLANATORY ) { + msg += QStringLiteral("\n\n%1:\n%2").arg( DialogSec::tr("Warning size parameter"), PrintSec::printableSize( warn_size ) ); } @@ -2623,7 +2890,7 @@ void MainWindow::on_button_LogFiles_ViewFile_clicked() // failed closing gzip file pointer proceed &= false; // >> e.what() << // - DialogSec::errGeneric( QString("%1:\n%2").arg( + DialogSec::errGeneric( QStringLiteral("%1:\n%2").arg( DialogSec::tr("Failed to read gzipped file"), item.name()) ); @@ -2676,9 +2943,9 @@ void MainWindow::on_listLogFiles_itemChanged(QTreeWidgetItem *item, int column) QTreeWidgetItemIterator i(this->ui->listLogFiles); while ( *i ) { if ( (*i)->checkState(0) == Qt::CheckState::Checked ) { - n_checked++; + ++ n_checked; } - ++i; + ++ i; } if ( n_checked == 0ul ) { this->ui->checkBox_LogFiles_CheckAll->setCheckState(Qt::CheckState::Unchecked); @@ -2692,74 +2959,55 @@ void MainWindow::on_listLogFiles_itemChanged(QTreeWidgetItem *item, int column) void MainWindow::on_button_MakeStats_Start_clicked() { - if ( this->dbUsable() ) { - bool proceed{ true }; - // check that the format has been set - const LogsFormat& lf{ this->craplog.getLogsFormat( this->craplog.getCurrentWSID() ) }; - if ( lf.string.empty() ) { - // format string not set - proceed &= false; - DialogSec::errLogFormatNotSet( nullptr ); - } else if ( lf.fields.empty() ) { - // no field, useless to parse - proceed &= false; - DialogSec::errLogFormatNoFields( nullptr ); - } else if ( lf.separators.size() < lf.fields.size()-1 ) { - // missing at least a separator between two (or more) fields - proceed &= false; - DialogSec::errLogFormatNoSeparators( nullptr ); - } + if ( !( this->dbUsable() && this->checkDataDB() ) ) { + return; + } - if ( proceed ) { - // take actions on Craplog's start - this->craplogStarted(); + // check that the format has been set and is consistent + if ( ! craplog.checkCurrentLogsFormat() ) { + return; + } - // feed craplog with the checked files - QTreeWidgetItemIterator i{ this->ui->listLogFiles }; - while ( *i ) { - if ( (*i)->checkState(0) == Qt::CheckState::Checked ) { - // tell Craplog to set this file as selected - if ( ! this->craplog.setLogFileSelected( (*i)->text(0) ) ) { - // failed to retrieve the file. this shouldn't be, but... - const int choice{ DialogSec::choiceSelectedFileNotFound( (*i)->text(0) ) }; - if ( choice == 0 ) { - // choosed to abort all - proceed &= false; - break; - } else if ( choice == 1 ) { - // choosed to discard the file and continue - ; - } else { - // shouldn't be here - throw GenericException( "Unexpeced value returned: "+std::to_string(choice) ); - } - } + // take actions on Craplog's start + this->craplogStarted(); + + // feed craplog with the checked files + QTreeWidgetItemIterator i{ this->ui->listLogFiles }; + while ( *i ) { + if ( (*i)->checkState(0) == Qt::CheckState::Checked ) { + // tell Craplog to set this file as selected + if ( ! this->craplog.setLogFileSelected( (*i)->text(0) ) ) { + // failed to retrieve the file. this shouldn't be, but... + const int choice{ DialogSec::choiceSelectedFileNotFound( (*i)->text(0) ) }; + if ( choice == 0 ) { + // choosed to abort all + this->craplogFinished(); + return; + } else if ( choice == 1 ) { + // choosed to discard the file and continue + ; + } else { + // shouldn't be here + throw GenericException( "Unexpeced value returned: "+std::to_string(choice) ); } - ++i; - } - - if ( proceed ) { - // check files to be used before to start - proceed = this->craplog.checkStuff(); - } else { - this->craplogFinished(); - } - - if ( proceed ) { - // periodically update perfs - this->waiter_timer.reset( new QTimer(this) ); - this->waiter_timer->setInterval(250); - this->waiter_timer->setTimerType( Qt::PreciseTimer ); - connect( this->waiter_timer.get(), &QTimer::timeout, - this, &MainWindow::updatePerfsLabels ); - // start processing - this->waiter_timer_start = std::chrono::system_clock::now(); - this->waiter_timer->start(); - emit runCraplog(); - } else { - this->craplogFinished(); } } + ++i; + } + + if ( this->craplog.checkStuff() ) { + // periodically update perfs + this->waiter_timer.reset( new QTimer(this) ); + this->waiter_timer->setInterval(250); + this->waiter_timer->setTimerType( Qt::PreciseTimer ); + connect( this->waiter_timer.get(), &QTimer::timeout, + this, &MainWindow::updatePerfsLabels ); + // start processing + this->waiter_timer_start = std::chrono::system_clock::now(); + this->waiter_timer->start(); + emit runCraplog( this->blacklists ); + } else { + this->craplogFinished(); } } @@ -2810,10 +3058,10 @@ void MainWindow::craplogFinished() // draw the chart this->craplog.makeChart( this->CHARTS_THEMES.at( static_cast(GlobalConfigs::charts_theme) ), - this->FONTS, + this->fonts, this->ui->chart_MakeStats_Size ); ColorSec::applyChartTheme( - this->FONTS, + this->fonts, this->ui->chart_MakeStats_Size ); this->db_edited = this->craplog.editedDatabase(); // refresh the logs section @@ -2980,7 +3228,7 @@ void MainWindow::on_box_StatsWarn_Hour_currentIndexChanged(int index) void MainWindow::on_button_StatsWarn_Draw_clicked() { - if ( this->dbUsable() ) { + if ( this->dbUsable() && this->checkDataDB() ) { this->setDbWorkingState( true ); this->crapview_timer.reset( new QTimer(this) ); this->crapview_timer->setSingleShot( true ); @@ -2991,32 +3239,25 @@ void MainWindow::on_button_StatsWarn_Draw_clicked() } void MainWindow::drawStatsWarn() { + const int wsIndex{ this->ui->box_StatsWarn_WebServer->currentIndex() }; this->ui->table_StatsWarn->horizontalHeader()->setSortIndicator( -1, Qt::SortOrder::AscendingOrder ); this->ui->table_StatsWarn->setRowCount(0); this->crapview.drawWarn( this->ui->table_StatsWarn, this->ui->chart_StatsWarn, this->CHARTS_THEMES.at( static_cast(GlobalConfigs::charts_theme) ), - this->wsFromIndex( this->ui->box_StatsWarn_WebServer->currentIndex() ), + this->wsFromIndex( wsIndex ), this->ui->box_StatsWarn_Year->currentText(), this->ui->box_StatsWarn_Month->currentText(), this->ui->box_StatsWarn_Day->currentText(), - (this->ui->checkBox_StatsWarn_Hour->isChecked()) ? this->ui->box_StatsWarn_Hour->currentText() : "" ); + this->ui->checkBox_StatsWarn_Hour->isChecked() ? this->ui->box_StatsWarn_Hour->currentText() : "", + this->warnlists.get( this->wsEnumFromIndex( wsIndex ) ) ); ColorSec::applyChartTheme( - this->FONTS, + this->fonts, this->ui->chart_StatsWarn ); this->setDbWorkingState( false ); } -void MainWindow::on_button_StatsWarn_Update_clicked() -{ - this->crapview.updateWarn( - this->ui->table_StatsWarn, - this->wsFromIndex( this->ui->box_StatsWarn_WebServer->currentIndex() ) ); - this->db_edited |= true; -} - - /////////////// //// SPEED //// void MainWindow::checkStatsSpeedDrawable() @@ -3172,7 +3413,7 @@ void MainWindow::on_inLine_StatsSpeed_Response_textChanged(const QString& arg1) void MainWindow::on_button_StatsSpeed_Draw_clicked() { - if ( this->dbUsable() ) { + if ( this->dbUsable() && this->checkDataDB() ) { this->setDbWorkingState( true ); this->crapview_timer.reset( new QTimer(this) ); this->crapview_timer->setSingleShot( true ); @@ -3199,7 +3440,7 @@ void MainWindow::drawStatsSpeed() FilterOps::parseTextualFilter( this->ui->inLine_StatsSpeed_Query->text() ).value(), FilterOps::parseNumericFilter( this->ui->inLine_StatsSpeed_Response->text() ).value() ); ColorSec::applyChartTheme( - this->FONTS, + this->fonts, this->ui->chart_StatsSpeed ); this->setDbWorkingState( false ); } @@ -3337,7 +3578,7 @@ void MainWindow::makeStatsCount() void MainWindow::on_button_StatsCount_Protocol_clicked() { - if ( this->dbUsable() ) { + if ( this->dbUsable() && this->checkDataDB() ) { this->resetStatsCountButtons(); this->ui->button_StatsCount_Protocol->setFlat( false ); this->count_fld = this->ui->button_StatsCount_Protocol->text(); @@ -3347,7 +3588,7 @@ void MainWindow::on_button_StatsCount_Protocol_clicked() void MainWindow::on_button_StatsCount_Method_clicked() { - if ( this->dbUsable() ) { + if ( this->dbUsable() && this->checkDataDB() ) { this->resetStatsCountButtons(); this->count_fld = this->ui->button_StatsCount_Method->text(); this->ui->button_StatsCount_Method->setFlat( false ); @@ -3357,7 +3598,7 @@ void MainWindow::on_button_StatsCount_Method_clicked() void MainWindow::on_button_StatsCount_Uri_clicked() { - if ( this->dbUsable() ) { + if ( this->dbUsable() && this->checkDataDB() ) { this->resetStatsCountButtons(); this->count_fld = this->ui->button_StatsCount_Uri->text(); this->ui->button_StatsCount_Uri->setFlat( false ); @@ -3367,7 +3608,7 @@ void MainWindow::on_button_StatsCount_Uri_clicked() void MainWindow::on_button_StatsCount_Query_clicked() { - if ( this->dbUsable() ) { + if ( this->dbUsable() && this->checkDataDB() ) { this->resetStatsCountButtons(); this->count_fld = this->ui->button_StatsCount_Query->text(); this->ui->button_StatsCount_Query->setFlat( false ); @@ -3377,7 +3618,7 @@ void MainWindow::on_button_StatsCount_Query_clicked() void MainWindow::on_button_StatsCount_Response_clicked() { - if ( this->dbUsable() ) { + if ( this->dbUsable() && this->checkDataDB() ) { this->resetStatsCountButtons(); this->count_fld = this->ui->button_StatsCount_Response->text(); this->ui->button_StatsCount_Response->setFlat( false ); @@ -3387,7 +3628,7 @@ void MainWindow::on_button_StatsCount_Response_clicked() void MainWindow::on_button_StatsCount_Referrer_clicked() { - if ( this->dbUsable() ) { + if ( this->dbUsable() && this->checkDataDB() ) { this->resetStatsCountButtons(); this->count_fld = this->ui->button_StatsCount_Referrer->text(); this->ui->button_StatsCount_Referrer->setFlat( false ); @@ -3397,7 +3638,7 @@ void MainWindow::on_button_StatsCount_Referrer_clicked() void MainWindow::on_button_StatsCount_Cookie_clicked() { - if ( this->dbUsable() ) { + if ( this->dbUsable() && this->checkDataDB() ) { this->resetStatsCountButtons(); this->count_fld = this->ui->button_StatsCount_Cookie->text(); this->ui->button_StatsCount_Cookie->setFlat( false ); @@ -3407,7 +3648,7 @@ void MainWindow::on_button_StatsCount_Cookie_clicked() void MainWindow::on_button_StatsCount_UserAgent_clicked() { - if ( this->dbUsable() ) { + if ( this->dbUsable() && this->checkDataDB() ) { this->resetStatsCountButtons(); this->count_fld = this->ui->button_StatsCount_UserAgent->text(); this->ui->button_StatsCount_UserAgent->setFlat( false ); @@ -3417,7 +3658,7 @@ void MainWindow::on_button_StatsCount_UserAgent_clicked() void MainWindow::on_button_StatsCount_Client_clicked() { - if ( this->dbUsable() ) { + if ( this->dbUsable() && this->checkDataDB() ) { this->resetStatsCountButtons(); this->count_fld = this->ui->button_StatsCount_Client->text(); this->ui->button_StatsCount_Client->setFlat( false ); @@ -3438,10 +3679,10 @@ void MainWindow::drawStatsCount() this->ui->box_StatsCount_Day->currentText(), this->count_fld ); ColorSec::applyChartTheme( - this->FONTS, + this->fonts, this->ui->chart_StatsCount ); this->ui->chart_StatsCount->chart()->setTitleFont( - this->FONTS.at( "main_big" ) ); + this->fonts.at( "main_big" ) ); this->setDbWorkingState( false ); } @@ -3492,7 +3733,7 @@ void MainWindow::checkStatsDayDrawable() aux &= false; } // check filter string validity - if ( !this->getStatsDayParsedFilter().has_value() ) { + if ( ! this->getStatsDayParsedFilter().has_value() ) { aux &= false; } this->ui->button_StatsDay_Draw->setEnabled( aux ); @@ -3503,12 +3744,15 @@ void MainWindow::checkStatsDayDrawable() } } +LogField MainWindow::getStatsDayLogField() const +{ + const QModelIndex idx{ this->ui->box_StatsDay_LogsField->model()->index( + this->ui->box_StatsDay_LogsField->currentIndex(), 0 ) }; + return this->ui->box_StatsDay_LogsField->model()->data(idx,Qt::UserRole).value(); +} std::optional MainWindow::getStatsDayParsedFilter() const { - const int fld_i{ this->ui->box_StatsDay_LogsField->currentIndex() }; - if ( fld_i == 0 ) { - return FilterOps::parseBooleanFilter( this->ui->inLine_StatsDay_Filter->text() ); - } else if ( fld_i == 5 ) { + if ( this->getStatsDayLogField() == LogField::ResponseCode ) { return FilterOps::parseNumericFilter( this->ui->inLine_StatsDay_Filter->text() ); } else { return FilterOps::parseTextualFilter( this->ui->inLine_StatsDay_Filter->text() ); @@ -3517,16 +3761,11 @@ std::optional MainWindow::getStatsDayParsedFilter() const void MainWindow::on_box_StatsDay_WebServer_currentIndexChanged(int index) { - this->ui->box_StatsDay_LogsField->clear(); this->ui->box_StatsDay_FromYear->clear(); this->ui->box_StatsDay_ToYear->clear(); if ( index >= 0 ) { - // refresh fields - this->ui->box_StatsDay_LogsField->addItems( - this->crapview.getFields( "Daytime" )); - this->ui->box_StatsDay_LogsField->setCurrentIndex( 0 ); // refresh dates - QStringList years{ this->crapview.getYears( this->wsFromIndex( index ) ) }; + const QStringList years{ this->crapview.getYears( this->wsFromIndex( index ) ) }; this->ui->box_StatsDay_FromYear->addItems( years ); this->ui->box_StatsDay_FromYear->setCurrentIndex( 0 ); if ( this->ui->checkBox_StatsDay_Period->isChecked() ) { @@ -3704,7 +3943,7 @@ void MainWindow::on_inLine_StatsDay_Filter_textChanged(const QString& arg1) void MainWindow::on_button_StatsDay_Draw_clicked() { - if ( this->dbUsable() ) { + if ( this->dbUsable() && this->checkDataDB() ) { this->setDbWorkingState( true ); this->crapview_timer.reset( new QTimer(this) ); this->crapview_timer->setSingleShot( true ); @@ -3723,13 +3962,14 @@ void MainWindow::drawStatsDay() this->ui->box_StatsDay_FromYear->currentText(), this->ui->box_StatsDay_FromMonth->currentText(), this->ui->box_StatsDay_FromDay->currentText(), - ( period ) ? this->ui->box_StatsDay_ToYear->currentText() : "", - ( period ) ? this->ui->box_StatsDay_ToMonth->currentText() : "", - ( period ) ? this->ui->box_StatsDay_ToDay->currentText() : "", + period ? this->ui->box_StatsDay_ToYear->currentText() : QString(), + period ? this->ui->box_StatsDay_ToMonth->currentText() : QString(), + period ? this->ui->box_StatsDay_ToDay->currentText() : QString(), this->ui->box_StatsDay_LogsField->currentText(), + this->getStatsDayLogField(), this->getStatsDayParsedFilter().value() ); ColorSec::applyChartTheme( - this->FONTS, + this->fonts, this->ui->chart_StatsDay ); this->setDbWorkingState( false ); } @@ -3791,38 +4031,43 @@ void MainWindow::checkStatsRelatDrawable() } } + +LogField MainWindow::getStatsRelatLogField( const int filter_num ) const +{ + const QComboBox* cb{ ( filter_num == 1 ) + ? this->ui->box_StatsRelat_LogsField_1 + : this->ui->box_StatsRelat_LogsField_2 }; + + const QModelIndex idx{ cb->model()->index( cb->currentIndex(), 0 ) }; + return cb->model()->data(idx,Qt::UserRole).value(); +} std::optional MainWindow::getStatsRelatParsedFilter( const int filter_num ) const { - const int fld_i{ ( filter_num == 1 ) - ? this->ui->box_StatsRelat_LogsField_1->currentIndex() - : this->ui->box_StatsRelat_LogsField_2->currentIndex() }; const QString fld_t{ ( filter_num == 1 ) ? this->ui->inLine_StatsRelat_Filter_1->text() : this->ui->inLine_StatsRelat_Filter_2->text() }; - if ( fld_i == 0 ) { - return FilterOps::parseBooleanFilter( fld_t ); - } else if ( fld_i >= 5 && fld_i <= 8 ) { - return FilterOps::parseNumericFilter( fld_t ); - } else { - return FilterOps::parseTextualFilter( fld_t ); + + switch ( this->getStatsRelatLogField( filter_num ) ) { + case LogField::ResponseCode: + [[fallthrough]]; + case LogField::TimeTaken: + [[fallthrough]]; + case LogField::BytesReceived: + [[fallthrough]]; + case LogField::BytesSent: + return FilterOps::parseNumericFilter( fld_t ); + default: + return FilterOps::parseTextualFilter( fld_t ); } } void MainWindow::on_box_StatsRelat_WebServer_currentIndexChanged(int index) { - this->ui->box_StatsRelat_LogsField_1->clear(); - this->ui->box_StatsRelat_LogsField_2->clear(); this->ui->box_StatsRelat_FromYear->clear(); this->ui->box_StatsRelat_ToYear->clear(); if ( index >= 0 ) { - // refresh fields - QStringList fields{ this->crapview.getFields( "Relational" ) }; - this->ui->box_StatsRelat_LogsField_1->addItems( fields ); - this->ui->box_StatsRelat_LogsField_2->addItems( fields ); - this->ui->box_StatsRelat_LogsField_1->setCurrentIndex( 0 ); - this->ui->box_StatsRelat_LogsField_2->setCurrentIndex( 0 ); // refresh dates - QStringList years{ this->crapview.getYears( this->wsFromIndex( index ) ) }; + const QStringList years{ this->crapview.getYears( this->wsFromIndex( index ) ) }; // from this->ui->box_StatsRelat_FromYear->clear(); this->ui->box_StatsRelat_FromYear->addItems( years ); @@ -3992,7 +4237,7 @@ void MainWindow::on_inLine_StatsRelat_Filter_2_textChanged(const QString &arg1) void MainWindow::on_button_StatsRelat_Draw_clicked() { - if ( this->dbUsable() ) { + if ( this->dbUsable() && this->checkDataDB() ) { this->setDbWorkingState( true ); this->crapview_timer.reset( new QTimer(this) ); this->crapview_timer->setSingleShot( true ); @@ -4014,11 +4259,13 @@ void MainWindow::drawStatsRelat() this->ui->box_StatsRelat_ToMonth->currentText(), this->ui->box_StatsRelat_ToDay->currentText(), this->ui->box_StatsRelat_LogsField_1->currentText(), + this->getStatsRelatLogField( 1 ), this->getStatsRelatParsedFilter( 1 ).value(), this->ui->box_StatsRelat_LogsField_2->currentText(), + this->getStatsRelatLogField( 2 ), this->getStatsRelatParsedFilter( 2 ).value() ); ColorSec::applyChartTheme( - this->FONTS, + this->fonts, this->ui->chart_StatsRelat ); this->setDbWorkingState( false ); } @@ -4145,7 +4392,7 @@ void MainWindow::makeStatsGlob() void MainWindow::on_button_StatsGlob_Apache_clicked() { - if ( this->dbUsable() ) { + if ( this->dbUsable() && this->checkDataDB() ) { this->glob_ws = "apache"; this->makeStatsGlob(); } @@ -4154,7 +4401,7 @@ void MainWindow::on_button_StatsGlob_Apache_clicked() void MainWindow::on_button_StatsGlob_Nginx_clicked() { - if ( this->dbUsable() ) { + if ( this->dbUsable() && this->checkDataDB() ) { this->glob_ws = "nginx"; this->makeStatsGlob(); } @@ -4163,7 +4410,7 @@ void MainWindow::on_button_StatsGlob_Nginx_clicked() void MainWindow::on_button_StatsGlob_Iis_clicked() { - if ( this->dbUsable() ) { + if ( this->dbUsable() && this->checkDataDB() ) { this->glob_ws = "iis"; this->makeStatsGlob(); } @@ -4273,15 +4520,18 @@ void MainWindow::on_box_ConfWindow_Icons_currentIndexChanged(int index) //// DIALOGS //// void MainWindow::on_slider_ConfDialogs_General_sliderReleased() { - this->dialogs_level = this->ui->slider_ConfDialogs_General->value(); + this->dialogs_level = this->dialogsLevelFromInt( + this->ui->slider_ConfDialogs_General->value() ); } void MainWindow::on_slider_ConfDialogs_Logs_sliderReleased() { - this->craplog.setDialogsLevel( this->ui->slider_ConfDialogs_Logs->value() ); + this->craplog.setDialogsLevel( this->dialogsLevelFromInt( + this->ui->slider_ConfDialogs_Logs->value() ) ); } void MainWindow::on_slider_ConfDialogs_Stats_sliderReleased() { - this->crapview.setDialogsLevel( this->ui->slider_ConfDialogs_Stats->value() ); + this->crapview.setDialogsLevel( this->dialogsLevelFromInt( + this->ui->slider_ConfDialogs_Stats->value() ) ); } @@ -4298,9 +4548,9 @@ void MainWindow::on_box_ConfTextBrowser_Font_currentIndexChanged(int index) case 2: f = "script"; break; default: - throw GenericException( "Unexpected Font index: "+std::to_string(index), true ); + throw DoNotCatchException( "Unexpected Font index", std::to_string(index) ); } - const QFont& font{ this->FONTS.at( f ) }; + const QFont& font{ this->fonts.at( f ) }; this->TB.setFont( font ); this->ui->textBrowser_ConfTextBrowser_Preview->setFont( font ); this->ui->preview_ConfApache_Format_Sample->setFont( font ); @@ -4309,6 +4559,9 @@ void MainWindow::on_box_ConfTextBrowser_Font_currentIndexChanged(int index) if ( !this->crapnote.isNull() ) { this->crapnote->setTextFont( font ); } + if ( !this->changelog.isNull() ) { + this->changelog->setTextFont( font ); + } } void MainWindow::on_checkBox_ConfTextBrowser_WideLines_clicked(bool checked) { @@ -4317,9 +4570,11 @@ void MainWindow::on_checkBox_ConfTextBrowser_WideLines_clicked(bool checked) } void MainWindow::on_box_ConfTextBrowser_ColorScheme_currentIndexChanged(int index) { - this->TB.setColorScheme( index, this->TB_COLOR_SCHEMES.at( index ) ); + ColorsScheme cs{ static_cast( index ) }; + GlobalConfigs::colors_scheme = cs; + this->TB.setColorScheme( cs, this->tb_colors_schemes.at( cs ) ); if ( !this->crapnote.isNull() ) { - this->crapnote->setColorScheme( index ); + this->crapnote->setColorScheme( cs ); } this->refreshTextBrowserPreview(); } @@ -4340,22 +4595,22 @@ void MainWindow::on_box_ConfCharts_Theme_currentIndexChanged(int index) this->refreshChartsPreview(); ColorSec::applyChartTheme( - this->FONTS, + this->fonts, this->ui->chart_MakeStats_Size ); ColorSec::applyChartTheme( - this->FONTS, + this->fonts, this->ui->chart_StatsWarn ); ColorSec::applyChartTheme( - this->FONTS, + this->fonts, this->ui->chart_StatsSpeed ); ColorSec::applyChartTheme( - this->FONTS, + this->fonts, this->ui->chart_StatsCount ); ColorSec::applyChartTheme( - this->FONTS, + this->fonts, this->ui->chart_StatsDay ); ColorSec::applyChartTheme( - this->FONTS, + this->fonts, this->ui->chart_StatsRelat ); } void MainWindow::refreshChartsPreview() @@ -4378,7 +4633,7 @@ void MainWindow::refreshChartsPreview() return (rand()%10 > 8) ? rand()%100 : (rand()%10 > 6) ? rand()%50 : rand()%30; }; int aux, max{0}; - for ( int i{0}; i<24; i++ ) { + for ( int i{0}; i<24; ++i ) { aux = random_value(); *bars_1 << aux; if ( aux > max ) { @@ -4422,7 +4677,7 @@ void MainWindow::refreshChartsPreview() // add the bars t_chart->addSeries( bars ); t_chart->setTitle( "Sample preview" ); - t_chart->setTitleFont( this->FONTS.at("main") ); + t_chart->setTitleFont( this->fonts.at("main") ); t_chart->setAnimationOptions( QChart::SeriesAnimations ); QStringList categories; @@ -4431,16 +4686,16 @@ void MainWindow::refreshChartsPreview() QBarCategoryAxis* axisX{ new QBarCategoryAxis() }; axisX->append( categories ); - axisX->setLabelsFont( this->FONTS.at( "main_small" ) ); + axisX->setLabelsFont( this->fonts.at( "main_small" ) ); axisX->setTitleText( "Infoes" ); - axisX->setTitleFont( this->FONTS.at("main_small") ); + axisX->setTitleFont( this->fonts.at("main_small") ); t_chart->addAxis( axisX, Qt::AlignBottom ); bars->attachAxis( axisX ); QValueAxis* axisY{ new QValueAxis() }; axisY->setLabelFormat( "%d" ); axisY->setRange( 0, max ); - axisY->setLabelsFont( this->FONTS.at( "main_small" ) ); + axisY->setLabelsFont( this->fonts.at( "main_small" ) ); t_chart->addAxis( axisY, Qt::AlignLeft ); bars->attachAxis( axisY) ; @@ -4452,7 +4707,7 @@ void MainWindow::refreshChartsPreview() this->ui->chart_ConfCharts_Preview->setRenderHint( QPainter::Antialiasing ); ColorSec::applyChartTheme( - this->FONTS, + this->fonts, this->ui->chart_ConfCharts_Preview ); } @@ -4460,6 +4715,26 @@ void MainWindow::refreshChartsPreview() /////////////////// //// DATABASES //// // data collection +void MainWindow::on_tool_ConfDatabases_Data_Dialog_clicked() +{ + this->crappath.reset( new Crappath( this ) ); + + const QString current_path{ this->ui->inLine_ConfDatabases_Data_Path->text() }; + if ( ! current_path.isEmpty() ) { + crappath->setDirectory( current_path ); + } else if ( ! this->db_data_path.empty() ) { + crappath->setDirectory( QString::fromStdString( this->db_data_path ) ); + } else { + crappath->setDirectory( QString::fromStdString( this->home_path ) ); + } + + if ( crappath->exec() ) { + const QStringList selection{ crappath->selectedFiles() }; + if ( ! selection.isEmpty() ) { + this->ui->inLine_ConfDatabases_Data_Path->setText( selection[0] ); + } + } +} void MainWindow::on_inLine_ConfDatabases_Data_Path_textChanged(const QString& arg1) { if ( ! arg1.isEmpty() ) { @@ -4504,6 +4779,26 @@ void MainWindow::on_button_ConfDatabases_Data_Save_clicked() } // usef files hashes +void MainWindow::on_tool_ConfDatabases_Hashes_Dialog_clicked() +{ + this->crappath.reset( new Crappath( this ) ); + + const QString current_path{ this->ui->inLine_ConfDatabases_Hashes_Path->text() }; + if ( ! current_path.isEmpty() ) { + crappath->setDirectory( current_path ); + } else if ( ! this->db_hashes_path.empty() ) { + crappath->setDirectory( QString::fromStdString( this->db_hashes_path ) ); + } else { + crappath->setDirectory( QString::fromStdString( this->home_path ) ); + } + + if ( crappath->exec() ) { + const QStringList selection{ crappath->selectedFiles() }; + if ( ! selection.isEmpty() ) { + this->ui->inLine_ConfDatabases_Hashes_Path->setText( selection[0] ); + } + } +} void MainWindow::on_inLine_ConfDatabases_Hashes_Path_textChanged(const QString& arg1) { if ( ! arg1.isEmpty() ) { @@ -4579,17 +4874,17 @@ void MainWindow::on_spinBox_ConfDatabases_NumBackups_valueChanged(int arg1) void MainWindow::on_radio_ConfDefaults_Apache_toggled(bool checked) { Q_UNUSED(checked) - this->default_ws = APACHE_ID; + this->default_web_server = WS_APACHE; } void MainWindow::on_radio_ConfDefaults_Nginx_toggled(bool checked) { Q_UNUSED(checked) - this->default_ws = NGINX_ID; + this->default_web_server = WS_NGINX; } void MainWindow::on_radio_ConfDefaults_Iis_toggled(bool checked) { Q_UNUSED(checked) - this->default_ws = IIS_ID; + this->default_web_server = WS_IIS; } ///////////////// @@ -4621,6 +4916,27 @@ void MainWindow::on_spinBox_ConfControl_Size_editingFinished() //////////////// //// APACHE //// // paths +void MainWindow::on_tool_ConfApache_Path_Dialog_clicked() +{ + this->crappath.reset( new Crappath( this ) ); + + const QString current_path{ this->ui->inLine_ConfApache_Path_String->text() }; + const std::string& logs_path{ this->craplog.getLogsPath( WS_APACHE ) }; + if ( ! current_path.isEmpty() ) { + crappath->setDirectory( current_path ); + } else if ( ! logs_path.empty() ) { + crappath->setDirectory( QString::fromStdString( logs_path ) ); + } else { + crappath->setDirectory( QString::fromStdString( this->home_path ) ); + } + + if ( crappath->exec() ) { + const QStringList selection{ crappath->selectedFiles() }; + if ( ! selection.isEmpty() ) { + this->ui->inLine_ConfApache_Path_String->setText( selection[0] ); + } + } +} void MainWindow::on_inLine_ConfApache_Path_String_textChanged(const QString& arg1) { if ( arg1.size() > 0 ) { @@ -4652,7 +4968,7 @@ void MainWindow::on_button_ConfApache_Path_Save_clicked() if ( ! IOutils::checkDir( path, true ) ) { DialogSec::warnDirNotReadable( nullptr ); } - this->craplog.setLogsPath( APACHE_ID, path ); + this->craplog.setLogsPath( WS_APACHE, path ); this->ui->inLine_ConfApache_Path_String->setText( QString::fromStdString( path ) ); } this->ui->button_ConfApache_Path_Save->setEnabled( false ); @@ -4677,10 +4993,10 @@ void MainWindow::on_inLine_ConfApache_Format_String_returnPressed() void MainWindow::on_button_ConfApache_Format_Save_clicked() { const bool success{ this->craplog.setApacheLogFormat( - this->ui->inLine_ConfApache_Format_String->text().toStdString() ) }; + this->ui->inLine_ConfApache_Format_String->text().trimmed().toStdString() ) }; if ( success ) { this->ui->button_ConfApache_Format_Save->setEnabled( false ); - if ( this->craplog.getCurrentWSID() == APACHE_ID ) { + if ( this->craplog.getCurrentWebServer() == WS_APACHE ) { this->craplog.setCurrentLogFormat(); } } @@ -4688,7 +5004,7 @@ void MainWindow::on_button_ConfApache_Format_Save_clicked() void MainWindow::on_button_ConfApache_Format_Sample_clicked() { this->ui->preview_ConfApache_Format_Sample->setText( - this->craplog.getLogsFormatSample( APACHE_ID ) ); + this->craplog.getLogsFormatSample( WS_APACHE ) ); } void MainWindow::on_button_ConfApache_Format_Help_clicked() { @@ -4702,24 +5018,24 @@ void MainWindow::on_box_ConfApache_Warnlist_Field_currentTextChanged(const QStri this->ui->inLine_ConfApache_Warnlist_String->clear(); this->ui->list_ConfApache_Warnlist_List->clear(); // update the list - const std::vector& list{ this->craplog.getWarnlist( - APACHE_ID, this->crapview.getLogFieldID( arg1 ) ) }; + const WarnlistField field{ this->warnlistFieldFromString( arg1 ) }; + const std::vector& list{ this->warnlists.getListConst( + WS_APACHE, field ) }; for ( const std::string& item : list ) { this->ui->list_ConfApache_Warnlist_List->addItem( QString::fromStdString( item ) ); } // check/uncheck the usage option - const bool used{ this->craplog.isWarnlistUsed( - APACHE_ID, - this->crapview.getLogFieldID( this->ui->box_ConfApache_Warnlist_Field->currentText() ) ) }; + const bool used{ this->warnlists.isUsed( + WS_APACHE, field ) }; this->ui->checkBox_ConfApache_Warnlist_Used->setChecked( used ); this->on_checkBox_ConfApache_Warnlist_Used_clicked( used ); } } void MainWindow::on_checkBox_ConfApache_Warnlist_Used_clicked(bool checked) { - this->craplog.setWarnlistUsed( - APACHE_ID, - this->crapview.getLogFieldID( this->ui->box_ConfApache_Warnlist_Field->currentText() ), + this->warnlists.setUsed( + WS_APACHE, + this->warnlistFieldFromString( this->ui->box_ConfApache_Warnlist_Field->currentText() ), checked ); if ( checked ) { this->ui->inLine_ConfApache_Warnlist_String->setEnabled( true ); @@ -4759,9 +5075,9 @@ void MainWindow::on_button_ConfApache_Warnlist_Add_clicked() if ( this->ui->list_ConfApache_Warnlist_List->findItems( item, Qt::MatchFlag::MatchCaseSensitive ).isEmpty() ) { // not in the list yet, append try { - this->craplog.warnlistAdd( - APACHE_ID, - this->crapview.getLogFieldID( this->ui->box_ConfApache_Warnlist_Field->currentText() ), + this->warnlists.addItem( + WS_APACHE, + this->warnlistFieldFromString( this->ui->box_ConfApache_Warnlist_Field->currentText() ), item.toStdString() ); this->ui->list_ConfApache_Warnlist_List->addItem( item ); } catch ( const BWlistException& ) { @@ -4788,7 +5104,7 @@ void MainWindow::on_list_ConfApache_Warnlist_List_itemSelectionChanged() this->ui->button_ConfApache_Warnlist_Up->setEnabled( false ); this->ui->button_ConfApache_Warnlist_Down->setEnabled( false ); } else { - for ( int i{0}; i<=max; i++ ) { + for ( int i{0}; i<=max; ++i ) { if ( this->ui->list_ConfApache_Warnlist_List->item(i) == item ) { if ( i == 0 ) { this->ui->button_ConfApache_Warnlist_Up->setEnabled( false ); @@ -4807,9 +5123,9 @@ void MainWindow::on_list_ConfApache_Warnlist_List_itemSelectionChanged() void MainWindow::on_button_ConfApache_Warnlist_Remove_clicked() { const auto item{ this->ui->list_ConfApache_Warnlist_List->selectedItems().at(0) }; - this->craplog.warnlistRemove( - APACHE_ID, - this->crapview.getLogFieldID( this->ui->box_ConfApache_Warnlist_Field->currentText() ), + this->warnlists.removeItem( + WS_APACHE, + this->warnlistFieldFromString( this->ui->box_ConfApache_Warnlist_Field->currentText() ), item->text().toStdString() ); // refresh the list this->on_box_ConfApache_Warnlist_Field_currentTextChanged( this->ui->box_ConfApache_Warnlist_Field->currentText() ); @@ -4817,9 +5133,9 @@ void MainWindow::on_button_ConfApache_Warnlist_Remove_clicked() void MainWindow::on_button_ConfApache_Warnlist_Up_clicked() { const auto item{ this->ui->list_ConfApache_Warnlist_List->selectedItems().at(0) }; - const int i{ this->craplog.warnlistMoveUp( - APACHE_ID, - this->crapview.getLogFieldID( this->ui->box_ConfApache_Warnlist_Field->currentText() ), + const int i{ this->warnlists.moveUpItem( + WS_APACHE, + this->warnlistFieldFromString( this->ui->box_ConfApache_Warnlist_Field->currentText() ), item->text().toStdString() ) }; // refresh the list this->on_box_ConfApache_Warnlist_Field_currentTextChanged( this->ui->box_ConfApache_Warnlist_Field->currentText() ); @@ -4830,9 +5146,9 @@ void MainWindow::on_button_ConfApache_Warnlist_Up_clicked() void MainWindow::on_button_ConfApache_Warnlist_Down_clicked() { const auto item{ this->ui->list_ConfApache_Warnlist_List->selectedItems().at(0) }; - const int i{ this->craplog.warnlistMoveDown( - APACHE_ID, - this->crapview.getLogFieldID( this->ui->box_ConfApache_Warnlist_Field->currentText() ), + const int i{ this->warnlists.moveDownItem( + WS_APACHE, + this->warnlistFieldFromString( this->ui->box_ConfApache_Warnlist_Field->currentText() ), item->text().toStdString() ) }; // refresh the list this->on_box_ConfApache_Warnlist_Field_currentTextChanged( this->ui->box_ConfApache_Warnlist_Field->currentText() ); @@ -4849,24 +5165,24 @@ void MainWindow::on_box_ConfApache_Blacklist_Field_currentTextChanged(const QStr this->ui->inLine_ConfApache_Blacklist_String->clear(); this->ui->list_ConfApache_Blacklist_List->clear(); // update the list - const std::vector& list{ this->craplog.getBlacklist( - APACHE_ID, this->crapview.getLogFieldID( arg1 ) ) }; + const BlacklistField field{ this->blacklistFieldFromString( arg1 ) }; + const std::vector& list{ this->blacklists.getListConst( + WS_APACHE, field ) }; for ( const std::string& item : list ) { this->ui->list_ConfApache_Blacklist_List->addItem( QString::fromStdString( item ) ); } // check/uncheck the usage option - const bool used{ this->craplog.isBlacklistUsed( - APACHE_ID, - this->crapview.getLogFieldID( this->ui->box_ConfApache_Blacklist_Field->currentText() ) ) }; + const bool used{ this->blacklists.isUsed( + WS_APACHE, field ) }; this->ui->checkBox_ConfApache_Blacklist_Used->setChecked( used ); this->on_checkBox_ConfApache_Blacklist_Used_clicked( used ); } } void MainWindow::on_checkBox_ConfApache_Blacklist_Used_clicked(bool checked) { - this->craplog.setBlacklistUsed( - APACHE_ID, - this->crapview.getLogFieldID( this->ui->box_ConfApache_Blacklist_Field->currentText() ), + this->blacklists.setUsed( + WS_APACHE, + this->blacklistFieldFromString( this->ui->box_ConfApache_Blacklist_Field->currentText() ), checked ); if ( checked ) { this->ui->inLine_ConfApache_Blacklist_String->setEnabled( true ); @@ -4906,9 +5222,9 @@ void MainWindow::on_button_ConfApache_Blacklist_Add_clicked() if ( this->ui->list_ConfApache_Blacklist_List->findItems( item, Qt::MatchFlag::MatchCaseSensitive ).isEmpty() ) { // not in the list yet, append try { - this->craplog.blacklistAdd( - APACHE_ID, - this->crapview.getLogFieldID( this->ui->box_ConfApache_Blacklist_Field->currentText() ), + this->blacklists.addItem( + WS_APACHE, + this->blacklistFieldFromString( this->ui->box_ConfApache_Blacklist_Field->currentText() ), item.toStdString() ); this->ui->list_ConfApache_Blacklist_List->addItem( item ); } catch ( const BWlistException& ) { @@ -4935,7 +5251,7 @@ void MainWindow::on_list_ConfApache_Blacklist_List_itemSelectionChanged() this->ui->button_ConfApache_Blacklist_Up->setEnabled( false ); this->ui->button_ConfApache_Blacklist_Down->setEnabled( false ); } else { - for ( int i{0}; i<=max; i++ ) { + for ( int i{0}; i<=max; ++i ) { if ( this->ui->list_ConfApache_Blacklist_List->item(i) == item ) { if ( i == 0 ) { this->ui->button_ConfApache_Blacklist_Up->setEnabled( false ); @@ -4954,9 +5270,9 @@ void MainWindow::on_list_ConfApache_Blacklist_List_itemSelectionChanged() void MainWindow::on_button_ConfApache_Blacklist_Remove_clicked() { const auto item{ this->ui->list_ConfApache_Blacklist_List->selectedItems().at(0) }; - this->craplog.blacklistRemove( - APACHE_ID, - this->crapview.getLogFieldID( this->ui->box_ConfApache_Blacklist_Field->currentText() ), + this->blacklists.removeItem( + WS_APACHE, + this->blacklistFieldFromString( this->ui->box_ConfApache_Blacklist_Field->currentText() ), item->text().toStdString() ); // refresh the list this->on_box_ConfApache_Blacklist_Field_currentTextChanged( this->ui->box_ConfApache_Blacklist_Field->currentText() ); @@ -4964,9 +5280,9 @@ void MainWindow::on_button_ConfApache_Blacklist_Remove_clicked() void MainWindow::on_button_ConfApache_Blacklist_Up_clicked() { const auto item{ this->ui->list_ConfApache_Blacklist_List->selectedItems().at(0) }; - const int i{ this->craplog.blacklistMoveUp( - APACHE_ID, - this->crapview.getLogFieldID( this->ui->box_ConfApache_Blacklist_Field->currentText() ), + const int i{ this->blacklists.moveUpItem( + WS_APACHE, + this->blacklistFieldFromString( this->ui->box_ConfApache_Blacklist_Field->currentText() ), item->text().toStdString() ) }; // refresh the list this->on_box_ConfApache_Blacklist_Field_currentTextChanged( this->ui->box_ConfApache_Blacklist_Field->currentText() ); @@ -4977,9 +5293,9 @@ void MainWindow::on_button_ConfApache_Blacklist_Up_clicked() void MainWindow::on_button_ConfApache_Blacklist_Down_clicked() { const auto item{ this->ui->list_ConfApache_Blacklist_List->selectedItems().at(0) }; - const int i{ this->craplog.blacklistMoveDown( - APACHE_ID, - this->crapview.getLogFieldID( this->ui->box_ConfApache_Blacklist_Field->currentText() ), + const int i{ this->blacklists.moveDownItem( + WS_APACHE, + this->blacklistFieldFromString( this->ui->box_ConfApache_Blacklist_Field->currentText() ), item->text().toStdString() ) }; // refresh the list this->on_box_ConfApache_Blacklist_Field_currentTextChanged( this->ui->box_ConfApache_Blacklist_Field->currentText() ); @@ -4992,6 +5308,27 @@ void MainWindow::on_button_ConfApache_Blacklist_Down_clicked() //////////////// //// NGINX //// // paths +void MainWindow::on_tool_ConfNginx_Path_Dialog_clicked() +{ + this->crappath.reset( new Crappath( this ) ); + + const QString current_path{ this->ui->inLine_ConfNginx_Path_String->text() }; + const std::string& logs_path{ this->craplog.getLogsPath( WS_NGINX ) }; + if ( ! current_path.isEmpty() ) { + crappath->setDirectory( current_path ); + } else if ( ! logs_path.empty() ) { + crappath->setDirectory( QString::fromStdString( logs_path ) ); + } else { + crappath->setDirectory( QString::fromStdString( this->home_path ) ); + } + + if ( crappath->exec() ) { + const QStringList selection{ crappath->selectedFiles() }; + if ( ! selection.isEmpty() ) { + this->ui->inLine_ConfNginx_Path_String->setText( selection[0] ); + } + } +} void MainWindow::on_inLine_ConfNginx_Path_String_textChanged(const QString& arg1) { if ( ! arg1.isEmpty() ) { @@ -5023,7 +5360,7 @@ void MainWindow::on_button_ConfNginx_Path_Save_clicked() if ( ! IOutils::checkDir( path, true ) ) { DialogSec::warnDirNotReadable( nullptr ); } - this->craplog.setLogsPath( NGINX_ID, path ); + this->craplog.setLogsPath( WS_NGINX, path ); this->ui->inLine_ConfNginx_Path_String->setText( QString::fromStdString( path ) ); } this->ui->button_ConfNginx_Path_Save->setEnabled( false ); @@ -5048,10 +5385,10 @@ void MainWindow::on_inLine_ConfNginx_Format_String_returnPressed() void MainWindow::on_button_ConfNginx_Format_Save_clicked() { const bool success{ this->craplog.setNginxLogFormat( - this->ui->inLine_ConfNginx_Format_String->text().toStdString() ) }; + this->ui->inLine_ConfNginx_Format_String->text().trimmed().toStdString() ) }; if ( success ) { this->ui->button_ConfNginx_Format_Save->setEnabled( false ); - if ( this->craplog.getCurrentWSID() == NGINX_ID ) { + if ( this->craplog.getCurrentWebServer() == WS_NGINX ) { this->craplog.setCurrentLogFormat(); } } @@ -5059,7 +5396,7 @@ void MainWindow::on_button_ConfNginx_Format_Save_clicked() void MainWindow::on_button_ConfNginx_Format_Sample_clicked() { this->ui->preview_ConfNginx_Format_Sample->setText( - this->craplog.getLogsFormatSample( NGINX_ID ) ); + this->craplog.getLogsFormatSample( WS_NGINX ) ); } void MainWindow::on_button_ConfNginx_Format_Help_clicked() { @@ -5073,24 +5410,24 @@ void MainWindow::on_box_ConfNginx_Warnlist_Field_currentTextChanged(const QStrin this->ui->inLine_ConfNginx_Warnlist_String->clear(); this->ui->list_ConfNginx_Warnlist_List->clear(); // update the list - const std::vector& list{ this->craplog.getWarnlist( - NGINX_ID, this->crapview.getLogFieldID( arg1 ) ) }; + const WarnlistField field{ this->warnlistFieldFromString( arg1 ) }; + const std::vector& list{ this->warnlists.getListConst( + WS_NGINX, field ) }; for ( const std::string& item : list ) { this->ui->list_ConfNginx_Warnlist_List->addItem( QString::fromStdString( item ) ); } // check/uncheck the usage option - const bool used{ this->craplog.isWarnlistUsed( - NGINX_ID, - this->crapview.getLogFieldID( this->ui->box_ConfNginx_Warnlist_Field->currentText() ) ) }; + const bool used{ this->warnlists.isUsed( + WS_NGINX, field ) }; this->ui->checkBox_ConfNginx_Warnlist_Used->setChecked( used ); this->on_checkBox_ConfNginx_Warnlist_Used_clicked( used ); } } void MainWindow::on_checkBox_ConfNginx_Warnlist_Used_clicked(bool checked) { - this->craplog.setWarnlistUsed( - NGINX_ID, - this->crapview.getLogFieldID( this->ui->box_ConfNginx_Warnlist_Field->currentText() ), + this->warnlists.setUsed( + WS_NGINX, + this->warnlistFieldFromString( this->ui->box_ConfNginx_Warnlist_Field->currentText() ), checked ); if ( checked ) { this->ui->inLine_ConfNginx_Warnlist_String->setEnabled( true ); @@ -5130,9 +5467,9 @@ void MainWindow::on_button_ConfNginx_Warnlist_Add_clicked() if ( this->ui->list_ConfNginx_Warnlist_List->findItems( item, Qt::MatchFlag::MatchCaseSensitive ).isEmpty() ) { // not in the list yet, append try { - this->craplog.warnlistAdd( - NGINX_ID, - this->crapview.getLogFieldID( this->ui->box_ConfNginx_Warnlist_Field->currentText() ), + this->warnlists.addItem( + WS_NGINX, + this->warnlistFieldFromString( this->ui->box_ConfNginx_Warnlist_Field->currentText() ), item.toStdString() ); this->ui->list_ConfNginx_Warnlist_List->addItem( item ); } catch ( const BWlistException& ) { @@ -5159,7 +5496,7 @@ void MainWindow::on_list_ConfNginx_Warnlist_List_itemSelectionChanged() this->ui->button_ConfNginx_Warnlist_Up->setEnabled( false ); this->ui->button_ConfNginx_Warnlist_Down->setEnabled( false ); } else { - for ( int i{0}; i<=max; i++ ) { + for ( int i{0}; i<=max; ++i ) { if ( this->ui->list_ConfNginx_Warnlist_List->item(i) == item ) { if ( i == 0 ) { this->ui->button_ConfNginx_Warnlist_Up->setEnabled( false ); @@ -5178,9 +5515,9 @@ void MainWindow::on_list_ConfNginx_Warnlist_List_itemSelectionChanged() void MainWindow::on_button_ConfNginx_Warnlist_Remove_clicked() { const auto item{ this->ui->list_ConfNginx_Warnlist_List->selectedItems().at(0) }; - this->craplog.warnlistRemove( - NGINX_ID, - this->crapview.getLogFieldID( this->ui->box_ConfNginx_Warnlist_Field->currentText() ), + this->warnlists.removeItem( + WS_NGINX, + this->warnlistFieldFromString( this->ui->box_ConfNginx_Warnlist_Field->currentText() ), item->text().toStdString() ); // refresh the list this->on_box_ConfNginx_Warnlist_Field_currentTextChanged( this->ui->box_ConfNginx_Warnlist_Field->currentText() ); @@ -5188,9 +5525,9 @@ void MainWindow::on_button_ConfNginx_Warnlist_Remove_clicked() void MainWindow::on_button_ConfNginx_Warnlist_Up_clicked() { const auto item{ this->ui->list_ConfNginx_Warnlist_List->selectedItems().at(0) }; - const int i{ this->craplog.warnlistMoveUp( - NGINX_ID, - this->crapview.getLogFieldID( this->ui->box_ConfNginx_Warnlist_Field->currentText() ), + const int i{ this->warnlists.moveUpItem( + WS_NGINX, + this->warnlistFieldFromString( this->ui->box_ConfNginx_Warnlist_Field->currentText() ), item->text().toStdString() ) }; // refresh the list this->on_box_ConfNginx_Warnlist_Field_currentTextChanged( this->ui->box_ConfNginx_Warnlist_Field->currentText() ); @@ -5201,9 +5538,9 @@ void MainWindow::on_button_ConfNginx_Warnlist_Up_clicked() void MainWindow::on_button_ConfNginx_Warnlist_Down_clicked() { const auto item{ this->ui->list_ConfNginx_Warnlist_List->selectedItems().at(0) }; - const int i{ this->craplog.warnlistMoveDown( - NGINX_ID, - this->crapview.getLogFieldID( this->ui->box_ConfNginx_Warnlist_Field->currentText() ), + const int i{ this->warnlists.moveDownItem( + WS_NGINX, + this->warnlistFieldFromString( this->ui->box_ConfNginx_Warnlist_Field->currentText() ), item->text().toStdString() ) }; // refresh the list this->on_box_ConfNginx_Warnlist_Field_currentTextChanged( this->ui->box_ConfNginx_Warnlist_Field->currentText() ); @@ -5220,24 +5557,24 @@ void MainWindow::on_box_ConfNginx_Blacklist_Field_currentTextChanged(const QStri this->ui->inLine_ConfNginx_Blacklist_String->clear(); this->ui->list_ConfNginx_Blacklist_List->clear(); // update the list - const std::vector& list{ this->craplog.getBlacklist( - NGINX_ID, this->crapview.getLogFieldID( arg1 ) ) }; + const BlacklistField field{ this->blacklistFieldFromString( arg1 ) }; + const std::vector& list{ this->blacklists.getListConst( + WS_NGINX, field ) }; for ( const std::string& item : list ) { this->ui->list_ConfNginx_Blacklist_List->addItem( QString::fromStdString( item ) ); } // check/uncheck the usage option - const bool used{ this->craplog.isBlacklistUsed( - NGINX_ID, - this->crapview.getLogFieldID( this->ui->box_ConfNginx_Blacklist_Field->currentText() ) ) }; + const bool used{ this->blacklists.isUsed( + WS_NGINX, field ) }; this->ui->checkBox_ConfNginx_Blacklist_Used->setChecked( used ); this->on_checkBox_ConfNginx_Blacklist_Used_clicked( used ); } } void MainWindow::on_checkBox_ConfNginx_Blacklist_Used_clicked(bool checked) { - this->craplog.setBlacklistUsed( - NGINX_ID, - this->crapview.getLogFieldID( this->ui->box_ConfNginx_Blacklist_Field->currentText() ), + this->blacklists.setUsed( + WS_NGINX, + this->blacklistFieldFromString( this->ui->box_ConfNginx_Blacklist_Field->currentText() ), checked ); if ( checked ) { this->ui->inLine_ConfNginx_Blacklist_String->setEnabled( true ); @@ -5277,9 +5614,9 @@ void MainWindow::on_button_ConfNginx_Blacklist_Add_clicked() if ( this->ui->list_ConfNginx_Blacklist_List->findItems( item, Qt::MatchFlag::MatchCaseSensitive ).isEmpty() ) { // not in the list yet, append try { - this->craplog.blacklistAdd( - NGINX_ID, - this->crapview.getLogFieldID( this->ui->box_ConfNginx_Blacklist_Field->currentText() ), + this->blacklists.addItem( + WS_NGINX, + this->blacklistFieldFromString( this->ui->box_ConfNginx_Blacklist_Field->currentText() ), item.toStdString() ); this->ui->list_ConfNginx_Blacklist_List->addItem( item ); } catch ( const BWlistException& ) { @@ -5306,7 +5643,7 @@ void MainWindow::on_list_ConfNginx_Blacklist_List_itemSelectionChanged() this->ui->button_ConfNginx_Blacklist_Up->setEnabled( false ); this->ui->button_ConfNginx_Blacklist_Down->setEnabled( false ); } else { - for ( int i{0}; i<=max; i++ ) { + for ( int i{0}; i<=max; ++i ) { if ( this->ui->list_ConfNginx_Blacklist_List->item(i) == item ) { if ( i == 0 ) { this->ui->button_ConfNginx_Blacklist_Up->setEnabled( false ); @@ -5325,9 +5662,9 @@ void MainWindow::on_list_ConfNginx_Blacklist_List_itemSelectionChanged() void MainWindow::on_button_ConfNginx_Blacklist_Remove_clicked() { const auto item{ this->ui->list_ConfNginx_Blacklist_List->selectedItems().at(0) }; - this->craplog.blacklistRemove( - NGINX_ID, - this->crapview.getLogFieldID( this->ui->box_ConfNginx_Blacklist_Field->currentText() ), + this->blacklists.removeItem( + WS_NGINX, + this->blacklistFieldFromString( this->ui->box_ConfNginx_Blacklist_Field->currentText() ), item->text().toStdString() ); // refresh the list this->on_box_ConfNginx_Blacklist_Field_currentTextChanged( this->ui->box_ConfNginx_Blacklist_Field->currentText() ); @@ -5335,9 +5672,9 @@ void MainWindow::on_button_ConfNginx_Blacklist_Remove_clicked() void MainWindow::on_button_ConfNginx_Blacklist_Up_clicked() { const auto item{ this->ui->list_ConfNginx_Blacklist_List->selectedItems().at(0) }; - const int i{ this->craplog.blacklistMoveUp( - NGINX_ID, - this->crapview.getLogFieldID( this->ui->box_ConfNginx_Blacklist_Field->currentText() ), + const int i{ this->blacklists.moveUpItem( + WS_NGINX, + this->blacklistFieldFromString( this->ui->box_ConfNginx_Blacklist_Field->currentText() ), item->text().toStdString() ) }; // refresh the list this->on_box_ConfNginx_Blacklist_Field_currentTextChanged( this->ui->box_ConfNginx_Blacklist_Field->currentText() ); @@ -5348,9 +5685,9 @@ void MainWindow::on_button_ConfNginx_Blacklist_Up_clicked() void MainWindow::on_button_ConfNginx_Blacklist_Down_clicked() { const auto item{ this->ui->list_ConfNginx_Blacklist_List->selectedItems().at(0) }; - const int i{ this->craplog.blacklistMoveDown( - NGINX_ID, - this->crapview.getLogFieldID( this->ui->box_ConfNginx_Blacklist_Field->currentText() ), + const int i{ this->blacklists.moveDownItem( + WS_NGINX, + this->blacklistFieldFromString( this->ui->box_ConfNginx_Blacklist_Field->currentText() ), item->text().toStdString() ) }; // refresh the list this->on_box_ConfNginx_Blacklist_Field_currentTextChanged( this->ui->box_ConfNginx_Blacklist_Field->currentText() ); @@ -5363,6 +5700,27 @@ void MainWindow::on_button_ConfNginx_Blacklist_Down_clicked() //////////////// //// IIS //// // paths +void MainWindow::on_tool_ConfIis_Path_Dialog_clicked() +{ + this->crappath.reset( new Crappath( this ) ); + + const QString current_path{ this->ui->inLine_ConfIis_Path_String->text() }; + const std::string& logs_path{ this->craplog.getLogsPath( WS_IIS ) }; + if ( ! current_path.isEmpty() ) { + crappath->setDirectory( current_path ); + } else if ( ! logs_path.empty() ) { + crappath->setDirectory( QString::fromStdString( logs_path ) ); + } else { + crappath->setDirectory( QString::fromStdString( this->home_path ) ); + } + + if ( crappath->exec() ) { + const QStringList selection{ crappath->selectedFiles() }; + if ( ! selection.isEmpty() ) { + this->ui->inLine_ConfIis_Path_String->setText( selection[0] ); + } + } +} void MainWindow::on_inLine_ConfIis_Path_String_textChanged(const QString& arg1) { if ( ! arg1.isEmpty() ) { @@ -5394,32 +5752,29 @@ void MainWindow::on_button_ConfIis_Path_Save_clicked() if ( ! IOutils::checkDir( path, true ) ) { DialogSec::warnDirNotReadable( nullptr ); } - this->craplog.setLogsPath( IIS_ID, path ); + this->craplog.setLogsPath( WS_IIS, path ); this->ui->inLine_ConfIis_Path_String->setText( QString::fromStdString( path ) ); } this->ui->button_ConfIis_Path_Save->setEnabled( false ); } // formats -int MainWindow::getIisLogsModule() const +IISLogsModule MainWindow::getIisLogsModule() const { - if ( this->ui->radio_ConfIis_Format_NCSA->isChecked() ) { - return 1; - } else if ( this->ui->radio_ConfIis_Format_IIS->isChecked() ) { - return 2; - } - return 0; + return this->ui->radio_ConfIis_Format_W3C->isChecked() ? IISLogsModule::W3C + : this->ui->radio_ConfIis_Format_IIS->isChecked() ? IISLogsModule::IIS + : IISLogsModule::NCSA; } void MainWindow::on_radio_ConfIis_Format_W3C_toggled(bool checked) { if ( checked ) { - const bool success{ this->craplog.setIisLogFormat( "", 0 ) }; + const bool success{ this->craplog.setIisLogFormat( "", IISLogsModule::W3C ) }; if ( success ) { this->ui->inLine_ConfIis_Format_String->clear(); this->ui->inLine_ConfIis_Format_String->setEnabled( true ); this->ui->inLine_ConfIis_Format_String->setFocus(); - if ( this->craplog.getCurrentWSID() == IIS_ID ) { + if ( this->craplog.getCurrentWebServer() == WS_IIS ) { this->craplog.setCurrentLogFormat(); this->on_button_LogFiles_RefreshList_clicked(); } @@ -5431,13 +5786,13 @@ void MainWindow::on_radio_ConfIis_Format_NCSA_toggled(bool checked) if ( checked ) { const bool success{ this->craplog.setIisLogFormat( "c-ip s-sitename s-computername [date:time] sc-status sc-bytes", - 1 ) }; + IISLogsModule::NCSA ) }; if ( success ) { this->ui->inLine_ConfIis_Format_String->clear(); - this->ui->inLine_ConfIis_Format_String->setText( QString::fromStdString( this->craplog.getLogsFormatString( IIS_ID ) ) ); + this->ui->inLine_ConfIis_Format_String->setText( QString::fromStdString( this->craplog.getLogsFormatString( WS_IIS ) ) ); this->ui->inLine_ConfIis_Format_String->setEnabled( false ); this->ui->button_ConfIis_Format_Save->setEnabled( false ); - if ( this->craplog.getCurrentWSID() == IIS_ID ) { + if ( this->craplog.getCurrentWebServer() == WS_IIS ) { this->craplog.setCurrentLogFormat(); this->on_button_LogFiles_RefreshList_clicked(); } @@ -5449,13 +5804,13 @@ void MainWindow::on_radio_ConfIis_Format_IIS_toggled(bool checked) if ( checked ) { const bool success{ this->craplog.setIisLogFormat( "c-ip, cs-username, date, time, s-sitename, s-computername, s-ip, time-taken, cs-bytes, sc-bytes, sc-status, sc-win32-status, cs-method, cs-uri-stem, cs-uri-query,", - 2 ) }; + IISLogsModule::IIS ) }; if ( success ) { this->ui->inLine_ConfIis_Format_String->clear(); - this->ui->inLine_ConfIis_Format_String->setText( QString::fromStdString( this->craplog.getLogsFormatString( IIS_ID ) ) ); + this->ui->inLine_ConfIis_Format_String->setText( QString::fromStdString( this->craplog.getLogsFormatString( WS_IIS ) ) ); this->ui->inLine_ConfIis_Format_String->setEnabled( false ); this->ui->button_ConfIis_Format_Save->setEnabled( false ); - if ( this->craplog.getCurrentWSID() == IIS_ID ) { + if ( this->craplog.getCurrentWebServer() == WS_IIS ) { this->craplog.setCurrentLogFormat(); this->on_button_LogFiles_RefreshList_clicked(); } @@ -5481,11 +5836,11 @@ void MainWindow::on_inLine_ConfIis_Format_String_returnPressed() void MainWindow::on_button_ConfIis_Format_Save_clicked() { const bool success{ this->craplog.setIisLogFormat( - StringOps::strip( this->ui->inLine_ConfIis_Format_String->text().toStdString() ), + this->ui->inLine_ConfIis_Format_String->text().trimmed().toStdString(), this->getIisLogsModule() ) }; if ( success ) { this->ui->button_ConfIis_Format_Save->setEnabled( false ); - if ( this->craplog.getCurrentWSID() == IIS_ID ) { + if ( this->craplog.getCurrentWebServer() == WS_IIS ) { this->craplog.setCurrentLogFormat(); } } @@ -5493,7 +5848,7 @@ void MainWindow::on_button_ConfIis_Format_Save_clicked() void MainWindow::on_button_ConfIis_Format_Sample_clicked() { this->ui->preview_ConfIis_Format_Sample->setText( - this->craplog.getLogsFormatSample( IIS_ID ) ); + this->craplog.getLogsFormatSample( WS_IIS ) ); } void MainWindow::on_button_ConfIis_Format_Help_clicked() { @@ -5507,24 +5862,24 @@ void MainWindow::on_box_ConfIis_Warnlist_Field_currentTextChanged(const QString& this->ui->inLine_ConfIis_Warnlist_String->clear(); this->ui->list_ConfIis_Warnlist_List->clear(); // update the list - const std::vector& list{ this->craplog.getWarnlist( - IIS_ID, this->crapview.getLogFieldID( arg1 ) ) }; + const WarnlistField field{ this->warnlistFieldFromString( arg1 ) }; + const std::vector& list{ this->warnlists.getListConst( + WS_IIS, field ) }; for ( const std::string& item : list ) { this->ui->list_ConfIis_Warnlist_List->addItem( QString::fromStdString( item ) ); } // check/uncheck the usage option - const bool used{ this->craplog.isWarnlistUsed( - IIS_ID, - this->crapview.getLogFieldID( this->ui->box_ConfIis_Warnlist_Field->currentText() ) ) }; + const bool used{ this->warnlists.isUsed( + WS_IIS, field ) }; this->ui->checkBox_ConfIis_Warnlist_Used->setChecked( used ); this->on_checkBox_ConfIis_Warnlist_Used_clicked( used ); } } void MainWindow::on_checkBox_ConfIis_Warnlist_Used_clicked(bool checked) { - this->craplog.setWarnlistUsed( - IIS_ID, - this->crapview.getLogFieldID( this->ui->box_ConfIis_Warnlist_Field->currentText() ), + this->warnlists.setUsed( + WS_IIS, + this->warnlistFieldFromString( this->ui->box_ConfIis_Warnlist_Field->currentText() ), checked ); if ( checked ) { this->ui->inLine_ConfIis_Warnlist_String->setEnabled( true ); @@ -5564,9 +5919,9 @@ void MainWindow::on_button_ConfIis_Warnlist_Add_clicked() if ( this->ui->list_ConfIis_Warnlist_List->findItems( item, Qt::MatchFlag::MatchCaseSensitive ).isEmpty() ) { // not in the list yet, append try { - this->craplog.warnlistAdd( - IIS_ID, - this->crapview.getLogFieldID( this->ui->box_ConfIis_Warnlist_Field->currentText() ), + this->warnlists.addItem( + WS_IIS, + this->warnlistFieldFromString( this->ui->box_ConfIis_Warnlist_Field->currentText() ), item.toStdString() ); this->ui->list_ConfIis_Warnlist_List->addItem( item ); } catch ( const BWlistException& ) { @@ -5593,7 +5948,7 @@ void MainWindow::on_list_ConfIis_Warnlist_List_itemSelectionChanged() this->ui->button_ConfIis_Warnlist_Up->setEnabled( false ); this->ui->button_ConfIis_Warnlist_Down->setEnabled( false ); } else { - for ( int i{0}; i<=max; i++ ) { + for ( int i{0}; i<=max; ++i ) { if ( this->ui->list_ConfIis_Warnlist_List->item(i) == item ) { if ( i == 0 ) { this->ui->button_ConfIis_Warnlist_Up->setEnabled( false ); @@ -5612,9 +5967,9 @@ void MainWindow::on_list_ConfIis_Warnlist_List_itemSelectionChanged() void MainWindow::on_button_ConfIis_Warnlist_Remove_clicked() { const auto item{ this->ui->list_ConfIis_Warnlist_List->selectedItems().at(0) }; - this->craplog.warnlistRemove( - IIS_ID, - this->crapview.getLogFieldID( this->ui->box_ConfIis_Warnlist_Field->currentText() ), + this->warnlists.removeItem( + WS_IIS, + this->warnlistFieldFromString( this->ui->box_ConfIis_Warnlist_Field->currentText() ), item->text().toStdString() ); // refresh the list this->on_box_ConfIis_Warnlist_Field_currentTextChanged( this->ui->box_ConfIis_Warnlist_Field->currentText() ); @@ -5622,9 +5977,9 @@ void MainWindow::on_button_ConfIis_Warnlist_Remove_clicked() void MainWindow::on_button_ConfIis_Warnlist_Up_clicked() { const auto item{ this->ui->list_ConfIis_Warnlist_List->selectedItems().at(0) }; - const int i{ this->craplog.warnlistMoveUp( - IIS_ID, - this->crapview.getLogFieldID( this->ui->box_ConfIis_Warnlist_Field->currentText() ), + const int i{ this->warnlists.moveUpItem( + WS_IIS, + this->warnlistFieldFromString( this->ui->box_ConfIis_Warnlist_Field->currentText() ), item->text().toStdString() ) }; // refresh the list this->on_box_ConfIis_Warnlist_Field_currentTextChanged( this->ui->box_ConfIis_Warnlist_Field->currentText() ); @@ -5635,9 +5990,9 @@ void MainWindow::on_button_ConfIis_Warnlist_Up_clicked() void MainWindow::on_button_ConfIis_Warnlist_Down_clicked() { const auto item{ this->ui->list_ConfIis_Warnlist_List->selectedItems().at(0) }; - const int i{ this->craplog.warnlistMoveDown( - IIS_ID, - this->crapview.getLogFieldID( this->ui->box_ConfIis_Warnlist_Field->currentText() ), + const int i{ this->warnlists.moveDownItem( + WS_IIS, + this->warnlistFieldFromString( this->ui->box_ConfIis_Warnlist_Field->currentText() ), item->text().toStdString() ) }; // refresh the list this->on_box_ConfIis_Warnlist_Field_currentTextChanged( this->ui->box_ConfIis_Warnlist_Field->currentText() ); @@ -5654,24 +6009,24 @@ void MainWindow::on_box_ConfIis_Blacklist_Field_currentTextChanged(const QString this->ui->inLine_ConfIis_Blacklist_String->clear(); this->ui->list_ConfIis_Blacklist_List->clear(); // update the list - const std::vector& list{ this->craplog.getBlacklist( - IIS_ID, this->crapview.getLogFieldID( arg1 ) ) }; + const BlacklistField field{ this->blacklistFieldFromString( arg1 ) }; + const std::vector& list{ this->blacklists.getListConst( + WS_IIS, field ) }; for ( const std::string& item : list ) { this->ui->list_ConfIis_Blacklist_List->addItem( QString::fromStdString( item ) ); } // check/uncheck the usage option - const bool used{ this->craplog.isBlacklistUsed( - IIS_ID, - this->crapview.getLogFieldID( this->ui->box_ConfIis_Blacklist_Field->currentText() ) ) }; + const bool used{ this->blacklists.isUsed( + WS_IIS, field ) }; this->ui->checkBox_ConfIis_Blacklist_Used->setChecked( used ); this->on_checkBox_ConfIis_Blacklist_Used_clicked( used ); } } void MainWindow::on_checkBox_ConfIis_Blacklist_Used_clicked(bool checked) { - this->craplog.setBlacklistUsed( - IIS_ID, - this->crapview.getLogFieldID( this->ui->box_ConfIis_Blacklist_Field->currentText() ), + this->blacklists.setUsed( + WS_IIS, + this->blacklistFieldFromString( this->ui->box_ConfIis_Blacklist_Field->currentText() ), checked ); if ( checked ) { this->ui->inLine_ConfIis_Blacklist_String->setEnabled( true ); @@ -5711,9 +6066,9 @@ void MainWindow::on_button_ConfIis_Blacklist_Add_clicked() if ( this->ui->list_ConfIis_Blacklist_List->findItems( item, Qt::MatchFlag::MatchCaseSensitive ).isEmpty() ) { // not in the list yet, append try { - this->craplog.blacklistAdd( - IIS_ID, - this->crapview.getLogFieldID( this->ui->box_ConfIis_Blacklist_Field->currentText() ), + this->blacklists.addItem( + WS_IIS, + this->blacklistFieldFromString( this->ui->box_ConfIis_Blacklist_Field->currentText() ), item.toStdString() ); this->ui->list_ConfIis_Blacklist_List->addItem( item ); } catch ( const BWlistException& ) { @@ -5740,7 +6095,7 @@ void MainWindow::on_list_ConfIis_Blacklist_List_itemSelectionChanged() this->ui->button_ConfIis_Blacklist_Up->setEnabled( false ); this->ui->button_ConfIis_Blacklist_Down->setEnabled( false ); } else { - for ( int i{0}; i<=max; i++ ) { + for ( int i{0}; i<=max; ++i ) { if ( this->ui->list_ConfIis_Blacklist_List->item(i) == item ) { if ( i == 0 ) { this->ui->button_ConfIis_Blacklist_Up->setEnabled( false ); @@ -5759,9 +6114,9 @@ void MainWindow::on_list_ConfIis_Blacklist_List_itemSelectionChanged() void MainWindow::on_button_ConfIis_Blacklist_Remove_clicked() { const auto item{ this->ui->list_ConfIis_Blacklist_List->selectedItems().at(0) }; - this->craplog.blacklistRemove( - IIS_ID, - this->crapview.getLogFieldID( this->ui->box_ConfIis_Blacklist_Field->currentText() ), + this->blacklists.removeItem( + WS_IIS, + this->blacklistFieldFromString( this->ui->box_ConfIis_Blacklist_Field->currentText() ), item->text().toStdString() ); // refresh the list this->on_box_ConfIis_Blacklist_Field_currentTextChanged( this->ui->box_ConfIis_Blacklist_Field->currentText() ); @@ -5769,9 +6124,9 @@ void MainWindow::on_button_ConfIis_Blacklist_Remove_clicked() void MainWindow::on_button_ConfIis_Blacklist_Up_clicked() { const auto item{ this->ui->list_ConfIis_Blacklist_List->selectedItems().at(0) }; - const int i{ this->craplog.blacklistMoveUp( - IIS_ID, - this->crapview.getLogFieldID( this->ui->box_ConfIis_Blacklist_Field->currentText() ), + const int i{ this->blacklists.moveUpItem( + WS_IIS, + this->blacklistFieldFromString( this->ui->box_ConfIis_Blacklist_Field->currentText() ), item->text().toStdString() ) }; // refresh the list this->on_box_ConfIis_Blacklist_Field_currentTextChanged( this->ui->box_ConfIis_Blacklist_Field->currentText() ); @@ -5782,9 +6137,9 @@ void MainWindow::on_button_ConfIis_Blacklist_Up_clicked() void MainWindow::on_button_ConfIis_Blacklist_Down_clicked() { const auto item{ this->ui->list_ConfIis_Blacklist_List->selectedItems().at(0) }; - const int i{ this->craplog.blacklistMoveDown( - IIS_ID, - this->crapview.getLogFieldID( this->ui->box_ConfIis_Blacklist_Field->currentText() ), + const int i{ this->blacklists.moveDownItem( + WS_IIS, + this->blacklistFieldFromString( this->ui->box_ConfIis_Blacklist_Field->currentText() ), item->text().toStdString() ) }; // refresh the list this->on_box_ConfIis_Blacklist_Field_currentTextChanged( this->ui->box_ConfIis_Blacklist_Field->currentText() ); diff --git a/logdoctor/mainwindow.h b/logdoctor/mainwindow.h index 85257fd1..75251346 100644 --- a/logdoctor/mainwindow.h +++ b/logdoctor/mainwindow.h @@ -8,14 +8,23 @@ #include "modules/tb.h" +#include "modules/database/database.h" + +#include "modules/blacklists/blacklists.h" +#include "modules/warnlists/warnlists.h" + #include "modules/craplog/craplog.h" #include "modules/crapview/crapview.h" + +class Crappath; class Craphelp; class Crapup; class Crapinfo; class Crapnote; +class Changelog; + class CrissCross; class SnakeGame; @@ -23,6 +32,9 @@ class QCloseEvent; class QTranslator; class QTreeWidgetItem; +enum class LogField; +enum class ColorsScheme : unsigned char; + namespace Ui { class MainWindow; @@ -33,20 +45,20 @@ namespace Ui { /*! The parent window */ -class MainWindow : public QMainWindow +class MainWindow final : public QMainWindow { Q_OBJECT public: explicit MainWindow( QWidget* parent=nullptr ); - + Q_DISABLE_COPY_MOVE(MainWindow) signals: void refreshLogs(); - void runCraplog(); + void runCraplog( const Blacklists& blacklists ); private slots: @@ -153,8 +165,6 @@ private slots: void on_button_StatsWarn_Draw_clicked(); - void on_button_StatsWarn_Update_clicked(); - //// SPEED //// void on_box_StatsSpeed_WebServer_currentIndexChanged(int index); @@ -301,12 +311,16 @@ private slots: //// DATABASES //// + void on_tool_ConfDatabases_Data_Dialog_clicked(); + void on_inLine_ConfDatabases_Data_Path_textChanged(const QString& arg1); void on_inLine_ConfDatabases_Data_Path_returnPressed(); void on_button_ConfDatabases_Data_Save_clicked(); + void on_tool_ConfDatabases_Hashes_Dialog_clicked(); + void on_inLine_ConfDatabases_Hashes_Path_textChanged(const QString& arg1); void on_inLine_ConfDatabases_Hashes_Path_returnPressed(); @@ -335,6 +349,8 @@ private slots: //// APACHE //// + void on_tool_ConfApache_Path_Dialog_clicked(); + void on_inLine_ConfApache_Path_String_textChanged(const QString& arg1); void on_inLine_ConfApache_Path_String_returnPressed(); @@ -389,6 +405,8 @@ private slots: //// NGINX //// + void on_tool_ConfNginx_Path_Dialog_clicked(); + void on_inLine_ConfNginx_Path_String_textChanged(const QString& arg1); void on_inLine_ConfNginx_Path_String_returnPressed(); @@ -443,6 +461,8 @@ private slots: //// IIS //// + void on_tool_ConfIis_Path_Dialog_clicked(); + void on_inLine_ConfIis_Path_String_textChanged(const QString& arg1); void on_inLine_ConfIis_Path_String_returnPressed(); @@ -527,6 +547,8 @@ private slots: void menu_actionInfos_triggered(); + void menu_actionChangelog_triggered(); + void menu_actionCheckUpdates_triggered(); //// GAMES //// @@ -540,9 +562,10 @@ private: QSharedPointer ui; // current version of LogDoctor - const float version{ 3.00f }; + const float version{ 4.00f }; QString wsFromIndex( const int index ) const; + WebServer wsEnumFromIndex( const int index ) const; ////////////////////////// @@ -630,13 +653,32 @@ private: ///////////////// - //// GENERAL //// + //// DIALOGS //// // quantoty of informational dialogs to display - int dialogs_level{ 2 }; // 0: essential, 1: usefull, 2: explanatory + DialogsLevel dialogs_level{ DL_NORMAL }; + + //! Retrieves the dialogs level from the given string + /*! + \see readConfigs() + */ + void setDialogsLevelFromString( const std::string& dialogs_level ); + + //! Returns the dialogs level corresponding to the given number + DialogsLevel dialogsLevelFromInt( const int dialogs_level ); + + + //////////////////// + //// WEB SERVER //// // default web server - unsigned default_ws{ 11 }; + WebServer default_web_server{ WS_APACHE }; + + //! Retrieves the Web Server from the given string + /*! + \see readConfigs() + */ + void setWebServerFromString( const std::string& web_server ); ////////////////// @@ -664,13 +706,13 @@ private: }; // color schemes - std::unordered_map> TB_COLOR_SCHEMES; + const std::unordered_map> tb_colors_schemes; // colors - std::unordered_map COLORS; + const std::unordered_map colors; // fonts - std::unordered_map FONTS; + std::unordered_map fonts; int font_size { 13 }; int font_size_big { 16 }; @@ -698,7 +740,7 @@ private: //! Resolves the given path and returns the canonical path - std::string resolvePath( const std::string& path ) const; + std::string resolvePath( const std::string& path ) const noexcept; //! Returns the parent folder of the given path std::string parentPath( const std::string& path ) const; @@ -710,23 +752,23 @@ private: bool initiating{ true }; - bool db_ok{ true }; - //! Makes the initial integrity checks void makeInitialChecks(); - //! Checks the integrity of the logs data collection database - bool checkDataDB(); - /////////////////// //// DATABASES //// /////////////////// + DatabaseHandler dbHandler; + + // true if a process edited the database and so a backup is required bool db_edited{ false }; + // user-defined configuration: whether to make backups or not bool db_do_backup{ true }; + // user-defined configuration: maximum number of backups to keep unsigned db_backups_number{ 3 }; //! Backs-up the logs data collection database @@ -735,14 +777,37 @@ private: std::string db_data_path; std::string db_hashes_path; - // actions when working on a db + // true when a process is working on a db bool db_working{ false }; //! Called when a member begins/ends performing operations on the database void setDbWorkingState( const bool working ); + //! Weak check on the logs data collection database + /*! + Returns true if the database is free (no other process is running + that may access it for read/write operations) and it exists + \see checkDataDB + */ bool dbUsable(); + // false if the logs data collection database is invalid + bool db_ok{ true }; + + //! Checks the integrity of the logs data collection database + bool checkDataDB(); + + + ////////////////////////////// + //// BLACKLIST / WARNLIST //// + ////////////////////////////// + + Blacklists blacklists; + Warnlists warnlists; + + BlacklistField blacklistFieldFromString( const QString& str ); + WarnlistField warnlistFieldFromString( const QString& str ); + ////////////////// //// CRAPTABS //// @@ -818,9 +883,11 @@ private: void resetStatsCountButtons(); // day-time + LogField getStatsDayLogField() const; std::optional getStatsDayParsedFilter() const; // relational + LogField getStatsRelatLogField( const int filter_num ) const; std::optional getStatsRelatParsedFilter( const int filter_num ) const; // globals @@ -837,7 +904,14 @@ private: void refreshChartsPreview(); - int getIisLogsModule() const; + IISLogsModule getIisLogsModule() const; + + + ////////////////// + //// CRAPPATH //// + ////////////////// + + QSharedPointer crappath; ////////////////// @@ -870,6 +944,13 @@ private: QSharedPointer crapinfo; + /////////////////// + //// CRANGELOG //// + /////////////////// + + QSharedPointer changelog; + + /////////////////// //// CRAPGAMES //// /////////////////// diff --git a/logdoctor/mainwindow.ui b/logdoctor/mainwindow.ui index a0b8d29d..e66e40b5 100644 --- a/logdoctor/mainwindow.ui +++ b/logdoctor/mainwindow.ui @@ -1391,13 +1391,85 @@ li.checked::marker { content: "\2612"; } - - - - Qt::Vertical + + + + QFrame::StyledPanel + + QFrame::Sunken + + + + + + + 13 + + + + Web Server + + + + + + + + 100 + 32 + + + + + 16777215 + 32 + + + + + 13 + + + + Select a Web Server + + + QComboBox::AdjustToContents + + + + Apache2 + + + + + Nginx + + + + + IIS + + + + + + + + + Qt::Horizontal + + + + 82 + 20 + + + + @@ -1588,55 +1660,6 @@ li.checked::marker { content: "\2612"; } - - - - Qt::Horizontal - - - - 82 - 20 - - - - - - - - false - - - - 64 - 88 - - - - - 64 - 88 - - - - - 23 - - - - PointingHandCursor - - - Update the database with current Warning States - - - - 44 - 44 - - - - @@ -1670,77 +1693,18 @@ li.checked::marker { content: "\2612"; } - - + + Qt::Vertical - - - - QFrame::StyledPanel + + + + Qt::Vertical - - QFrame::Sunken - - - - - - - 13 - - - - Web Server - - - - - - - - 100 - 32 - - - - - 16777215 - 32 - - - - - 13 - - - - Select a Web Server - - - QComboBox::AdjustToContents - - - - Apache2 - - - - - Nginx - - - - - IIS - - - - - @@ -1874,10 +1838,21 @@ li.checked::marker { content: "\2612"; } - Referrer + User-agent - The URL which redirected the Client to the requested page + User-agent of the client which made the request + + + AlignLeading|AlignVCenter + + + + + Client + + + IP address of the Client which made the request AlignLeading|AlignVCenter @@ -1896,21 +1871,10 @@ li.checked::marker { content: "\2612"; } - User-agent + Referrer - User-agent of the client which made the request - - - AlignLeading|AlignVCenter - - - - - Client - - - IP address of the Client which made the request + The URL which redirected the Client to the requested page AlignLeading|AlignVCenter @@ -1949,17 +1913,6 @@ li.checked::marker { content: "\2612"; } AlignLeading|AlignVCenter - - - rowid - - - - - - AlignLeading|AlignVCenter - - @@ -2774,7 +2727,7 @@ Use '!', '=','<' or '>' to declare what to use - 14 + 0 0 263 402 @@ -3582,7 +3535,80 @@ Use '!', '=','<' or '>' to declare what to use - + + + + + 0 + 0 + + + + + 192 + 32 + + + + + 16777215 + 32 + + + + + 13 + + + + Select a log field to view + + + + + + + + 13 + + + + Field: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 13 + + + + Filter: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + @@ -3607,7 +3633,7 @@ With numbers, use '!', '=','<' or '>' to declare what to use - + Qt::Vertical @@ -3623,60 +3649,6 @@ With numbers, use '!', '=','<' or '>' to declare what to use - - - - - 13 - - - - Field: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 32 - - - - - 160 - 32 - - - - - 13 - - - - Select a log field to view - - - - - - - - 13 - - - - Filter: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - @@ -4198,9 +4170,15 @@ With numbers, use '!', '=','<' or '>' to declare what to use + + + 0 + 0 + + - 160 + 192 32 @@ -4247,9 +4225,15 @@ With numbers, use '!', '=','<' or '>' to declare what to use + + + 0 + 0 + + - 160 + 192 32 @@ -4573,7 +4557,7 @@ With numbers, use '!', '=','<' or '>' to declare what to use 0 0 - 315 + 181 348 @@ -4929,7 +4913,7 @@ With numbers, use '!', '=','<' or '>' to declare what to use 0 0 - 315 + 164 348 @@ -5184,7 +5168,7 @@ With numbers, use '!', '=','<' or '>' to declare what to use 0 0 - 431 + 151 276 @@ -5449,7 +5433,7 @@ With numbers, use '!', '=','<' or '>' to declare what to use 0 0 - 431 + 181 276 @@ -7405,38 +7389,40 @@ li.checked::marker { content: "\2612"; } - - - - false + + + + Qt::Vertical - + + QSizePolicy::Fixed + + - 32 - 32 + 20 + 8 - - - 32 - 32 - - - - - 16 - - - - PointingHandCursor - - - Apply the current path - - + - - + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 16 + 178 + + + + + + 0 @@ -7450,103 +7436,11 @@ li.checked::marker { content: "\2612"; } - Path where the logs data collection database is located - - - Logs data - - - - - - - true - - - - 32 - 32 - - - - - 32 - 32 - - - - - a Arbei Berry - 16 - - - - The given path doen't exists, or doesn't point to a folder - - - - - - :/icons/icons/err.png - - - true + Insert the base path only, file name excluded - - - false - - - - 32 - 32 - - - - - 32 - 32 - - - - - 16 - - - - PointingHandCursor - - - Apply the current path - - - - - - - - 0 - 32 - - - - - 16777215 - 32 - - - - Path where the used files hashes database is located - - - Used files - - - - true @@ -7583,58 +7477,7 @@ li.checked::marker { content: "\2612"; } - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 8 - - - - - - - - - 0 - 32 - - - - - 16777215 - 32 - - - - Insert the base path only, file name excluded - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 16 - 178 - - - - - + @@ -7661,7 +7504,7 @@ li.checked::marker { content: "\2612"; } - + @@ -7680,6 +7523,209 @@ li.checked::marker { content: "\2612"; } + + + + true + + + + 32 + 32 + + + + + 32 + 32 + + + + + a Arbei Berry + 16 + + + + The given path doen't exists, or doesn't point to a folder + + + + + + :/icons/icons/err.png + + + true + + + + + + + false + + + + 32 + 32 + + + + + 32 + 32 + + + + + 16 + + + + PointingHandCursor + + + Apply the current path + + + + 22 + 22 + + + + + + + + false + + + + 32 + 32 + + + + + 32 + 32 + + + + + 16 + + + + PointingHandCursor + + + Apply the current path + + + + 22 + 22 + + + + + + + + + 32 + 32 + + + + + 32 + 32 + + + + Select the path through a dialog window + + + ... + + + QToolButton::InstantPopup + + + + + + + + 0 + 32 + + + + + 16777215 + 32 + + + + Path where the logs data collection database is located + + + Logs data + + + + + + + + 32 + 32 + + + + + 32 + 32 + + + + Select the path through a dialog window + + + ... + + + QToolButton::InstantPopup + + + + + + + + 0 + 32 + + + + + 16777215 + 32 + + + + Path where the used files hashes database is located + + + Used files + + + @@ -8247,8 +8293,33 @@ li.checked::marker { content: "\2612"; } 184 - + + + + + 32 + 32 + + + + + 32 + 32 + + + + Select the path through a dialog window + + + ... + + + QToolButton::InstantPopup + + + + @@ -8258,7 +8329,7 @@ li.checked::marker { content: "\2612"; } - + true @@ -8295,7 +8366,7 @@ li.checked::marker { content: "\2612"; } - + false @@ -8331,7 +8402,7 @@ li.checked::marker { content: "\2612"; } - + @@ -8511,7 +8582,7 @@ Any field not considered by LogDoctor will appear as 'DISCARDED' 0 0 - 648 + 98 54 @@ -9209,8 +9280,33 @@ Fields marked as 'DISCARDED' got parsed correctly, but are not considered by Log 184 - + + + + + 32 + 32 + + + + + 32 + 32 + + + + Select the path through a dialog window + + + ... + + + QToolButton::InstantPopup + + + + @@ -9220,7 +9316,7 @@ Fields marked as 'DISCARDED' got parsed correctly, but are not considered by Log - + true @@ -9257,7 +9353,7 @@ Fields marked as 'DISCARDED' got parsed correctly, but are not considered by Log - + false @@ -9293,7 +9389,7 @@ Fields marked as 'DISCARDED' got parsed correctly, but are not considered by Log - + @@ -9360,7 +9456,7 @@ Fields marked as 'DISCARDED' got parsed correctly, but are not considered by Log 0 0 - 648 + 98 54 @@ -10191,27 +10287,33 @@ Any field not considered by LogDoctor will appear as 'DISCARDED' 184 - - - + + + - 0 + 32 32 - 16777215 + 32 32 + + Select the path through a dialog window + - Logs folder + ... + + + QToolButton::InstantPopup - + @@ -10221,7 +10323,7 @@ Any field not considered by LogDoctor will appear as 'DISCARDED' - + true @@ -10258,7 +10360,7 @@ Any field not considered by LogDoctor will appear as 'DISCARDED' - + false @@ -10294,6 +10396,25 @@ Any field not considered by LogDoctor will appear as 'DISCARDED' + + + + + 0 + 32 + + + + + 16777215 + 32 + + + + Logs folder + + + @@ -10533,7 +10654,7 @@ Any field not considered by LogDoctor will appear as 'DISCARDED' 0 0 - 648 + 98 54 @@ -11285,6 +11406,7 @@ Fields marked as 'DISCARDED' got parsed correctly, but are not considered by Log Utilities + @@ -11390,6 +11512,9 @@ Fields marked as 'DISCARDED' got parsed correctly, but are not considered by Log Infos + + Show some info about LogDoctor + @@ -11439,6 +11564,14 @@ Fields marked as 'DISCARDED' got parsed correctly, but are not considered by Log Português + + + Changelog + + + Show the changelog + + @@ -11477,7 +11610,6 @@ Fields marked as 'DISCARDED' got parsed correctly, but are not considered by Log button_StatsWarn_Draw table_StatsWarn chart_StatsWarn - button_StatsWarn_Update box_StatsSpeed_WebServer box_StatsSpeed_Year box_StatsSpeed_Month diff --git a/logdoctor/modules/blacklists/blacklists.cpp b/logdoctor/modules/blacklists/blacklists.cpp new file mode 100644 index 00000000..5ed00fc8 --- /dev/null +++ b/logdoctor/modules/blacklists/blacklists.cpp @@ -0,0 +1,35 @@ + +#include "blacklists.h" + +#include "modules/exceptions.h" + + +const Blacklist& Blacklists::getConst( const WebServer ws ) const +{ + switch (ws) { + case WebServer::Apache: + return this->apache; + case WebServer::Nginx: + return this->nginx; + case WebServer::IIS: + return this->iis; + default: + // should be unreachable + throw DoNotCatchException( "Unexpected WebServer", std::to_string(static_cast(ws)) ); + } +} + +Blacklist& Blacklists::get( const WebServer ws ) +{ + switch (ws) { + case WebServer::Apache: + return this->apache; + case WebServer::Nginx: + return this->nginx; + case WebServer::IIS: + return this->iis; + default: + // should be unreachable + throw DoNotCatchException( "Unexpected WebServer", std::to_string(static_cast(ws)) ); + } +} diff --git a/logdoctor/modules/blacklists/blacklists.h b/logdoctor/modules/blacklists/blacklists.h new file mode 100644 index 00000000..1ea6bbf8 --- /dev/null +++ b/logdoctor/modules/blacklists/blacklists.h @@ -0,0 +1,113 @@ +#ifndef LOGDOCTOR__BLACKLISTS__H +#define LOGDOCTOR__BLACKLISTS__H + + +#include "main_lib.h" + +#include "modules/blacklists/modules/blacklist.h" + +#include + + +struct Blacklists final +{ + Blacklist apache; + Blacklist nginx; + Blacklist iis; + + explicit Blacklists() noexcept = default; + + //! Returns whether the requested blacklist is in use + /*! + \throw DoNotCatchException + */ + inline bool isUsed( const WebServer ws, const BlacklistField fld ) + { return get( ws ).isUsed( fld ); } + + //! Sets the requested blacklist in the given in-use condition + /*! + \throw DoNotCatchException + */ + inline void setUsed( const WebServer ws, const BlacklistField fld, const bool used ) + { get( ws ).setUsed( fld, used ); } + + //! Returns a const reference to the requested blacklist + /*! + \throw DoNotCatchException + */ + const Blacklist& getConst( const WebServer ws ) const; + + //! Returns a reference to the requested blacklist + /*! + \throw DoNotCatchException + */ + Blacklist& get( const WebServer ws ); + + //! Returns a reference to the requested blacklist + /*! + \throw DoNotCatchException + */ + inline BlacklistItem& get( const WebServer ws, const BlacklistField fld ) + { return get( ws ).get( fld ); } + + //! Returns a reference to the requested blacklist + /*! + \throw DoNotCatchException + */ + inline std::vector& getList( const WebServer ws, const BlacklistField fld ) + { return get( ws, fld ).list; } + + //! Returns a const reference to the requested blacklist + /*! + \throw DoNotCatchException + */ + inline const std::vector& getListConst( const WebServer ws, const BlacklistField fld ) + { return get( ws, fld ).list; } + + //! Replaces the requested blacklist with the one provided + /*! + \throw BWlistException, DoNotCatchException + */ + inline void setList( const WebServer ws, const BlacklistField fld, const std::vector& list ) + { get( ws, fld ).set( list ); } + + //! Clears the requested blacklist + /*! + \throw BWlistException, DoNotCatchException + */ + inline void clearList( const WebServer ws, const BlacklistField fld ) + { getList( ws, fld ).clear(); } + + //! Adds the provided item to the requested blacklist + /*! + \throw BWlistException, DoNotCatchException + */ + inline void addItem( const WebServer ws, const BlacklistField fld, const std::string& item ) + { get( ws, fld ).add( item ); } + + //! Remove the requested item from the requested blacklist + /*! + \throw BWlistException + */ + inline void removeItem( const WebServer ws, const BlacklistField fld, const std::string& item ) + { get( ws, fld ).remove( item ); } + + //! Moves the requested item one position up in the requested blacklist + /*! + \throw BWlistException + */ + inline int moveUpItem( const WebServer ws, const BlacklistField fld, const std::string& item ) + { return get( ws, fld ).moveUp( item ); } + + //! Moves the requested item one position down in the requested blacklist + /*! + \throw BWlistException + */ + inline int moveDownItem( const WebServer ws, const BlacklistField fld, const std::string& item ) + { return get( ws, fld ).moveDown( item ); } +}; + +Q_DECLARE_METATYPE(Blacklists) + + +#endif // LOGDOCTOR__BLACKLISTS__H diff --git a/logdoctor/modules/blacklists/modules/blacklist.cpp b/logdoctor/modules/blacklists/modules/blacklist.cpp new file mode 100644 index 00000000..74fc063e --- /dev/null +++ b/logdoctor/modules/blacklists/modules/blacklist.cpp @@ -0,0 +1,21 @@ + +#include "blacklist.h" + +#include "modules/exceptions.h" + + +Blacklist::Blacklist() noexcept + : client{ BlacklistField::Client } +{ + +} + +BlacklistItem& Blacklist::get( const BlacklistField field ) +{ + switch (field) { + case BlacklistField::Client: + return this->client; + default: + throw DoNotCatchException( "Unexpected BlacklistField", std::to_string(static_cast(field)) ); + } +} diff --git a/logdoctor/modules/blacklists/modules/blacklist.h b/logdoctor/modules/blacklists/modules/blacklist.h new file mode 100644 index 00000000..76490fb4 --- /dev/null +++ b/logdoctor/modules/blacklists/modules/blacklist.h @@ -0,0 +1,36 @@ +#ifndef LOGDOCTOR__BLACKLISTS__BLACKLIST__H +#define LOGDOCTOR__BLACKLISTS__BLACKLIST__H + + +#include "modules/blacklists/modules/blacklist_item.h" + + +struct Blacklist final +{ + BlacklistItem client; + + explicit Blacklist() noexcept; + + //! Returns a reference to the requested blacklist item + /*! + \throw DoNotCatchException + */ + BlacklistItem& get( const BlacklistField field ); + + //! Returns whether the requested blacklist is in use + /*! + \throw DoNotCatchException + */ + inline bool isUsed( const BlacklistField field ) + { return get( field ).used; } + + //! Sets the requested blacklist in the given in-use condition + /*! + \throw DoNotCatchException + */ + inline void setUsed( const BlacklistField field, const bool used ) + { get( field ).used = used; } +}; + + +#endif // LOGDOCTOR__BLACKLISTS__BLACKLIST__H diff --git a/logdoctor/modules/blacklists/modules/blacklist_item.cpp b/logdoctor/modules/blacklists/modules/blacklist_item.cpp new file mode 100644 index 00000000..6ded6fe7 --- /dev/null +++ b/logdoctor/modules/blacklists/modules/blacklist_item.cpp @@ -0,0 +1,76 @@ + +#include "blacklist_item.h" + +#include "modules/shared.h" + +#include "modules/exceptions.h" + +#include "utilities/bwlists.h" + + +const char* BlacklistItem::fieldName() const +{ + switch (this->field) { + case BlacklistField::Client: + return FIELDS__CLIENT.c_str(); + default: + // should be unreachable + throw DoNotCatchException( "Unexpected BlacklistField", std::to_string(static_cast(this->field)) ); + } +} + +void BlacklistItem::set( const std::vector& new_list ) +{ + this->list.clear(); + this->list.reserve( new_list.size() ); + for ( const std::string& item : new_list ) { + this->add( item ); + } +} + +void BlacklistItem::add( const std::string& item ) +{ + this->list.push_back( this->sanitized( item ) ); +} + +void BlacklistItem::remove( const std::string& item ) +{ + if ( const auto it{ std::find( this->list.cbegin(), this->list.cend(), item ) }; it != this->list.cend() ) { + this->list.erase( it ); + } else { + throw BWlistException( "Failed to remove the item: "+item ); + } +} + +int BlacklistItem::moveUp( const std::string& item ) +{ + if ( auto it{ std::find( std::next(this->list.begin()), this->list.end(), item ) }; it != this->list.end() ) { + const int pos{ static_cast( std::distance(this->list.begin(), it) ) - 1 }; + std::swap( *it, *std::prev(it) ); + return pos; + } else { + throw BWlistException( "Failed to move up the item: "+item ); + } +} + +int BlacklistItem::moveDown( const std::string& item ) +{ + if ( auto it{ std::find( this->list.begin(), std::prev(this->list.end()), item ) }; it != this->list.end() ) { + const int pos{ static_cast( std::distance(this->list.begin(), it) ) + 1 }; + std::swap( *it, *std::next(it) ); + return pos; + } else { + throw BWlistException( "Failed to move down the item: "+item ); + } +} + +std::string BlacklistItem::sanitized(const std::string& item ) const +{ + switch (this->field) { + case BlacklistField::Client: + return BWutils::sanitizedClient( item ); + default: + // should be unreachable + throw DoNotCatchException( "Unexpected BlacklistField", std::to_string(static_cast(this->field)) ); + } +} diff --git a/logdoctor/modules/blacklists/modules/blacklist_item.h b/logdoctor/modules/blacklists/modules/blacklist_item.h new file mode 100644 index 00000000..ea4f3f29 --- /dev/null +++ b/logdoctor/modules/blacklists/modules/blacklist_item.h @@ -0,0 +1,72 @@ +#ifndef LOGDOCTOR__BLACKLISTS__BLACKLISTITEM__H +#define LOGDOCTOR__BLACKLISTS__BLACKLISTITEM__H + + +#include "modules/blacklists/modules/lib.h" + +#include +#include + + +struct BlacklistItem final +{ + bool used; + BlacklistField field; + std::vector list; + + BlacklistItem( const BlacklistField fld ) noexcept + : used{false}, field{fld} {} + BlacklistItem( const bool use, const BlacklistField fld ) noexcept + : used{use}, field{fld} {} + + //! Returns the name of the field to which the list is associated + /*! + The name is translatable + \throw DoNotCatchException + */ + const char* fieldName() const; + + //! Replaces the current list with the one provided + /*! + All the items will be sanitized before actually + becoming part of the list + \throw BWlistException, DoNotCatchException + */ + void set( const std::vector& new_list ); + + //! Adds the provided item to the list + /*! + The item will be sanitized before actually + being added to the list + \throw BWlistException, DoNotCatchException + */ + void add( const std::string& item ); + + //! Remove the requested item from the list + /*! + \throw BWlistException + */ + void remove( const std::string& item ); + + //! Moves the requested item one position up in the list + /*! + \throw BWlistException + */ + int moveUp( const std::string& item ); + + //! Moves the requested item one position down in the list + /*! + \throw BWlistException + */ + int moveDown( const std::string& item ); + +private: + //! Returns a sanitized item + /*! + \throw BWlistException, DoNotCatchException + */ + std::string sanitized( const std::string& item ) const; +}; + + +#endif // LOGDOCTOR__BLACKLISTS__BLACKLISTITEM__H diff --git a/logdoctor/modules/blacklists/modules/lib.h b/logdoctor/modules/blacklists/modules/lib.h new file mode 100644 index 00000000..1ac95591 --- /dev/null +++ b/logdoctor/modules/blacklists/modules/lib.h @@ -0,0 +1,11 @@ +#ifndef LOGDOCTOR__BLACKLISTS__LIB__H +#define LOGDOCTOR__BLACKLISTS__LIB__H + + +enum class BlacklistField +{ + Client +}; + + +#endif // LOGDOCTOR__BLACKLISTS__LIB__H diff --git a/logdoctor/modules/changelog/changelog.cpp b/logdoctor/modules/changelog/changelog.cpp new file mode 100644 index 00000000..37cc9596 --- /dev/null +++ b/logdoctor/modules/changelog/changelog.cpp @@ -0,0 +1,250 @@ + +#include "changelog.h" +#include "ui_changelog.h" + +#include "modules/stylesheets.h" + +#include "modules/exceptions.h" + + +Changelog::Changelog( const QFont& font, const QFont& tb_font, QWidget *parent ) + : QWidget{ parent } + , ui{ new Ui::Changelog } +{ + this->ui->setupUi(this); + + this->setFont( font ); + this->ui->tree_Versions->setFont( font ); + this->ui->text_Logs->setFont( tb_font ); + + this->setStyleSheet( StyleSec::Changelog::getStyleSheet() ); +} + +void Changelog::setTextFont( const QFont& font ) noexcept +{ + this->ui->text_Logs->setFont( font ); +} + +void Changelog::on_tree_Versions_itemClicked(QTreeWidgetItem* item, int index) +{ + Q_UNUSED(index) + + static const QRegularExpression regex{ R"(^v[0-9]{1}\.[0-9]{2,2}$)" }; + + const QString version{ item->text(0) }; + if ( ! regex.match( version ).hasMatch() ) { + return; + } + + QString content{ QStringLiteral(R"(

      %1

        )").arg( version ) }; + + if ( version == "v1.00" ) { + + content.append( R"(
      • )" ); + content.append( tr("C++17") ); + content.append( R"(
      • )" ); + content.append( tr("Qt5") ); + content.append( R"(
      • )" ); + content.append( tr("Build scripts") ); + content.append( R"(
      • )" ); + content.append( tr("Cross-platform compatibility:") ); + content.append( R"(
        • )" ); + content.append( tr("Linux") ); + content.append( R"(
        • )" ); + content.append( tr("BSD") ); + content.append( R"(
        • )" ); + content.append( tr("Windows") ); + content.append( R"(
        • )" ); + content.append( tr("OSX") ); + content.append( R"(
        )" ); + content.append( R"(
      • )" ); + content.append( tr("Statistics:") ); + content.append( R"(
        • )" ); + content.append( tr("Warnings") ); + content.append( R"(
        • )" ); + content.append( tr("Speed") ); + content.append( R"(
        • )" ); + content.append( tr("Counts") ); + content.append( R"(
        • )" ); + content.append( tr("Daytime") ); + content.append( R"(
        • )" ); + content.append( tr("Relational") ); + content.append( R"(
        • )" ); + content.append( tr("Globals") ); + content.append( R"(
        )" ); + content.append( R"(
      • )" ); + content.append( tr("Translations:") ); + content.append( R"(
        • )" ); + content.append( tr("Italian") ); + content.append( R"(
        • )" ); + content.append( tr("Spanish") ); + content.append( R"(
        • )" ); + content.append( tr("French") ); + content.append( R"(
        )" ); + content.append( R"(
      • )" ); + content.append( tr("Tools:") ); + content.append( R"(
        • )" ); + content.append( tr("Block note") ); + content.append( R"(
        )" ); + content.append( R"(
      • )" ); + content.append( tr("Utilities:") ); + content.append( R"(
        • )" ); + content.append( tr("Infos viewer") ); + content.append( R"(
        • )" ); + content.append( tr("Updates checker") ); + content.append( R"(
        )" ); + content.append( R"(
      • )" ); + content.append( tr("Themes:") ); + content.append( R"(
        • )" ); + content.append( tr("Dark") ); + content.append( R"(
        • )" ); + content.append( tr("Light") ); + content.append( R"(
        )" ); + content.append( R"(
      • )" ); // leave the p tag + + } else if ( version == "v1.01" ) { + + content.append( R"(
      • )" ); + content.append( tr("Improvements and fixes") ); + content.append( R"(
      • )" ); + content.append( tr("New themes:") ); + content.append( R"(
        • )" ); + content.append( tr("Ash") ); + content.append( R"(
        • )" ); + content.append( tr("Candy") ); + content.append( R"(
        • )" ); + content.append( tr("Forest").append(" ← ").append(tr("Dark")).append("") ); + content.append( R"(
        • )" ); + content.append( tr("Powder").append(" ← ").append(tr("Light")).append("") ); + content.append( R"(
        )" ); + content.append( R"(
      • )" ); // leave the p tag + + } else if ( version == "v2.00" ) { + + content.append( R"(
      • )" ); + content.append( tr("Improvements and fixes") ); + content.append( R"(
      • )" ); + content.append( tr("Restyled GUI") ); + content.append( R"(
      • )" ); + content.append( tr("Restyled dialogs") ); + content.append( R"(
      • )" ); + content.append( tr("Doxygen documentation") ); + content.append( R"(
      • )" ); + content.append( tr("Mini-Games:") ); + content.append( R"(
        • )" ); + content.append( tr("Criss-cross") ); + content.append( R"(
        • )" ); + content.append( tr("Snake") ); + content.append( R"(
        )" ); + content.append( R"(
      • )" ); // leave the p tag + + } else if ( version == "v2.01" ) { + + content.append( R"(
      • )" ); + content.append( tr("Improvements and fixes") ); + content.append( R"(
      • )" ); + content.append( tr("Changed default paths") ); + content.append( R"(
      • )" ); + content.append( tr("New game modes for Snake") ); + content.append( R"(
        • )" ); + content.append( tr("Hunt") ); + content.append( R"(
        • )" ); + content.append( tr("Battle") ); + content.append( R"(
        )" ); + content.append( R"(
      • )" ); // leave the p tag + + } else if ( version == "v2.02" ) { + + content.append( R"(
      • )" ); + content.append( tr("Improvements and fixes") ); + content.append( R"(
      • )" ); + content.append( tr("New translations:") ); + content.append( R"(
        • )" ); + content.append( tr("Japanese") ); + content.append( R"(
        • )" ); + content.append( tr("Portuguese") ); + content.append( R"(
        )" ); + content.append( R"(
      • )" ); // leave the p tag + + } else if ( version == "v2.03" ) { + + content.append( R"(
      • )" ); + content.append( tr("Improvements and fixes") ); + content.append( R"(
      • )" ); // leave the p tag + + } else if ( version == "v2.04" ) { + + content.append( R"(
      • )" ); + content.append( tr("Code improvements") ); + content.append( R"(
      • )" ); + content.append( tr("Performance improvements") ); + content.append( R"(
      • )" ); + content.append( tr("Added tests suite:") ); + content.append( R"(
        • )" ); + content.append( tr("white box tests") ); + content.append( R"(
        )" ); + content.append( R"(
      • )" ); + content.append( tr("Customized charts themes") ); + content.append( R"(
      • )" ); // leave the p tag + + } else if ( version == "v2.05" ) { + + content.append( R"(
      • )" ); + content.append( tr("Fixes") ); + content.append( R"(
      • )" ); + content.append( tr("Code improvements") ); + content.append( R"(
      • )" ); + content.append( tr("Performance improvements") ); + content.append( R"(
      • )" ); + content.append( tr("Tests improvements") ); + content.append( R"(
      • )" ); + content.append( tr("Docker support") ); + content.append( R"(
      • )" ); // leave the p tag + + } else if ( version == "v3.00" ) { + + content.append( R"(
      • )" ); + content.append( tr("Upgrade to C++20") ); + content.append( R"(
      • )" ); + content.append( tr("Upgrade to Qt6") ); + content.append( R"(
      • )" ); + content.append( tr("Restyled themes") ); + content.append( R"(
      • )" ); + content.append( tr("Redesigned configs section") ); + content.append( R"(
      • )" ); + content.append( tr("Code improvements") ); + content.append( R"(
      • )" ); + content.append( tr("Tests improvements") ); + content.append( R"(
      • )" ); + content.append( tr("Fixes") ); + content.append( R"(
      • )" ); // leave the p tag + + } else if ( version == "v4.00" ) { + + content.append( R"(
      • )" ); + content.append( tr("Fixes") ); + content.append( R"(
      • )" ); + content.append( tr("Code improvements") ); + content.append( R"(
      • )" ); + content.append( tr("Performance improvements") ); + content.append( R"(
      • )" ); + content.append( tr("Stability improvements") ); + content.append( R"(
      • )" ); + content.append( tr("Tests improvements") ); + content.append( R"(
      • )" ); + content.append( tr("Generating warnings dinamically") ); + content.append( R"(
      • )" ); + content.append( tr("New tool:") ); + content.append( R"(
        • )" ); + content.append( tr("Changelog") ); + content.append( R"(
        )" ); + content.append( R"(
      • )" ); // leave the p tag + + } else { + throw DoNotCatchException( "Unexpected changelog version", version.toStdString() ); + } + + content.append( QStringLiteral("
      ") ); + + this->ui->text_Logs->setText( content ); +} diff --git a/logdoctor/modules/changelog/changelog.h b/logdoctor/modules/changelog/changelog.h new file mode 100644 index 00000000..e4568e2b --- /dev/null +++ b/logdoctor/modules/changelog/changelog.h @@ -0,0 +1,38 @@ +#ifndef LOGDOCTOR__CHANGELOG_H +#define LOGDOCTOR__CHANGELOG_H + + +#include + +class QTreeWidgetItem; + + +namespace Ui { + class Changelog; +} + + +//! Changelog +/*! + Displays information about the changes between the various versions of LogDoctor +*/ +class Changelog : public QWidget +{ + Q_OBJECT + +public: + explicit Changelog( const QFont& font, const QFont& tb_font, QWidget* parent=nullptr ); + Q_DISABLE_COPY_MOVE(Changelog) + + //! Sets the given font for the changelog info + void setTextFont( const QFont& font ) noexcept; + +private slots: + void on_tree_Versions_itemClicked(QTreeWidgetItem* item, int index); + +private: + QSharedPointer ui; +}; + + +#endif // LOGDOCTOR__CHANGELOG_H diff --git a/logdoctor/modules/changelog/changelog.ui b/logdoctor/modules/changelog/changelog.ui new file mode 100644 index 00000000..89548ee3 --- /dev/null +++ b/logdoctor/modules/changelog/changelog.ui @@ -0,0 +1,230 @@ + + + Changelog + + + + 0 + 0 + 600 + 600 + + + + + 300 + 300 + + + + LogDoctor - Changelog + + + + :/logo/logo/logdoctor.svg:/logo/logo/logdoctor.svg + + + + + + + 8 + + + 16 + + + 16 + + + 16 + + + 16 + + + + + + 180 + 0 + + + + + 180 + 16777215 + + + + QAbstractItemView::NoEditTriggers + + + false + + + true + + + + Versions + + + + + Version 4 + + + + true + + + + + v4.00 + + + + + + Version 3 + + + + true + + + + ItemIsSelectable|ItemIsEnabled + + + + v3.00 + + + ItemIsSelectable|ItemIsEnabled + + + + + + Version 2 + + + + true + + + + ItemIsSelectable|ItemIsEnabled + + + + v2.05 + + + ItemIsSelectable|ItemIsEnabled + + + + + v2.04 + + + ItemIsSelectable|ItemIsEnabled + + + + + v2.03 + + + ItemIsSelectable|ItemIsEnabled + + + + + v2.02 + + + ItemIsSelectable|ItemIsEnabled + + + + + v2.01 + + + ItemIsSelectable|ItemIsEnabled + + + + + v2.00 + + + ItemIsSelectable|ItemIsEnabled + + + + + + Version 1 + + + + true + + + + ItemIsSelectable|ItemIsEnabled + + + + v1.01 + + + ItemIsSelectable|ItemIsEnabled + + + + + v1.00 + + + ItemIsSelectable|ItemIsEnabled + + + + + + + + + QTextEdit::NoWrap + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css"> +p, li { white-space: pre-wrap; } +hr { height: 1px; border-width: 0; } +li.unchecked::marker { content: "\2610"; } +li.checked::marker { content: "\2612"; } +</style></head><body style=" font-family:'Noto Sans'; font-size:13pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + + + + + diff --git a/logdoctor/modules/changelog/modules/stylesheets.cpp b/logdoctor/modules/changelog/modules/stylesheets.cpp new file mode 100644 index 00000000..f518b4df --- /dev/null +++ b/logdoctor/modules/changelog/modules/stylesheets.cpp @@ -0,0 +1,227 @@ + +#include "stylesheets.h" + +#include "globals/global_configs.h" + +#include "modules/exceptions.h" + +#include +#include + +#include + + +namespace /*private*/ +{ + +enum StyleId : uint32_t { + TEXT, + WINDOW_PRIMARY, + VERSIONS_TREE_BASE, + VERSIONS_TREE_BASE_SELECTION, + TEXTBROWSER_TEXT, + TEXTBROWSER_BASE, + TEXTBROWSER_BORDER, + TEXTBROWSER_TEXT_SELECTION, + TEXTBROWSER_BASE_SELECTION, + SCROLLBAR_BASE, + SCROLLBAR_HANDLER, + SCROLLBAR_CONTROLS, + TABLES_HEADER, + TABLES_HEADER_HOVER, + TABLES_DECO +}; + +using StyleMap = std::unordered_map; + +StyleMap makeStyleMap() +{ + switch ( GlobalConfigs::window_theme ) { + case WindowTheme::Light: + return { + {TEXT, + "rgb( 22, 11, 0 )"}, + {WINDOW_PRIMARY, + "rgb( 230, 230, 230 )"}, + {VERSIONS_TREE_BASE, + "rgb( 245, 245, 247 )"}, + {VERSIONS_TREE_BASE_SELECTION, + "rgb( 220, 220, 222 )"}, + {TEXTBROWSER_TEXT, + "rgb( 88, 80, 80 )"}, + {TEXTBROWSER_BASE, + "rgb( 250, 250, 255 )"}, + {TEXTBROWSER_BORDER, + "rgb( 236, 236, 236 )"}, + {TEXTBROWSER_TEXT_SELECTION, + "rgb( 68, 60, 60 )"}, + {TEXTBROWSER_BASE_SELECTION, + "rgb( 207, 201, 195 )"}, + {SCROLLBAR_BASE, + "transparent"}, + {SCROLLBAR_HANDLER, + "rgb( 40, 185, 40 )"}, + {SCROLLBAR_CONTROLS, + "transparent"}, + {TABLES_HEADER, + "rgb( 220, 220, 220 )"}, + {TABLES_HEADER_HOVER, + "rgb( 201, 239, 255 )"}, + {TABLES_DECO, + "rgb( 99, 188, 255 )"} + }; + case WindowTheme::Dark: + return { + {TEXT, + "rgb( 248, 248, 248 )"}, + {WINDOW_PRIMARY, + "rgb( 27, 30, 33 )"}, + {VERSIONS_TREE_BASE, + "rgb( 20, 21, 22 )"}, + {VERSIONS_TREE_BASE_SELECTION, + "rgb( 40, 42, 44 )"}, + {TEXTBROWSER_TEXT, + "rgb( 210, 210, 210 )"}, + {TEXTBROWSER_BASE, + "rgb( 13, 14, 15 )"}, + {TEXTBROWSER_BORDER, + "rgb( 32, 32, 32 )"}, + {TEXTBROWSER_TEXT_SELECTION, + "rgb( 248, 248, 248 )"}, + {TEXTBROWSER_BASE_SELECTION, + "rgb( 64, 64, 64 )"}, + {SCROLLBAR_BASE, + "transparent"}, + {SCROLLBAR_HANDLER, + "rgb( 69, 177, 255 )"}, + {SCROLLBAR_CONTROLS, + "transparent"}, + {TABLES_HEADER, + "rgb( 50, 52, 50 )"}, + {TABLES_HEADER_HOVER, + "rgb( 43, 82, 43 )"}, + {TABLES_DECO, + "rgb( 10, 155, 10 )"} + }; + default: + throw DoNotCatchException( "Unexpected WindowTheme", std::to_string(static_cast(GlobalConfigs::window_theme)) ); + } +} + +} //namespace (private) + + +namespace StyleSec::Changelog +{ + +QString getStyleSheet() +{ + if ( GlobalConfigs::window_theme == WindowTheme::Native ) { + return ""; + } + const StyleMap style{ makeStyleMap() }; + return + "QWidget#Changelog {" + " color: "% style.at(TEXT) %";" + " background-color: "% style.at(WINDOW_PRIMARY) %";" + "}" + "QFrame {" + " border: 0px;" + " background-color: transparent;" + "}" + // versions + "QTreeView {" + " border-radius: 8px;" + " color: "% style.at(TEXT) %";" + " background-color: "% style.at(VERSIONS_TREE_BASE) %";" + " selection-color: "% style.at(TEXT) %";" + " selection-background-color: "% style.at(VERSIONS_TREE_BASE_SELECTION) %";" + "}" + "QTreeView QScrollBar::sub-line:vertical {" + " margin-top: -12px;" + " border: 0px;" + " border-top-right-radius: 8px;" + " background-color: transparent;" + "}" + "QTreeView QScrollBar::handle:vertical," + "QTreeView QScrollBar::handle:vertical:hover {" + " margin-top: 32px;" + "}" + "QTreeView QScrollBar::sub-line:vertical," + "QTableView QScrollBar::sub-line:vertical {" + " margin-top: -12px;" + " height: 24px;" + " border: 0px;" + " border-top-right-radius: 8px;" + " border-bottom: 2px solid "% style.at(TABLES_DECO) %";" + " background-color: "% style.at(TABLES_HEADER) %";" + "}" + // text browser + "QTextBrowser {" + " border: 4px solid "% style.at(TEXTBROWSER_BORDER) %";" + " border-radius: 8px;" + " color: "% style.at(TEXTBROWSER_TEXT) %";" + " background-color: "% style.at(TEXTBROWSER_BASE) %";" + " selection-color: "% style.at(TEXTBROWSER_TEXT_SELECTION) %";" + " selection-background-color: "% style.at(TEXTBROWSER_BASE_SELECTION) %";" + "}" + "QTextBrowser QScrollBar::handle:vertical {" + " padding: 12px;" + "}" + // scroll-bars + "QScrollBar {" + " border: 0px solid transparent;" + "}" + "QScrollBar:horizontal {" + " height: 12px;" + " background-color: "% style.at(SCROLLBAR_BASE) %";" + "}" + "QScrollBar::handle:horizontal {" + " min-width: 16px;" + " margin: 5px 0px 5px 0px;" + " background-color: "% style.at(SCROLLBAR_HANDLER) %";" + "}" + "QScrollBar::handle:horizontal:hover {" + " margin: 4px 0px 4px 0px;" + " border-radius: 2px;" + "}" + "QScrollBar:vertical {" + " width: 12px;" + " background-color: "% style.at(SCROLLBAR_BASE) %";" + "}" + "QScrollBar::handle:vertical {" + " min-width: 16px;" + " margin: 0px 5px 0px 5px;" + " background-color: "% style.at(SCROLLBAR_HANDLER) %";" + "}" + "QScrollBar::handle:vertical:hover {" + " margin: 0px 4px 0px 4px;" + " border-radius: 2px;" + "}" + "QScrollBar::add-line," + "QScrollBar::sub-line," + "QScrollBar::add-pae," + "QScrollBar::sub-pae," + "QScrollBar::up-arrow," + "QScrollBar::down-arrow," + "QScrollBar::left-arrow," + "QScrollBar::right-arrow {" + " border: 0px;" + " background-color: "% style.at(SCROLLBAR_CONTROLS) %";" + "}" + // tree header + "QHeaderView::section {" + " height: 24px;" + " padding-left: 6px;" + " border-top-left-radius: 6px;" + " border-top-right-radius: 6px;" + " color: "% style.at(TEXT) %";" + " border-bottom: 2px solid "% style.at(TABLES_DECO) %";" + " background-color: "% style.at(TABLES_HEADER) %";" + "}" + "QHeaderView::section::hover {" + " background-color: "% style.at(TABLES_HEADER_HOVER) %";" + "}"; +} + +} // namespace StyleSec::Changelog diff --git a/logdoctor/modules/changelog/modules/stylesheets.h b/logdoctor/modules/changelog/modules/stylesheets.h new file mode 100644 index 00000000..c5c44962 --- /dev/null +++ b/logdoctor/modules/changelog/modules/stylesheets.h @@ -0,0 +1,20 @@ +#ifndef LOGDOCTOR__CHANGELOG__STYLESHEETS_H +#define LOGDOCTOR__CHANGELOG__STYLESHEETS_H + + +class QString; + + +namespace StyleSec::Changelog +{ + +//! Returns the proper style sheet +/*! + \throw DoNotCatchException +*/ +QString getStyleSheet(); + +} // namespace StyleSec::Changelog + + +#endif // LOGDOCTOR__CHANGELOG__STYLESHEETS_H diff --git a/logdoctor/modules/craphelp/craphelp.cpp b/logdoctor/modules/craphelp/craphelp.cpp index 2f5545b1..dfa3722d 100644 --- a/logdoctor/modules/craphelp/craphelp.cpp +++ b/logdoctor/modules/craphelp/craphelp.cpp @@ -2,6 +2,8 @@ #include "craphelp.h" #include "ui_craphelp.h" +#include "globals/global_configs.h" + #include "modules/exceptions.h" #include "utilities/io.h" @@ -15,11 +17,10 @@ Craphelp::Craphelp(QWidget *parent) } -std::unordered_map Craphelp::getColorScheme( const int scheme_id ) const +std::unordered_map Craphelp::getColorScheme( const ColorsScheme scheme_id ) const { switch ( scheme_id ) { - case 0: - // none + case ColorsScheme::None: return { {"background", ""}, {"text", ""}, @@ -27,8 +28,7 @@ std::unordered_map Craphelp::getColorScheme( const int sch {"h3", ""}, {"code", ""}, {"link", ""} }; - case 1: - // breeze + case ColorsScheme::Breeze: return { {"background", "#ffffff"}, {"text", "#1f1c1b"}, @@ -38,8 +38,7 @@ std::unordered_map Craphelp::getColorScheme( const int sch {"code", "#644a9b"}, {"link", "#d24f4f"} }; - case 2: - // monokai + case ColorsScheme::Monokai: return { {"background", "#272822"}, {"text", "#d1d1cb"}, @@ -49,8 +48,7 @@ std::unordered_map Craphelp::getColorScheme( const int sch {"code", "#57adbc"}, {"link", "#f92672"} }; - case 3: - // radical + case ColorsScheme::Radical: return { {"background", "#141322"}, {"text", "#a8c0c2"}, @@ -62,18 +60,18 @@ std::unordered_map Craphelp::getColorScheme( const int sch default: // wrong, shouldn't be here - throw GenericException( "Unexpected ColorScheme ID: "+std::to_string( scheme_id ), true ); // leave un-catched + throw DoNotCatchException( "Unexpected ColorScheme", std::to_string(static_cast(scheme_id)) ); } } -void Craphelp::helpLogsFormat( const std::string& path, const QFont& font, const int color_scheme_id ) const +void Craphelp::helpLogsFormat( const std::string& path, const QFont& font, const ColorsScheme colors_scheme_id ) const noexcept { - std::unordered_map color_scheme{ this->getColorScheme( color_scheme_id ) }; + std::unordered_map colors_scheme{ this->getColorScheme( colors_scheme_id ) }; std::string aux; IOutils::readFile( path, aux ); QString content; - if ( color_scheme_id == 0 ) { + if ( colors_scheme_id == ColorsScheme::None ) { // remove the style for the colors while (true) { const size_t start{ aux.find( "background-color:" ) }; @@ -96,13 +94,13 @@ void Craphelp::helpLogsFormat( const std::string& path, const QFont& font, const } else { // replace with colors content = QString::fromStdString( aux ) - .replace( "$BG$", color_scheme.at("background") ) - .replace( "$TEXT$", color_scheme.at("text") ) - .replace( "$IT$", color_scheme.at("italic") ) - .replace( "$H1$", color_scheme.at("h1") ) - .replace( "$H3$", color_scheme.at("h3") ) - .replace( "$CODE$", color_scheme.at("code") ) - .replace( "$LINK$", color_scheme.at("link") ); + .replace( "$BG$", colors_scheme.at("background") ) + .replace( "$TEXT$", colors_scheme.at("text") ) + .replace( "$IT$", colors_scheme.at("italic") ) + .replace( "$H1$", colors_scheme.at("h1") ) + .replace( "$H3$", colors_scheme.at("h3") ) + .replace( "$CODE$", colors_scheme.at("code") ) + .replace( "$LINK$", colors_scheme.at("link") ); } // show the content this->ui->helpBrowser->setText( content ); @@ -111,9 +109,9 @@ void Craphelp::helpLogsFormat( const std::string& path, const QFont& font, const } -void Craphelp::helpLogsFormatDefault( std::string_view file_name, const QFont& font, const int color_scheme_id ) const +void Craphelp::helpLogsFormatDefault( std::string_view file_name, const QFont& font, const ColorsScheme colors_scheme_id ) const noexcept { - std::unordered_map color_scheme = this->getColorScheme( color_scheme_id ); + std::unordered_map colors_scheme = this->getColorScheme( colors_scheme_id ); std::string aux; if ( file_name == "apache_format" ) { this->defaultApacheFormat( aux ); @@ -123,7 +121,7 @@ void Craphelp::helpLogsFormatDefault( std::string_view file_name, const QFont& f this->defaultIisFormat( aux ); } QString content; - if ( color_scheme_id == 0 ) { + if ( colors_scheme_id == ColorsScheme::None ) { // remove the style for the colors while (true) { const size_t start{ aux.find( "background-color:" ) }; @@ -146,13 +144,13 @@ void Craphelp::helpLogsFormatDefault( std::string_view file_name, const QFont& f } else { // replace with colors content = QString::fromStdString( aux ) - .replace( "$BG$", color_scheme.at("background") ) - .replace( "$TEXT$", color_scheme.at("text") ) - .replace( "$IT$", color_scheme.at("italic") ) - .replace( "$H1$", color_scheme.at("h1") ) - .replace( "$H3$", color_scheme.at("h3") ) - .replace( "$CODE$", color_scheme.at("code") ) - .replace( "$LINK$", color_scheme.at("link") ); + .replace( "$BG$", colors_scheme.at("background") ) + .replace( "$TEXT$", colors_scheme.at("text") ) + .replace( "$IT$", colors_scheme.at("italic") ) + .replace( "$H1$", colors_scheme.at("h1") ) + .replace( "$H3$", colors_scheme.at("h3") ) + .replace( "$CODE$", colors_scheme.at("code") ) + .replace( "$LINK$", colors_scheme.at("link") ); } // show the content this->ui->helpBrowser->setText( content ); @@ -162,7 +160,7 @@ void Craphelp::helpLogsFormatDefault( std::string_view file_name, const QFont& f -void Craphelp::defaultApacheFormat( std::string& str ) const +void Craphelp::defaultApacheFormat( std::string& str ) const noexcept { str.append( "" @@ -420,7 +418,7 @@ void Craphelp::defaultApacheFormat( std::string& str ) const ); } -void Craphelp::defaultNginxFormat( std::string& str ) const +void Craphelp::defaultNginxFormat( std::string& str ) const noexcept { str.append( "" @@ -618,7 +616,7 @@ void Craphelp::defaultNginxFormat( std::string& str ) const ); } -void Craphelp::defaultIisFormat( std::string& str ) const +void Craphelp::defaultIisFormat( std::string& str ) const noexcept { str.append( "" diff --git a/logdoctor/modules/craphelp/craphelp.h b/logdoctor/modules/craphelp/craphelp.h index 287f82ca..463fe6eb 100644 --- a/logdoctor/modules/craphelp/craphelp.h +++ b/logdoctor/modules/craphelp/craphelp.h @@ -7,6 +7,9 @@ #include +enum class ColorsScheme : unsigned char; + + namespace Ui { class Craphelp; } @@ -16,20 +19,22 @@ namespace Ui { /*! Displays an help window */ -class Craphelp : public QWidget +class Craphelp final : public QWidget { Q_OBJECT public: explicit Craphelp( QWidget* parent=nullptr ); + Q_DISABLE_COPY_MOVE(Craphelp) //! Provides help about log formats /*! \param path The path of the file resource to be displayed \param font The font to be used - \param color_scheme_id The ID of the color-scheme to be used + \param colors_scheme_id The ID of the color-scheme to be used + \throw DoNotCatchException */ - void helpLogsFormat( const std::string& path, const QFont& font, const int color_scheme_id ) const; + void helpLogsFormat( const std::string& path, const QFont& font, const ColorsScheme colors_scheme_id ) const noexcept; //! Provides help about log formats /*! @@ -37,18 +42,20 @@ public: for the currently selected locale was not found or unreadable \param file_name The file that was supposed to be shown \param font The font to be used - \param color_scheme_id The ID of the color-scheme to be used + \param colors_scheme_id The ID of the color-scheme to be used + \throw DoNotCatchException */ - void helpLogsFormatDefault( std::string_view file_name, const QFont& font, const int color_scheme_id ) const; + void helpLogsFormatDefault( std::string_view file_name, const QFont& font, const ColorsScheme colors_scheme_id ) const noexcept; private: QSharedPointer ui; - std::unordered_map getColorScheme( const int scheme_id ) const; + // \throw DoNotCatchException + std::unordered_map getColorScheme( const ColorsScheme scheme_id ) const; - void defaultApacheFormat( std::string& str ) const; - void defaultNginxFormat( std::string& str ) const; - void defaultIisFormat( std::string& str ) const; + void defaultApacheFormat( std::string& str ) const noexcept; + void defaultNginxFormat( std::string& str ) const noexcept; + void defaultIisFormat( std::string& str ) const noexcept; }; diff --git a/logdoctor/modules/crapinfo/crapinfo.cpp b/logdoctor/modules/crapinfo/crapinfo.cpp index 8af529c1..8afe34c8 100644 --- a/logdoctor/modules/crapinfo/crapinfo.cpp +++ b/logdoctor/modules/crapinfo/crapinfo.cpp @@ -13,9 +13,7 @@ Crapinfo::Crapinfo( const QString& version, const QString& exec_path, const QStr { ui->setupUi(this); - QString stylesheet; - StyleSec::Crapinfo::getStyleSheet( stylesheet ); - this->setStyleSheet( stylesheet ); + this->setStyleSheet( StyleSec::Crapinfo::getStyleSheet() ); // fonts const QString ff{ QFontDatabase::applicationFontFamilies( diff --git a/logdoctor/modules/crapinfo/crapinfo.h b/logdoctor/modules/crapinfo/crapinfo.h index 723f8339..77c1d10d 100644 --- a/logdoctor/modules/crapinfo/crapinfo.h +++ b/logdoctor/modules/crapinfo/crapinfo.h @@ -14,13 +14,12 @@ namespace Ui { /*! Displays informations */ -class Crapinfo : public QWidget +class Crapinfo final : public QWidget { Q_OBJECT public: - //! Class constructor /*! \param version The version of LogDoctor actually running \param exec_path The path of the executable @@ -29,6 +28,7 @@ public: \param parent The parent Widget */ explicit Crapinfo( const QString& version, const QString& exec_path, const QString& conf_path, const QString& logdoc_path, QWidget* parent=nullptr ); + Q_DISABLE_COPY_MOVE(Crapinfo) private: QSharedPointer ui; diff --git a/logdoctor/modules/crapinfo/modules/stylesheets.cpp b/logdoctor/modules/crapinfo/modules/stylesheets.cpp index a1047c70..1e4d2114 100644 --- a/logdoctor/modules/crapinfo/modules/stylesheets.cpp +++ b/logdoctor/modules/crapinfo/modules/stylesheets.cpp @@ -6,6 +6,7 @@ #include "modules/exceptions.h" #include +#include #include @@ -36,7 +37,7 @@ enum StyleId : uint32_t { using StyleMap = std::unordered_map; -const StyleMap makeStyleMap() +StyleMap makeStyleMap() { switch ( GlobalConfigs::window_theme ) { case WindowTheme::Light: @@ -78,7 +79,6 @@ const StyleMap makeStyleMap() {SEPARATORS, "rgb( 88, 80, 80 )"} }; - break; case WindowTheme::Dark: return { {TEXT, @@ -118,127 +118,126 @@ const StyleMap makeStyleMap() {SEPARATORS, "rgb( 96, 96, 96 )"} }; - break; default: - throw GenericException( "Unexpected WindowTheme: "+std::to_string(static_cast(GlobalConfigs::window_theme)), true ); - break; + throw DoNotCatchException( "Unexpected WindowTheme", std::to_string(static_cast(GlobalConfigs::window_theme)) ); } } -} // namespace (private) +} //namespace (private) namespace StyleSec::Crapinfo { -void getStyleSheet( QString& stylesheet ) +QString getStyleSheet() { - if ( GlobalConfigs::window_theme != WindowTheme::Native ) { - const StyleMap style{ makeStyleMap() }; - stylesheet = - "QWidget#Crapinfo {" - " color: "+style.at(TEXT)+";" - " background-color: "+style.at(WINDOW_SECONDARY)+";" - "}" - "QFrame {" - " border: 0px;" - " background-color: transparent;" - "}" - "QLabel {" - " color: "+style.at(TEXT)+";" - "}" - "QPushButton:pressed {" - " background-color: "+style.at(WINDOW_PRIMARY)+";" - "}" - "QWidget#page_LogDoc," - "QWidget#page_Paths," - "QWidget#scrollAreaContents_LogDoc {" - " border: 1px solid "+style.at(BORDER)+";" - " border-top: 0px;" - " border-radius: 4px;" - " border-top-left-radius: 0px;" - " border-top-right-radius: 0px;" - " background-color: "+style.at(WINDOW_PRIMARY)+";" - "}" - "QToolBox::tab {" - " border: 1px solid "+style.at(BORDER_UNSELECTED)+";" - " border-radius: 8px;" - " color: "+style.at(TEXT_UNSELECTED)+";" - " background-color: "+style.at(TOOLBOX_TAB_BASE)+";" - "}" - "QToolBox::tab:!selected:hover {" - " border-color: "+style.at(BORDER_HOVER)+";" - " color: "+style.at(TEXT)+";" - " background-color: "+style.at(TOOLBOX_TAB_BASE)+";" - "}" - "QToolBox::tab:selected {" - " border-color: "+style.at(BORDER)+";" - " border-top: 4px solid "+style.at(BORDER)+";" - " border-bottom: 0px;" - " border-bottom-left-radius: 0px;" - " border-bottom-right-radius: 0px;" - " color: "+style.at(TEXT)+";" - " background-color: "+style.at(TOOLBOX_TAB_BASE_SELECTED)+";" - "}" - "QScrollBar {" - " border: 0px solid transparent;" - "}" - "QScrollBar:horizontal {" - " height: 12px;" - " background-color: "+style.at(SCROLLBAR_BASE)+";" - "}" - "QScrollBar::handle:horizontal {" - " min-width: 16px;" - " margin: 5px 0px 5px 0px;" - " background-color: "+style.at(SCROLLBAR_HANDLER)+";" - "}" - "QScrollBar::handle:horizontal:hover {" - " margin: 4px 0px 4px 0px;" - " border-radius: 2px;" - "}" - "QScrollBar:vertical {" - " width: 12px;" - " background-color: "+style.at(SCROLLBAR_BASE)+";" - "}" - "QScrollBar::handle:vertical {" - " min-width: 16px;" - " margin: 0px 5px 0px 5px;" - " background-color: "+style.at(SCROLLBAR_HANDLER)+";" - "}" - "QScrollBar::handle:vertical:hover {" - " margin: 0px 4px 0px 4px;" - " border-radius: 2px;" - "}" - "QScrollBar::add-line," - "QScrollBar::sub-line," - "QScrollBar::add-pae," - "QScrollBar::sub-pae," - "QScrollBar::up-arrow," - "QScrollBar::down-arrow," - "QScrollBar::left-arrow," - "QScrollBar::right-arrow {" - " border: 0px;" - " background-color: "+style.at(SCROLLBAR_CONTROLS)+";" - "}" - "QLineEdit {" - " border-radius: 4px;" - " color: "+style.at(LINEDIT_TEXT)+";" - " selection-color: "+style.at(LINEDIT_TEXT_SELECTION)+";" - " background-color: "+style.at(LINEDIT_BASE)+";" - " selection-background-color: "+style.at(LINEDIT_BASE_SELECTION)+";" - "}" - "QWidget#scrollAreaContents_Paths_Executable," - "QWidget#scrollAreaContents_Paths_ConfigFile," - "QWidget#scrollAreaContents_Paths_AppData {" - " border-radius: 8px;" - " background-color: "+style.at(PATHS_FRAME_BASE)+";" - "}" - "QFrame#gline_Version {" - " border: 1px solid "+style.at(WINDOW_PRIMARY)+";" - " margin: 2px 0px 3px 0px;" - " background-color: "+style.at(SEPARATORS)+";" - "}"; + if ( GlobalConfigs::window_theme == WindowTheme::Native ) { + return ""; } + const StyleMap style{ makeStyleMap() }; + return + "QWidget#Crapinfo {" + " color: "% style.at(TEXT) %";" + " background-color: "% style.at(WINDOW_SECONDARY) %";" + "}" + "QFrame {" + " border: 0px;" + " background-color: transparent;" + "}" + "QLabel {" + " color: "% style.at(TEXT) %";" + "}" + "QPushButton:pressed {" + " background-color: "% style.at(WINDOW_PRIMARY) %";" + "}" + "QWidget#page_LogDoc," + "QWidget#page_Paths," + "QWidget#scrollAreaContents_LogDoc {" + " border: 1px solid "% style.at(BORDER) %";" + " border-top: 0px;" + " border-radius: 4px;" + " border-top-left-radius: 0px;" + " border-top-right-radius: 0px;" + " background-color: "% style.at(WINDOW_PRIMARY) %";" + "}" + "QToolBox::tab {" + " border: 1px solid "% style.at(BORDER_UNSELECTED) %";" + " border-radius: 8px;" + " color: "% style.at(TEXT_UNSELECTED) %";" + " background-color: "% style.at(TOOLBOX_TAB_BASE) %";" + "}" + "QToolBox::tab:!selected:hover {" + " border-color: "% style.at(BORDER_HOVER) %";" + " color: "% style.at(TEXT) %";" + " background-color: "% style.at(TOOLBOX_TAB_BASE) %";" + "}" + "QToolBox::tab:selected {" + " border-color: "% style.at(BORDER) %";" + " border-top: 4px solid "% style.at(BORDER) %";" + " border-bottom: 0px;" + " border-bottom-left-radius: 0px;" + " border-bottom-right-radius: 0px;" + " color: "% style.at(TEXT) %";" + " background-color: "% style.at(TOOLBOX_TAB_BASE_SELECTED) %";" + "}" + "QScrollBar {" + " border: 0px solid transparent;" + "}" + "QScrollBar:horizontal {" + " height: 12px;" + " background-color: "% style.at(SCROLLBAR_BASE) %";" + "}" + "QScrollBar::handle:horizontal {" + " min-width: 16px;" + " margin: 5px 0px 5px 0px;" + " background-color: "% style.at(SCROLLBAR_HANDLER) %";" + "}" + "QScrollBar::handle:horizontal:hover {" + " margin: 4px 0px 4px 0px;" + " border-radius: 2px;" + "}" + "QScrollBar:vertical {" + " width: 12px;" + " background-color: "% style.at(SCROLLBAR_BASE) %";" + "}" + "QScrollBar::handle:vertical {" + " min-width: 16px;" + " margin: 0px 5px 0px 5px;" + " background-color: "% style.at(SCROLLBAR_HANDLER) %";" + "}" + "QScrollBar::handle:vertical:hover {" + " margin: 0px 4px 0px 4px;" + " border-radius: 2px;" + "}" + "QScrollBar::add-line," + "QScrollBar::sub-line," + "QScrollBar::add-pae," + "QScrollBar::sub-pae," + "QScrollBar::up-arrow," + "QScrollBar::down-arrow," + "QScrollBar::left-arrow," + "QScrollBar::right-arrow {" + " border: 0px;" + " background-color: "% style.at(SCROLLBAR_CONTROLS) %";" + "}" + "QLineEdit {" + " border-radius: 4px;" + " color: "% style.at(LINEDIT_TEXT) %";" + " selection-color: "% style.at(LINEDIT_TEXT_SELECTION) %";" + " background-color: "% style.at(LINEDIT_BASE) %";" + " selection-background-color: "% style.at(LINEDIT_BASE_SELECTION) %";" + "}" + "QWidget#scrollAreaContents_Paths_Executable," + "QWidget#scrollAreaContents_Paths_ConfigFile," + "QWidget#scrollAreaContents_Paths_AppData {" + " border-radius: 8px;" + " background-color: "% style.at(PATHS_FRAME_BASE) %";" + "}" + "QFrame#gline_Version {" + " border: 1px solid "% style.at(WINDOW_PRIMARY) %";" + " margin: 2px 0px 3px 0px;" + " background-color: "% style.at(SEPARATORS) %";" + "}"; } } // namespace StyleSec::Crapinfo diff --git a/logdoctor/modules/crapinfo/modules/stylesheets.h b/logdoctor/modules/crapinfo/modules/stylesheets.h index 128d865c..83d0fbb7 100644 --- a/logdoctor/modules/crapinfo/modules/stylesheets.h +++ b/logdoctor/modules/crapinfo/modules/stylesheets.h @@ -8,7 +8,11 @@ class QString; namespace StyleSec::Crapinfo { -void getStyleSheet( QString& stylesheet ); +//! Returns the proper style sheet +/*! + \throw DoNotCatchException +*/ +QString getStyleSheet(); } // namespace StyleSec::Crapinfo diff --git a/logdoctor/modules/craplog/craplog.cpp b/logdoctor/modules/craplog/craplog.cpp index 53bb8523..323054e0 100644 --- a/logdoctor/modules/craplog/craplog.cpp +++ b/logdoctor/modules/craplog/craplog.cpp @@ -1,6 +1,8 @@ #include "craplog.h" +#include "globals/db_names.h" + #include "utilities/checks.h" #include "utilities/gzip.h" #include "utilities/io.h" @@ -13,14 +15,16 @@ #include "modules/exceptions.h" #include "modules/shared.h" +#include "modules/blacklists/blacklists.h" + +#include "modules/craplog/modules/lib.h" #include "modules/craplog/modules/donuts.h" #include "modules/craplog/modules/logs.h" #include "modules/craplog/modules/workers/lister.h" #include "modules/craplog/modules/workers/parser.h" -#include "modules/craplog/modules/workers/parser_async.h" -#include #include +#include #include #include @@ -33,53 +37,42 @@ Craplog::Craplog() //////////////////////// //// INITIALIZATION //// //////////////////////// - // blacklists / whitelists - for ( unsigned i{APACHE_ID}; i<=IIS_ID; i++ ) { - this->warnlists.emplace( i, std::unordered_map{} ); - this->blacklists.emplace( i, std::unordered_map{} ); - // default data - this->warnlists.at( i ).emplace( 11, BWlist{ .used=false, .list={"DELETE","HEAD","OPTIONS","PUT","PATCH"} } ); - this->warnlists.at( i ).emplace( 12, BWlist{ .used=true, .list={"/robots.txt","/../","/./","/.env","/.htaccess","/phpmyadmin","/wp-admin","/wp-content","/wp-config.php","/config.py","/views.py","/routes.py","/setup.cgi","/cgi-bin"} } ); - this->warnlists.at( i ).emplace( 20, BWlist{ .used=false, .list={} } ); - this->warnlists.at( i ).emplace( 21, BWlist{ .used=false, .list={} } ); - this->blacklists.at( i ).emplace( 20, BWlist{ .used=true, .list={} } ); - } // default format strings this->logs_format_strings.emplace( - APACHE_ID, "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" ); + WS_APACHE, "" ); this->logs_format_strings.emplace( - NGINX_ID, "$remote_addr - $remote_user [$time_local] \"$request\" $status $bytes_sent \"$http_referer\" \"$http_user_agent\"" ); + WS_NGINX, "" ); this->logs_format_strings.emplace( - IIS_ID, "date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken" ); + WS_IIS, "" ); // initialize formats this->logs_formats.emplace( - APACHE_ID, this->formatOps.processApacheFormatString( this->logs_format_strings.at(APACHE_ID) ) ); + WS_APACHE, LogsFormat() ); this->logs_formats.emplace( - NGINX_ID, this->formatOps.processNginxFormatString( this->logs_format_strings.at(NGINX_ID) ) ); + WS_NGINX, LogsFormat() ); this->logs_formats.emplace( - IIS_ID, this->formatOps.processIisFormatString( this->logs_format_strings.at(IIS_ID), 0 ) ); + WS_IIS, LogsFormat() ); - this->current_LF = this->logs_formats.at( APACHE_ID ); + this->current_log_format = this->logs_formats.at( WS_APACHE ); // apache2 access/error logs location - this->logs_paths.emplace( APACHE_ID, "/var/log/apache2" ); + this->logs_paths.emplace( WS_APACHE, std::string{} ); // nginx access/error logs location - this->logs_paths.emplace( NGINX_ID, "/var/log/nginx" ); + this->logs_paths.emplace( WS_NGINX, std::string{} ); // iis access/error logs location - this->logs_paths.emplace( IIS_ID, "C:/inetpub/logs/LogFiles" ); + this->logs_paths.emplace( WS_IIS, std::string{} ); // apache2 access/error log files' names - this->logs_base_names.emplace( APACHE_ID, LogName{ .starts = "access.log.", + this->logs_base_names.emplace( WS_APACHE, LogName{ .starts = "access.log.", .contains = "", .ends = "" } ); // nginx access/error log files' names - this->logs_base_names.emplace( NGINX_ID, LogName{ .starts = "access.log.", + this->logs_base_names.emplace( WS_NGINX, LogName{ .starts = "access.log.", .contains = "", .ends = "" }); // iis access/error log files' names - this->logs_base_names.emplace( IIS_ID, LogName{ .starts = "", + this->logs_base_names.emplace( WS_IIS, LogName{ .starts = "", .contains = "_ex", .ends = ".log" }); } @@ -87,345 +80,172 @@ Craplog::Craplog() ////////////////// //// SETTINGS //// -int Craplog::getDialogsLevel() const +DialogsLevel Craplog::getDialogsLevel() const noexcept { return this->dialogs_level; } -void Craplog::setDialogsLevel( const int new_level ) +void Craplog::setDialogsLevel( const DialogsLevel new_level ) noexcept { this->dialogs_level = new_level; this->hashOps.setDialogLevel( new_level ); } -const std::string& Craplog::getStatsDatabasePath() const +const std::string& Craplog::getStatsDatabasePath() const noexcept { return this->db_stats_path; } -const std::string& Craplog::getHashesDatabasePath() const +const std::string& Craplog::getHashesDatabasePath() const noexcept { return this->db_hashes_path; } -void Craplog::setStatsDatabasePath( const std::string& path ) +void Craplog::setStatsDatabasePath( const std::string& path ) noexcept { - this->db_stats_path = path + "/collection.db"; + this->db_stats_path = path + "/" + DatabasesNames::data; } -void Craplog::setHashesDatabasePath( const std::string& path ) +void Craplog::setHashesDatabasePath( const std::string& path ) noexcept { - this->db_hashes_path = path + "/hashes.db"; + this->db_hashes_path = path + "/" + DatabasesNames::hashes; } -size_t Craplog::getWarningSize() const +size_t Craplog::getWarningSize() const noexcept { return this->warning_size; } -void Craplog::setWarningSize(const size_t new_size ) +void Craplog::setWarningSize(const size_t new_size ) noexcept { this->warning_size = new_size; } -//////////////////// -//// WARN/BLACK //// -bool Craplog::isBlacklistUsed( const unsigned& web_server_id, const int& log_field_id ) const -{ - return this->blacklists.at( web_server_id ).at( log_field_id ).used; -} -bool Craplog::isWarnlistUsed( const unsigned& web_server_id, const int& log_field_id ) const -{ - return this->warnlists.at( web_server_id ).at( log_field_id ).used; -} - -void Craplog::setBlacklistUsed( const unsigned& web_server_id, const int& log_field_id, const bool used ) -{ - this->blacklists.at( web_server_id ).at( log_field_id ).used = used; -} -void Craplog::setWarnlistUsed( const unsigned& web_server_id, const int& log_field_id, const bool used ) -{ - this->warnlists.at( web_server_id ).at( log_field_id ).used = used; -} - -const std::vector& Craplog::getBlacklist( const unsigned& web_server_id, const int& log_field_id ) const -{ - return this->blacklists.at( web_server_id ).at( log_field_id ).list; -} -const std::vector& Craplog::getWarnlist( const unsigned& web_server_id, const int& log_field_id ) const -{ - return this->warnlists.at( web_server_id ).at( log_field_id ).list; -} - -void Craplog::setBlacklist( const unsigned& web_server_id, const int& log_field_id, const std::vector& new_list ) -{ - this->blacklists.at( web_server_id ).at( log_field_id ).list.clear(); - for ( const std::string& item : new_list ) { - this->blacklistAdd( web_server_id, log_field_id, item ); - } -} -void Craplog::setWarnlist( const unsigned& web_server_id, const int& log_field_id, const std::vector& new_list ) -{ - this->warnlists.at( web_server_id ).at( log_field_id ).list.clear(); - for ( const std::string& item : new_list ) { - this->warnlistAdd( web_server_id, log_field_id, item ); - } -} - -void Craplog::blacklistAdd( const unsigned& web_server_id, const int& log_field_id, const std::string& new_item ) -{ - this->blacklists.at( web_server_id ).at( log_field_id ).list.push_back( - this->sanitizeBWitem( log_field_id, new_item ) ); -} -void Craplog::warnlistAdd( const unsigned& web_server_id, const int& log_field_id, const std::string& new_item ) -{ - this->warnlists.at( web_server_id ).at( log_field_id ).list.push_back( - this->sanitizeBWitem( log_field_id, new_item ) ); -} - -void Craplog::blacklistRemove( const unsigned& web_server_id, const int& log_field_id, const std::string& item ) -{ - auto& list = this->blacklists.at( web_server_id ).at( log_field_id ).list; - // move the item to the end, then pop it - const size_t max{ list.size()-1ul }; - for ( size_t i{0}; iwarnlists.at( web_server_id ).at( log_field_id ).list; - // move the item to the end, then pop it - const size_t max{ list.size()-1ul }; - for ( size_t i{0}; iblacklists.at( web_server_id ).at( log_field_id ).list; - size_t i{ 1 }; - const size_t max{ list.size() }; - for ( ; i( i ); -} -int Craplog::warnlistMoveUp( const unsigned& web_server_id, const int& log_field_id, const std::string& item ) -{ - auto& list = this->warnlists.at( web_server_id ).at( log_field_id ).list; - size_t i{ 1 }; - const size_t max{ list.size() }; - for ( ; i( i ); -} - -int Craplog::blacklistMoveDown( const unsigned& web_server_id, const int& log_field_id, const std::string& item ) -{ - auto& list = this->blacklists.at( web_server_id ).at( log_field_id ).list; - size_t i{ 0 }; - const size_t max{ list.size()-1ul }; - for ( ; i( i ); -} -int Craplog::warnlistMoveDown( const unsigned& web_server_id, const int& log_field_id, const std::string& item ) -{ - auto& list = this->warnlists.at( web_server_id ).at( log_field_id ).list; - size_t i{ 0 }; - const size_t max{ list.size()-1ul }; - for ( ; i( i ); -} - -std::string Craplog::sanitizeBWitem( const int& log_field_id, const std::string& new_item ) const -{ - std::string sanitized_item; - switch ( log_field_id ) { - case 11: - sanitized_item = StringOps::strip( new_item ); - if ( ! StringOps::isAlphabetic( sanitized_item ) ) { - // only letters allowed - throw BWlistException("Invalid Method"); - } - sanitized_item = StringOps::toUpper( sanitized_item ); - break; - case 12: - sanitized_item = StringOps::lstrip( new_item ); - if ( sanitized_item.empty() ) { - throw BWlistException("Invalid URI"); - } - sanitized_item = QUrl::toPercentEncoding( - QString::fromStdString( sanitized_item ), - "/#&?=+").toStdString(); - break; - case 20: - sanitized_item = StringOps::strip( new_item ); - if ( ! StringOps::isIP( sanitized_item ) ) { - // only IPv4/IPv6 allowed - throw BWlistException("Invalid Client"); - } - break; - case 21: - sanitized_item = StringOps::replace( new_item, "\"", "\\\"" ); - break; - default: - // shouldn't be here - throw GenericException("Unexpected LogField ID: "+std::to_string(log_field_id)); - break; - } - return sanitized_item; -} - - ///////////////// //// FORMATS //// // get the logs format string -const std::string& Craplog::getLogsFormatString( const unsigned& web_server_id ) const +const std::string& Craplog::getLogsFormatString( const WebServer& web_server ) const noexcept { - return this->logs_format_strings.at( web_server_id ); + return this->logs_format_strings.at( web_server ); } // get the logs format -const LogsFormat& Craplog::getLogsFormat(const unsigned& web_server_id ) const +const LogsFormat& Craplog::getLogsFormat(const WebServer& web_server ) const noexcept { - return this->logs_formats.at( web_server_id ); + return this->logs_formats.at( web_server ); } // set the logs format -bool Craplog::setApacheLogFormat( const std::string& format_string ) +bool Craplog::setApacheLogFormat( const std::string& format_string ) noexcept { - // apache - bool success{ true }; try { - this->logs_formats.at( APACHE_ID ) = + this->logs_formats.at( WS_APACHE ) = this->formatOps.processApacheFormatString( format_string ); - this->logs_format_strings.at( APACHE_ID ) = format_string; + this->logs_format_strings.at( WS_APACHE ) = format_string; } catch ( LogFormatException& e ) { - success &= false; DialogSec::errInvalidLogFormatString( e.what() ); + return false; } catch (...) { - success &= false; DialogSec::errGeneric( DialogSec::tr("An error occured while parsing the format string"), true ); + return false; } - return success; + return true; } -bool Craplog::setNginxLogFormat( const std::string& format_string ) +bool Craplog::setNginxLogFormat( const std::string& format_string ) noexcept { - // nginx - bool success{ true }; try { - this->logs_formats.at( NGINX_ID ) = + this->logs_formats.at( WS_NGINX ) = this->formatOps.processNginxFormatString( format_string ); - this->logs_format_strings.at( NGINX_ID ) = format_string; + this->logs_format_strings.at( WS_NGINX ) = format_string; } catch ( LogFormatException& e ) { - success &= false; DialogSec::errInvalidLogFormatString( e.what() ); + return false; } catch (...) { - success &= false; DialogSec::errGeneric( DialogSec::tr("An error occured while parsing the format string"), true ); + return false; } - return success; + return true; } -bool Craplog::setIisLogFormat( const std::string& format_string, const int log_module ) +bool Craplog::setIisLogFormat( const std::string& format_string, const IISLogsModule log_module ) noexcept { - // iis - bool success{ true }; try { - this->logs_formats.at( IIS_ID ) = + this->logs_formats.at( WS_IIS ) = this->formatOps.processIisFormatString( format_string, log_module ); - this->logs_format_strings.at( IIS_ID ) = format_string; + this->logs_format_strings.at( WS_IIS ) = format_string; this->changeIisLogsBaseNames( log_module ); } catch ( LogFormatException& e ) { - success &= false; DialogSec::errInvalidLogFormatString( e.what() ); + return false; } catch (...) { - success &= false; DialogSec::errGeneric( DialogSec::tr("An error occured while parsing the format string"), true ); + return false; } - return success; + return true; } -QString Craplog::getLogsFormatSample( const unsigned& web_server_id ) const +QString Craplog::getLogsFormatSample( const WebServer& web_server ) const { - switch ( web_server_id ) { - case APACHE_ID: - return this->formatOps.getApacheLogSample( this->logs_formats.at( web_server_id ) ); - case NGINX_ID: - return this->formatOps.getNginxLogSample( this->logs_formats.at( web_server_id ) ); - case IIS_ID: - return this->formatOps.getIisLogSample( this->logs_formats.at( web_server_id ) ); + switch ( web_server ) { + case WS_APACHE: + return this->formatOps.getApacheLogSample( this->logs_formats.at( web_server ) ); + case WS_NGINX: + return this->formatOps.getNginxLogSample( this->logs_formats.at( web_server ) ); + case WS_IIS: + return this->formatOps.getIisLogSample( this->logs_formats.at( web_server ) ); default: - // unexpected WebServer - throw WebServerException( "Unexpected WebServerID: " + std::to_string( web_server_id ) ); + throw DoNotCatchException( "Unexpected WebServer", std::to_string(static_cast(web_server)) ); } } +bool Craplog::checkCurrentLogsFormat() const noexcept +{ + if ( this->current_log_format.string.empty() ) { + // format string not set + DialogSec::errLogFormatNotSet( nullptr ); + return false; + } else if ( this->current_log_format.fields.empty() ) { + // no field, useless to parse + DialogSec::errLogFormatNoFields( nullptr ); + return false; + } else if ( this->current_log_format.separators.size() < this->current_log_format.fields.size()-1 ) { + // at least one separator is missing between two (or more) fields + DialogSec::errLogFormatNoSeparators( nullptr ); + return false; + } + return true; +} + // set the current Web Server -void Craplog::setCurrentWSID( const unsigned web_server_id ) +void Craplog::setCurrentWebServer( const WebServer web_server ) noexcept { - this->current_WS = web_server_id; + this->current_web_server = web_server; this->setCurrentLogFormat(); } -unsigned Craplog::getCurrentWSID() const +WebServer Craplog::getCurrentWebServer() const noexcept { - return this->current_WS; + return this->current_web_server; } // set the current access logs format -void Craplog::setCurrentLogFormat() +void Craplog::setCurrentLogFormat() noexcept { - this->current_LF = this->logs_formats.at( this->current_WS ); + this->current_log_format = this->logs_formats.at( this->current_web_server ); } // get the current access logs format -const LogsFormat& Craplog::getCurrentLogFormat() const +const LogsFormat& Craplog::getCurrentLogFormat() const noexcept { - return this->current_LF; + return this->current_log_format; } /////////////////// //// LOGS PATH //// -const std::string& Craplog::getLogsPath( const unsigned& web_server ) const +const std::string& Craplog::getLogsPath( const WebServer& web_server ) const noexcept { return this->logs_paths.at( web_server ); } -void Craplog::setLogsPath( const unsigned& web_server, const std::string& new_path ) +void Craplog::setLogsPath( const WebServer& web_server, const std::string& new_path ) noexcept { this->logs_paths.at( web_server ) = new_path; } @@ -434,13 +254,13 @@ void Craplog::setLogsPath( const unsigned& web_server, const std::string& new_pa /////////////////// //// LOGS LIST //// // return the size of the list -size_t Craplog::getLogsListSize() const +size_t Craplog::getLogsListSize() const noexcept { return this->logs_list.size(); } -// return the list. rescan if fresh is true -const std::vector& Craplog::getLogsList() const +// return the current list +const std::vector& Craplog::getLogsList() const noexcept { return this->logs_list; } @@ -449,9 +269,8 @@ const std::vector& Craplog::getLogsList() const // return the LogFile instance of the file matching the given name const LogFile& Craplog::getLogFileItem( const QString& file_name ) const { - const auto& item{ std::find_if - ( this->logs_list.begin(), this->logs_list.end(), - [&file_name](const LogFile& it){ return it.name()==file_name; } ) }; + const auto item{ std::find_if( this->logs_list.begin(), this->logs_list.end(), + [&file_name](const LogFile& file){ return file.name()==file_name; } ) }; if ( item != this->logs_list.end() ) return *item; // should be unreachable throw GenericException("File item not found"); @@ -459,12 +278,10 @@ const LogFile& Craplog::getLogFileItem( const QString& file_name ) const // set a file as selected -bool Craplog::setLogFileSelected( const QString& file_name ) +bool Craplog::setLogFileSelected( const QString& file_name ) noexcept { - const auto item{ std::find_if - ( this->logs_list.begin(), this->logs_list.end(), - [&file_name]( const LogFile& it ) - { return it.name() == file_name; } ) }; + const auto item{ std::find_if( this->logs_list.begin(), this->logs_list.end(), + [&file_name](const LogFile& file){ return file.name() == file_name; } ) }; if ( item != this->logs_list.end() ) { item->setSelected(); return true; @@ -472,7 +289,7 @@ bool Craplog::setLogFileSelected( const QString& file_name ) return false; } -void Craplog::clearLogFilesSelection() +void Craplog::clearLogFilesSelection() noexcept { std::ignore = std::for_each( this->logs_list.begin(), this->logs_list.end(), @@ -487,10 +304,10 @@ void Craplog::scanLogsDir() this->logs_list.clear(); // hire the worker CraplogLister* worker{ new CraplogLister( - this->current_WS, + this->current_web_server, this->dialogs_level, - this->logs_paths.at( this->current_WS ), - this->logs_formats.at( this->current_WS ), + this->logs_paths.at( this->current_web_server ), + this->logs_formats.at( this->current_web_server ), this->hashOps, [this]( const std::string& file_name) { return this->isFileNameValid( file_name ); } @@ -522,62 +339,63 @@ void Craplog::scanLogsDir() worker_thread->start(); } -void Craplog::appendLogFile( const LogFile log_file ) +void Craplog::appendLogFile( const LogFile log_file ) noexcept { this->logs_list.push_back( std::move( log_file ) ); emit this->pushLogFile( this->logs_list.back() ); } -void Craplog::logsDirScanned() +void Craplog::logsDirScanned() noexcept { emit this->finishedRefreshing(); } -void Craplog::changeIisLogsBaseNames( const int module_id ) +void Craplog::changeIisLogsBaseNames( const IISLogsModule log_module ) { - switch ( module_id ) { - case 0: // W3C - this->logs_base_names.at( IIS_ID ).contains = "_ex"; break; - case 1: // NCSA - this->logs_base_names.at( IIS_ID ).contains = "_nc"; break; - case 2: // IIS - this->logs_base_names.at( IIS_ID ).contains = "_in"; break; + switch ( log_module ) { + case IISLogsModule::W3C: + this->logs_base_names.at( WS_IIS ).contains = "_ex"; break; + case IISLogsModule::NCSA: + this->logs_base_names.at( WS_IIS ).contains = "_nc"; break; + case IISLogsModule::IIS: + this->logs_base_names.at( WS_IIS ).contains = "_in"; break; default: // shouldn't be reachable - throw GenericException( "Unexpected LogFormatModule ID: "+std::to_string( module_id ), true ); // leave un-catched + throw DoNotCatchException( "Unexpected LogFormatModule", std::to_string(static_cast(log_module)) ); } } bool Craplog::isFileNameValid( const std::string& name ) const { - bool valid{ true }; - if ( ! this->logs_base_names.at( this->current_WS ).starts.empty() ) { - if ( ! StringOps::startsWith( name, this->logs_base_names.at( this->current_WS ).starts ) ) { + if ( ! this->logs_base_names.at( this->current_web_server ).starts.empty() ) { + if ( ! StringOps::startsWith( name, this->logs_base_names.at( this->current_web_server ).starts ) ) { return false; } } - if ( ! this->logs_base_names.at( this->current_WS ).contains.empty() ) { - if ( ! StringOps::contains( name.substr( this->logs_base_names.at( this->current_WS ).starts.size() ), - this->logs_base_names.at( this->current_WS ).contains ) ) { + if ( ! this->logs_base_names.at( this->current_web_server ).contains.empty() ) { + if ( ! StringOps::contains( name.substr( this->logs_base_names.at( this->current_web_server ).starts.size() ), + this->logs_base_names.at( this->current_web_server ).contains ) ) { return false; } } - if ( ! this->logs_base_names.at( this->current_WS ).ends.empty() ) { - if ( ! StringOps::endsWith( name, this->logs_base_names.at( this->current_WS ).ends ) + if ( ! this->logs_base_names.at( this->current_web_server ).ends.empty() ) { + if ( ! StringOps::endsWith( name, this->logs_base_names.at( this->current_web_server ).ends ) && ! StringOps::endsWith( name, ".gz" ) ) { return false; } } - switch ( this->current_WS ) { - size_t start, stop; - case APACHE_ID | NGINX_ID: + switch ( this->current_web_server ) { + case WS_APACHE: + [[fallthrough]]; + case WS_NGINX: + { // further checks for apache / nginx + size_t start, stop; start = name.rfind(".log." ); if ( start == std::string::npos ) { - valid &= false; - break; + return false; } start += 5ul; stop = name.size()-1ul; @@ -585,20 +403,20 @@ bool Craplog::isFileNameValid( const std::string& name ) const stop -= 3ul; } // serach for incremental numbers - for ( size_t i{start}; i<=stop; i++ ) { - if ( ! StringOps::isNumeric( name.at( i ) ) ) { - valid &= false; - break; + for ( size_t i{start}; i<=stop; ++i ) { + if ( ! CharOps::isNumeric( name.at( i ) ) ) { + return false; } } - break; + }break; - case IIS_ID: + case WS_IIS: + { // further checks for iis - start = name.find( this->logs_base_names.at( IIS_ID ).contains ) + 3ul; + size_t start, stop; + start = name.find( this->logs_base_names.at( WS_IIS ).contains ) + 3ul; if ( start == std::string::npos ) { - valid &= false; - break; + return false; } stop = name.size()-5ul; // removing the finel '.log' extension if ( StringOps::endsWith( name, ".gz" ) ) { @@ -606,33 +424,33 @@ bool Craplog::isFileNameValid( const std::string& name ) const } // search for date std::string date; - for ( size_t i{start}; i<=stop; i++ ) { - if ( ! StringOps::isNumeric( name.at( i ) ) ) { - valid &= false; - break; + for ( size_t i{start}; i<=stop; ++i ) { + if ( ! CharOps::isNumeric( name.at( i ) ) ) { + return false; } date.push_back( name.at( i ) ); } - if ( valid ) { - // check if the file has today's date - time_t t; - time( &t ); - struct tm* tmp = localtime( &t ); - char aux_date[7]; - // using strftime to display time - strftime( aux_date, 7, "%y%m%d", tmp ); - valid &= false; - for ( size_t i{0}; i<6ul; i++ ) { - if ( date.at(i) != aux_date[i] ) { - // different date, valid - valid |= true; - break; - } + // check if the file has today's date + time_t t; + time( &t ); + struct tm* tmp = localtime( &t ); + char aux_date[7]; + // using strftime to display time + strftime( aux_date, 7, "%y%m%d", tmp ); + for ( size_t i{0}; i<6ul; ++i ) { + if ( date.at(i) != aux_date[i] ) { + // different date, valid + return true; + break; } } - break; + }break; + + default: + throw DoNotCatchException( "Unexpected WebServer", std::to_string(static_cast(this->current_web_server)) ); } - return valid; + + return true; } @@ -656,8 +474,6 @@ bool Craplog::checkStuff() size_t logs_size{ 0ul }; for ( const LogFile& file : this->logs_list ) { - if ( ! this->proceed ) { break; } - if ( ! file.isSelected() ) { // not selected, skip continue; @@ -667,14 +483,14 @@ bool Craplog::checkStuff() if ( file.hasBeenUsed() ) { // already used QString msg{ file.name() }; - if ( this->dialogs_level == 2 ) { + if ( this->dialogs_level == DL_EXPLANATORY ) { msg += "\n" + QString::fromStdString( file.hash() ); } const int choice = DialogSec::choiceFileAlreadyUsed( msg ); if ( choice == 0 ) { // choosed to abort all this->proceed &= false; - break; + return false; } else if ( choice == 1 ) { // choosed to discard the file and continue continue; @@ -690,23 +506,23 @@ bool Craplog::checkStuff() if ( VecOps::contains( this->used_files_hashes, file.hash() ) ) { // appears twice in the list QString msg{ file.name() }; - if ( this->dialogs_level == 2 ) { + if ( this->dialogs_level == DL_EXPLANATORY ) { msg += "\n" + QString::fromStdString( file.hash() ); } const int choice = DialogSec::choiceDuplicateFile( msg ); if ( choice == 0 ) { - // choosed to abort all - this->proceed &= false; - break; + // choosed to abort all + this->proceed &= false; + return false; } else if ( choice == 1 ) { - // choosed to discard the file and continue - continue; + // choosed to discard the file and continue + continue; } else if ( choice == 2 ) { - // choosed to ignore and use the file anyway - ; + // choosed to ignore and use the file anyway + ; } else { - // shouldn't be here - throw GenericException( "Unexpeced value returned: "+std::to_string(choice) ); + // shouldn't be here + throw GenericException( "Unexpeced value returned: "+std::to_string(choice) ); } } } @@ -716,12 +532,12 @@ bool Craplog::checkStuff() if ( file.size() > this->warning_size ) { // exceeds the warning size QString msg{ file.name() }; - if ( this->dialogs_level >= 1 ) { - msg += QString("\n\n%1:\n%2").arg( + if ( this->dialogs_level >= DL_NORMAL ) { + msg += QStringLiteral("\n\n%1:\n%2").arg( DialogSec::tr("Size of the file"), PrintSec::printableSize( file.size() ) ); - if ( this->dialogs_level == 2 ) { - msg += QString("\n\n%1:\n%2").arg( + if ( this->dialogs_level == DL_EXPLANATORY ) { + msg += QStringLiteral("\n\n%1:\n%2").arg( DialogSec::tr("Warning size parameter"), PrintSec::printableSize( this->warning_size ) ); } @@ -730,7 +546,7 @@ bool Craplog::checkStuff() if ( choice == 0 ) { // choosed to abort all this->proceed &= false; - break; + return false; } else if ( choice == 1 ) { // choosed to discard the file and continue continue; @@ -748,12 +564,12 @@ bool Craplog::checkStuff() if ( ! CheckSec::checkCollectionDatabase( this->db_stats_path ) ) { // checks failed, abort this->proceed &= false; - break; + return false; } if ( ! CheckSec::checkHashesDatabase( this->db_hashes_path ) ) { // checks failed, abort this->proceed &= false; - break; + return false; } this->log_files_to_use.push_back( @@ -764,34 +580,36 @@ bool Craplog::checkStuff() } // check if there are enough files to use - if ( this->proceed && this->log_files_to_use.size() == 0ul ) { + if ( this->log_files_to_use.empty() ) { // no files left, abort DialogSec::msgNoFileToParse(); this->proceed &= false; + return false; } // check if the total size of the files do not exceed the available RAM - if ( this->proceed && logs_size >= MemOps::availableMemory() ) { + if ( logs_size >= MemOps::availableMemory() ) { // no files left, abort QString msg; - if ( this->dialogs_level >= 1 ) { - msg += QString("\n\n%1: %2").arg( + if ( this->dialogs_level >= DL_NORMAL ) { + msg += QStringLiteral("\n\n%1: %2").arg( DialogSec::tr("Available memory"), PrintSec::printableSize( MemOps::availableMemory() ) ); - if ( this->dialogs_level == 2 ) { - msg += QString("\n%1: %2").arg( + if ( this->dialogs_level == DL_EXPLANATORY ) { + msg += QStringLiteral("\n%1: %2").arg( DialogSec::tr("Size of the logs"), PrintSec::printableSize( logs_size ) ); } } DialogSec::msgNotEnoughMemory( msg ); this->proceed &= false; + return false; } - return this->proceed; + return true; } -void Craplog::showWorkerDialog( const WorkerDialog dialog_type, const QStringList args ) const +void Craplog::showWorkerDialog( const WorkerDialog dialog_type, const QStringList args ) const noexcept { switch ( dialog_type ) { case WorkerDialog::errGeneric: @@ -806,16 +624,22 @@ void Craplog::showWorkerDialog( const WorkerDialog dialog_type, const QStringLis case WorkerDialog::errFailedParsingLogs: DialogSec::errFailedParsingLogs( args.at(0) ); break; + case WorkerDialog::errDatabaseFileNotFound: + DialogSec::errDatabaseNotFound( args.at(0) ); + break; + case WorkerDialog::errDatabaseFileNotFile: + DialogSec::errDatabaseNotFile( args.at(0) ); + break; + case WorkerDialog::errDatabaseFileNotReadable: + DialogSec::errDatabaseNotReadable( args.at(0) ); + break; + case WorkerDialog::errDatabaseFileNotWritable: + DialogSec::errDatabaseNotWritable( args.at(0) ); + break; case WorkerDialog::errDatabaseFailedOpening: - if ( args.size() < 2 ) { - GenericException{ "call to showWorkerDialog() with invalid number of list items", true }; - } DialogSec::errDatabaseFailedOpening( args.at(0), args.at(1) ); break; case WorkerDialog::errDatabaseFailedExecuting: - if ( args.size() < 3 ) { - GenericException{ "call to showWorkerDialog() with invalid number of list items", true }; - } DialogSec::errDatabaseFailedExecuting( args.at(0), args.at(1), args.at(2) ); break; case WorkerDialog::warnFileNotReadable: @@ -827,20 +651,7 @@ void Craplog::showWorkerDialog( const WorkerDialog dialog_type, const QStringLis } } -bool Craplog::shouldWorkAsync() const -{ - const size_t n_log_files{ this->log_files_to_use.size() }; - const size_t average_size{ - std::accumulate( this->logs_list.cbegin(), this->logs_list.cend(), 0ul, - []( size_t sum, const LogFile& lf ) - { return lf.isSelected() ? sum+lf.size() : sum; }) - / n_log_files - }; - return (average_size > 1'048'576ul && n_log_files > 1) - || n_log_files > 150ul; -} - -void Craplog::startWorking() +void Craplog::startWorking( const Blacklists& blacklists ) { std::unique_lock lock( this->mutex ); this->proceed |= true; @@ -848,26 +659,25 @@ void Craplog::startWorking() this->parsed_lines = 0ul; this->total_size = 0ul; this->parsed_size = 0ul; - this->warnlisted_size = 0ul; this->blacklisted_size = 0ul; // hire a worker - if ( this->shouldWorkAsync() ) { - this->hireAsyncWorker(); - } else { - this->hireWorker(); - } + this->hireWorker( blacklists ); } -void Craplog::hireWorker() const +void Craplog::hireWorker( const Blacklists& blacklists ) const { + std::vector files; + files.reserve( this->log_files_to_use.size() ); + std::transform( + this->log_files_to_use.cbegin(), this->log_files_to_use.cend(), std::back_inserter(files), + [](const auto& tpl){ return std::get<0>(tpl); } ); + CraplogParser* worker{ new CraplogParser( - this->current_WS, + this->current_web_server, this->dialogs_level, - this->db_stats_path, - this->db_hashes_path, - this->logs_formats.at( this->current_WS ), - this->blacklists.at( this->current_WS ), - this->warnlists.at( this->current_WS ), - this->log_files_to_use + this->logs_formats.at( this->current_web_server ), + blacklists.getConst( this->current_web_server ), + std::move(files), + this->db_stats_path ) }; QThread* worker_thread{ new QThread() }; worker->moveToThread( worker_thread ); @@ -886,6 +696,9 @@ void Craplog::hireWorker() const // receive chart data, only received when worker has done connect( worker, &CraplogParser::chartData, this, &Craplog::updateChartData ); + // store the files hashes + connect( worker, &CraplogParser::readyStoringData, + this, &Craplog::storeFilesHashes ); // show a dialog connect( worker, &CraplogParser::showDialog, this, &Craplog::showWorkerDialog ); @@ -904,80 +717,32 @@ void Craplog::hireWorker() const // make the worker work worker_thread->start(); } -void Craplog::hireAsyncWorker() const -{ - CraplogParserAsync* worker{ new CraplogParserAsync( - this->current_WS, - this->dialogs_level, - this->db_stats_path, - this->db_hashes_path, - this->logs_formats.at( this->current_WS ), - this->blacklists.at( this->current_WS ), - this->warnlists.at( this->current_WS ), - this->log_files_to_use - ) }; - QThread* worker_thread{ new QThread() }; - worker->moveToThread( worker_thread ); - // start the worker - connect( worker_thread, &QThread::started, - worker, &CraplogParserAsync::work ); - // worker started parsing - connect( worker, &CraplogParserAsync::startedParsing, - this, &Craplog::workerStartedParsing ); - // worker finished parsing - connect( worker, &CraplogParserAsync::finishedParsing, - this, &Craplog::workerFinishedParsing ); - // receive performance data - connect( worker, &CraplogParserAsync::perfData, - this, &Craplog::updatePerfData ); - // receive chart data, only received when worker has done - connect( worker, &CraplogParserAsync::chartData, - this, &Craplog::updateChartData ); - // show a dialog - connect( worker, &CraplogParserAsync::showDialog, - this, &Craplog::showWorkerDialog ); - // worker finished its career - connect( worker, &CraplogParserAsync::done, - this, &Craplog::stopWorking ); - // plan deleting the worker - connect( worker, &CraplogParserAsync::retire, - worker, &CraplogParserAsync::deleteLater ); - // quit the thread - connect( worker, &CraplogParserAsync::retire, - worker_thread, &QThread::quit ); - // plan deleting the thread - connect( worker_thread, &QThread::finished, - worker_thread, &QThread::deleteLater ); - // make the worker work - worker_thread->start(); -} void Craplog::stopWorking( const bool successful ) { this->db_edited = successful; if ( successful ) { // insert the hashes of the used files - this->hashOps.insertUsedHashes( this->db_hashes_path, this->used_files_hashes, this->current_WS ); } emit this->finishedWorking(); } -bool Craplog::editedDatabase() const +bool Craplog::editedDatabase() const noexcept { return this->db_edited; } -size_t Craplog::getParsedSize() +size_t Craplog::getParsedSize() noexcept { std::unique_lock lock( this->mutex ); return this->parsed_size; } -size_t Craplog::getParsedLines() +size_t Craplog::getParsedLines() noexcept { std::unique_lock lock( this->mutex ); return this->parsed_lines; } -QString Craplog::getParsingSpeed() +QString Craplog::getParsingSpeed() noexcept { std::unique_lock lock( this->mutex ); auto stop{ ( is_parsing ) @@ -994,38 +759,49 @@ QString Craplog::getParsingSpeed() ); } -void Craplog::workerStartedParsing() +void Craplog::workerStartedParsing() noexcept { std::unique_lock lock( this->mutex ); this->is_parsing |= true; this->parsing_time_start = std::chrono::system_clock::now(); } -void Craplog::workerFinishedParsing() +void Craplog::workerFinishedParsing() noexcept { std::unique_lock lock( this->mutex ); this->parsing_time_stop = std::chrono::system_clock::now(); this->is_parsing &= false; } -bool Craplog::isParsing() const +bool Craplog::isParsing() const noexcept { return this->is_parsing; } -void Craplog::updatePerfData( const size_t parsed_size, const size_t parsed_lines ) +void Craplog::updatePerfData( const size_t parsed_size, const size_t parsed_lines ) noexcept { std::unique_lock lock( this->mutex ); this->parsed_size = parsed_size; this->parsed_lines = parsed_lines; } -void Craplog::updateChartData( const size_t total_size, const size_t total_lines, const size_t warnlisted_size, const size_t blacklisted_size ) +void Craplog::updateChartData( const size_t total_size, const size_t total_lines, const size_t blacklisted_size ) noexcept { std::unique_lock lock( this->mutex ); this->total_size = total_size; this->total_lines = total_lines; - this->warnlisted_size = warnlisted_size; this->blacklisted_size = blacklisted_size; } +void Craplog::storeFilesHashes( QWaitCondition* wc, bool* successful) noexcept +{ + try { + this->hashOps.insertUsedHashes( this->db_hashes_path, this->used_files_hashes, this->current_web_server ); + *successful |= true; + } catch (...) { + DialogSec::errFailedInsertUsedHashes(); + *successful &= false; + } + wc->wakeAll(); +} + void Craplog::makeChart( const QChart::ChartTheme& theme, const std::unordered_map& fonts, QChartView* size_chart ) const { @@ -1033,19 +809,15 @@ void Craplog::makeChart( const QChart::ChartTheme& theme, const std::unordered_m size_chart_name { TR::tr("Logs Size Breakdown") }, ignored_slice_name { TR::tr("Ignored") }, parsed_slice_name { TR::tr("Parsed") }, - warning_slice_name { TR::tr("Warnings") }, blacklisted_slice_name { TR::tr("Blacklisted") }; // logs size donut chart QPieSeries* parsedSize_donut{ new QPieSeries() }; parsedSize_donut->setName( PrintSec::printableSize( this->parsed_size ) ); - const size_t parsed_size{ this->parsed_size - this->warnlisted_size - this->blacklisted_size }; + const size_t parsed_size{ this->parsed_size - this->blacklisted_size }; parsedSize_donut->append( "P@" + parsed_slice_name + "@" + PrintSec::printableSize( parsed_size ), static_cast( parsed_size ) ); - parsedSize_donut->append( - "W@" + warning_slice_name + "@" + PrintSec::printableSize( this->warnlisted_size ), - static_cast( this->warnlisted_size ) ); parsedSize_donut->append( "B@" + blacklisted_slice_name + "@" + PrintSec::printableSize( this->blacklisted_size ), static_cast( this->blacklisted_size ) ); @@ -1072,7 +844,9 @@ void Craplog::makeChart( const QChart::ChartTheme& theme, const std::unordered_m sizeBreakdown->legend()->setVisible( false ); sizeBreakdown->setTitle(""); } - sizeBreakdown->legend()->markers( ignoredSize_donut ).first()->setVisible( false ); + if ( auto markers{ sizeBreakdown->legend()->markers( ignoredSize_donut ) }; !markers.isEmpty() ) { + markers.first()->setVisible( false ); + } size_chart->setChart( sizeBreakdown ); size_chart->setRenderHint( QPainter::Antialiasing ); diff --git a/logdoctor/modules/craplog/craplog.h b/logdoctor/modules/craplog/craplog.h index b4c3ee2d..b5121273 100644 --- a/logdoctor/modules/craplog/craplog.h +++ b/logdoctor/modules/craplog/craplog.h @@ -2,58 +2,65 @@ #define LOGDOCTOR__CRAPLOG_H -#include +#include "lib.h" -#include "defines/web_servers.h" - -#include "modules/craplog/modules/lib.h" #include "modules/craplog/modules/hash.h" #include "modules/craplog/modules/formats.h" #include "modules/craplog/modules/workers/lib.h" +#include + + +struct LogFile; +struct Blacklists; + +class QWaitCondition; + //! Craplog /*! Performs operations related to the logs */ -class Craplog : public QObject +class Craplog final : public QObject { Q_OBJECT public: + explicit Craplog(); + Q_DISABLE_COPY_MOVE(Craplog) ///////////////// //// DIALOGS //// //! Returns the Dialogs level - int getDialogsLevel() const; + DialogsLevel getDialogsLevel() const noexcept; //! Sets the new Dialogs level - void setDialogsLevel( const int new_level ); + void setDialogsLevel( const DialogsLevel new_level ) noexcept; /////////////////// //// DATABASES //// //! Returns the path of the logs Collection database - const std::string& getStatsDatabasePath() const; + const std::string& getStatsDatabasePath() const noexcept; //! Returns the path of the log files' Hashes database - const std::string& getHashesDatabasePath() const; + const std::string& getHashesDatabasePath() const noexcept; //! Sets the new path for the logs Collection database /*! \param The new path of the database file */ - void setStatsDatabasePath( const std::string& path ); + void setStatsDatabasePath( const std::string& path ) noexcept; //! Sets the new path for the log files' Hashes database /*! \param The new path of the database file */ - void setHashesDatabasePath( const std::string& path ); + void setHashesDatabasePath( const std::string& path ) noexcept; //////////////////////// @@ -61,28 +68,28 @@ public: //! Sets the currently used Web Server ID /*! - \param web_server_id The new currently used Web Server + \param web_server The new currently used Web Server */ - void setCurrentWSID( const unsigned web_server_id ); + void setCurrentWebServer( const WebServer web_server ) noexcept; //! Returns the currently used Web Server ID /*! \return The Web Server ID */ - unsigned getCurrentWSID() const; + WebServer getCurrentWebServer() const noexcept; //! Uses the current Web Server to set the relative logs format /*! \see LogsFormat */ - void setCurrentLogFormat(); + void setCurrentLogFormat() noexcept; //! Returns the currently used LogsFormat /*! \return The LogsFormat \see LogsFormat */ - const LogsFormat& getCurrentLogFormat() const; + const LogsFormat& getCurrentLogFormat() const noexcept; //////////////////// @@ -90,19 +97,17 @@ public: //! Returns the logs' path for the given web Server /*! - \param web_server The ID of the Web Server + \param web_server The Web Server \return The path of the logs' folder */ - const std::string& getLogsPath( const unsigned& web_server ) const; + const std::string& getLogsPath( const WebServer& web_server ) const noexcept; //! Sets a new path for the given Web Server to search the logs in /*! - \param web_server The ID of the Web Server + \param web_server The Web Server \param new_path The new path */ - void setLogsPath( const unsigned& web_server, - const std::string& new_path - ); + void setLogsPath( const WebServer& web_server, const std::string& new_path ) noexcept; /////////////////// @@ -112,6 +117,7 @@ public: /*! \param name The name of the file \return Wheter it does respect the criterions or not + \throw DoNotCatchException \see LogName */ bool isFileNameValid( const std::string& name ) const; @@ -125,14 +131,14 @@ public: \return The list of log files \see LogFile, logs_list */ - const std::vector& getLogsList() const; + const std::vector& getLogsList() const noexcept; //! Returns the amount of log files in the list /*! \return The number of files actually in the list \see logs_list */ - size_t getLogsListSize() const; + size_t getLogsListSize() const noexcept; //! Returns the LogFile instance of the given file /*! @@ -151,14 +157,14 @@ public: \return Wheter the given file name has been found in the list \see LogFile, logs_list */ - bool setLogFileSelected( const QString& file_name ); + bool setLogFileSelected( const QString& file_name ) noexcept; //! Sets all files in the list as unselected /*! \return Wheter the given file name has been found in the list \see LogFile, logs_list */ - void clearLogFilesSelection(); + void clearLogFilesSelection() noexcept; ////////////////////// @@ -170,7 +176,7 @@ public: \return Whether the process was successful or not \see FormatOps, FormatOps::LogsFormat, FormatOps::processApacheFormatString() */ - bool setApacheLogFormat( const std::string& format_string ); + bool setApacheLogFormat( const std::string& format_string ) noexcept; //! Sets the Nginx LogsFormat from the given format string /*! @@ -178,41 +184,45 @@ public: \return Whether the process was successful or not \see FormatOps, FormatOps::LogsFormat, FormatOps::processNginxFormatString() */ - bool setNginxLogFormat( const std::string& format_string ); + bool setNginxLogFormat( const std::string& format_string ) noexcept; //! Sets the IIS LogsFormat from the given format string /*! \param format_string The logs format string \param log_module The IIS logs module to be used to parse the format string \return Whether the process was successful or not + \throw DoNotCatchException \see FormatOps, FormatOps::LogsFormat, FormatOps::processIisFormatString() */ - bool setIisLogFormat( const std::string& format_string, const int log_module ); + bool setIisLogFormat( const std::string& format_string, const IISLogsModule log_module ) noexcept; //! Returns the logs format string for the given Web Server /*! - \param web_server_id ID of the Web Server + \param web_server ID of the Web Server \return The format string \see FormatOps::LogsFormat */ - const std::string& getLogsFormatString( const unsigned& web_server_id ) const; + const std::string& getLogsFormatString( const WebServer& web_server ) const noexcept; //! Returns the LogsFormat currently set for the given Web Server /*! - \param web_server_id ID of the Web Server + \param web_server ID of the Web Server \return The LogsFormat instance \see LogsFormat */ - const LogsFormat& getLogsFormat( const unsigned& web_server_id ) const; + const LogsFormat& getLogsFormat( const WebServer& web_server ) const noexcept; //! Returns a sample log line for the given Web Server using the relative LogsFormat /*! - \param web_server_id ID of the Web Server + \param web_server ID of the Web Server \return The sample of a log line - \throw WebServerException + \throw DoNotCatchException \see FormatOps::getApacheLogSample(), FormatOps::getNginxLogSample(), FormatOps::getIisLogSample() */ - QString getLogsFormatSample( const unsigned& web_server_id ) const; + QString getLogsFormatSample( const WebServer& web_server ) const; + + //! Checks whether the current Logs Format is valid or not + bool checkCurrentLogsFormat() const noexcept; @@ -220,10 +230,10 @@ public: //// WARNING SIZE //// //! Returns the currently set warning size for the log files - size_t getWarningSize() const; + size_t getWarningSize() const noexcept; //! Sets the new warning size for the log files - void setWarningSize( const size_t new_size ); + void setWarningSize( const size_t new_size ) noexcept; //////////////////// @@ -232,153 +242,6 @@ public: // logs usage control HashOps hashOps; - ////////////////////////////// - //// BLACKLIST / WARNLIST //// - - //! Returns whether the relative blacklist is set to be used or not - /*! - \param web_server_id The ID of the Web Server - \param log_field_id The ID of the log field - \return Whether the list is used or not - \see BWlist - */ - bool isBlacklistUsed( const unsigned& web_server_id, const int& log_field_id ) const; - - //! Returns whether the relative warnlist is set to be used or not - /*! - \param web_server_id The ID of the Web Server - \param log_field_id The ID of the log field - \return Whether the list is used or not - \see BWlist - */ - bool isWarnlistUsed( const unsigned& web_server_id, const int& log_field_id ) const; - - //! Sets the relative blacklist to be used or not - /*! - \param web_server_id The ID of the Web Server - \param log_field_id The ID of the log field - \param used Whether the list is to be used or not - \see BWlist - */ - void setBlacklistUsed( const unsigned& web_server_id, const int& log_field_id, const bool used ); - - //! Sets the relative warnlist to be used or not - /*! - \param web_server_id The ID of the Web Server - \param log_field_id The ID of the log field - \param used Whether the list is to be used or not - \see BWlist - */ - void setWarnlistUsed( const unsigned& web_server_id, const int& log_field_id, const bool used ); - - //! Returns the relative items list - /*! - \param web_server_id The ID of the Web Server - \param log_field_id The ID of the log field - \return The list of items in the given blacklist - \see BWlist - */ - const std::vector& getBlacklist( const unsigned& web_server_id, const int& log_field_id ) const; - - //! Returns the relative items list - /*! - \param web_server_id The ID of the Web Server - \param log_field_id The ID of the log field - \return The list of items in the givenwarnlist - \see BWlist - */ - const std::vector& getWarnlist( const unsigned& web_server_id, const int& log_field_id ) const; - - //! Sets the relative items list - /*! - \param web_server_id The ID of the Web Server - \param log_field_id The ID of the log field - \param new_list The new items list - \see BWlist - */ - void setBlacklist( const unsigned& web_server_id, const int& log_field_id, const std::vector& new_list ); - - //! Sets the relative items list - /*! - \param web_server_id The ID of the Web Server - \param log_field_id The ID of the log field - \param new_list The new items list - \see BWlist - */ - void setWarnlist( const unsigned& web_server_id, const int& log_field_id, const std::vector& new_list ); - - //! Adds an item to the relative list - /*! - \param web_server_id The ID of the Web Server - \param log_field_id The ID of the log field - \param new_list The new items list - \see BWlist - */ - void blacklistAdd( const unsigned& web_server_id, const int& log_field_id, const std::string& new_item ); - - //! Adds an item to the relative list - /*! - \param web_server_id The ID of the Web Server - \param log_field_id The ID of the log field - \param new_item The new item to add to the list - \see BWlist - */ - void warnlistAdd( const unsigned& web_server_id, const int& log_field_id, const std::string& new_item ); - - //! Removes an item from the relative list - /*! - \param web_server_id The ID of the Web Server - \param log_field_id The ID of the log field - \param item The item to remove from the list - \see BWlist - */ - void blacklistRemove( const unsigned& web_server_id, const int& log_field_id, const std::string& item ); - - //! Removes an item from the relative list - /*! - \param web_server_id The ID of the Web Server - \param log_field_id The ID of the log field - \param item The item to remove from the list - \see BWlist - */ - void warnlistRemove( const unsigned& web_server_id, const int& log_field_id, const std::string& item ); - - //! Moves an item one position up in the relative list - /*! - \param web_server_id The ID of the Web Server - \param log_field_id The ID of the log field - \param item The item to move - \see BWlist - */ - int blacklistMoveUp( const unsigned& web_server_id, const int& log_field_id, const std::string& item ); - - //! Moves an item one position up in the relative list - /*! - \param web_server_id The ID of the Web Server - \param log_field_id The ID of the log field - \param item The item to move - \see BWlist - */ - int warnlistMoveUp( const unsigned& web_server_id, const int& log_field_id, const std::string& item ); - - //! Moves an item one position down in the relative list - /*! - \param web_server_id The ID of the Web Server - \param log_field_id The ID of the log field - \param item The item to move - \see BWlist - */ - int blacklistMoveDown( const unsigned& web_server_id, const int& log_field_id, const std::string& item ); - - //! Moves an item one position down in the relative list - /*! - \param web_server_id The ID of the Web Server - \param log_field_id The ID of the log field - \param item The item to move - \see BWlist - */ - int warnlistMoveDown( const unsigned& web_server_id, const int& log_field_id, const std::string& item ); - ////////////// //// WORK //// @@ -392,23 +255,23 @@ public: bool checkStuff(); //! Returns whether the database has been edited or not during the process - bool isParsing() const; + bool isParsing() const noexcept; //! Returns whether the database has been edited or not during the process - bool editedDatabase() const; + bool editedDatabase() const noexcept; ////////////////////// //// PERFORMANCES //// //! Returns the total logs size - size_t getParsedSize(); + size_t getParsedSize() noexcept; //! Returns the parsed logs lines - size_t getParsedLines(); + size_t getParsedLines() noexcept; //! Returns the speed on parsing logs - QString getParsingSpeed(); + QString getParsingSpeed() noexcept; //! Builds and draws the chart to be displayed in the main window /*! @@ -424,6 +287,8 @@ signals: void pushLogFile( const LogFile& log_file ); + void doneStoringFilesHashes( const bool successful ); + void finishedRefreshing(); void finishedWorking(); @@ -433,28 +298,29 @@ public slots: void scanLogsDir(); - void appendLogFile( const LogFile log_file ); + void appendLogFile( const LogFile log_file ) noexcept; - void logsDirScanned(); + void logsDirScanned() noexcept; - void startWorking(); + void startWorking( const Blacklists& blacklists ); - void workerStartedParsing(); + void workerStartedParsing() noexcept; - void workerFinishedParsing(); + void workerFinishedParsing() noexcept; void stopWorking( const bool successful ); void updatePerfData( const size_t parsed_size, - const size_t parsed_lines ); + const size_t parsed_lines ) noexcept; void updateChartData( const size_t total_size, const size_t total_lines, - const size_t warnlisted_size, - const size_t blacklisted_size ); + const size_t blacklisted_size ) noexcept; void showWorkerDialog( const WorkerDialog dialog_type, - const QStringList args ) const; + const QStringList args ) const noexcept; + + void storeFilesHashes( QWaitCondition* wc, bool* successful ) noexcept; private: @@ -463,7 +329,7 @@ private: //// DIALOGS //// // quantity of information to display throught dialogs - int dialogs_level{ 2 }; // 0: essential, 1: usefull, 2: explanatory + DialogsLevel dialogs_level{ DL_NORMAL }; /////////////////// @@ -483,12 +349,7 @@ private: std::mutex mutex; //! Hires a worker to parse the selected logs - void hireWorker() const; - //! Hires a worker to parse the selected logs, asynchronously - void hireAsyncWorker() const; - - //! Defines whether it's worth it working async or not - bool shouldWorkAsync() const; + void hireWorker( const Blacklists& blacklists ) const; ////////////////////// @@ -498,7 +359,6 @@ private: size_t parsed_lines { 0ul }; // number of parsed logs lines size_t total_size { 0ul }; // total size of the logs size_t parsed_size { 0ul }; // size of the logs which have been used - size_t warnlisted_size { 0ul }; // size of the logs which caused a warning size_t blacklisted_size { 0ul }; // size of the logs which has been blacklisted std::chrono::system_clock::time_point parsing_time_start, @@ -521,53 +381,34 @@ private: size_t warning_size{ (1'048'576u * 50u) +1u }; // => 1 MiB * x - ////////////////////////////// - //// BLACKLIST / WARNLIST //// - - // { web_server_id : { log_field_id : BWlist } } - std::unordered_map> blacklists; - std::unordered_map> warnlists; - - //! Sanitizes an item removing the unwanted elements - /*! - Called when adding a new item to a list - \param log_field_id The ID of the log field - \param new_item The item to be sanitized - \return The sanitized item - \throw BWlistException, GenericException - \see BWlist - */ - std::string sanitizeBWitem( const int& log_field_id, const std::string& new_item ) const; - - //////////////////// //// WEB SERVER //// // currently used web server - unsigned current_WS{ APACHE_ID }; + WebServer current_web_server{ WS_APACHE }; - std::unordered_map logs_paths; + std::unordered_map logs_paths; //! Web Server specific file names criterions /*! 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 }; - std::unordered_map logs_base_names; + std::unordered_map logs_base_names; //! Changes the name criterions for IIS logs files names depending on the given module /*! - \param module_id The ID of the module to use to set the criterions - \throw GenericException + \param log_module The ID of the module to use to set the criterions + \throw DoNotCatchException \see LogName */ - void changeIisLogsBaseNames( const int module_id ); + void changeIisLogsBaseNames( const IISLogsModule log_module ); /////////////////// @@ -582,12 +423,12 @@ private: FormatOps formatOps; - std::unordered_map logs_format_strings; + std::unordered_map logs_format_strings; - std::unordered_map logs_formats; + std::unordered_map logs_formats; // currently used logs format - LogsFormat current_LF; + LogsFormat current_log_format; }; diff --git a/logdoctor/modules/craplog/lib.h b/logdoctor/modules/craplog/lib.h new file mode 100644 index 00000000..f8376123 --- /dev/null +++ b/logdoctor/modules/craplog/lib.h @@ -0,0 +1,14 @@ +#ifndef LOGDOCTOR__CRAPLOG__LIB_H +#define LOGDOCTOR__CRAPLOG__LIB_H + + +typedef unsigned char iis_logs_module_t; + +enum class IISLogsModule : iis_logs_module_t { + W3C = 0, + NCSA = 1, + IIS = 2 +}; + + +#endif // LOGDOCTOR__CRAPLOG__LIB_H diff --git a/logdoctor/modules/craplog/modules/datetime.cpp b/logdoctor/modules/craplog/modules/datetime.cpp index 0341dea9..7ed43509 100644 --- a/logdoctor/modules/craplog/modules/datetime.cpp +++ b/logdoctor/modules/craplog/modules/datetime.cpp @@ -1,6 +1,8 @@ #include "datetime.h" +#include "lib.h" + #include "modules/exceptions.h" #include "utilities/strings.h" @@ -50,19 +52,19 @@ const std::string convertMonth( std::string_view month ) return "12"; } else { // nope - throw DateTimeException("Unexpected month format: "+std::string{month}); + throw DateTimeException("Unexpected month format", std::string{month}); } } } // namespace (private) -std::vector processDateTime( std::string_view datetime_, std::string_view format ) +std::vector processDateTime( std::string_view datetime_, const LogsFormatField format ) { - std::string aux, datetime{datetime_}; + std::string datetime{datetime_}; std::string year, month, day, hour, minute, second; - if ( format == "ncsa" ) { + if ( format == date_time_ncsa ) { datetime = StringOps::strip( datetime, "[ ]" ); day = datetime.substr( 0ul, 2ul ); month = convertMonth( datetime.substr( 3ul, 3ul ) ); @@ -71,7 +73,7 @@ std::vector processDateTime( std::string_view datetime_, std::strin minute = datetime.substr( 15ul, 2ul ); second = datetime.substr( 18ul, 2ul ); - } else if ( format == "mcs" ) { + } else if ( format == date_time_mcs ) { month = convertMonth( datetime.substr( 4ul, 3ul ) ); day = datetime.substr( 8ul, 2ul ); hour = datetime.substr( 11ul, 2ul ); @@ -79,7 +81,7 @@ std::vector processDateTime( std::string_view datetime_, std::strin second = datetime.substr( 17ul, 2ul ); year = datetime.substr( datetime.size()-4 ); - } else if ( format == "gmt" ) { + } else if ( format == date_time_gmt ) { size_t start{ datetime.find( ", " ) + 2ul }; day = datetime.substr( start, 2ul ); start += 3ul; @@ -93,7 +95,7 @@ std::vector processDateTime( std::string_view datetime_, std::strin start += 3ul; second = datetime.substr( start, 2ul ); - } else if ( StringOps::startsWith( format, "iso" ) ) { + } else if ( format == date_time_iso ) { year = datetime.substr( 0ul, 4ul ); month = datetime.substr( 5ul, 2ul ); day = datetime.substr( 8ul, 2ul ); @@ -101,31 +103,36 @@ std::vector processDateTime( std::string_view datetime_, std::strin minute = datetime.substr( 14ul, 2ul ); second = datetime.substr( 17ul, 2ul ); - } else if ( StringOps::startsWith( format, "utc" ) ) { - if ( format == "utc_d" ) { + } else if ( _DATE_TIME_UTC & format ) { + if ( format == date_time_utc_d ) { // date year = datetime.substr( 0ul, 4ul ); month = datetime.substr( 5ul, 2ul ); day = datetime.substr( 8ul, 2ul ); - } else { + } else if ( format == date_time_utc_t ) { // time hour = datetime.substr( 0ul, 2ul ); minute = datetime.substr( 3ul, 2ul ); second = datetime.substr( 6ul, 2ul ); + } else [[unlikely]] { + // wronthing went some ... + throw DateTimeException("Unexpected DateTime UTC", std::string{datetime_}+" - format: "+std::to_string(format)); } - } else if ( StringOps::startsWith( format, "epoch_" ) ) { - aux = format.substr( 6ul ); + } else if ( _DATE_TIME_EPOCH & format ) { // convert to seconds - if ( aux == "us" ) { + if ( format == date_time_epoch_us ) { // from microseconds datetime.resize( datetime.size()-6ul ); - } else if ( aux == "ms" ) { + } else if ( format == date_time_epoch_ms ) { // from milliseconds datetime.resize( datetime.size()-3ul ); - } else if ( aux == "s.ms" ) { + } else if ( format == date_time_epoch_s_ms ) { // from seconds.milliseconds datetime = std::to_string( std::stoi( datetime ) ); + } else if ( format != date_time_epoch_s ) [[unlikely]] { + // wronthing went some ... + throw DateTimeException("Unexpected DateTime EPOCH", std::string{datetime_}+" - format: "+std::to_string(format)); } // convert to iso date format const QDateTime e{ QDateTime::fromSecsSinceEpoch( std::stoi( datetime ) ) }; @@ -139,20 +146,20 @@ std::vector processDateTime( std::string_view datetime_, std::strin minute = datetime.substr( 14ul, 2ul ); second = datetime.substr( 17ul, 2ul ); - } else { - if ( format == "YYYYMMDD" ) { + } else if ( _DATE_TIME_DATE & format ) { + if ( format == date_time_yyyymmdd ) { year = datetime.substr( 0ul, 4ul ); month = datetime.substr( 5ul, 2ul ); day = datetime.substr( 8ul, 2ul ); - } else if ( format == "MMDDYY" ) { + } else if ( format == date_time_mmddyy ) { const int y{ std::stoi( datetime.substr( 6ul, 2ul ) ) }; month = datetime.substr( 0ul, 2ul ); day = datetime.substr( 3ul, 2ul ); year = (y<70) ? "20" : "19"; year += (y<10) ? "0"+std::to_string( y ) : std::to_string( y ); - } else if ( format == "MDYYYY" ) { + } else if ( format == date_time_mdyyyy ) { size_t aux_; if ( datetime.at(2) == '/' ) { month = datetime.substr( 0ul, 2ul ); @@ -170,63 +177,65 @@ std::vector processDateTime( std::string_view datetime_, std::strin } year = datetime.substr( aux_ ); - } else if ( StringOps::startsWith( format, "year" ) ) { - year = datetime; - if ( format == "year_short" ) { - const int y{ std::stoi( year ) }; - year = (y<70) ? "20" : "19"; - year += year; - } - - } else if ( StringOps::startsWith( format, "month" ) ) { - if ( format.size() <= 5ul ) { - month = datetime; - } else { - datetime.resize( 3ul ); // may be the full name - month = convertMonth( datetime ); - } - - } else if ( format == "day" ) { - day = datetime; - - } else if ( StringOps::startsWith( format, "clock_" ) ) { - aux = format.substr( 6ul ); - if ( aux == "24" ) { - hour = datetime.substr( 0ul, 2ul ); - minute = datetime.substr( 3ul, 2ul ); - second = datetime.substr( 6ul, 2ul ); - - } else if ( aux == "12" ) { - hour = datetime.substr( 0ul, 2ul ); - minute = datetime.substr( 3ul, 2ul ); - second = datetime.substr( 6ul, 2ul ); - if ( datetime.substr( 9ul, 2ul ) == "pm" ) { - hour = std::to_string( 12 + std::stoi(hour) ); - } - - } else if ( aux == "short" ) { - hour = datetime.substr( 0ul, 2ul ); - minute = datetime.substr( 3ul, 2ul ); - - } else if ( aux == "meridian" ) { - if ( datetime == "pm" ) { - hour = "PM"; // to mark for final update - } - } - - } else if ( format == "hour" ) { - hour = datetime; - - } else if ( format == "minute" ) { - minute = datetime; - - } else if ( format == "second" ) { - second = datetime; - - } else { + } else [[unlikely]] { // wronthing went some ... - throw DateTimeException("Unexpected DateTime format: "+std::string{datetime_}); + throw DateTimeException("Unexpected DateTime DATE", std::string{datetime_}+" - format: "+std::to_string(format)); } + + } else if ( _DATE_TIME_CLOCK & format ) { + if ( format == date_time_clock_24 ) { + hour = datetime.substr( 0ul, 2ul ); + minute = datetime.substr( 3ul, 2ul ); + second = datetime.substr( 6ul, 2ul ); + + } else if ( format == date_time_clock_12 ) { + hour = datetime.substr( 0ul, 2ul ); + minute = datetime.substr( 3ul, 2ul ); + second = datetime.substr( 6ul, 2ul ); + if ( datetime.substr( 9ul, 2ul ) == "pm" ) { + hour = std::to_string( 12 + std::stoi(hour) ); + } + + } else if ( format == date_time_clock_short ) { + hour = datetime.substr( 0ul, 2ul ); + minute = datetime.substr( 3ul, 2ul ); + + } else [[unlikely]] { + // wronthing went some ... + throw DateTimeException("Unexpected DateTime CLOCK", std::string{datetime_}+" - format: "+std::to_string(format)); + } + + } else if ( _DATE_TIME_YEAR & format ) { + year = datetime; + if ( format == date_time_year_short ) { + const int y{ std::stoi( year ) }; + year = (y<70) ? "20" : "19"; + year += year; + } + + } else if ( _DATE_TIME_MONTH & format ) { + if ( format == date_time_month ) { + month = datetime; + } else { + datetime.resize( 3ul ); // may be the full name + month = convertMonth( datetime ); + } + + } else if ( format == date_time_day ) { + day = datetime; + + } else if ( format == date_time_hour ) { + hour = datetime; + + } else if ( format == date_time_minute ) { + minute = datetime; + + } else if ( format == date_time_second ) { + second = datetime; + + } else [[unlikely]] { + // wronthing went some ... + throw DateTimeException("Unexpected DateTime", std::string{datetime_}+" - format: "+std::to_string(format)); } return { year, month, day, hour, minute, second }; diff --git a/logdoctor/modules/craplog/modules/datetime.h b/logdoctor/modules/craplog/modules/datetime.h index 8c27fd99..6b9515b7 100644 --- a/logdoctor/modules/craplog/modules/datetime.h +++ b/logdoctor/modules/craplog/modules/datetime.h @@ -1,11 +1,15 @@ -#ifndef LOGDOCTOR__CRAPLOG__DATETIME_H -#define LOGDOCTOR__CRAPLOG__DATETIME_H +#ifndef LOGDOCTOR__CRAPLOG__MODULES__DATETIME_H +#define LOGDOCTOR__CRAPLOG__MODULES__DATETIME_H +#include #include #include +enum LogsFormatField : uint32_t; + + //! DateTimeOps /*! Operations for the dates @@ -20,9 +24,9 @@ namespace DateTimeOps \throw DateTimeException \return The list of items */ -std::vector processDateTime( std::string_view datetime, std::string_view format ); +std::vector processDateTime( std::string_view datetime, const LogsFormatField format ); } // namespace DateTimeOps -#endif // LOGDOCTOR__CRAPLOG__DATETIME_H +#endif // LOGDOCTOR__CRAPLOG__MODULES__DATETIME_H diff --git a/logdoctor/modules/craplog/modules/donuts.cpp b/logdoctor/modules/craplog/modules/donuts.cpp index 7c1f13ae..bc8927f1 100644 --- a/logdoctor/modules/craplog/modules/donuts.cpp +++ b/logdoctor/modules/craplog/modules/donuts.cpp @@ -34,7 +34,7 @@ QString MainSlice::name() const void MainSlice::updateLabel() { this->setLabel( this->m_name ); - //this->setLabel(QString("%1 %2%").arg(this->m_name).arg(this->percentage() * 100, 0, 'f', 2)); + //this->setLabel(QStringLiteral("%1 %2%").arg(this->m_name).arg(this->percentage() * 100, 0, 'f', 2)); } @@ -71,11 +71,9 @@ void DonutBreakdown::addBreakdownSeries( QPieSeries* series, const QColor& color series->setLabelsVisible(); const auto slices = series->slices(); for (QPieSlice *slice : slices) { - if ( StringOps::startsWith( slice->label().toStdString(), 'B' ) ) { + if ( slice->label().startsWith( 'B' ) ) { slice->setBrush( Qt::GlobalColor::black ); - } else if ( StringOps::startsWith( slice->label().toStdString(), 'W' ) ) { - slice->setBrush( QColor( 255, 140, 0, 255 ) ); - } else if ( StringOps::startsWith( slice->label().toStdString(), 'I' ) ) { + } else if ( slice->label().startsWith( 'I' ) ) { slice->setBrush( Qt::GlobalColor::transparent ); series->setPieSize( 0.0 ); } else { @@ -125,13 +123,13 @@ void DonutBreakdown::updateLegendMarkers() pieMarker->setVisible(false); } else { // modify markers from breakdown series - std::string aux = pieMarker->slice()->label().toStdString(); - if ( aux.at( aux.find('@')+1 ) != '#' ) { - pieMarker->setLabel( QString("%1 %2%") - .arg( QString::fromStdString( aux.substr( 0, aux.find('@') ) ) ) + const QString& aux = pieMarker->slice()->label(); + if ( aux.at( aux.indexOf('@')+1 ) != '#' ) { + pieMarker->setLabel( QStringLiteral("%1 %2%") + .arg( aux.mid( 0, aux.indexOf('@') ) ) .arg( pieMarker->slice()->percentage() * 100, 0, 'f', 2) ); pieMarker->setFont( QFont("Arial", 8) ); - pieMarker->slice()->setLabel( QString::fromStdString( aux.substr( aux.find('@')+1 ) ) ); + pieMarker->slice()->setLabel( aux.mid( aux.indexOf('@')+1 ) ); } else { pieMarker->setLabel( "" ); pieMarker->slice()->setLabel( "" ); diff --git a/logdoctor/modules/craplog/modules/donuts.h b/logdoctor/modules/craplog/modules/donuts.h index 207607bc..a667b4fc 100644 --- a/logdoctor/modules/craplog/modules/donuts.h +++ b/logdoctor/modules/craplog/modules/donuts.h @@ -1,5 +1,5 @@ -#ifndef LOGDOCTOR__CRAPLOG__DONUTS_H -#define LOGDOCTOR__CRAPLOG__DONUTS_H +#ifndef LOGDOCTOR__CRAPLOG__MODULES__DONUTS_H +#define LOGDOCTOR__CRAPLOG__MODULES__DONUTS_H #include @@ -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 @@ -84,4 +84,4 @@ private: }; -#endif // LOGDOCTOR__CRAPLOG__DONUTS_H +#endif // LOGDOCTOR__CRAPLOG__MODULES__DONUTS_H diff --git a/logdoctor/modules/craplog/modules/formats.cpp b/logdoctor/modules/craplog/modules/formats.cpp index 92aabfa7..0cb51fdb 100644 --- a/logdoctor/modules/craplog/modules/formats.cpp +++ b/logdoctor/modules/craplog/modules/formats.cpp @@ -1,7 +1,6 @@ #include "formats.h" -#include "lib.h" #include "modules/exceptions.h" #include "utilities/strings.h" @@ -20,7 +19,7 @@ namespace /*private*/ \return The number of new lines in a single log line \see LogsFormat, processApacheFormatString(), processNginxFormatString() */ -unsigned countNewLines( std::string_view initial, std::string_view final, const std::vector& separators ) +size_t countNewLines( std::string_view initial, std::string_view final, const std::vector& separators ) { size_t nl{ 0ul }; nl += StringOps::count( initial, '\n' ); @@ -28,7 +27,7 @@ unsigned countNewLines( std::string_view initial, std::string_view final, const for ( const std::string& sep : separators ) { nl += StringOps::count( sep, '\n' ); } - return static_cast(nl); + return nl; } @@ -66,14 +65,14 @@ std::string parseApacheEscapes( std::string_view string , const bool strftime=fa cc = string.at( i+1ul ); if ( c == '\\' && (cc == '\\' || cc == '"') ) { str1.push_back( cc ); - i++; + ++i; } else if ( c == '%' && cc == '%' ) { str1.push_back( c ); - i++; + ++i; } else { str1.push_back( c ); } - i++; + ++i; } i = 0ul; max = str1.size()-1ul; @@ -92,29 +91,29 @@ std::string parseApacheEscapes( std::string_view string , const bool strftime=fa // just the ones supported if ( cc == '\\' || cc == '"' ) { str2.push_back( cc ); - i++; + ++i; } else { if ( strftime ) { // when parsing for strftime, any other backslashed characters result in a backslash+character str2.push_back( c ); str2.push_back( cc ); - i++; + ++i; } else { if ( cc == 'n' ) { str2.push_back( '\n' ); - i++; + ++i; } else if ( cc == 'r' ) { // not supported throw LogFormatException( "LogDoctor doesn't support the usage of the Carriage Return: '\\r'" ); } else if ( cc == 't' ) { str2.push_back( '\t' ); - i++; + ++i; } else { // any other backslashed characters result in a backslash+character str2.push_back( c ); str2.push_back( cc ); - i++; + ++i; } } } @@ -122,21 +121,21 @@ std::string parseApacheEscapes( std::string_view string , const bool strftime=fa // strftime control-characters if ( cc == 'n' ) { str2.push_back( '\n' ); - i++; + ++i; } else if ( cc == 't' ) { str2.push_back( '\t' ); - i++; + ++i; } else { // any other characters result in a percent+character str2.push_back( c ); str2.push_back( cc ); - i++; + ++i; } } else { str2.push_back( c ); } - i++; + ++i; } str2.shrink_to_fit(); @@ -177,26 +176,26 @@ std::string parseNginxEscapes( std::string_view string ) // just the ones supported by nginx if ( cc == '\\' || cc == '\'' || cc == '"' ) { str.push_back( cc ); - i++; + ++i; } else if ( cc == 'n' ) { str.push_back( '\n' ); - i++; + ++i; } else if ( cc == 'r' ) { // not supported throw LogFormatException( "LogDoctor doesn't support the usage of the Carriage Return: '\\r'" ); } else if ( cc == 't' ) { str.push_back( '\t' ); - i++; + ++i; } else { // not a control-character, resulting in a backslash+character str.push_back( c ); str.push_back( cc ); - i++; + ++i; } } else { str.push_back( c ); } - i++; + ++i; } str.shrink_to_fit(); @@ -204,6 +203,17 @@ std::string parseNginxEscapes( std::string_view string ) } +//! Checks whether the given character is valid or not +/*! + \param chr The target character + \return The result of the check + \see findNginxFieldEnd +*/ +bool checkNginxFieldChar( const char& chr ) +{ + return CharOps::isAlnum( chr ) || chr == '_'; +} + //! Finds the end of a Nginx log field /*! \param string The format string @@ -211,24 +221,28 @@ std::string parseNginxEscapes( std::string_view string ) \return The ending poin of the field in the string \see processNginxFormatString() */ -size_t findNginxFieldEnd( std::string_view string, const size_t start ) +size_t findNginxFieldEnd( const std::string& string, const size_t start ) { - size_t stop{ start }; - const size_t max{ string.size()-1ul }; - if ( start < max ) { // if start equals max there's no need to loop - for ( size_t i{start}; i<=max; i++ ) { - const char& c{ string.at( i ) }; - if ( StringOps::isAlnum( c ) || c == '_' ) { - stop = i; - } else { - break; - } - } + if ( string.empty() || start >= string.size()-1ul ) { + return start; } - return stop; + return std::distance( std::cbegin(string), std::find_if_not( string.cbegin()+start, string.cend(), checkNginxFieldChar ) ) - 1ul; } +//! Checks whether the given character is valid or not +/*! + \param chr The target character + \return The result of the check + \see checkIisString +*/ +bool checkIisChar( const char& chr ) +{ + return CharOps::isAlnum( chr ) + || chr == ' ' || chr == '-' || chr == ',' || chr == ':' + || chr == '(' || chr == ')' || chr == '[' || chr == ']'; +} + //! Checks whether the format string contains invalid characters or not /*! \param string The format string @@ -237,11 +251,10 @@ size_t findNginxFieldEnd( std::string_view string, const size_t start ) */ void checkIisString( std::string_view string ) { - for ( const char chr : string ) { - if ( !(StringOps::isAlnum( chr ) || chr == ' ' || chr == '-' || chr == ',' || chr == ':' || chr == '(' || chr == ')' || chr == '[' || chr == ']') ) { - // unwanted character - throw LogFormatException( "Unexpected character found: '"+std::string{chr}+"'" ); - } + if ( const auto it{ std::find_if_not( string.cbegin(), string.cend(), checkIisChar ) }; + it != string.cend() ) { + // unwanted character + throw LogFormatException( "Unexpected character found in string: '"+std::string{*it}+"'" ); } } @@ -251,22 +264,28 @@ void checkIisString( std::string_view string ) LogsFormat FormatOps::processApacheFormatString( const std::string& f_str ) const { + if ( f_str.empty() ) { + return LogsFormat(); + } + const auto& f_map { this->APACHE_ALF }; const auto& f_map_v { this->APACHE_ALF_V }; std::string initial, final; - std::vector separators, fields; + std::vector separators; + std::vector fields; // parse the string to convert keyargs in craplog's fields format - bool is_strftime_sep; + bool is_strftime_sep{ false }; int n_fld{ 0 }; size_t start, stop{0ul}, aux, aux_start, aux_stop; const size_t max{ f_str.size()-1ul }; - std::string aux_fld, aux_fld_v, cur_fld, cur_sep; + std::string aux_fld, aux_fld_v, cur_sep; + LogsFormatField cur_fld{ _INVALID }; // find and convert any field while (true) { // start after the last found field start = stop; - if ( cur_fld == "date_time_ncsa" ) { + if ( cur_fld == date_time_ncsa ) { // NCAS time format is always enclosed inside brackets cur_sep += "]"; } @@ -295,7 +314,7 @@ LogsFormat FormatOps::processApacheFormatString( const std::string& f_str ) cons // the percent sign character, will be used as separator, skip stop = aux + 2ul; continue; - } else if ( ! StringOps::isAlnum( c ) ) { + } else if ( ! CharOps::isAlnum( c ) ) { // invalid, there must be a field code, a status code or a percent sign after a '%' throw LogFormatException( "Invalid format: there must be a valid format code, a status code or a percent sign character after a '%', found: '%"+std::string{c}+"'" ); } @@ -312,11 +331,11 @@ LogsFormat FormatOps::processApacheFormatString( const std::string& f_str ) cons // append the current separator cur_sep += f_str.substr( start, aux-start ); - aux ++; + ++ aux; char c = f_str.at( aux ); // remove the per-status directives (if any) - if ( StringOps::isNumeric( c ) || c == '!' || c == ',' ) { + if ( CharOps::isNumeric( c ) || c == '!' || c == ',' ) { // per-status, not important for LogDoctor size_t aux_aux{ aux+1ul }; while (true) { @@ -324,9 +343,9 @@ LogsFormat FormatOps::processApacheFormatString( const std::string& f_str ) cons break; } c = f_str.at( aux_aux ); - if ( StringOps::isNumeric( c ) || c == '!' || c == ',' ) { + if ( CharOps::isNumeric( c ) || c == '!' || c == ',' ) { // skip these chars - aux_aux ++; + ++ aux_aux; continue; } else { // stop @@ -363,7 +382,7 @@ LogsFormat FormatOps::processApacheFormatString( const std::string& f_str ) cons const auto& aux_map{ f_map_v.at( aux_fld_v ) }; if ( aux_map.empty() ) { // module not considered and always giving out something, even if invalid varname is passed - cur_fld = "NONE"; + cur_fld = _DISCARDED; } else if ( aux_fld.empty() ) { // no need to check further, the dafault is used in this case @@ -375,11 +394,12 @@ LogsFormat FormatOps::processApacheFormatString( const std::string& f_str ) cons } else if ( aux_fld_v == "p" || aux_fld_v == "P" || aux_fld_v == "T" ) { // still not considered (except 'T'), but invalid fields get used as text // field concatenation not allowed, whole content used as varname - if ( aux_map.find( aux_fld ) != aux_map.end() ) { + if ( aux_map.contains( aux_fld ) ) { // valid varname cur_fld = aux_map.at( aux_fld ); } else { // invalid varname, use as text + cur_fld = _INVALID; cur_sep += aux_fld; start = stop = aux_stop; continue; @@ -388,15 +408,15 @@ LogsFormat FormatOps::processApacheFormatString( const std::string& f_str ) cons } else if ( aux_fld_v == "a" || aux_fld_v == "h" ) { // whatever the varname is (valid, invalid, empty), always returns the client // field concatenation not allowed, the entire content is used as varname - cur_fld = "client" ; + cur_fld = client; } else if ( aux_fld_v == "i" ) { // always giving a result, may the varname be valid or not ('-' if invalid/empty) // field concatenation not allowed, the entire content is used as varname - if ( aux_map.find( aux_fld ) != aux_map.end() ) { + if ( aux_map.contains( aux_fld ) ) { cur_fld = aux_map.at( aux_fld ); } else { - cur_fld = "NONE"; + cur_fld = _DISCARDED; } } else /*if ( aux_fld_v == "t" )*/ { @@ -405,12 +425,13 @@ LogsFormat FormatOps::processApacheFormatString( const std::string& f_str ) cons if ( aux_aux == std::string::npos ) { // no concatenation, only valid fields used, anything else used as text // whole content used as varname - if ( aux_map.find( aux_fld ) != aux_map.end() ) { + if ( aux_map.contains( aux_fld ) ) { // valid cur_fld = aux_map.at( aux_fld ); is_strftime_sep = true; } else { // invalid, append to current separator + cur_fld = _INVALID; cur_sep += aux_fld; start = stop = aux_stop; continue; @@ -457,7 +478,7 @@ LogsFormat FormatOps::processApacheFormatString( const std::string& f_str ) cons aux_aux_fld = aux_fld.substr( aux_aux, 2ul ); aux_aux_stop = aux_aux+2ul; // check if the field is valid - if ( aux_map.find( aux_aux_fld ) != aux_map.end() ) { + if ( aux_map.contains( aux_aux_fld ) ) { // valid, append cur_fld = aux_map.at( aux_aux_fld ); // append the separator @@ -475,7 +496,7 @@ LogsFormat FormatOps::processApacheFormatString( const std::string& f_str ) cons cur_sep.clear(); // append the field fields.push_back( cur_fld ); - n_fld ++; + ++ n_fld; } else { // invalid, append as separator and keep hunting @@ -496,13 +517,13 @@ LogsFormat FormatOps::processApacheFormatString( const std::string& f_str ) cons aux_stop = aux+1ul; if ( aux_fld == ">" || aux_fld == "<" ) { aux_fld += f_str.at( aux+1 ); - aux_stop ++; + ++ aux_stop; } // check if the module is valid - if ( f_map.find( aux_fld ) != f_map.end() ) { + if ( f_map.contains( aux_fld ) ) { // valid cur_fld = f_map.at( aux_fld ); - if ( cur_fld == "date_time_ncsa" ) { + if ( cur_fld == date_time_ncsa ) { // apache's NCSA time format is always enclosed inside brackets cur_sep += "["; } @@ -526,7 +547,7 @@ LogsFormat FormatOps::processApacheFormatString( const std::string& f_str ) cons break; } - if ( cur_fld.empty() ) { + if ( cur_fld == _INVALID ) { // invalid field, used as text (namely, added to current separator) continue; } @@ -548,23 +569,24 @@ LogsFormat FormatOps::processApacheFormatString( const std::string& f_str ) cons // append the field fields.push_back( cur_fld ); - n_fld++; + ++ n_fld; } return LogsFormat( - f_str, initial, final, separators, fields, + f_str, std::move(initial), std::move(final), + std::move(separators), std::move(fields), countNewLines( initial, final, separators ) ); } // sample -QString FormatOps::getApacheLogSample( const LogsFormat& log_format ) const +QString FormatOps::getApacheLogSample( const LogsFormat& log_format ) const noexcept { QString sample; const auto& map{ this->APACHE_ALF_SAMPLES }; // append the initial characters sample += QString::fromStdString( log_format.initial ); - for ( size_t i{0ul}; iNGINX_ALF }; std::string initial, final; - std::vector separators, fields; + std::vector separators; + std::vector fields; // parse the string to convert keyargs in craplog's fields format bool finished{ false }; size_t start, aux, stop{0ul}; @@ -602,13 +629,14 @@ LogsFormat FormatOps::processNginxFormatString( const std::string& f_str ) const final = parseNginxEscapes( f_str.substr( start ) ); break; } - aux ++; + ++ aux; // find the end of the current field - stop = findNginxFieldEnd( f_str, aux ) + 1ul; + stop = findNginxFieldEnd( f_str, aux ); if ( stop == max ) { // this is the last field, and ther's no final separator finished |= true; } + ++ stop; cur_sep = f_str.substr( start, aux-start-1ul ); cur_fld = f_str.substr( aux, stop-aux ); @@ -630,14 +658,14 @@ LogsFormat FormatOps::processNginxFormatString( const std::string& f_str ) const } // check if the field is valid - if ( f_map.find( cur_fld ) != f_map.end() ) { + if ( const auto it{ f_map.find( cur_fld ) }; it != f_map.end() ) { // valid, append if ( start == 0ul ) { initial = parseNginxEscapes( cur_sep ); } else { separators.push_back( parseNginxEscapes( cur_sep ) ); } - fields.push_back( f_map.at( cur_fld ) ); + fields.push_back( it->second ); if ( finished ) { // this was the last field break; @@ -649,18 +677,19 @@ LogsFormat FormatOps::processNginxFormatString( const std::string& f_str ) const } return LogsFormat( - f_str, initial, final, separators, fields, + f_str, std::move(initial), std::move(final), + std::move(separators), std::move(fields), countNewLines( initial, final, separators ) ); } // sample -QString FormatOps::getNginxLogSample( const LogsFormat& log_format ) const +QString FormatOps::getNginxLogSample( const LogsFormat& log_format ) const noexcept { QString sample; const auto& map{ this->NGINX_ALF_SAMPLES }; // append the initial characters sample += QString::fromStdString( log_format.initial ); - for ( size_t i{0}; i separators, fields; + std::vector separators; + std::vector fields; switch ( l_mod ) { - case 2: + case IISLogsModule::IIS: // IIS logging module final = ","; separators = {", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", "}; - fields = {"client","NONE","date_time_MDYYYY","date_time_utc_t","NONE","NONE","NONE","time_taken_ms","bytes_received","bytes_sent","response_code","NONE","request_method","request_uri","request_query"}; + fields = {client,_DISCARDED,date_time_mdyyyy,date_time_utc_t,_DISCARDED,_DISCARDED,_DISCARDED,time_taken_ms,bytes_received,bytes_sent,response_code,_DISCARDED,request_method,request_uri,request_query}; break; - case 1: + case IISLogsModule::NCSA: // NCSA logging module separators = {" "," "," [","] \"","\" "," "}; - fields = {"client","NONE","NONE","date_time_ncsa","request_full","response_code","bytes_sent"}; + fields = {client,_DISCARDED,_DISCARDED,date_time_ncsa,request_full,response_code,bytes_sent}; break; - case 0: + case IISLogsModule::W3C: // W3C logging module if ( f_str.size() > 0ul ) { bool finished{ false }; @@ -717,12 +747,12 @@ LogsFormat FormatOps::processIisFormatString( const std::string& f_str, const in // set the current field cur_fld = f_str.substr( start, stop-start ); // step over the separator - stop++; + ++ stop; // check if the module is valid - if ( f_map.find( cur_fld ) != f_map.end() ) { + if ( const auto it{ f_map.find( cur_fld ) }; it != f_map.end() ) { // valid, append - fields.push_back( f_map.at( cur_fld ) ); + fields.push_back( it->second ); if ( ! finished ) { separators.push_back( cur_sep ); } else { @@ -740,21 +770,22 @@ LogsFormat FormatOps::processIisFormatString( const std::string& f_str, const in default: // shouldn't be here - throw LogFormatException( "Unexpected LogModule for IIS: "+std::to_string( l_mod ) ); + throw LogFormatException( "Unexpected LogModule for IIS: "+std::to_string( static_cast(l_mod) ) ); } return LogsFormat( - f_str, initial, final, separators, fields, 0 ); + f_str, std::move(initial), std::move(final), + std::move(separators), std::move(fields), 0 ); } // sample -QString FormatOps::getIisLogSample( const LogsFormat& log_format ) const +QString FormatOps::getIisLogSample( const LogsFormat& log_format ) const noexcept { QString sample; const auto& map{ this->IIS_ALF_SAMPLES }; // append the initial characters sample += QString::fromStdString( log_format.initial ); - for ( size_t i{0}; i #include -class LogsFormat; + +struct LogsFormat; //! FormatOps /*! Operations for the logs formats */ -class FormatOps +class FormatOps final { + using simple_fields_umap_t = std::unordered_map; + using composed_fields_umap_t = std::unordered_map>; + using samples_umap_t = std::unordered_map; + public: //! Processes the given string to extrapolate the format for Apache2 @@ -43,7 +52,7 @@ public: \throw LogFormatException \see LogsFormat */ - LogsFormat processIisFormatString( const std::string& format_string, const int& log_module ) const; + LogsFormat processIisFormatString( const std::string& format_string, const IISLogsModule log_module ) const; ///////////////// @@ -55,7 +64,7 @@ public: \return The sample line \see LogsFormat, Craplog::getLogsFormatSample() */ - QString getApacheLogSample( const LogsFormat& log_format ) const; + QString getApacheLogSample( const LogsFormat& log_format ) const noexcept; //! Returns a log line sample based on the given format /*! @@ -63,7 +72,7 @@ public: \return The sample line \see LogsFormat, Craplog::getLogsFormatSample() */ - QString getNginxLogSample( const LogsFormat& log_format ) const; + QString getNginxLogSample( const LogsFormat& log_format ) const noexcept; //! Returns a log line sample based on the given format /*! @@ -71,7 +80,7 @@ public: \return The sample line \see LogsFormat, Craplog::getLogsFormatSample() */ - QString getIisLogSample( const LogsFormat& log_format ) const; + QString getIisLogSample( const LogsFormat& log_format ) const noexcept; private: @@ -79,364 +88,364 @@ private: ///////////////// //// APACHE2 //// - //!< Access logs fields formats - const std::unordered_map APACHE_ALF{ - {"a", "NONE"}, - {"A", "NONE"}, - {"b", "NONE"}, - {"B", "NONE"}, - {"C", "NONE"}, - {"D", "time_taken_ms"}, - {"e", "NONE"}, - {"f", "NONE"}, - {"h", "client"}, - {"H", "request_protocol"}, - {"i", "NONE"}, - {"I", "bytes_received"}, - {"k", "NONE"}, - {"l", "NONE"}, - {"L", "NONE"}, - {"m", "request_method"}, - {"n", "NONE"}, - {"o", "NONE"}, - {"O", "bytes_sent"}, - {"p", "NONE"}, - {"P", "NONE"}, - {"q", "request_query"}, - {"r", "request_full"}, - {"R", "NONE"}, - {"s", "response_code"}, - {"s", "response_code"}, - {"S", "NONE"}, - {"t", "date_time_ncsa"}, - {"T", "time_taken_s"}, - {"u", "NONE"}, - {"U", "request_uri"}, - {"v", "NONE"}, - {"V", "NONE"}, - {"X", "NONE"} }; + //! Access logs fields formats + const simple_fields_umap_t APACHE_ALF{ + {"a", _DISCARDED}, + {"A", _DISCARDED}, + {"b", _DISCARDED}, + {"B", _DISCARDED}, + {"C", _DISCARDED}, + {"D", time_taken_ms}, + {"e", _DISCARDED}, + {"f", _DISCARDED}, + {"h", client}, + {"H", request_protocol}, + {"i", _DISCARDED}, + {"I", bytes_received}, + {"k", _DISCARDED}, + {"l", _DISCARDED}, + {"L", _DISCARDED}, + {"m", request_method}, + {"n", _DISCARDED}, + {"o", _DISCARDED}, + {"O", bytes_sent}, + {"p", _DISCARDED}, + {"P", _DISCARDED}, + {"q", request_query}, + {"r", request_full}, + {"R", _DISCARDED}, + {"s", response_code}, + {"s", response_code}, + {"S", _DISCARDED}, + {"t", date_time_ncsa}, + {"T", time_taken_s}, + {"u", _DISCARDED}, + {"U", request_uri}, + {"v", _DISCARDED}, + {"V", _DISCARDED}, + {"X", _DISCARDED} }; - //!< Composed access logs fields formats - const std::unordered_map> APACHE_ALF_V{ - {"a", { {"", "client"}, // as %h (from single fields) - {"c", "client"}}}, - {"h", { {"", "client"}, // as %h (from single fields) - {"c", "client"}}}, - {"i", { {"", "NONE"}, - {"Cookie", "cookie"}, - {"Referer", "referer"}, - {"User-agent", "user_agent"}}}, - {"t", { {"", "date_time_ncsa"}, // as %t (from single fields) - //{"%%", "NONE"}, // the percent sign - //{"%n", "NONE"}, // line feed - //{"%t", "NONE"}, // horizontal tab - {"sec", "date_time_epoch_s"}, - {"msec", "date_time_epoch_ms"}, - {"usec", "date_time_epoch_us"}, - {"msec_frac", "NONE"}, // milliseconds fraction - {"usec_frac", "NONE"}, // microseconds fraction - {"%a", "NONE"}, // abbreviated weekday name - {"%A", "NONE"}, // weekday name - {"%b", "date_time_month_str"}, - {"%B", "date_time_month_str"}, - {"%c", "date_time_mcs"}, - {"%C", "NONE"}, // year (first 2 digits, aka centuries) - {"%d", "date_time_day"}, - {"%D", "date_time_MMDDYY"}, - {"%e", "date_time_day"}, - {"%F", "date_time_YYYYMMDD"}, - {"%g", "NONE"}, // weel-based year (last 2 digits) - {"%G", "NONE"}, // week-based year, namely the year which contains the current week - {"%h", "date_time_month_str"}, - {"%H", "date_time_hour"}, - {"%I", "NONE"}, // hour (12h format) - {"%j", "NONE"}, // day of the year number - {"%k", "date_time_hour"}, // ?!? hour (24h format) !?! no documentation ?!? - {"%l", "NONE"}, // hour (12h format) - {"%m", "date_time_month"}, - {"%M", "date_time_minute"}, - {"%p", "NONE"}, // AM or PM - {"%r", "date_time_clock_12"}, - {"%R", "date_time_clock_short"}, - {"%s", "date_time_epoch_s"}, - {"%S", "date_time_second"}, - {"%T", "date_time_clock_24"}, - {"%u", "NONE"}, // weekday number (1-7, Monday is 1) - {"%U", "NONE"}, // week of the year number, with the first Sunday as the first day of week one - {"%V", "NONE"}, // week of the year number - {"%w", "NONE"}, // weekday number (0-6, Sunday is 0) - {"%W", "NONE"}, // week of the year number, with the first Monday as the first day of week one - {"%x", "date_time_MMDDYY"}, - {"%X", "date_time_clock_24"}, - {"%y", "date_time_year_short"}, - {"%Y", "date_time_year"}, - {"%z", "NONE"}, // timezone offset from UTC (1 minute=1, 1 hour=100) - {"%Z", "NONE"}}}, // timezone name abbreviation - {"T", { {"", "time_taken_s"}, // as s - {"s", "time_taken_s"}, - {"ms", "time_taken_ms"}, - {"us", "time_taken_us"}}}, + //! Composed access logs fields formats + const composed_fields_umap_t APACHE_ALF_V{ + {"a", { {"", client}, // as %h (from single fields) + {"c", client}}}, + {"h", { {"", client}, // as %h (from single fields) + {"c", client}}}, + {"i", { {"", _DISCARDED}, + {"Cookie", cookie}, + {"Referer", referer}, + {"User-agent", user_agent}}}, + {"t", { {"", date_time_ncsa}, // as %t (from single fields) + //{"%%", _DISCARDED}, // the percent sign + //{"%n", _DISCARDED}, // line feed + //{"%t", _DISCARDED}, // horizontal tab + {"sec", date_time_epoch_s}, + {"msec", date_time_epoch_ms}, + {"usec", date_time_epoch_us}, + {"msec_frac", _DISCARDED}, // milliseconds fraction + {"usec_frac", _DISCARDED}, // microseconds fraction + {"%a", _DISCARDED}, // abbreviated weekday name + {"%A", _DISCARDED}, // weekday name + {"%b", date_time_month_str}, + {"%B", date_time_month_str}, + {"%c", date_time_mcs}, + {"%C", _DISCARDED}, // year (first 2 digits, aka centuries) + {"%d", date_time_day}, + {"%D", date_time_mmddyy}, + {"%e", date_time_day}, + {"%F", date_time_yyyymmdd}, + {"%g", _DISCARDED}, // weel-based year (last 2 digits) + {"%G", _DISCARDED}, // week-based year, namely the year which contains the current week + {"%h", date_time_month_str}, + {"%H", date_time_hour}, + {"%I", _DISCARDED}, // hour (12h format) + {"%j", _DISCARDED}, // day of the year number + {"%k", date_time_hour}, // ?!? hour (24h format) !?! no documentation ?!? + {"%l", _DISCARDED}, // hour (12h format) + {"%m", date_time_month}, + {"%M", date_time_minute}, + {"%p", _DISCARDED}, // AM or PM + {"%r", date_time_clock_12}, + {"%R", date_time_clock_short}, + {"%s", date_time_epoch_s}, + {"%S", date_time_second}, + {"%T", date_time_clock_24}, + {"%u", _DISCARDED}, // weekday number (1-7, Monday is 1) + {"%U", _DISCARDED}, // week of the year number, with the first Sunday as the first day of week one + {"%V", _DISCARDED}, // week of the year number + {"%w", _DISCARDED}, // weekday number (0-6, Sunday is 0) + {"%W", _DISCARDED}, // week of the year number, with the first Monday as the first day of week one + {"%x", date_time_mmddyy}, + {"%X", date_time_clock_24}, + {"%y", date_time_year_short}, + {"%Y", date_time_year}, + {"%z", _DISCARDED}, // timezone offset from UTC (1 minute=1, 1 hour=100) + {"%Z", _DISCARDED}}}, // timezone name abbreviation + {"T", { {"", time_taken_s}, // as s + {"s", time_taken_s}, + {"ms", time_taken_ms}, + {"us", time_taken_us}}}, // composed not in use {"C", {}}, {"e", {}}, {"L", {}}, {"n", {}}, {"o", {}}, - {"p", {{"", "NONE"}, // as canonical - {"canonical", "NONE"}, - {"local", "NONE"}, - {"remote", "NONE"}}}, - {"P", {{"", "NONE"}, // as pid - {"pid", "NONE"}, - {"tid", "NONE"}, - {"hextid", "NONE"}}}, + {"p", {{"", _DISCARDED}, // as canonical + {"canonical", _DISCARDED}, + {"local", _DISCARDED}, + {"remote", _DISCARDED}}}, + {"P", {{"", _DISCARDED}, // as pid + {"pid", _DISCARDED}, + {"tid", _DISCARDED}, + {"hextid", _DISCARDED}}}, {"^ti", {}}, {"^to", {}} }; // Access logs fields formats samples - const std::unordered_map APACHE_ALF_SAMPLES{ - {"NONE", "DISCARDED"}, - {"date_time_epoch_s", "946771199"}, - {"date_time_epoch_ms", "946771199000"}, - {"date_time_epoch_us", "946771199000000"}, - {"date_time_ncsa", "01/Jan/2000:23:59:59 +0000"}, - {"date_time_mcs", "Sat Jan 01 23:59:59 2000"}, - {"date_time_YYYYMMDD", "2000-01-01"}, - {"date_time_MMDDYY", "01/01/00"}, - {"date_time_year", "2000"}, - {"date_time_year_short", "00"}, - {"date_time_month_str", "January"}, - {"date_time_month", "01"}, - {"date_time_day", "01"}, - {"date_time_clock_12", "11:59:59 pm"}, - {"date_time_clock_24", "23:59:59"}, - {"date_time_clock_short", "23:59"}, - {"date_time_hour", "23"}, - {"date_time_minute", "59"}, - {"date_time_second", "59"}, - {"request_full", "GET /index.php?query=x HTTP/1.1"}, - {"request_protocol", "HTTP/1.1"}, - {"request_method", "GET"}, - {"request_uri", "/index.php"}, - {"request_query", "query=x"}, - {"response_code", "404"}, - {"bytes_sent", "1234"}, - {"bytes_received", "123"}, - {"time_taken_s", "1"}, - {"time_taken_ms", "1000"}, - {"time_taken_us", "1000000"}, - {"referer", "http://www.referrer.site"}, - {"cookie", "aCookie=abc123"}, - {"user_agent", "UserAgent/3.0 (Details stuff) Info/123"}, - {"client", "192.168.1.123"} }; + const samples_umap_t APACHE_ALF_SAMPLES{ + {_DISCARDED, R"(DISCARDED)"}, + {date_time_epoch_s, R"(946771199)"}, + {date_time_epoch_ms, R"(946771199000)"}, + {date_time_epoch_us, R"(946771199000000)"}, + {date_time_ncsa, R"(01/Jan/2000:23:59:59 +0000)"}, + {date_time_mcs, R"(Sat Jan 01 23:59:59 2000)"}, + {date_time_yyyymmdd, R"(2000-01-01)"}, + {date_time_mmddyy, R"(01/01/00)"}, + {date_time_year, R"(2000)"}, + {date_time_year_short, R"(00)"}, + {date_time_month_str, R"(January)"}, + {date_time_month, R"(01)"}, + {date_time_day, R"(01)"}, + {date_time_clock_12, R"(11:59:59 pm)"}, + {date_time_clock_24, R"(23:59:59)"}, + {date_time_clock_short, R"(23:59)"}, + {date_time_hour, R"(23)"}, + {date_time_minute, R"(59)"}, + {date_time_second, R"(59)"}, + {request_full, R"(GET /index.php?query=x HTTP/1.1)"}, + {request_protocol, R"(HTTP/1.1)"}, + {request_method, R"(GET)"}, + {request_uri, R"(/index.php)"}, + {request_query, R"(query=x)"}, + {response_code, R"(404)"}, + {bytes_sent, R"(1234)"}, + {bytes_received, R"(123)"}, + {time_taken_s, R"(1)"}, + {time_taken_ms, R"(1000)"}, + {time_taken_us, R"(1000000)"}, + {referer, R"(http://www.referrer.site)"}, + {cookie, R"(aCookie=abc123)"}, + {user_agent, R"(UserAgent/3.0 (Details stuff) Info/123)"}, + {client, R"(192.168.1.123)"} }; /////////////// //// NGINX //// - //!< Access logs fields formats - const std::unordered_map NGINX_ALF{ - {"remote_addr", "client"}, - {"realip_remote_addr", "client"}, - {"time_local", "date_time_ncsa"}, - {"time_iso8601", "date_time_iso"}, - {"date_gmt", "date_time_gmt"}, - {"msec", "date_time_epoch_s.ms"}, - {"request", "request_full"}, - {"server_protocol", "request_protocol"}, - {"request_method", "request_method"}, - {"request_uri", "request_uri_query"}, - {"uri", "request_uri"}, - {"query_string", "request_query"}, - {"status", "response_code"}, - {"bytes_sent", "bytes_sent"}, - {"request_length", "bytes_received"}, - {"request_time", "time_taken_s.ms"}, - {"http_referer", "referer"}, - {"cookie_", "cookie"}, - {"http_user_agent", "user_agent"}, + //! Access logs fields formats + const simple_fields_umap_t NGINX_ALF{ + {"remote_addr", client}, + {"realip_remote_addr", client}, + {"time_local", date_time_ncsa}, + {"time_iso8601", date_time_iso}, + {"date_gmt", date_time_gmt}, + {"msec", date_time_epoch_s_ms}, + {"request", request_full}, + {"server_protocol", request_protocol}, + {"request_method", request_method}, + {"request_uri", request_uri_query}, + {"uri", request_uri}, + {"query_string", request_query}, + {"status", response_code}, + {"bytes_sent", bytes_sent}, + {"request_length", bytes_received}, + {"request_time", time_taken_s_ms}, + {"http_referer", referer}, + {"cookie_", cookie}, + {"http_user_agent", user_agent}, // not in use, will be discarded - {"ancient_browser", "NONE"}, - {"arg_", "NONE"}, - {"args", "NONE"}, - {"binary_remote_addr", "NONE"}, - {"body_bytes_sent", "NONE"}, - {"connection", "NONE"}, - {"connection_requests", "NONE"}, - {"connections_active", "NONE"}, - {"connections_reading", "NONE"}, - {"connections_waiting", "NONE"}, - {"connections_writing", "NONE"}, - {"content_length", "NONE"}, - {"content_type", "NONE"}, - {"date_local", "NONE"}, - {"document_root", "NONE"}, - {"document_uri", "NONE"}, - {"fastcgi_path_info", "NONE"}, - {"fastcgi_script_name", "NONE"}, - {"geoip_area_code", "NONE"}, - {"geoip_city", "NONE"}, - {"geoip_city_continent_code", "NONE"}, - {"geoip_city_country_code", "NONE"}, - {"geoip_city_country_code3", "NONE"}, - {"geoip_city_country_name", "NONE"}, - {"geoip_country_code", "NONE"}, - {"geoip_country_code3", "NONE"}, - {"geoip_country_name", "NONE"}, - {"geoip_dma_code", "NONE"}, - {"geoip_latitude", "NONE"}, - {"geoip_longitude", "NONE"}, - {"geoip_org", "NONE"}, - {"geoip_postal_code", "NONE"}, - {"geoip_region", "NONE"}, - {"geoip_region_name", "NONE"}, - {"gzip_ratio", "NONE"}, - {"host", "NONE"}, - {"hostname", "NONE"}, - {"http2", "NONE"}, - {"http_", "NONE"}, - {"https", "NONE"}, - {"invalid_referer", "NONE"}, - {"is_args", "NONE"}, - {"limit_rate", "NONE"}, - {"memcached_key", "NONE"}, - {"modern_browser", "NONE"}, - {"msie", "NONE"}, - {"nginx_version", "NONE"}, - {"pid", "NONE"}, - {"pipe", "NONE"}, - {"proxy_add_x_forwarded_for", "NONE"}, - {"proxy_host", "NONE"}, - {"proxy_port", "NONE"}, - {"proxy_protocol_addr", "NONE"}, - {"proxy_protocol_port", "NONE"}, - {"realip_remote_port", "NONE"}, - {"realpath_root", "NONE"}, - {"remote_port", "NONE"}, - {"remote_user", "NONE"}, - {"request_body", "NONE"}, - {"request_body_file", "NONE"}, - {"request_completion", "NONE"}, - {"request_filename", "NONE"}, - {"request_id", "NONE"}, - {"scheme", "NONE"}, - {"secure_link", "NONE"}, - {"secure_link_expires", "NONE"}, - {"sent_http_", "NONE"}, - {"server_addr", "NONE"}, - {"server_name", "NONE"}, - {"server_port", "NONE"}, - {"session_log_binary_id", "NONE"}, - {"session_log_id", "NONE"}, - {"slice_range", "NONE"}, - {"spdy", "NONE"}, - {"spdy_request_priority", "NONE"}, - {"ssl_cipher", "NONE"}, - {"ssl_client_cert", "NONE"}, - {"ssl_client_fingerprint", "NONE"}, - {"ssl_client_i_dn", "NONE"}, - {"ssl_client_raw_cert", "NONE"}, - {"ssl_client_s_dn", "NONE"}, - {"ssl_client_serial", "NONE"}, - {"ssl_client_verify", "NONE"}, - {"ssl_protocol", "NONE"}, - {"ssl_server_name", "NONE"}, - {"ssl_session_id", "NONE"}, - {"ssl_session_reused", "NONE"}, - {"tcpinfo_rtt,", "NONE"}, - {"tcpinfo_rttvar,", "NONE"}, - {"tcpinfo_snd_cwnd,", "NONE"}, - {"tcpinfo_rcv_space", "NONE"}, - {"uid_got", "NONE"}, - {"uid_reset", "NONE"}, - {"uid_set", "NONE"}, - {"upstream_addr", "NONE"}, - {"upstream_cache_status", "NONE"}, - {"upstream_connect_time", "NONE"}, - {"upstream_cookie_", "NONE"}, - {"upstream_header_time", "NONE"}, - {"upstream_http_", "NONE"}, - {"upstream_response_length", "NONE"}, - {"upstream_response_time", "NONE"}, - {"upstream_status", "NONE"} }; + {"ancient_browser", _DISCARDED}, + {"arg_", _DISCARDED}, + {"args", _DISCARDED}, + {"binary_remote_addr", _DISCARDED}, + {"body_bytes_sent", _DISCARDED}, + {"connection", _DISCARDED}, + {"connection_requests", _DISCARDED}, + {"connections_active", _DISCARDED}, + {"connections_reading", _DISCARDED}, + {"connections_waiting", _DISCARDED}, + {"connections_writing", _DISCARDED}, + {"content_length", _DISCARDED}, + {"content_type", _DISCARDED}, + {"date_local", _DISCARDED}, + {"document_root", _DISCARDED}, + {"document_uri", _DISCARDED}, + {"fastcgi_path_info", _DISCARDED}, + {"fastcgi_script_name", _DISCARDED}, + {"geoip_area_code", _DISCARDED}, + {"geoip_city", _DISCARDED}, + {"geoip_city_continent_code", _DISCARDED}, + {"geoip_city_country_code", _DISCARDED}, + {"geoip_city_country_code3", _DISCARDED}, + {"geoip_city_country_name", _DISCARDED}, + {"geoip_country_code", _DISCARDED}, + {"geoip_country_code3", _DISCARDED}, + {"geoip_country_name", _DISCARDED}, + {"geoip_dma_code", _DISCARDED}, + {"geoip_latitude", _DISCARDED}, + {"geoip_longitude", _DISCARDED}, + {"geoip_org", _DISCARDED}, + {"geoip_postal_code", _DISCARDED}, + {"geoip_region", _DISCARDED}, + {"geoip_region_name", _DISCARDED}, + {"gzip_ratio", _DISCARDED}, + {"host", _DISCARDED}, + {"hostname", _DISCARDED}, + {"http2", _DISCARDED}, + {"http_", _DISCARDED}, + {"https", _DISCARDED}, + {"invalid_referer", _DISCARDED}, + {"is_args", _DISCARDED}, + {"limit_rate", _DISCARDED}, + {"memcached_key", _DISCARDED}, + {"modern_browser", _DISCARDED}, + {"msie", _DISCARDED}, + {"nginx_version", _DISCARDED}, + {"pid", _DISCARDED}, + {"pipe", _DISCARDED}, + {"proxy_add_x_forwarded_for", _DISCARDED}, + {"proxy_host", _DISCARDED}, + {"proxy_port", _DISCARDED}, + {"proxy_protocol_addr", _DISCARDED}, + {"proxy_protocol_port", _DISCARDED}, + {"realip_remote_port", _DISCARDED}, + {"realpath_root", _DISCARDED}, + {"remote_port", _DISCARDED}, + {"remote_user", _DISCARDED}, + {"request_body", _DISCARDED}, + {"request_body_file", _DISCARDED}, + {"request_completion", _DISCARDED}, + {"request_filename", _DISCARDED}, + {"request_id", _DISCARDED}, + {"scheme", _DISCARDED}, + {"secure_link", _DISCARDED}, + {"secure_link_expires", _DISCARDED}, + {"sent_http_", _DISCARDED}, + {"server_addr", _DISCARDED}, + {"server_name", _DISCARDED}, + {"server_port", _DISCARDED}, + {"session_log_binary_id", _DISCARDED}, + {"session_log_id", _DISCARDED}, + {"slice_range", _DISCARDED}, + {"spdy", _DISCARDED}, + {"spdy_request_priority", _DISCARDED}, + {"ssl_cipher", _DISCARDED}, + {"ssl_client_cert", _DISCARDED}, + {"ssl_client_fingerprint", _DISCARDED}, + {"ssl_client_i_dn", _DISCARDED}, + {"ssl_client_raw_cert", _DISCARDED}, + {"ssl_client_s_dn", _DISCARDED}, + {"ssl_client_serial", _DISCARDED}, + {"ssl_client_verify", _DISCARDED}, + {"ssl_protocol", _DISCARDED}, + {"ssl_server_name", _DISCARDED}, + {"ssl_session_id", _DISCARDED}, + {"ssl_session_reused", _DISCARDED}, + {"tcpinfo_rtt", _DISCARDED}, + {"tcpinfo_rttvar", _DISCARDED}, + {"tcpinfo_snd_cwnd", _DISCARDED}, + {"tcpinfo_rcv_space", _DISCARDED}, + {"uid_got", _DISCARDED}, + {"uid_reset", _DISCARDED}, + {"uid_set", _DISCARDED}, + {"upstream_addr", _DISCARDED}, + {"upstream_cache_status", _DISCARDED}, + {"upstream_connect_time", _DISCARDED}, + {"upstream_cookie_", _DISCARDED}, + {"upstream_header_time", _DISCARDED}, + {"upstream_http_", _DISCARDED}, + {"upstream_response_length", _DISCARDED}, + {"upstream_response_time", _DISCARDED}, + {"upstream_status", _DISCARDED} }; // Access logs fields formats samples - const std::unordered_map NGINX_ALF_SAMPLES{ - {"NONE", "DISCARDED"}, - {"date_time_epoch_s.ms", "946771199.000"}, - {"date_time_ncsa", "01/Jan/2000:23:59:59 +0000"}, - {"date_time_iso", "2000-01-01T23:59:59+00:00"}, - {"date_time_gmt", "Saturday, 01-Jan-2000 23:59:59 UTC"}, - {"request_full", "GET /index.php?query=x HTTP/1.1"}, - {"request_protocol", "HTTP/1.1"}, - {"request_method", "GET"}, - {"request_uri_query", "/index.php?query=x"}, - {"request_uri", "/index.php"}, - {"request_query", "query=x"}, - {"response_code", "404"}, - {"bytes_sent", "1234"}, - {"bytes_received", "123"}, - {"time_taken_s.ms", "1.000"}, - {"referer", "http://www.referrer.site"}, - {"cookie", "aCookie=abc123"}, - {"user_agent", "UserAgent/3.0 (Details stuff) Info/123"}, - {"client", "192.168.1.123"} }; + const samples_umap_t NGINX_ALF_SAMPLES{ + {_DISCARDED, R"(DISCARDED)"}, + {date_time_epoch_s_ms, R"(946771199.000)"}, + {date_time_ncsa, R"(01/Jan/2000:23:59:59 +0000)"}, + {date_time_iso, R"(2000-01-01T23:59:59+00:00)"}, + {date_time_gmt, R"(Saturday, 01-Jan-2000 23:59:59 UTC)"}, + {request_full, R"(GET /index.php?query=x HTTP/1.1)"}, + {request_protocol, R"(HTTP/1.1)"}, + {request_method, R"(GET)"}, + {request_uri_query, R"(/index.php?query=x)"}, + {request_uri, R"(/index.php)"}, + {request_query, R"(query=x)"}, + {response_code, R"(404)"}, + {bytes_sent, R"(1234)"}, + {bytes_received, R"(123)"}, + {time_taken_s_ms, R"(1.000)"}, + {referer, R"(http://www.referrer.site)"}, + {cookie, R"(aCookie=abc123)"}, + {user_agent, R"(UserAgent/3.0 (Details stuff) Info/123)"}, + {client, R"(192.168.1.123)"} }; ///////////// //// IIS //// - //!< Access logs fields formats (W3C) - const std::unordered_map IIS_ALF{ - {"date", "date_time_utc_d"}, - {"time", "date_time_utc_t"}, - {"cs-version", "request_protocol"}, - {"cs-method", "request_method"}, - {"cs-uri-stem", "request_uri"}, - {"cs-uri-query", "request_query"}, - {"sc-status", "response_code"}, - {"sc-bytes", "bytes_sent"}, - {"cs-bytes", "bytes_received"}, - {"time-taken", "time_taken_ms"}, - {"cs(Referer)", "referer"}, - {"cs(Cookie)", "cookie"}, - {"cs(User-Agent)", "user_agent"}, - {"c-ip", "client"}, + //! Access logs fields formats (W3C) + const simple_fields_umap_t IIS_ALF{ + {"date", date_time_utc_d}, + {"time", date_time_utc_t}, + {"cs-version", request_protocol}, + {"cs-method", request_method}, + {"cs-uri-stem", request_uri}, + {"cs-uri-query", request_query}, + {"sc-status", response_code}, + {"sc-bytes", bytes_sent}, + {"cs-bytes", bytes_received}, + {"time-taken", time_taken_ms}, + {"cs(Referer)", referer}, + {"cs(Cookie)", cookie}, + {"cs(User-Agent)", user_agent}, + {"c-ip", client}, // not in use, will be discarded - {"s-sitename", "NONE"}, - {"s-computername", "NONE"}, - {"s-ip", "NONE"}, - {"s-port", "NONE"}, - {"cs-username", "NONE"}, - {"cs-host", "NONE"}, - {"sc-substatus", "NONE"}, - {"sc-win32-status", "NONE"}, - {"streamid", "NONE"} }; + {"s-sitename", _DISCARDED}, + {"s-computername", _DISCARDED}, + {"s-ip", _DISCARDED}, + {"s-port", _DISCARDED}, + {"cs-username", _DISCARDED}, + {"cs-host", _DISCARDED}, + {"sc-substatus", _DISCARDED}, + {"sc-win32-status", _DISCARDED}, + {"streamid", _DISCARDED} }; // Access logs fields formats samples - const std::unordered_map IIS_ALF_SAMPLES{ - {"NONE", "DISCARDED"}, - {"date_time_ncsa", "01/Jan/2000:23:59:59 +0000"}, - {"date_time_MDYYYY", "1/1/2000"}, - {"date_time_utc_d", "2000-01-01"}, - {"date_time_utc_t", "23:59:59"}, - {"request_full", "GET /index.php?query=x HTTP/1.1"}, - {"request_protocol", "HTTP/1.1"}, - {"request_method", "GET"}, - {"request_uri", "/index.php"}, - {"request_query", "query=x"}, - {"response_code", "404"}, - {"bytes_sent", "1234"}, - {"bytes_received", "123"}, - {"time_taken_ms", "1000"}, - {"referer", "http://www.referrer.site"}, - {"cookie", "aCookie=abc123"}, - {"user_agent", "UserAgent/3.0+(Details+stuff)+Info/123"}, - {"client", "192.168.1.123"} }; + const samples_umap_t IIS_ALF_SAMPLES{ + {_DISCARDED, R"(DISCARDED)"}, + {date_time_ncsa, R"(01/Jan/2000:23:59:59 +0000)"}, + {date_time_mdyyyy, R"(1/1/2000)"}, + {date_time_utc_d, R"(2000-01-01)"}, + {date_time_utc_t, R"(23:59:59)"}, + {request_full, R"(GET /index.php?query=x HTTP/1.1)"}, + {request_protocol, R"(HTTP/1.1)"}, + {request_method, R"(GET)"}, + {request_uri, R"(/index.php)"}, + {request_query, R"(query=x)"}, + {response_code, R"(404)"}, + {bytes_sent, R"(1234)"}, + {bytes_received, R"(123)"}, + {time_taken_ms, R"(1000)"}, + {referer, R"(http://www.referrer.site)"}, + {cookie, R"(aCookie=abc123)"}, + {user_agent, R"(UserAgent/3.0+(Details+stuff)+Info/123)"}, + {client, R"(192.168.1.123)"} }; }; -#endif // LOGDOCTOR__CRAPLOG__FORMATS_H +#endif // LOGDOCTOR__CRAPLOG__MODULES__FORMATS_H diff --git a/logdoctor/modules/craplog/modules/hash.cpp b/logdoctor/modules/craplog/modules/hash.cpp index ce5acfc1..4448f444 100644 --- a/logdoctor/modules/craplog/modules/hash.cpp +++ b/logdoctor/modules/craplog/modules/hash.cpp @@ -1,6 +1,8 @@ #include "hash.h" +#include "globals/db_names.h" + #include "utilities/checks.h" #include "utilities/gzip.h" #include "utilities/io.h" @@ -9,75 +11,47 @@ #include "modules/dialogs.h" #include "modules/exceptions.h" +#include "modules/database/database.h" + #include "sha256.h" #include #include -#include -#include -#include -void HashOps::setDialogLevel( const int new_level ) +void HashOps::setDialogLevel( const DialogsLevel new_level ) noexcept { - this->dialog_level = new_level; + this->dialogs_level = new_level; } // reads the database holding the already used hashes -bool HashOps::loadUsedHashesLists( const std::string& db_path ) +bool HashOps::loadUsedHashesLists( const std::string& db_path ) noexcept { - bool successful{ true }; - const QString db_name{ QString::fromStdString( db_path.substr( db_path.find_last_of( '/' ) + 1ul ) ) }; + DatabaseWrapper db{ DatabaseHandler::get( DatabaseType::Hashes ) }; - QSqlDatabase db; - if ( QSqlDatabase::contains("qt_sql_default_connection") ) { - db = QSqlDatabase::database("qt_sql_default_connection"); - } else { - db = QSqlDatabase::addDatabase("QSQLITE"); - } - db.setDatabaseName( QString::fromStdString( db_path ) ); + db.open( db_path, this->dialogs_level==DL_EXPLANATORY ); - if ( ! CheckSec::checkDatabaseFile( db_path, db_name ) ) { - successful &= false; + const QString stmt{ QStringLiteral(R"(SELECT "hash" FROM "%1";)") }; - } else if ( ! db.open() ) { - // error opening database - successful &= false; - QString err_msg; - if ( this->dialog_level == 2 ) { - err_msg = db.lastError().text(); - } - DialogSec::errDatabaseFailedOpening( db_name, err_msg ); + for ( const auto& [wid,name] : this->ws_names ) { - } else { - QSqlQuery query{ db }; - for ( const auto& [wid,name] : this->ws_names ) { - if ( ! query.exec("SELECT hash FROM "+name+";") ) { - // error querying database - successful &= false; - DialogSec::errDatabaseFailedExecuting( db_name, query.lastQuery(), query.lastError().text() ); - break; - } else { - // iterate over results - while ( query.next() ) { - std::string hash{ query.value(0).toString().toStdString() }; - if ( hash.size() != 64ul ) { - // not a valid sha256 hash - continue; - } - this->hashes.at( wid ).push_back( hash ); - } + QueryWrapper query{ db.getQuery() }; + + query( stmt.arg( name ) ); + + while ( query->next() ) { + const QString hash{ query[0].toString() }; + if ( hash.size() != 64ul ) { + // not a valid sha256 hash + continue; } - if ( ! successful ) { break; } + this->hashes.at( wid ).push_back( hash.toStdString() ); } } - if ( db.isOpen() ) { - db.close(); - } - return successful; + return true; } @@ -96,7 +70,7 @@ void HashOps::digestFile( const std::string& file_path, std::string& hash ) } catch (...) { // failed as gzip, try as text file - if ( content.size() > 0ul ) { + if ( ! content.empty() ) { content.clear(); } IOutils::readFile( file_path, content ); @@ -105,21 +79,21 @@ void HashOps::digestFile( const std::string& file_path, std::string& hash ) // re-catched in craplog } catch ( const GenericException& ) { // failed closing gzip file pointer - throw GenericException( QString("%1:\n%2").arg( - DialogSec::tr("An error accured while reading the gzipped file"), + throw GenericException( QStringLiteral("%1:\n%2").arg( + DialogSec::tr("An error occured while reading the gzipped file"), QString::fromStdString( file_path ) ).toStdString() ); } catch ( const std::ios_base::failure& ) { // failed reading as text - throw GenericException( QString("%1:\n%2").arg( - DialogSec::tr("An error accured while reading the file"), + throw GenericException( QStringLiteral("%1:\n%2").arg( + DialogSec::tr("An error occured while reading the file"), QString::fromStdString( file_path ) ).toStdString() ); } catch (...) { // failed somehow - throw GenericException( QString("%1:\n%2").arg( + throw GenericException( QStringLiteral("%1:\n%2").arg( DialogSec::tr("Something failed while handling the file"), QString::fromStdString( file_path ) ).toStdString() ); @@ -127,7 +101,6 @@ void HashOps::digestFile( const std::string& file_path, std::string& hash ) SHA256 sha; sha.update( content ); - content.clear(); uint8_t* digest{ sha.digest() }; // return the hex digest hash.append( SHA256::toString(digest) ); @@ -136,9 +109,9 @@ void HashOps::digestFile( const std::string& file_path, std::string& hash ) // check if the given hash is from a file which has been used already -bool HashOps::hasBeenUsed( const std::string &file_hash, const unsigned& web_server_id) const +bool HashOps::hasBeenUsed( const std::string &file_hash, const WebServer& web_server) const noexcept { - const auto& ws_hashes{ this->hashes.at( web_server_id ) }; + const auto& ws_hashes{ this->hashes.at( web_server ) }; return std::any_of( ws_hashes.cbegin(), ws_hashes.cend(), [&file_hash]( const std::string& hash ) @@ -146,132 +119,35 @@ bool HashOps::hasBeenUsed( const std::string &file_hash, const unsigned& web_ser } -// insert the given hash/es in the relative list -bool HashOps::insertUsedHash( QSqlQuery& query, const QString& db_name, const std::string& hash, const unsigned& web_server_id ) +void HashOps::insertUsedHashes( const std::string& db_path, const std::vector& hashes, const WebServer& web_server ) { - bool successful{ true }; + const bool explain_msg{ this->dialogs_level > DL_ESSENTIAL }; + const bool explain_err{ this->dialogs_level == DL_EXPLANATORY }; + + DatabaseWrapper db{ DatabaseHandler::get( DatabaseType::Hashes ) }; + + db.open( db_path, explain_err ); + + db.startTransaction( explain_msg, explain_err ); + try { - if( ! VecOps::contains( this->hashes.at( web_server_id ), hash ) ) { - this->hashes.at( web_server_id ).push_back( hash ); - // insert tnto the database - QString stmt = QString("INSERT INTO %1 ( hash ) VALUES ( '%2' );") - .arg( this->ws_names.at(web_server_id), QString::fromStdString(hash).replace("'","''") ); - if ( ! query.exec( stmt ) ) { - // error opening database - successful &= false; - QString query_msg, err_msg; - if ( this->dialog_level > 0 ) { - query_msg = "query.exec()"; - if ( this->dialog_level == 2 ) { - err_msg = query.lastError().text(); - } - } - DialogSec::errDatabaseFailedExecuting( db_name, query_msg, err_msg ); + + for ( const std::string& hash : hashes ) { + + if ( ! VecOps::contains( this->hashes.at( web_server ), hash ) ) { + + db.getQuery()( QStringLiteral(R"(INSERT INTO "%1" ( hash ) VALUES ( '%2' );)") + .arg( this->ws_names.at(web_server), QString::fromStdString(hash).replace(QLatin1Char('\''),QLatin1String("''")) ) ); } - }/* else { - // hash already stored - }*/ + } + + db.commitTransaction( explain_msg, explain_err ); + + auto& used_hashes{ this->hashes.at( web_server ) }; + used_hashes.insert( used_hashes.end(), hashes.begin(), hashes.end() ); + } catch (...) { - // failed to insert the hash - successful &= false; + // rollback the transaction + db.rollbackTransaction( explain_msg, explain_err ); } - query.finish(); - return successful; -} - - -bool HashOps::insertUsedHashes( const std::string& db_path, const std::vector& hashes, const unsigned& web_server_id ) -{ - bool successful{ true }; - - const QString db_name{ QString::fromStdString( db_path.substr( db_path.find_last_of( '/' ) + 1ul ) ) }; - QSqlDatabase db{ QSqlDatabase::addDatabase("QSQLITE") }; - db.setDatabaseName( QString::fromStdString( db_path ) ); - - if ( ! CheckSec::checkDatabaseFile( db_path, db_name ) ) { - successful &= false; - - } else if ( ! db.open() ) { - // error opening database - successful &= false; - QString err_msg; - if ( this->dialog_level == 2 ) { - err_msg = db.lastError().text(); - } - DialogSec::errDatabaseFailedOpening( db_name, err_msg ); - - } else { - QSqlQuery query{ db }; - if ( ! db.transaction() ) { - // error opening database - successful &= false; - QString stmt_msg, err_msg; - if ( this->dialog_level > 0 ) { - stmt_msg = "db.transaction()"; - if ( this->dialog_level == 2 ) { - err_msg = db.lastError().text(); - } - } - DialogSec::errDatabaseFailedExecuting( db_name, stmt_msg, err_msg ); - - } else { - - try { - for ( const std::string& hash : hashes ) { - successful = this->insertUsedHash( query, db_name, hash, web_server_id ); - if ( ! successful ) { - break; - } - } - query.finish(); - - if ( successful ) { - // commit the transaction - if ( ! db.commit() ) { - // error opening database - successful &= false; - QString stmt_msg, err_msg; - if ( this->dialog_level > 0 ) { - stmt_msg = "db.commit()"; - if ( this->dialog_level == 2 ) { - err_msg= db.lastError().text(); - } - } - DialogSec::errDatabaseFailedExecuting( db_name, stmt_msg, err_msg ); - } - } - if ( ! successful ) { - // rollback - throw (std::exception()); - } - - } catch (...) { - // wrongthing w3nt some.,. - successful &= false; - bool err_shown{ false }; - // rollback the transaction - if ( ! db.rollback() ) { - // error rolling back commits - QString stmt_msg, err_msg; - if ( this->dialog_level > 0 ) { - stmt_msg = "db.rollback()"; - if ( this->dialog_level == 2 ) { - err_msg = db.lastError().text(); - } - } - DialogSec::errDatabaseFailedExecuting( db_name, stmt_msg, err_msg ); - err_shown |= true; - } - if ( ! err_shown ) { - // show a message - QString msg{ DialogSec::tr("An error occured while working on the database\n\nAborting") }; - DialogSec::errGeneric( msg ); - } - } - } - } - if ( db.isOpen() ) { - db.close(); - } - return successful; } diff --git a/logdoctor/modules/craplog/modules/hash.h b/logdoctor/modules/craplog/modules/hash.h index 1de807f4..fcc23c89 100644 --- a/logdoctor/modules/craplog/modules/hash.h +++ b/logdoctor/modules/craplog/modules/hash.h @@ -1,14 +1,17 @@ -#ifndef LOGDOCTOR__CRAPLOG__HASH_H -#define LOGDOCTOR__CRAPLOG__HASH_H +#ifndef LOGDOCTOR__CRAPLOG__MODULES__HASH_H +#define LOGDOCTOR__CRAPLOG__MODULES__HASH_H -#include "defines/web_servers.h" +#include "main_lib.h" #include #include #include + +enum class WebServer; + class QSqlQuery; @@ -16,19 +19,20 @@ class QSqlQuery; /*! Operations for the hashes */ -class HashOps +class HashOps final { public: //! Sets the new Dialogs level - void setDialogLevel( const int new_level ); + void setDialogLevel( const DialogsLevel new_level ) noexcept; //! Retrieves the lists of hashes from the database file /*! \param db_path The path of the log files' Hashes database \return Whether the operation has been successful or not + \throw VoidException */ - bool loadUsedHashesLists( const std::string& db_path ); + bool loadUsedHashesLists( const std::string& db_path ) noexcept; //! Returns the hash resulting from the content of the given file /*! @@ -45,43 +49,38 @@ public: \param web_server_id The ID of the Web Server which generated the file \return Whether the hash is already in the list or not */ - bool hasBeenUsed( const std::string& file_hash, const unsigned& web_server_id ) const; + bool hasBeenUsed( const std::string& file_hash, const WebServer& web_server ) const noexcept; //! Inserts multiple hashes in the corresponding database table /*! \param db_path The path of the Hashes database \param hashes The list of hashes to insert \param web_server_id The ID of the Web Server which generated the file - \return Whether the operation has been successful or not + \throw VoidException */ - bool insertUsedHashes( const std::string& db_path, const std::vector& hashes, const unsigned& web_server_id ); + void insertUsedHashes( const std::string& db_path, const std::vector& hashes, const WebServer& web_server ); private: // Quantity of information to display throught dialogs - int dialog_level{ 2 }; + DialogsLevel dialogs_level{ DL_NORMAL }; // List of Web Servers names for database tables - const std::unordered_map ws_names{ - {APACHE_ID, "apache"}, - {NGINX_ID, "nginx"}, - {IIS_ID, "iis"} + const std::unordered_map ws_names{ + {WS_APACHE, "apache"}, + {WS_NGINX, "nginx"}, + {WS_IIS, "iis"} }; // Lists of used files' hashes // { web_server_id : { hashes } } - std::unordered_map> hashes{ - {APACHE_ID, {}}, - {NGINX_ID, {}}, - {IIS_ID, {}} + std::unordered_map> hashes{ + {WS_APACHE, {}}, + {WS_NGINX, {}}, + {WS_IIS, {}} }; - - // Called by insertUsedHashes() - // Inserts a hash in the corresponding database table - bool insertUsedHash( QSqlQuery& query, const QString& db_name, const std::string& hash, const unsigned& web_server_id ); - }; -#endif // LOGDOCTOR__CRAPLOG__HASH_H +#endif // LOGDOCTOR__CRAPLOG__MODULES__HASH_H diff --git a/logdoctor/modules/craplog/modules/lib.h b/logdoctor/modules/craplog/modules/lib.h index d1230982..2d22dd4a 100644 --- a/logdoctor/modules/craplog/modules/lib.h +++ b/logdoctor/modules/craplog/modules/lib.h @@ -1,5 +1,5 @@ -#ifndef LOGDOCTOR__CRAPLOG__LIB_H -#define LOGDOCTOR__CRAPLOG__LIB_H +#ifndef LOGDOCTOR__CRAPLOG__MODULES__LIB_H +#define LOGDOCTOR__CRAPLOG__MODULES__LIB_H #include @@ -15,10 +15,11 @@ */ enum class LogType #ifdef _MSC_VER - : __int8 { + : __int8 #else - : __INT8_TYPE__ { + : __INT8_TYPE__ #endif +{ Failed = -1, //!< Failed to determine the type Discarded = 0, //!< Not a valid file, will be discarded Access = 1 //!< Valid access logs file type @@ -26,28 +27,40 @@ enum class LogType //! Holds informations about a log file -class LogFile { -public: - explicit LogFile(){} - explicit LogFile - (const bool sel,const bool used,const size_t sz,const QString& nm,const std::string& hs,const std::string& pt) +struct LogFile final +{ + explicit LogFile() noexcept = default; + explicit LogFile(const bool sel,const bool used,const size_t sz,const QString& nm,const std::string& hs,const std::string& pt) noexcept :selected{sel},used_already{used},size_{sz},name_{nm},hash_{hs},path_{pt}{} - bool isSelected() const //!< Wheter the file has been selected to be use or not - { return this->selected; } - void setSelected() //!< Sets the file as selected - { this->selected |= true; } - void setUnselected() //!< Sets the file as unselected - { this->selected &= false; } - bool hasBeenUsed() const //!< Wheter the file has been used already or not - { return this->used_already; } - size_t size() const //!< The size of the file - { return this->size_; } - const QString& name() const //!< The name of the file, to be displayed in the list - { return this->name_; } - const std::string& hash() const //!< The sha256 hash of the content - { return this->hash_; } - const std::string& path() const //!< The path of the file, including the file name - { return this->path_; } + LogFile(LogFile&& other) noexcept = default; + LogFile& operator=(LogFile&& other) noexcept = default; + LogFile(const LogFile& other) noexcept = default; + LogFile& operator=(const LogFile& other) noexcept = default; + + //! Returns whether the file has been selected to be used or not + inline bool isSelected() const noexcept + { return this->selected; } + //! Sets the file as selected + inline void setSelected() noexcept + { this->selected |= true; } + //! Sets the file as unselected + inline void setUnselected() noexcept + { this->selected &= false; } + //! Returns whether the file has been used already or not + inline bool hasBeenUsed() const noexcept + { return this->used_already; } + //! Returns the size of the file + inline size_t size() const noexcept + { return this->size_; } + //! Returns the name of the file, to be displayed in the list + inline const QString& name() const noexcept + { return this->name_; } + //! Returns the sha256 hash of the content + inline const std::string& hash() const noexcept + { return this->hash_; } + //! Returns the path of the file, including the file name + inline const std::string& path() const noexcept + { return this->path_; } private: bool selected; bool used_already; @@ -59,27 +72,95 @@ private: Q_DECLARE_METATYPE( LogFile ) + +//! Identifies a log field +enum LogsFormatField : uint32_t { + // not a considered field + _INVALID = 0x00000001, // 00000000'00000000'00000000'00000001 + // not a considered field + _DISCARDED = 0x00000000, // 00000000'00000000'00000000'00000000 + // no need to parse + _NO_PARSE_NEEDED = 0x80000000, // 10000000'00000000'00000000'00000000 + // no need to parse + _MAY_HAVE_SPACES = 0x01000000, // 00000001'00000000'00000000'00000000 + _COUNT_SPACES = 0x000000ff, // 00000000'00000000'00000000'11111111 + // response + _RESPONSE_CODE = 0x00000100, // 00000000'00000000'00000001'00000000 + response_code = 0x80000101, // 10000000'00000000'00000001'00000001 + // data transfer + _DATA_TRANSFER = 0x00000200, // 00000000'00000000'00000010'00000000 + bytes_received = 0x80000201, // 10000000'00000000'00000010'00000001 + bytes_sent = 0x80000202, // 10000000'00000000'00000010'00000010 + // performance + _TIME_TAKEN = 0x00000400, // 00000000'00000000'00000100'00000000 + time_taken_us = 0x00000401, // 00000000'00000000'00000100'00000001 + time_taken_ms = 0x80000402, // 10000000'00000000'00000100'00000010 + time_taken_s = 0x00000404, // 00000000'00000000'00000100'00000100 + time_taken_s_ms = 0x00000406, // 00000000'00000000'00000100'00000110 + // client data + _CLIENT_DATA = 0x00000800, // 00000000'00000000'00001000'00000000 + client = 0x80000801, // 10000000'00000000'00001000'00000001 + user_agent = 0x80000802, // 10000000'00000000'00001000'00000010 + cookie = 0x80000804, // 10000000'00000000'00001000'00000100 + referer = 0x80000808, // 10000000'00000000'00001000'00001000 + // request + _REQUEST = 0x00001000, // 00000000'00000000'00010000'00000000 + request_protocol = 0x80001001, // 10000000'00000000'00010000'00000001 + request_method = 0x80001002, // 10000000'00000000'00010000'00000010 + request_uri = 0x80001004, // 10000000'00000000'00010000'00000100 + request_query = 0x80001008, // 10000000'00000000'00010000'00001000 + request_uri_query = 0x0000100c, // 00000000'00000000'00010000'00001100 + request_full = 0x0100100f, // 00000001'00000000'00010000'00001111 + // date-time + _DATE_TIME = 0x00800000, // 00000000'10000000'00000000'00000000 + _DATE_TIME_FULL = 0x00400000, // 00000000'01000000'00000000'00000000 + _DATE_TIME_EPOCH = 0x00200000, // 00000000'00100000'00000000'00000000 + _DATE_TIME_UTC = 0x00100000, // 00000000'00010000'00000000'00000000 + _DATE_TIME_DATE = 0x00080000, // 00000000'00001000'00000000'00000000 + _DATE_TIME_YEAR = 0x00040000, // 00000000'00000100'00000000'00000000 + _DATE_TIME_MONTH = 0x00020000, // 00000000'00000010'00000000'00000000 + _DATE_TIME_CLOCK = 0x00010000, // 00000000'00000001'00000000'00000000 + date_time_epoch_us = 0x00e00001, // 00000000'11100000'00000000'00000001 + date_time_epoch_ms = 0x00e00002, // 00000000'11100000'00000000'00000010 + date_time_epoch_s = 0x00e00004, // 00000000'11100000'00000000'00000100 + date_time_epoch_s_ms = 0x00e00006, // 00000000'11100000'00000000'00000110 + date_time_ncsa = 0x01c00001, // 00000001'11000000'00000000'00000001 + date_time_iso = 0x00c00002, // 00000000'11000000'00000000'00000010 + date_time_gmt = 0x01c00003, // 00000001'11000000'00000000'00000011 + date_time_mcs = 0x01c00004, // 00000001'11000000'00000000'00000100 + date_time_utc_d = 0x00980001, // 00000000'10011000'00000000'00000001 + date_time_utc_t = 0x00900002, // 00000000'10010000'00000000'00000010 + date_time_yyyymmdd = 0x00880001, // 00000000'10001000'00000000'00000001 + date_time_mmddyy = 0x00880002, // 00000000'10001000'00000000'00000010 + date_time_mdyyyy = 0x00880004, // 00000000'10001000'00000000'00000100 + date_time_year_short = 0x00840001, // 00000000'10000100'00000000'00000001 + date_time_month_str = 0x00820002, // 00000000'10000010'00000000'00000010 + date_time_year = 0x80840001, // 10000000'10000100'00000000'00000001 + date_time_month = 0x80820002, // 10000000'10000010'00000000'00000010 + date_time_day = 0x80800004, // 10000000'10000000'00000000'00000100 + date_time_hour = 0x80800008, // 10000000'10000000'00000000'00001000 + date_time_minute = 0x80800010, // 10000000'10000000'00000000'00010000 + date_time_second = 0x80800020, // 10000000'10000000'00000000'00100000 + date_time_clock_short = 0x00810018, // 00000000'10000001'00000000'00011000 + date_time_clock_12 = 0x00810038, // 00000000'10000001'00000000'00111000 + date_time_clock_24 = 0x008100b8, // 00000000'10000001'00000000'10111000 +}; + + //! Holds informations about a log format -class LogsFormat { -public: - explicit LogsFormat(){} - explicit LogsFormat - (const std::string& str,const std::string& itl,const std::string& fnl,const std::vector& seps,const std::vector& flds,const unsigned nl) - :string{str},initial{itl},final{fnl},separators{seps},fields{flds},new_lines{nl}{} +struct LogsFormat final +{ std::string string; //!< The logs format string std::string initial; //!< The initial separator std::string final; //!< The final separator std::vector separators; //!< The separators in the middle - std::vector fields; //!< The fields - size_t new_lines; //!< The number of new lines + std::vector fields; //!< The logged fields + size_t new_lines; //!< The number of new lines within the string + + explicit LogsFormat() noexcept = default; + explicit LogsFormat(const std::string& str,std::string&& itl,std::string&& fnl,std::vector&& seps,std::vector&& flds,const size_t nl) noexcept + :string{str},initial{std::move(itl)},final{std::move(fnl)},separators{std::move(seps)},fields{std::move(flds)},new_lines{nl}{} }; -//! Hold the items of a blacklist/warnlist -struct BWlist { - bool used; //!< Whether the list is set to be used or not - std::vector list; //!< The list of items -}; - - -#endif // LOGDOCTOR__CRAPLOG__LIB_H +#endif // LOGDOCTOR__CRAPLOG__MODULES__LIB_H diff --git a/logdoctor/modules/craplog/modules/logs.cpp b/logdoctor/modules/craplog/modules/logs.cpp index f911b7bc..8f31ef36 100644 --- a/logdoctor/modules/craplog/modules/logs.cpp +++ b/logdoctor/modules/craplog/modules/logs.cpp @@ -20,7 +20,7 @@ namespace /*private*/ \return Whether the line respects the format or not \see defineFileType(), FormatOps::LogsFormat */ -bool deepTypeCheck( const std::string& line, const LogsFormat& format ) +bool deepTypeCheck( const std::string& line, const LogsFormat& format ) noexcept { size_t n_sep{ format.separators.size() }, n_sep_found{0}, n_blank_sep{0}, @@ -29,18 +29,18 @@ bool deepTypeCheck( const std::string& line, const LogsFormat& format ) // check the initial part if ( ! format.initial.empty() ) { if ( StringOps::startsWith( line, format.initial ) ) { - n_sep_found ++; + ++ n_sep_found; } } else { - n_sep_found ++; - n_blank_sep ++; + ++ n_sep_found; + ++ n_blank_sep; } // check the middle part - for ( size_t i{0}; i= n_sep-1 - && n_blank_sep <= n_sep_found/2 ) { - result |= true; - } - - return result; + // the line is considered valid if all the seps have been found + // and more than a half of them were not blank + return n_sep_found >= n_sep-1 + && n_blank_sep <= n_sep_found/2; } } // namespace (private) -LogType defineFileType( const std::vector& lines, const LogsFormat& format ) +LogType defineFileType( const std::vector& lines, const LogsFormat& format ) noexcept { if ( lines.empty() ) { // empty file, already handled by craplog, should be unreachable @@ -124,9 +119,9 @@ LogType defineFileType( const std::vector& lines, const LogsFormat& for ( const std::string& line : lines ) { // scan the given lines if ( deepTypeCheck( line, format ) ) { - n_access++; + ++ n_access; } else { - n_other++; + ++ n_other; } } diff --git a/logdoctor/modules/craplog/modules/logs.h b/logdoctor/modules/craplog/modules/logs.h index e914bea0..bb29ee4d 100644 --- a/logdoctor/modules/craplog/modules/logs.h +++ b/logdoctor/modules/craplog/modules/logs.h @@ -1,5 +1,5 @@ -#ifndef LOGDOCTOR__CRAPLOG__LOGS_H -#define LOGDOCTOR__CRAPLOG__LOGS_H +#ifndef LOGDOCTOR__CRAPLOG__MODULES__LOGS_H +#define LOGDOCTOR__CRAPLOG__MODULES__LOGS_H #include "lib.h" @@ -22,9 +22,9 @@ namespace LogOps LogType defineFileType( const std::vector& lines, const LogsFormat& format -); +) noexcept; } // namespace LogOps -#endif // LOGDOCTOR__CRAPLOG__LOGS_H +#endif // LOGDOCTOR__CRAPLOG__MODULES__LOGS_H diff --git a/logdoctor/modules/craplog/modules/workers/impl/loglinedata.cpp b/logdoctor/modules/craplog/modules/workers/impl/loglinedata.cpp new file mode 100644 index 00000000..fd3283be --- /dev/null +++ b/logdoctor/modules/craplog/modules/workers/impl/loglinedata.cpp @@ -0,0 +1,561 @@ + +#include "../lib.h" + +#include "modules/exceptions.h" + +#include "modules/craplog/modules/lib.h" +#include "modules/craplog/modules/datetime.h" + +#include "utilities/strings.h" +#include "utilities/vectors.h" + + + +LogLineData::LogLineData(const std::string& line, const LogsFormat& logs_format) +{ + using F = LogsFormatField; + + size_t start, stop{logs_format.initial.size()}, + sep_i{0}; + const size_t line_size{ line.size()-1ul }, + max_seps{ logs_format.separators.size() }, + n_seps{ max_seps-1ul }; + + while ( sep_i <= max_seps ) { + // split fields + start = stop; // stop updated at the end of the loop + + std::string_view sep; + if ( sep_i <= n_seps ) { + sep = logs_format.separators.at( sep_i ); + stop = line.find( sep, start ); + if ( stop == std::string::npos ) { + throw LogParserException( "Separator not found", std::string{sep} ); + } + } else if ( sep_i == max_seps ) { + // final separator + sep = logs_format.final; + if ( sep.empty() ) { + stop = line_size+1ul; + } else { + stop = line.find( sep, start ); + if ( stop == std::string::npos ) { + throw LogParserException( "Final separator not found", std::string{sep} ); + } + } + } else [[unlikely]] { + // should be unreachable + throw ("Unexpected section reached"); + } + const size_t sep_size{ sep.size() }; + + // get the field + const F fld{ logs_format.fields.at( sep_i ) }; + if ( _DISCARDED | fld ) { + // only parse the considered fields + + std::string fld_str{ line.substr(start, stop-start) }; + + if ( sep_i < n_seps ) { + // not the last separator, check for mistakes + size_t aux_stop = stop; + + if ( (_MAY_HAVE_SPACES & fld) && sep == " " ) { + // check the fields with whitespace-separated values + const size_t n{ fld == request_full ? 2ul + : fld & _COUNT_SPACES }; + + size_t c{ StringOps::count( fld_str, ' ' ) }; + if ( c < n ) { + // loop until the correct number of whitespaces is reached + size_t aux_start = line[stop+1ul] == ' ' ? stop : stop+1ul; + while ( c < n ) { + aux_stop = line.find( sep, aux_start ); + if ( aux_stop == std::string::npos ) { + // not found + throw LogParserException( "Separator not found", std::string{sep} ); + } + aux_start = aux_stop+1ul; + ++c; + } + } else if ( c > n ) [[unlikely]] { + // should be unreachable + throw LogParserException( "Unexpected count for separator", std::string{sep} ); + } + + } else if ( sep.front() == '"' && fld == F::user_agent ) { + // atm the only support is for escaped quotes + if ( fld_str.back() == '\\' ) { + // the found separator is not actually the separator but is part of the user-agent string + // keep searching until the real separator is found + size_t aux_start = stop + sep_size; + while (true) { + aux_stop = line.find( sep, aux_start ); + if ( aux_stop == std::string::npos ) { + // not found + throw LogParserException( "Separator not found", std::string{sep} ); + } else if ( line.at( aux_stop-1ul ) != '\\' ) { + // non-backslashed quotes, real separator found (hopefully) + break; + } + aux_start = aux_stop + sep_size; + } + } + } + + // finally update if needed + if ( aux_stop > stop ) { + stop = aux_stop; + fld_str = line.substr(start, stop-start); + } + } + + if ( ! fld_str.empty() ) { + // process the field + if ( _NO_PARSE_NEEDED & fld ) { + // no need to process, append directly if non-empty + if ( fld == request_query && fld_str == "-" ) { + continue; + } + this->data( fld ) = FieldData( std::move(fld_str) ); + + } else { + // process the field + + // process the date to get year, month, day, hour and minute + if ( _DATE_TIME & fld ) { + auto dt = DateTimeOps::processDateTime( fld_str, fld ); // cut away the "date_time_" part + if ( auto& year{ dt.at(0) }; !year.empty() ) { + // year + this->year = FieldData( std::move(year) ); + } + if ( auto& month{ dt.at(1) }; !month.empty() ) { + // month + this->month = FieldData( std::move(month) ); + } + if ( auto& day{ dt.at(2) }; !day.empty() ) { + // day + this->day = FieldData( std::move(day) ); + } + if ( auto& hour{ dt.at(3) }; !hour.empty() ) { + // hour + this->hour = FieldData( std::move(hour) ); + } + if ( auto& minute{ dt.at(4) }; !minute.empty() ) { + // minute + this->minute = FieldData( std::move(minute) ); + } + if ( auto& second{ dt.at(5) }; !second.empty() ) { + // second + this->second = FieldData( std::move(second) ); + } + + + // process the time taken to convert to milliseconds + } else if ( _TIME_TAKEN & fld ) { + float t{ std::stof( fld_str ) }; + if ( fld == time_taken_us ) { + // from microseconds + t /= 1000.0f; + } else if ( fld & time_taken_s ) { + // from seconds or seconds.milliseconds + t *= 1000.0f; + } + this->time_taken = FieldData( std::to_string( static_cast( t ) ) ); + + + // process the request to get the protocol, method, resource and query + } else if ( fld == request_full ) { + // check whether the request string has the proper number of spaces + const size_t n_spaces{ StringOps::count( fld_str, ' ' ) }; + + if ( n_spaces == 0ul ) [[unlikely]] { + // no spaces + if ( VecOps::contains( this->valid_methods, fld_str ) ) { + this->method = FieldData( std::move(fld_str) ); + } else if ( VecOps::contains( this->valid_protocols, fld_str ) ) { + this->protocol = FieldData( std::move(fld_str) ); + } else { + this->storeUriQuery( std::move(fld_str) ); + } + + } else if ( n_spaces == 1ul ) [[unlikely]] { + // 1 field is missing + this->storeMalformedRequestOneSpace( std::move(fld_str) ); + + } else if ( n_spaces > 2ul ) [[unlikely]] { + // most likely a malicious attempt + if ( sep == " " ) { + // hard to say how to handle it properly + throw LogParserException( "Malformed request string", fld_str ); + } + this->storeMalformedRequestMultiSpace( std::move(fld_str) ); + + } else [[likely]] { + // correct amount of spaces + const size_t aux_stop1{ fld_str.find( ' ' ) }, + aux_start{ aux_stop1+1ul }, + aux_stop2{ fld_str.find( ' ', aux_start ) }; + + if ( aux_stop1 > 0ul && aux_stop2 > aux_start ) [[likely]] { + std::string method{ fld_str.substr( 0ul, aux_stop1 ) }; + std::string protocol{ fld_str.substr( aux_stop2+1ul ) }; + if ( VecOps::contains( this->valid_methods, method ) + && VecOps::contains( this->valid_protocols, protocol ) ) [[likely]] { + this->method = FieldData( std::move(method) ); + this->protocol = FieldData( std::move(protocol) ); + this->storeUriQuery( fld_str.substr( aux_start, aux_stop2-aux_start ) ); + + } else [[unlikely]] { + this->storeMalformedRequestMultiSpace( std::move(fld_str) ); + } + + } else [[unlikely]] { + this->storeMalformedRequestMultiSpace( std::move(fld_str) ); + } + } + + + // process the request to get uri and query + } else if ( fld == request_uri_query ) { + // search for the query + std::string uri, query; + const size_t aux_{ fld_str.find( '?' ) }; + if ( aux_ != std::string::npos ) { + uri = fld_str.substr( 0ul, aux_ ); + query = fld_str.substr( aux_+1ul ); + } else { + // query not found + uri = fld_str; + } + if ( ! uri.empty() ) { + this->uri = FieldData( std::move(uri) ); + } + if ( ! query.empty() ) { + this->query = FieldData( std::move(query) ); + } + + + // something went wrong + } else { + // hmmm.. no... + throw LogParserException( "Unexpected LogFormatField", std::to_string(fld) ); + } + } + } + } + + // update the stop for the next start + stop += sep_size; + ++sep_i; + if ( stop > line_size ) { + // this was the final separator + break; + } + + } +} + +void LogLineData::storeUriQuery(std::string&& str) noexcept +{ + if ( ! str.empty() ) { + if ( const auto pos{ str.find( '?' ) }; pos != std::string::npos ) { + this->uri = FieldData( str.substr( 0ul, pos ) ); + this->query = FieldData( str.substr( pos+1ul ) ); + } else { + this->uri = FieldData( std::move(str) ); + } + } +} + +void LogLineData::storeMalformedRequestOneSpace(std::string&& str) noexcept +{ + const size_t pos{ str.find( ' ' ) }; + std::string field1{ str.substr( 0ul, pos ) }, + field2{ str.substr( pos+1 ) }; + const bool is_method1{ VecOps::contains( this->valid_methods, field1 ) }, + is_method2{ VecOps::contains( this->valid_methods, field2 ) }, + is_protocol1{ VecOps::contains( this->valid_protocols, field1 ) }, + is_protocol2{ VecOps::contains( this->valid_protocols, field2 ) }; + + /** + *** P\M + *** 00 01 10 11 + *** + *** 00 U+ UM MU U+ + *** + *** 01 UP -- MP -- + *** + *** 10 PU PM -- -- + *** + *** 11 U+ -- -- -- + **/ + + if ( is_method1 ) { + if ( is_method2 ) { + // uri = 12 + this->storeUriQuery( StringOps::strip( str ) ); + } else if ( is_protocol2 ) { + // method = 1 // protocol = 2 + this->method = FieldData( std::move(field1) ); + this->protocol = FieldData( std::move(field2) ); + } else { + // method = 1 // uri = 2 + this->method = FieldData( std::move(field1) ); + this->storeUriQuery( std::move(field2) ); + } + } else if ( is_method2 ) { + if ( is_protocol1 ) { + // protocol = 1 // method = 2 + this->protocol = FieldData( std::move(field1) ); + this->method = FieldData( std::move(field2) ); + } else { + // uri = 1 // method = 2 + this->storeUriQuery( std::move(field1) ); + this->method = FieldData( std::move(field2) ); + } + } else if ( is_protocol1 ) { + if ( is_protocol2 ) { + // uri = 12 + this->storeUriQuery( StringOps::strip( str ) ); + } else { + // protocol = 1 // uri = 2 + this->protocol = FieldData( std::move(field1) ); + this->storeUriQuery( std::move(field2) ); + } + } else if ( is_protocol2 ) { + // uri = 1 // protocol = 2 + this->storeUriQuery( std::move(field1) ); + this->protocol = FieldData( std::move(field2) ); + } else { + // uri = 12 + this->storeUriQuery( StringOps::strip( str ) ); + } +} + +void LogLineData::storeMalformedRequestMultiSpace(std::string&& str) noexcept +{ + const size_t pos1{ str.find( ' ' ) }, + pos2{ str.rfind( ' ' ) }; + std::string field1{ str.substr( 0ul, pos1 ) }; + std::string field2{ StringOps::strip( str.substr( pos1+1ul, pos2-pos1-1ul ) ) }; + std::string field3{ str.substr( pos2+1ul ) }; + const bool is_method1{ VecOps::contains( this->valid_methods, field1 ) }, + is_method2{ VecOps::contains( this->valid_methods, field2 ) }, + is_method3{ VecOps::contains( this->valid_methods, field3 ) }, + is_protocol1{ VecOps::contains( this->valid_protocols, field1 ) }, + is_protocol2{ VecOps::contains( this->valid_protocols, field2 ) }, + is_protocol3{ VecOps::contains( this->valid_protocols, field3 ) }; + + /** + *** P\M + *** 000 001 010 011 100 101 110 111 + *** + *** 000 +U+ +UM +U+ +U+ MU+ +U+ +U+ +U+ + *** + *** 001 +UP --- UMP --- MUP --- +UP --- + *** + *** 010 +U+ UPM --- --- MPU +U+ --- --- + *** + *** 011 +U+ --- --- --- MU+ --- --- --- + *** + *** 100 PU+ PUM PMU PU+ --- --- --- --- + *** + *** 101 +U+ --- +U+ --- --- --- --- --- + *** + *** 110 +U+ +UM --- --- --- --- --- --- + *** + *** 111 +U+ --- --- --- --- --- --- --- + **/ + + if ( is_method1 && is_method3 ) { + // uri = 123 + this->storeUriQuery( StringOps::strip( str ) ); + + } else if ( is_method1 && is_method2 ) { + if ( is_protocol3 ) { + // uri = 12 // protocol = 3 + this->storeUriQuery( StringOps::strip( str.substr( 0ul, pos2 ) ) ); + this->protocol = FieldData( std::move(field3) ); + } else { + // uri = 123 + this->storeUriQuery( StringOps::strip( str ) ); + } + + } else if ( is_method2 && is_method3 ) { + if ( is_protocol1 ) { + // protocol = 1 // uri = 23 + this->protocol = FieldData( std::move(field1) ); + this->storeUriQuery( StringOps::strip( str.substr( pos1+1ul ) ) ); + } else { + // uri = 123 + this->storeUriQuery( StringOps::strip( str ) ); + } + + } else if ( is_method1 ) { + if ( is_protocol2 && !is_protocol3 ) { + // method = 1 // protocol = 2 // uri = 3 + this->method = FieldData( std::move(field1) ); + this->protocol = FieldData( std::move(field2) ); + this->storeUriQuery( std::move(field3) ); + } else if ( is_protocol3 && !is_protocol2 ) { + // method = 1 // uri = 2 // protocol = 3 + this->method = FieldData( std::move(field1) ); + this->storeUriQuery( std::move(field2) ); + this->protocol = FieldData( std::move(field3) ); + } else { + // method = 1 // uri = 23 + this->method = FieldData( std::move(field1) ); + this->storeUriQuery( StringOps::strip( str.substr( pos1+1ul ) ) ); + } + + } else if ( is_method2 ) { + if ( is_protocol1 && !is_protocol3 ) { + // protocol = 1 // method = 2 // uri = 3 + this->protocol = FieldData( std::move(field1) ); + this->method = FieldData( std::move(field2) ); + this->storeUriQuery( std::move(field3) ); + } else if ( is_protocol3 && !is_protocol1 ) { + // uri = 1 // method = 2 // protocol = 3 + this->storeUriQuery( std::move(field1) ); + this->method = FieldData( std::move(field2) ); + this->protocol = FieldData( std::move(field3) ); + } else { + // uri = 123 + this->storeUriQuery( StringOps::strip( str ) ); + } + + } else if ( is_method3 ) { + if ( is_protocol1 && !is_protocol2 ) { + // protocol = 1 // uri = 2 // method = 3 + this->protocol = FieldData( std::move(field1) ); + this->storeUriQuery( std::move(field2) ); + this->method = FieldData( std::move(field3) ); + } else if ( is_protocol2 && !is_protocol1 ) { + // uri = 1 // protocol = 2 // method = 3 + this->storeUriQuery( std::move(field1) ); + this->protocol = FieldData( std::move(field2) ); + this->method = FieldData( std::move(field3) ); + } else { + // uri = 12 // method = 3 + this->storeUriQuery( StringOps::strip( str.substr( 0ul, pos2 ) ) ); + this->method = FieldData( std::move(field3) ); + } + + } else if ( is_protocol1 && is_protocol3 ) { + // uri = 123 + this->storeUriQuery( StringOps::strip( str ) ); + + } else if ( is_protocol1 && is_protocol2 ) { + if ( is_method3 ) { + // uri = 12 // method = 3 + this->storeUriQuery( StringOps::strip( str.substr( 0ul, pos2 ) ) ); + this->method = FieldData( std::move(field3) ); + } else { + // uri = 123 + this->storeUriQuery( StringOps::strip( str ) ); + } + + } else if ( is_protocol2 && is_protocol3 ) { + if ( is_method1 ) { + // method = 1 // uri = 23 + this->method = FieldData( std::move(field1) ); + this->storeUriQuery( StringOps::strip( str.substr( pos1+1ul ) ) ); + } else { + // uri = 123 + this->storeUriQuery( StringOps::strip( str ) ); + } + + } else if ( is_protocol1 ) { + if ( !is_method2 && !is_method3 ) { + // protocol = 1 // uri = 23 + this->protocol = FieldData( std::move(field1) ); + this->storeUriQuery( StringOps::strip( str.substr( pos1+1ul ) ) ); + } else { + // uri = 123 + this->storeUriQuery( StringOps::strip( str ) ); + } + + } else if ( is_protocol3 ) { + if ( !is_method2 && !is_method1 ) { + // uri = 12 // protocol = 3 + this->storeUriQuery( StringOps::strip( str.substr( 0ul, pos2 ) ) ); + this->protocol = FieldData( std::move(field3) ); + } else { + // uri = 123 + this->storeUriQuery( StringOps::strip( str ) ); + } + + } else { + // uri = 123 + this->storeUriQuery( StringOps::strip( str ) ); + } +} + +size_t LogLineData::size() const noexcept +{ + return this->year + + this->month + + this->day + + this->hour + + this->minute + + this->second + + this->protocol + + this->method + + this->uri + + this->query + + this->response_code + + this->time_taken + + this->bytes_sent + + this->bytes_received + + this->referrer + + this->client + + this->user_agent + + this->cookie; +} + +FieldData& LogLineData::data(const LogsFormatField id) +{ + using F = LogsFormatField; + + switch (id) { + case F::date_time_year: + return this->year; + case F::date_time_month: + return this->month; + case F::date_time_day: + return this->day; + case F::date_time_hour: + return this->hour; + case F::date_time_minute: + return this->minute; + case F::date_time_second: + return this->second; + case F::request_protocol: + return this->protocol; + case F::request_method: + return this->method; + case F::request_uri: + return this->uri; + case F::request_query: + return this->query; + case F::response_code: + return this->response_code; + case F::time_taken_ms: + return this->time_taken; + case F::bytes_sent: + return this->bytes_sent; + case F::bytes_received: + return this->bytes_received; + case F::referer: + return this->referrer; + case F::client: + return this->client; + case F::user_agent: + return this->user_agent; + case F::cookie: + return this->cookie; + default: + throw LogParserException( "Unexpected LogFormatField", std::to_string(id) ); + } +} diff --git a/logdoctor/modules/craplog/modules/workers/lib.h b/logdoctor/modules/craplog/modules/workers/lib.h index a41dbd9b..120690cf 100644 --- a/logdoctor/modules/craplog/modules/workers/lib.h +++ b/logdoctor/modules/craplog/modules/workers/lib.h @@ -1,20 +1,144 @@ #ifndef LOGDOCTOR__CRAPLOG__WORKERS__LIB_H #define LOGDOCTOR__CRAPLOG__WORKERS__LIB_H + #include + +enum LogsFormatField : uint32_t; + +struct LogsFormat; + + +//! Signals which dialog to show enum class WorkerDialog { - errGeneric, - errDirNotExists, - errFailedDefiningLogType, - errFailedParsingLogs, - errDatabaseFailedOpening, - errDatabaseFailedExecuting, - warnFileNotReadable, - warnEmptyFile, + errGeneric, // 1 arg + errDirNotExists, // 1 arg + errFailedDefiningLogType, // 1 arg + errFailedParsingLogs, // 1 arg + errDatabaseFileNotFound, // 1 arg + errDatabaseFileNotFile, // 1 arg + errDatabaseFileNotReadable, // 1 arg + errDatabaseFileNotWritable, // 1 arg + errDatabaseFailedOpening, // 2 args + errDatabaseFailedExecuting, // 3 args + warnFileNotReadable, // 1 arg + warnEmptyFile, // 1 arg }; Q_DECLARE_METATYPE(WorkerDialog) + +//! FieldData +/*! + Holds the data of a single field from a log line + \see LogLineData +*/ +struct FieldData final +{ + FieldData() noexcept + : is_set{false} {} + explicit FieldData(std::string&& data) noexcept + : is_set{!data.empty()}, data{std::move(data)} {} + ~FieldData() noexcept = default; + FieldData(FieldData&& other) noexcept = default; + FieldData& operator=(FieldData&& rhs) noexcept = default; + Q_DISABLE_COPY(FieldData) + + //! Returns whether the field contains data + inline operator bool() const noexcept + { return this->is_set; } + //! Returns a reference to the field's data + inline const std::string& operator *() const noexcept + { return this->data; } + //! Returns the sum of the field's data size with another field's data size + inline size_t operator +(const FieldData& rhs) const noexcept + { return this->data.size() + rhs.data.size(); } + //! Returns the sum of the field's data size with the given size + friend inline size_t operator +(const size_t lhs, const FieldData& rhs) noexcept; + +private: + bool is_set; + std::string data; +}; + + +inline size_t operator +(const size_t lhs, const FieldData& rhs) noexcept +{ + return lhs + rhs.data.size(); +} + + + +//! LogLineData +/*! + Holds the data of a single log line +*/ +struct LogLineData final +{ + //! \throw LogParserException + LogLineData(const std::string& line, const LogsFormat& logs_format); + ~LogLineData() noexcept = default; + LogLineData(LogLineData&& other) noexcept = default; + LogLineData& operator=(LogLineData&& rhs) noexcept = delete; + Q_DISABLE_COPY(LogLineData) + + //! Returns the total size of all the fields' data + size_t size() const noexcept; + + // date and time + FieldData year; + FieldData month; + FieldData day; + FieldData hour; + FieldData minute; + FieldData second; + // request + FieldData protocol; + FieldData method; + FieldData uri; + FieldData query; + // server + FieldData response_code; + FieldData time_taken; + FieldData bytes_sent; + FieldData bytes_received; + // client + FieldData client; + FieldData cookie; + FieldData user_agent; + FieldData referrer; + +private: + //! Returns a reference to the field data corresponding to the given field identifier + FieldData& data(const LogsFormatField id); + + void storeUriQuery(std::string&& str) noexcept; + + void storeMalformedRequestOneSpace(std::string&& str) noexcept; + void storeMalformedRequestMultiSpace(std::string&& str) noexcept; + + inline static const std::vector valid_methods{ + "GET", + "POST", + "HEAD", + "PUT", + "DELETE", + "OPTIONS", + "CONNECT", + "TRACE", + "PATCH" + }; + + inline static const std::vector valid_protocols{ + "HTTP/0.9", + "HTTP/1.0", + "HTTP/1.1", + "HTTP/2", + "HTTP/3" + }; +}; + + #endif // LOGDOCTOR__CRAPLOG__WORKERS__LIB_H diff --git a/logdoctor/modules/craplog/modules/workers/lister.cpp b/logdoctor/modules/craplog/modules/workers/lister.cpp index a58fe905..92b83eb7 100644 --- a/logdoctor/modules/craplog/modules/workers/lister.cpp +++ b/logdoctor/modules/craplog/modules/workers/lister.cpp @@ -13,9 +13,9 @@ #include "modules/craplog/modules/workers/lib.h" -CraplogLister::CraplogLister( const unsigned web_server_id, const unsigned dialogs_level, const std::string& logs_path, const LogsFormat& logs_format, const HashOps& hashOps, const std::function check_filename, QObject* parent ) +CraplogLister::CraplogLister( const WebServer web_server, const DialogsLevel dialogs_level, const std::string& logs_path, const LogsFormat& logs_format, const HashOps& hashOps, const std::function check_filename, QObject* parent ) : QObject { parent } - , wsID { web_server_id } + , web_server { web_server } , dialogs_level { dialogs_level } , logs_path { logs_path } , logs_format { logs_format } @@ -61,7 +61,7 @@ void CraplogLister::work() // it's a file, check the readability if ( ! IOutils::checkFile( path, true ) ) { // not readable, skip - if ( this->dialogs_level == 2 ) { + if ( this->dialogs_level == DL_EXPLANATORY ) { emit this->showDialog( WorkerDialog::warnFileNotReadable, {name} ); } @@ -86,7 +86,7 @@ void CraplogLister::work() } if ( content.empty() ) { - if ( this->dialogs_level == 2 ) { + if ( this->dialogs_level == DL_EXPLANATORY ) { emit this->showDialog( WorkerDialog::warnEmptyFile, {name} ); } @@ -120,7 +120,7 @@ void CraplogLister::work() // push in the list emit this->pushLogFile( LogFile{ - false, this->hashOps.hasBeenUsed( hash, this->wsID ), + false, this->hashOps.hasBeenUsed( hash, this->web_server ), size, name, hash, path } ); } this->quit(); diff --git a/logdoctor/modules/craplog/modules/workers/lister.h b/logdoctor/modules/craplog/modules/workers/lister.h index e6cbf4e1..f7c62c7d 100644 --- a/logdoctor/modules/craplog/modules/workers/lister.h +++ b/logdoctor/modules/craplog/modules/workers/lister.h @@ -2,24 +2,26 @@ #define LOGDOCTOR__CRAPLOG__WORKERS__LISTER_H +#include "main_lib.h" + #include -class LogsFormat; -class LogFile; +struct LogsFormat; +struct LogFile; class HashOps; enum class WorkerDialog; -class CraplogLister : public QObject +class CraplogLister final : public QObject { Q_OBJECT public: explicit CraplogLister( - const unsigned web_server_id, - const unsigned dialogs_level, + const WebServer web_server, + const DialogsLevel dialogs_level, const std::string& logs_path, const LogsFormat& logs_format, const HashOps& hashOps, @@ -45,9 +47,9 @@ public slots: private: - const unsigned wsID; + const WebServer web_server; - const unsigned dialogs_level; + const DialogsLevel dialogs_level; const std::string& logs_path; diff --git a/logdoctor/modules/craplog/modules/workers/parser.cpp b/logdoctor/modules/craplog/modules/workers/parser.cpp index f3439cca..6edbf756 100644 --- a/logdoctor/modules/craplog/modules/workers/parser.cpp +++ b/logdoctor/modules/craplog/modules/workers/parser.cpp @@ -1,41 +1,75 @@ #include "parser.h" -#include "defines/web_servers.h" +#include "globals/db_names.h" #include "utilities/checks.h" #include "utilities/gzip.h" #include "utilities/io.h" #include "utilities/strings.h" +#include "utilities/vectors.h" #include "modules/dialogs.h" #include "modules/exceptions.h" -#include "modules/craplog/craplog.h" -#include "modules/craplog/modules/datetime.h" +#include "modules/craplog/modules/workers/lib.h" +#include #include #include #include +#include -CraplogParser::CraplogParser( const unsigned web_server_id, const unsigned dialogs_level, const std::string& db_data_path, const std::string& db_hashes_path, const LogsFormat& logs_format, const bw_lists_t& blacklists, const bw_lists_t& warnlists, const worker_files_t& log_files, QObject* parent ) - : CraplogParserInterface { web_server_id, dialogs_level, db_data_path, db_hashes_path, logs_format, blacklists, warnlists, log_files, parent } +CraplogParser::CraplogParser( const WebServer web_server, const DialogsLevel dialogs_level, const LogsFormat& logs_format, const Blacklist& blacklist, worker_files_t&& log_files, const std::string& data_db_path, QObject* parent ) + : QObject { parent } + , web_server { web_server } + , dialogs_level { dialogs_level } + , db_path { data_db_path } + , db_name { DatabasesConnections::data } + , blacklist { blacklist } + , logs_format { logs_format } + , files_to_use { std::move( log_files ) } { } +CraplogParser::~CraplogParser() +{ + if ( QSqlDatabase::contains( this->db_conn_name ) ) { + QSqlDatabase::removeDatabase( this->db_conn_name ); + } +} + + +void CraplogParser::sendPerfData() noexcept +{ + emit this->perfData( + this->parsed_size, + this->parsed_lines + ); +} + +void CraplogParser::sendChartData() noexcept +{ + emit this->chartData( + this->total_size, + this->total_lines, + this->blacklisted_size + ); +} + void CraplogParser::work() { this->proceed |= true; this->db_edited &= false; try { - if ( this->proceed ) { + if ( this->proceed ) [[likely]] { // collect log lines this->joinLogLines(); } - if ( this->proceed ) { + if ( this->proceed ) [[likely]] { // parse the log lines to fill the collection emit this->startedParsing(); this->parseLogLines(); @@ -43,11 +77,24 @@ void CraplogParser::work() } // clear log lines data this->logs_lines.clear(); + this->proceed = !this->data_collection.empty(); - if ( this->proceed && this->parsed_size > 0ul ) { + if ( this->proceed ) [[likely]] { + // tell craplog to store the hashes before to proceed + QWaitCondition wc; + emit this->readyStoringData( &wc, &this->proceed ); + QMutex mutex; mutex.lock(); + wc.wait( &mutex ); + mutex.unlock(); + } + if ( this->proceed ) [[likely]] { // store the new data - this->storeLogLines(); + auto db{ QSqlDatabase::addDatabase( "QSQLITE", this->db_conn_name ) }; + this->storeLogLines( db ); this->db_edited |= this->proceed; + if ( db.isOpen() ) { + db.close(); + } } } catch ( GenericException& e ) { @@ -59,6 +106,7 @@ void CraplogParser::work() emit this->showDialog( WorkerDialog::errFailedParsingLogs, {e.what()} ); this->proceed &= false; + } // send the final data if ( ! this->proceed ) { @@ -66,7 +114,6 @@ void CraplogParser::work() this->parsed_lines = 0ul; this->total_size = 0ul; this->parsed_size = 0ul; - this->warnlisted_size = 0ul; this->blacklisted_size = 0ul; } this->sendPerfData(); @@ -82,7 +129,7 @@ void CraplogParser::joinLogLines() std::vector aux; aux.reserve( lines.size() ); for ( const std::string& line : lines ) { - if ( line.front() != '#' ) { + if ( line.front() != '#' ) [[likely]] { // not a commented line aux.push_back( line ); } @@ -94,12 +141,10 @@ void CraplogParser::joinLogLines() std::string aux; std::vector content; - for ( const auto& file : this->files_to_use ) { + for ( const auto& file_path : this->files_to_use ) { if ( ! this->proceed ) { break; } - const std::string& file_path = std::get<0>( file ); - // collect lines try { // try reading @@ -125,34 +170,34 @@ void CraplogParser::joinLogLines() this->total_lines += content.size(); this->total_size += aux.size(); - if ( this->wsID == IIS_ID ) { + if ( this->web_server == WS_IIS ) { cleanLines( content ); } // re-catched in run() } catch ( const GenericException& ) { // failed closing gzip file pointer - throw GenericException( QString("%1:\n%2").arg( - DialogSec::tr("An error accured while reading the gzipped file"), + throw GenericException( QStringLiteral("%1:\n%2").arg( + DialogSec::tr("An error occured while reading the gzipped file"), QString::fromStdString( file_path ) ).toStdString() ); } catch ( const std::ios_base::failure& ) { // failed reading as text - throw GenericException( QString("%1:\n%2").arg( - DialogSec::tr("An error accured while reading the file"), + throw GenericException( QStringLiteral("%1:\n%2").arg( + DialogSec::tr("An error occured while reading the file"), QString::fromStdString( file_path ) ).toStdString() ); } catch (...) { // failed somehow - throw GenericException( QString("%1:\n%2").arg( + throw GenericException( QStringLiteral("%1:\n%2").arg( DialogSec::tr("Something failed while handling the file"), QString::fromStdString( file_path ) ).toStdString() ); } - // append to the relative list + // append to the list this->logs_lines.insert( this->logs_lines.end(), content.begin(), content.end() ); } if ( this->logs_lines.empty() ) { @@ -163,624 +208,276 @@ void CraplogParser::joinLogLines() void CraplogParser::parseLogLines() { - const auto parseLine = [this]( const std::string& line ) { - log_line_data_t data; - std::string_view sep; - std::string fld_str; - bool add_pm{false}, ok{true}; - size_t start, stop{this->logs_format.initial.size()}, - sep_i{0}; - const size_t line_size{ line.size()-1ul }, - n_seps{ this->logs_format.separators.size()-1ul }; + const auto parseLine{ [this]( const std::string& line, const LogsFormat& logs_format ) { + this->data_collection.emplace_back( LogLineData(line, logs_format) ); + this->parsed_size += line.size(); + ++ this->parsed_lines; + }}; - while (true) { - // split fields - start = stop; // stop updated at the end of the loop - if ( sep_i <= n_seps ) { - sep = this->logs_format.separators.at( sep_i ); - stop = line.find( sep, start ); - } else if ( sep_i == n_seps+1ul ) { - // final separator - sep = this->logs_format.final; - if ( sep.empty() ) { - stop = line_size+1ul; - } else { - stop = line.find( sep, start ); - if ( stop == std::string::npos ) { - stop = line_size+1ul; - } - } - } else { - // no more separators - break; - } - if ( stop == std::string::npos ) { - // separator not found, abort - throw LogParserException( "Separator not found", std::string{sep} ); - } - const size_t sep_size = sep.size(); - - // get the field - const std::string& fld = this->logs_format.fields.at( sep_i ); - if ( fld != "NONE" ) { - // only parse the considered fields - fld_str = StringOps::strip( line.substr(start, stop-start), ' ' ); - - if ( sep_i+1ul <= n_seps ) { - // not the last separator, check for mistakes - ok |= true; - size_t aux_stop = stop; - - if ( sep == " " ) { - // whitespace-separated-values fields - size_t c{ static_cast( std::count( fld_str.cbegin(), fld_str.cend(), ' ' ) ) }, - n{ 0 }; - if ( fld == "request_full" ) { - n += 2ul; - } else if ( fld == "date_time_mcs" ) { - n += 4ul; - } else if ( fld == "date_time_ncsa" ) { - n += 1ul; - } else if ( fld == "date_time_gmt" ) { - n += 3ul; - } - if ( n > 0ul && c < n ) { - // loop until the correct number of whitespaces is reached - size_t aux_start = stop+1ul; - while ( c < n ) { - aux_stop = line.find( sep, aux_start ); - if ( aux_stop == std::string::npos ) { - // not found - ok &= false; - break; - } - aux_start = aux_stop+1ul; - c++; - } - } - - } else if ( sep.front() == '"' && fld == "user_agent" ) { - // atm the only support is for escaped quotes - if ( fld_str.back() == '\\' ) { - size_t aux_start = stop + sep_size; - while (true) { - aux_stop = line.find( sep, aux_start ); - if ( aux_stop == std::string::npos ) { - // not found - break; - } else if ( line.at( aux_stop-1ul ) != '\\' ) { - // non-backslashed quotes - break; - } - aux_start = aux_stop + sep_size; - } - } - } - - // finally update if needed - if ( ok && aux_stop >= stop ) { - stop = aux_stop; - fld_str = StringOps::strip( line.substr(start, stop-start), ' ' ); - } - } - - if ( ! fld_str.empty() ) { - // process the field - const int& fld_id{ this->field2id.at(fld) }; - if ( fld_id > 0 ) { - // no need to process, append directly if non-empty - if ( fld_id == 13 && fld_str == "-" ) { - continue; - } - data.emplace( fld_id, fld_str ); - - } else { - // process the field - - // process the date to get year, month, day, hour and minute - if ( fld.rfind("date_time",0ul) == 0ul ) { - const auto dt = DateTimeOps::processDateTime( fld_str, fld.substr( 10 ) ); // cut away the "date_time_" part - if ( ! dt.at( 0 ).empty() ) { - // year - data.emplace( this->field2id.at("date_time_year"), dt.at( 0 ) ); - } - if ( ! dt.at( 1 ).empty() ) { - // month - data.emplace( this->field2id.at("date_time_month"), dt.at( 1 ) ); - } - if ( ! dt.at( 2 ).empty() ) { - // day - data.emplace( this->field2id.at("date_time_day"), dt.at( 2 ) ); - } - if ( ! dt.at( 3 ).empty() ) { - // hour - if ( dt.at( 3 ) == "PM" ) { - add_pm |= true; - } else { - data.emplace( this->field2id.at("date_time_hour"), dt.at( 3 ) ); - } - } - if ( ! dt.at( 4 ).empty() ) { - // minute - data.emplace( this->field2id.at("date_time_minute"), dt.at( 4 ) ); - } - if ( ! dt.at( 5 ).empty() ) { - // second - data.emplace( this->field2id.at("date_time_second"), dt.at( 5 ) ); - } - - - // process the request to get the protocol, method, resource and query - } else if ( fld == "request_full" ) { - size_t aux; - std::string protocol, method, uri, query, - aux_fld{ fld_str }; - // method - aux = aux_fld.find( ' ' ); - if ( aux != std::string::npos ) { - method = aux_fld.substr( 0ul, aux ); - aux_fld = StringOps::lstrip( aux_fld.substr( aux+1ul ) ); - - // page & query - aux = aux_fld.find( ' ' ); - if ( aux != std::string::npos ) { - const std::string aux_str{ aux_fld.substr( 0ul, aux ) }; - // search for the query - const size_t aux_{ aux_str.find( '?' ) }; - if ( aux_ != std::string::npos ) { - uri = aux_str.substr( 0ul, aux_ ); - query = aux_str.substr( aux_+1ul ); - } else { - // query not found - uri = aux_str; - } - // protocol - protocol = StringOps::lstrip( aux_fld.substr( aux+1ul ) ); - } - } - // append non-empty data - if ( ! protocol.empty() ) { - data.emplace( this->field2id.at("request_protocol"), protocol ); - } - if ( ! method.empty() ) { - data.emplace( this->field2id.at("request_method"), method ); - } - if ( ! uri.empty() ) { - data.emplace( this->field2id.at("request_uri"), uri ); - } - if ( ! query.empty() ) { - data.emplace( this->field2id.at("request_query"), query ); - } - - - // process the request to get uri and query - } else if ( fld == "request_uri_query" ) { - // search for the query - std::string uri, query; - const size_t aux_{ fld_str.find( '?' ) }; - if ( aux_ != std::string::npos ) { - uri = fld_str.substr( 0ul, aux_ ); - query = fld_str.substr( aux_+1ul ); - } else { - // query not found - uri = fld_str; - } - if ( ! uri.empty() ) { - data.emplace( this->field2id.at("request_uri"), uri ); - } - if ( ! query.empty() ) { - data.emplace( this->field2id.at("request_query"), query ); - } - - - // process the time taken to convert to milliseconds - } else if ( fld.rfind("time_taken_",0ul) == 0ul ) { - float t{ std::stof( fld_str ) }; - const std::string u{ fld.substr( 11ul ) }; - if ( u == "us" ) { - // from microseconds - t /= 1000.0f; - } else if ( u == "s" || u == "s.ms" ) { - // from seconds - t *= 1000.0f; - } - data.emplace( this->field2id.at("time_taken"), std::to_string( static_cast( t ) ) ); - - - // something went wrong - } else { - // hmmm.. no... - throw LogParserException( "Unexpected LogField", fld ); - } - } - } - } - - // update the stop for the next start - stop += sep_size; - sep_i++; - if ( stop > line_size ) { - // this was the final separator - break; - } - - } - - if ( add_pm ) { - try { - // add +12 hours for PM - data.at( 4 ) = std::to_string( 12 + std::stoi(data.at( 4 )) ); - } catch (...) { - // no hour data - } - } - - this->data_collection.push_back( data ); - // update performance data - this->parsed_size += line_size; - this->parsed_lines ++; - this->sendPerfData(); - }; + const auto signal_emission_gap{ [](const size_t n_lines)->size_t{ + return n_lines>10000ul ? n_lines/1000ul + : n_lines>1000ul ? n_lines/100ul + : n_lines>100ul ? n_lines/10ul + : 10ul; + }}; // parse all the lines if ( this->proceed ) { const size_t n_lines{ this->logs_lines.size() }; const size_t nl{ this->logs_format.new_lines }; + size_t send{ 0ul }; if ( nl == 0ul ) { + const size_t send_gap{ signal_emission_gap(n_lines) }; + const LogsFormat& lf {this->logs_format}; this->data_collection.reserve( n_lines ); for ( const std::string& line : this->logs_lines ) { - parseLine( line ); + parseLine( line, lf ); + if (++send == send_gap) { + this->sendPerfData(); + send = 0ul; + } } } else { - this->data_collection.reserve( n_lines / (nl+1ul) ); - for ( size_t i{0ul}; ilogs_format}; + this->data_collection.reserve( real_lines ); + for ( size_t i{0ul}; ilogs_lines.at( i ); - for ( size_t n{0ul}; nlogs_lines.at( i ); } - parseLine( line ); + parseLine( line, lf ); + if (++send == send_gap) { + this->sendPerfData(); + send = 0ul; + } } } + this->sendPerfData(); } } -void CraplogParser::storeLogLines() +void CraplogParser::storeLogLines( QSqlDatabase& db ) { - QString db_path{ QString::fromStdString( this->db_data_path ) }; - QString db_name{ QString::fromStdString( this->db_data_path.substr( this->db_data_path.find_last_of( '/' ) + 1ul ) ) }; + db.setDatabaseName( QString::fromStdString( this->db_path ) ); - QSqlDatabase db{ QSqlDatabase::addDatabase("QSQLITE") }; - db.setDatabaseName( db_path ); - - if ( ! CheckSec::checkDatabaseFile( this->db_data_path, db_name ) ) { + if ( ! this->checkDatabaseFile() ) [[unlikely]] { this->proceed &= false; + return; + } - } else if ( ! db.open() ) { - // error opening database + if ( ! db.open() ) [[unlikely]] { this->proceed &= false; QString err_msg; - if ( this->dialogs_level == 2 ) { + if ( this->dialogs_level == DL_EXPLANATORY ) { err_msg = db.lastError().text(); } emit this->showDialog( WorkerDialog::errDatabaseFailedOpening, - {db_name, err_msg} ); - - } else { - - try { - // ACID transaction - if ( ! db.transaction() ) { - // error opening database - this->proceed &= false; - QString stmt_msg, err_msg; - if ( this->dialogs_level > 0 ) { - stmt_msg = "db.transaction()"; - if ( this->dialogs_level == 2 ) { - err_msg = db.lastError().text(); - } - } - emit this->showDialog( WorkerDialog::errDatabaseFailedExecuting, - {db_name, stmt_msg, err_msg} ); - } - - if ( this->proceed && !this->data_collection.empty() ) { - this->proceed &= this->storeData( db ); - } - - if ( this->proceed ) { - // commit the transaction - if ( ! db.commit() ) { - // error opening database - this->proceed &= false; - QString stmt_msg, err_msg; - if ( this->dialogs_level > 0 ) { - stmt_msg = "db.commit()"; - if ( this->dialogs_level == 2 ) { - err_msg= db.lastError().text(); - } - } - emit this->showDialog( WorkerDialog::errDatabaseFailedExecuting, - {db_name, stmt_msg, err_msg} ); - } - } - if ( ! proceed ) { - // rollback - throw (std::exception()); - } - - } catch (...) { - // wrongthing w3nt some.,. - this->proceed &= false; - bool err_shown = false; - // rollback the transaction - if ( ! db.rollback() ) { - // error rolling back commits - QString stmt_msg, err_msg; - if ( this->dialogs_level > 0 ) { - stmt_msg = "db.rollback()"; - if ( this->dialogs_level == 2 ) { - err_msg = db.lastError().text(); - } - } - emit this->showDialog( WorkerDialog::errDatabaseFailedExecuting, - {db_name, stmt_msg, err_msg} ); - err_shown = true; - } - if ( ! err_shown ) { - // show a message - emit this->showDialog( - WorkerDialog::errGeneric, - {QString("%1\n\n%2").arg( - DialogSec::tr("An error occured while working on the database"), - DialogSec::tr("Aborting") )} ); - } - } - - if ( db.isOpen() ) { - db.close(); - } + {this->db_name, err_msg} ); + return; } + try { + + if ( ! db.transaction() ) [[unlikely]] { + this->proceed &= false; + QString stmt_msg, err_msg; + if ( this->dialogs_level > DL_ESSENTIAL ) { + stmt_msg.append( "db.transaction()" ); + if ( this->dialogs_level == DL_EXPLANATORY ) { + err_msg = db.lastError().text(); + } + } + emit this->showDialog( WorkerDialog::errDatabaseFailedExecuting, + {this->db_name, stmt_msg, err_msg} ); + return; + + } else if ( this->storeData( db ) ) [[likely]] { + + if ( ! db.commit() ) [[unlikely]] { + this->proceed &= false; + QString stmt_msg, err_msg; + if ( this->dialogs_level > DL_ESSENTIAL ) { + stmt_msg.append( "db.commit()" ); + if ( this->dialogs_level == DL_EXPLANATORY ) { + err_msg.append( db.lastError().text() ); + } + } + emit this->showDialog( WorkerDialog::errDatabaseFailedExecuting, + {this->db_name, stmt_msg, err_msg} ); + } + } + + if ( ! this->proceed ) [[unlikely]] { + // rollback the transaction + if ( ! db.rollback() ) { + QString stmt_msg, err_msg; + if ( this->dialogs_level > DL_ESSENTIAL ) { + stmt_msg = "db.rollback()"; + if ( this->dialogs_level == DL_EXPLANATORY ) { + err_msg = db.lastError().text(); + } + } + emit this->showDialog( WorkerDialog::errDatabaseFailedExecuting, + {this->db_name, stmt_msg, err_msg} ); + return; + } + } + + } catch (...) { + // wrongthing w3nt some.,. + emit this->showDialog( + WorkerDialog::errGeneric, + {QStringLiteral("%1\n\n%2").arg( + DialogSec::tr("An error occured while working on the database"), + DialogSec::tr("Aborting") )} ); + } } +#define APPEND_TO_QUERY_AS_NUMBER(LOG_FIELD)\ + if ( LOG_FIELD ) {\ + stmt.append( QString::fromStdString( *LOG_FIELD ).replace(QLatin1Char('\''),QLatin1String("''")) );\ + } else {\ + stmt.append( QStringLiteral("NULL") );\ + } +#define CONCAT_TO_QUERY_AS_NUMBER(LOG_FIELD)\ + stmt.append( QStringLiteral(", ") );\ + APPEND_TO_QUERY_AS_NUMBER(LOG_FIELD) + +#define CONCAT_TO_QUERY_AS_STRING(LOG_FIELD)\ + stmt.append( QStringLiteral(", ") );\ + if ( LOG_FIELD ) {\ + stmt.append( QStringLiteral("'%1'").arg( QString::fromStdString( *LOG_FIELD ).replace(QLatin1Char('\''),QLatin1String("''")) ) );\ + } else {\ + stmt.append( QStringLiteral("NULL") );\ + } + +// in IIS logs the user-agent is logged with '+' instead of ' ' (whitespace) +#define CONCAT_TO_QUERY_USERAGENT(LOG_FIELD)\ + stmt.append( QStringLiteral(", ") );\ + if ( LOG_FIELD ) {\ + if ( this->web_server == WS_IIS ) {\ + stmt.append( QStringLiteral("'%1'").arg( QString::fromStdString( *LOG_FIELD ).replace(QLatin1Char('+'),QLatin1Char(' ')).replace(QLatin1Char('\''),QLatin1String("''")) ) );\ + } else {\ + stmt.append( QStringLiteral("'%1'").arg( QString::fromStdString( *LOG_FIELD ).replace(QLatin1Char('\''),QLatin1String("''")) ) );\ + }\ + } else {\ + stmt.append( QStringLiteral("NULL") );\ + } + bool CraplogParser::storeData( QSqlDatabase& db ) { - const QString db_name{ QString::fromStdString( - this->db_data_path.substr( - this->db_data_path.find_last_of( '/' ) + 1ul ) ) }; - - // get blacklist/warnlist items - const bool check_bl_cli { this->blacklists.at( 20 ).used }; - const bool check_wl_met { this->warnlists.at( 11 ).used }; - const bool check_wl_req { this->warnlists.at( 12 ).used }; - const bool check_wl_cli { this->warnlists.at( 20 ).used }; - const bool check_wl_ua { this->warnlists.at( 21 ).used }; + // get blacklist items + const bool check_bl_cli { this->blacklist.client.used }; const std::vector empty; const std::vector& bl_cli_list{ (check_bl_cli) - ? this->blacklists.at( 20 ).list - : empty }; - - const std::vector& wl_met_list{ (check_wl_met) - ? this->warnlists.at( 11 ).list - : empty }; - - const std::vector& wl_req_list{ (check_wl_req) - ? this->warnlists.at( 12 ).list - : empty }; - - const std::vector& wl_cli_list{ (check_wl_cli) - ? this->warnlists.at( 20 ).list - : empty }; - - const std::vector& wl_ua_list{ (check_wl_ua) - ? this->warnlists.at( 21 ).list + ? this->blacklist.client.list : empty }; // prepare the database related studd QString table; - switch ( this->wsID ) { - case APACHE_ID: - table += "apache"; + switch ( this->web_server ) { + case WS_APACHE: + table.append( "apache" ); break; - case NGINX_ID: - table += "nginx"; + case WS_NGINX: + table.append( "nginx" ); break; - case IIS_ID: - table += "iis"; + case WS_IIS: + table.append( "iis" ); break; default: - // wrong WebServerID, but should be unreachable because of the previous operations - throw WebServerException( "Unexpected WebServerID: " + std::to_string(this->wsID) ); + // wrong WebServer, but should be unreachable because of the previous operations + throw LogParserException( "Unexpected WebServer", std::to_string(static_cast(this->web_server)) ); } + const QString stmt_template{ + QStringLiteral(R"(INSERT INTO "%1" ("year", "month", "day", "hour", "minute", "second", "protocol", "method", "uri", "query", "response", "time_taken", "bytes_sent", "bytes_received", "referrer", "client", "user_agent", "cookie") )" + "VALUES (") + }; /*int perf_size;*/ - bool warning{ false }; - QSqlQuery query{ db }; // parse every row of data - for ( const log_line_data_t& row : this->data_collection ) { + for ( const LogLineData& line_data : this->data_collection ) { // check blacklisted clients - if ( check_bl_cli ) { - if ( row.find( 20 ) != row.end() ) { - // this row does contain this row item, check if they match - const std::string& target{ row.at( 20 ) }; - if ( std::any_of( bl_cli_list.cbegin(), bl_cli_list.cend(), - [&target]( const std::string& item ) - { return target.rfind( item, 0ul ) == 0ul; }) ) { - // append every field to ignored size - this->blacklisted_size += std::accumulate( row.cbegin(), row.cend(), 0ul, - []( size_t size, const auto& item ) - { return size + item.second.size(); }); - continue; - } + if ( check_bl_cli && line_data.client ) { + if ( VecOps::contains( bl_cli_list, *line_data.client ) ) { + this->blacklisted_size += line_data.size(); + continue; } } - // check warnlisted clients - if ( check_wl_cli ) { - if ( row.find( 20 ) != row.end() ) { - // this row do contains this row item, check if they match - const std::string& target{ row.at( 20 ) }; - if ( std::any_of( wl_cli_list.cbegin(), wl_cli_list.cend(), - [&target]( const std::string& item ) - { return target.rfind( item, 0ul ) == 0ul; }) ) { - // match found! put a warning on this line - warning |= true; - } - } - } - // check warnlisted user-agents - if ( check_wl_ua && !warning ) { - if ( row.find( 21 ) != row.end() ) { - // this row do contains this row item, check if they match - const std::string& target{ row.at( 21 ) }; - if ( std::any_of( wl_ua_list.cbegin(), wl_ua_list.cend(), - [&target]( const std::string& item ) - { return target.rfind( item, 0ul ) == 0ul; }) ) { - // match found! skip this line - warning |= true; - } - } - } - // check warnlisted methods - if ( check_wl_met && !warning ) { - if ( row.find( 11 ) != row.end() ) { - // this row do contains this row item, check if they match - const std::string& target{ row.at( 11 ) }; - if ( std::any_of( wl_met_list.cbegin(), wl_met_list.cend(), - [&target]( const std::string& item ) - { return item == target; }) ) { - // match found! skip this line - warning |= true; - } - } - } - // check warnlisted requests URIs - if ( check_wl_req && !warning ) { - if ( row.find( 12 ) != row.end() ) { - // this row do contains this row item, check if they match - const std::string& target{ row.at( 12 ) }; - if ( std::any_of( wl_req_list.cbegin(), wl_req_list.cend(), - [&target]( const std::string& item ) - { return target.rfind( item, 0ul ) == 0ul; }) ) { - // match found! skip this line - warning |= true; - } - } - } - - - // initialize the SQL statement - QString query_stmt{ "INSERT INTO \""+table+"\" (\"warning\", \"year\", \"month\", \"day\", \"hour\", \"minute\", \"second\", \"protocol\", \"method\", \"uri\", \"query\", \"response\", \"time_taken\", \"bytes_sent\", \"bytes_received\", \"referrer\", \"client\", \"user_agent\", \"cookie\") " - "VALUES (" }; + QString stmt{ stmt_template.arg( table ) }; // complete and execute the statement, binding NULL if not found - // warning - if ( warning ) { - warning &= false; - this->warnlisted_size += std::accumulate( row.cbegin(), row.cend(), 0ul, - []( size_t size, const auto& item ) - { return size + item.second.size(); }); - query_stmt += "1"; - } else { - query_stmt += "0"; - } - // date and time - for ( int i{1}; i<7; i++ ) { - query_stmt += ", "; - if ( row.find( i ) == row.cend() ) { - // no value found in the collection, bind NULL - query_stmt += "NULL"; - } else { - // value found, bind it - query_stmt += QString::fromStdString( row.at( i ) ).replace("'","''"); - } - } + APPEND_TO_QUERY_AS_NUMBER(line_data.year) // 1 + CONCAT_TO_QUERY_AS_NUMBER(line_data.month) // 2 + CONCAT_TO_QUERY_AS_NUMBER(line_data.day) // 3 + CONCAT_TO_QUERY_AS_NUMBER(line_data.hour) // 4 + CONCAT_TO_QUERY_AS_NUMBER(line_data.minute) // 5 + CONCAT_TO_QUERY_AS_NUMBER(line_data.second) // 6 // request - for ( int i{10}; i<14; i++ ) { - query_stmt += ", "; - if ( row.find( i ) == row.cend() ) { - // no value found in the collection, bind NULL - query_stmt += "NULL"; - } else { - // value found, bind it - query_stmt += QString("'%1'").arg( QString::fromStdString( row.at( i ) ).replace("'","''") ); - } - } + CONCAT_TO_QUERY_AS_STRING(line_data.protocol) // 10 + CONCAT_TO_QUERY_AS_STRING(line_data.method) // 11 + CONCAT_TO_QUERY_AS_STRING(line_data.uri) // 12 + CONCAT_TO_QUERY_AS_STRING(line_data.query) // 13 - for ( int i{14}; i<18; i++ ) { - query_stmt += ", "; - if ( row.find( i ) == row.cend() ) { - // no value found in the collection, bind NULL - query_stmt += "NULL"; - } else { - // value found, bind it - query_stmt += QString::fromStdString( row.at( i ) ).replace("'","''"); - } - } + CONCAT_TO_QUERY_AS_NUMBER(line_data.response_code) // 14 + CONCAT_TO_QUERY_AS_NUMBER(line_data.time_taken) // 15 + CONCAT_TO_QUERY_AS_NUMBER(line_data.bytes_sent) // 16 + CONCAT_TO_QUERY_AS_NUMBER(line_data.bytes_received) // 17 // client data and referrer - for ( const int& i : std::vector{18,20,21,22} ) { - query_stmt += ", "; - if ( row.find( i ) == row.cend() ) { - // no value found in the collection, bind NULL - query_stmt += "NULL"; - } else { - // value found, bind it - if ( i == 21 && this->wsID == IIS_ID ) { - // iis logs the user-agent using '+' instead of ' ' (spaces) - QString str = QString::fromStdString( row.at( i ) ).replace("+"," "); - query_stmt += QString("'%1'").arg( str.replace("'","''") ); - } else { - query_stmt += QString("'%1'").arg( QString::fromStdString( row.at( i ) ).replace("'","''") ); - } - } - } + CONCAT_TO_QUERY_AS_STRING(line_data.referrer) // 18 + CONCAT_TO_QUERY_AS_STRING(line_data.client) // 20 + CONCAT_TO_QUERY_USERAGENT(line_data.user_agent) // 21 + CONCAT_TO_QUERY_AS_STRING(line_data.cookie) // 22 - query_stmt += ");"; + stmt.append( ");" ); - // encode the statement - if ( ! query.prepare( query_stmt ) ) { - // error opening database - QString query_msg, err_msg; - if ( this->dialogs_level > 0 ) { - query_msg = "query.prepare()"; - if ( this->dialogs_level == 2 ) { - err_msg = query.lastError().text(); - } - } - emit this->showDialog( WorkerDialog::errDatabaseFailedExecuting, - {db_name, query_msg, err_msg} ); - return false; - } - - // finalize this statement - if ( ! query.exec() ) { + if ( QSqlQuery query(db); !query.exec( stmt ) ) [[unlikely]] { // error finalizing step QString query_msg, err_msg; - if ( this->dialogs_level > 0 ) { - query_msg = "query.exec()"; - if ( this->dialogs_level == 2 ) { + if ( this->dialogs_level > DL_ESSENTIAL ) { + query_msg.append( "query.exec()" ); + if ( this->dialogs_level == DL_EXPLANATORY ) { err_msg = query.lastError().text(); } } emit this->showDialog( WorkerDialog::errDatabaseFailedExecuting, - {db_name, query_msg, err_msg} ); + {this->db_name, query_msg, err_msg} ); return false; } - - // reset the statement to prepare for the next one - query.finish(); } return true; } + + +bool CraplogParser::checkDatabaseFile() noexcept +{ + if ( ! IOutils::exists( this->db_path ) ) { + emit this->showDialog( WorkerDialog::errDatabaseFileNotFound, {this->db_name} ); + return false; + } else if ( ! IOutils::isFile( this->db_path ) ) { + emit this->showDialog( WorkerDialog::errDatabaseFileNotFile, {this->db_name} ); + return false; + } else if ( ! IOutils::checkFile( this->db_path, true ) ) { + emit this->showDialog( WorkerDialog::errDatabaseFileNotReadable, {this->db_name} ); + return false; + } else if ( ! IOutils::checkFile( this->db_path, false, true ) ) { + emit this->showDialog( WorkerDialog::errDatabaseFileNotWritable, {this->db_name} ); + return false; + } + return true; +} diff --git a/logdoctor/modules/craplog/modules/workers/parser.h b/logdoctor/modules/craplog/modules/workers/parser.h index b15f719a..51a7a5d3 100644 --- a/logdoctor/modules/craplog/modules/workers/parser.h +++ b/logdoctor/modules/craplog/modules/workers/parser.h @@ -2,36 +2,129 @@ #define LOGDOCTOR__CRAPLOG__WORKERS__PARSER_H -#include "parser_interface.h" +#include "main_lib.h" + +#include "modules/craplog/modules/lib.h" + +#include "modules/blacklists/modules/blacklist.h" + +#include + +#include -class CraplogParser : public CraplogParserInterface +struct LogLineData; + +class DatabaseWrapper; + +enum class WorkerDialog; + +class QWaitCondition; + +class QSqlDatabase; + + +class CraplogParser final : public QObject { + Q_OBJECT + + using worker_files_t = std::vector; + public: explicit CraplogParser( - const unsigned web_server_id, - const unsigned dialogs_level, - const std::string& db_data_path, - const std::string& db_hashes_path, + const WebServer web_server, + const DialogsLevel dialogs_level, const LogsFormat& logs_format, - const bw_lists_t& blacklists, - const bw_lists_t& warnlists, - const worker_files_t& log_files, + const Blacklist& blacklist, + worker_files_t&& log_files, + const std::string& data_db_path, QObject* parent=nullptr ); + ~CraplogParser(); + +signals: + + void perfData( + const size_t parsed_size, + const size_t parsed_lines ); + + void chartData( + const size_t total_size, + const size_t total_lines, + const size_t blacklisted_size ); + + void showDialog( + const WorkerDialog dialog_type, + const QStringList arg ); + + void readyStoringData( QWaitCondition* wc, bool* successful ); + + void startedParsing(); + + void finishedParsing(); + + void done( const bool successful ); + + void retire(); + public slots: - void work() override; + void work(); + + void sendPerfData() noexcept; + + void sendChartData() noexcept; private: + const WebServer web_server; + + const DialogsLevel dialogs_level; + bool proceed{ true }; + /////////////////// + //// DATABASES //// + + bool db_edited{ false }; + + std::string db_path; + + const QString db_name; + const QString db_conn_name{ QStringLiteral("Parser_LogsData") }; + + bool checkDatabaseFile() noexcept; + + ////////////////////// + //// PERFORMANCES //// + + size_t total_lines { 0ul }; + size_t parsed_lines { 0ul }; + size_t total_size { 0ul }; + size_t parsed_size { 0ul }; + size_t blacklisted_size { 0ul }; + + /////////////////// + //// BLACKLIST //// + + const Blacklist blacklist; + + ////////////// + //// LOGS //// + + LogsFormat logs_format; + + // the selected log files to be parsed during the process + const worker_files_t files_to_use; + // the entire stack of lines which have been read from the log files std::vector logs_lines; + // collection of logs data, each item represents a log line + std::vector data_collection; + //! Reads the selected files and append the resulting lines to the list /*! \throw GenericException @@ -46,18 +139,18 @@ private: //! Handles the process of storing data in the database /*! + \param db The database instance, not initialized already \see storeData() */ - void storeLogLines(); + void storeLogLines( QSqlDatabase& db ); //! Stores the data collection in the logs Collection database /*! - \param db A database instance, already initizlized + \param db The database instance, already initialized \return Whether the operation has been successful or not \throw WebServerException */ bool storeData( QSqlDatabase& db ); - }; diff --git a/logdoctor/modules/craplog/modules/workers/parser_async.cpp b/logdoctor/modules/craplog/modules/workers/parser_async.cpp deleted file mode 100644 index 2f1eb4a7..00000000 --- a/logdoctor/modules/craplog/modules/workers/parser_async.cpp +++ /dev/null @@ -1,821 +0,0 @@ - -#include "parser_async.h" - -#include "defines/web_servers.h" - -#include "utilities/checks.h" -#include "utilities/gzip.h" -#include "utilities/io.h" -#include "utilities/strings.h" - -#include "modules/dialogs.h" -#include "modules/exceptions.h" - -#include "modules/craplog/craplog.h" -#include "modules/craplog/modules/datetime.h" - -#include - -#include -#include -#include - - -CraplogParserAsync::CraplogParserAsync( const unsigned web_server_id, const unsigned dialogs_level, const std::string& db_data_path, const std::string& db_hashes_path, const LogsFormat& logs_format, const bw_lists_t& blacklists, const bw_lists_t& warnlists, const worker_files_t& log_files, QObject* parent ) - : CraplogParserInterface { web_server_id, dialogs_level, db_data_path, db_hashes_path, logs_format, blacklists, warnlists, log_files, parent } -{ - -} - - -void CraplogParserAsync::work() -{ - const size_t n_files{ this->files_to_use.size() }; - std::vector> pms_logs_lines; - std::vector> ftr_logs_lines; - - auto joinLines = [this,&n_files,&pms_logs_lines]() - { - for ( size_t i{0ul}; ijoinLogLines( pms_logs_lines.at( i ), this->files_to_use.at( i ) ); - if ( !this->proceed.load() ) { - break; - } - } - }; - - auto parseLines = [this,&n_files,&ftr_logs_lines]() - { - bool first{ true }; - for ( size_t i{0ul}; istartedParsing(); - } - this->parseLogLines( ftr_logs_lines.at( i ) ); - if ( !this->proceed.load() ) { - break; - } - } - emit this->finishedParsing(); - }; - - try { - ftr_logs_lines.reserve( n_files ); - pms_logs_lines.reserve( n_files ); - for ( size_t i{0ul}; i{} ); - ftr_logs_lines.push_back( pms_logs_lines.back().get_future() ); - } - - // collect log lines - std::thread j{ joinLines }; - // collect log data - std::thread p{ parseLines }; - // wait for completion - j.join(); - p.join(); - - // clear log lines data - pms_logs_lines.clear(); - ftr_logs_lines.clear(); - - if ( this->proceed.load() && this->parsed_size > 0ul ) { - // store the new data - this->storeLogLines(); - this->db_edited |= this->proceed.load(); - } - - } catch ( GenericException& e ) { - emit this->showDialog( WorkerDialog::errGeneric, - {e.what()} ); - this->proceed.store( false ); - - } catch ( LogParserException& e ) { - emit this->showDialog( WorkerDialog::errFailedParsingLogs, - {e.what()} ); - this->proceed.store( false ); - } - // send the final data - if ( ! this->proceed ) { - this->total_lines = 0ul; - this->parsed_lines = 0ul; - this->total_size = 0ul; - this->parsed_size = 0ul; - this->warnlisted_size = 0ul; - this->blacklisted_size = 0ul; - } - this->sendPerfData(); - this->sendChartData(); - emit this->done( this->db_edited ); - emit this->retire(); -} - - -void CraplogParserAsync::joinLogLines( std::promise& log_lines, const logs_file_t& logs_file ) -{ - const auto cleanLines = [](std::vector& lines) { - std::vector aux; - aux.reserve( lines.size() ); - for ( const std::string& line : lines ) { - if ( line.front() != '#' ) { - // not a commented line - aux.push_back( line ); - } - } - aux.shrink_to_fit(); - lines = std::move( aux ); - }; - - - std::string aux; - logs_lines_t content; - - const std::string& file_path = std::get<0>( logs_file ); - - // collect lines - try { - // try reading - try { - // try as gzip compressed archive first - GZutils::readFile( file_path, aux ); - - } catch ( const GenericException& ) { - // failed closing file pointer - throw; - - } catch (...) { - // fallback on reading as normal file - if ( ! aux.empty() ) { - aux.clear(); - } - IOutils::readFile( file_path, aux ); - } - StringOps::splitrip( content, aux ); - - this->total_lines += content.size(); - this->total_size += aux.size(); - - if ( this->wsID == IIS_ID ) { - cleanLines( content ); - } - - // re-catched in run() - } catch ( const GenericException& ) { - // failed closing gzip file pointer - this->proceed.store( false ); - throw GenericException( QString("%1:\n%2").arg( - DialogSec::tr("An error accured while reading the gzipped file"), - QString::fromStdString( file_path ) - ).toStdString() ); - - } catch ( const std::ios_base::failure& ) { - // failed reading as text - this->proceed.store( false ); - throw GenericException( QString("%1:\n%2").arg( - DialogSec::tr("An error accured while reading the file"), - QString::fromStdString( file_path ) - ).toStdString() ); - - } catch (...) { - // failed somehow - this->proceed.store( false ); - throw GenericException( QString("%1:\n%2").arg( - DialogSec::tr("Something failed while handling the file"), - QString::fromStdString( file_path ) - ).toStdString() ); - } - - // append to the relative list - if ( this->proceed.load() ) { - log_lines.set_value( std::move( content ) ); - } -} - - -void CraplogParserAsync::parseLogLines( std::future& f_log_lines ) -{ - const auto parseLine = [this]( const std::string& line ) { - log_line_data_t data; - std::string_view sep; - std::string fld_str; - bool add_pm{false}, ok{true}; - size_t start, stop{this->logs_format.initial.size()}, - sep_i{0}; - const size_t line_size{ line.size()-1ul }, - n_seps{ this->logs_format.separators.size()-1ul }; - - while (true) { - // split fields - start = stop; // stop updated at the end of the loop - if ( sep_i <= n_seps ) { - sep = this->logs_format.separators.at( sep_i ); - stop = line.find( sep, start ); - } else if ( sep_i == n_seps+1ul ) { - // final separator - sep = this->logs_format.final; - if ( sep.empty() ) { - stop = line_size+1ul; - } else { - stop = line.find( sep, start ); - if ( stop == std::string::npos ) { - stop = line_size+1ul; - } - } - } else { - // no more separators - break; - } - if ( stop == std::string::npos ) { - // separator not found, abort - throw LogParserException( "Separator not found", std::string{sep} ); - } - const size_t sep_size = sep.size(); - - // get the field - const std::string& fld = this->logs_format.fields.at( sep_i ); - if ( fld != "NONE" ) { - // only parse the considered fields - fld_str = StringOps::strip( line.substr(start, stop-start), ' ' ); - - if ( sep_i+1ul <= n_seps ) { - // not the last separator, check for mistakes - ok |= true; - size_t aux_stop = stop; - - if ( sep == " " ) { - // whitespace-separated-values fields - size_t c{ static_cast( std::count( fld_str.cbegin(), fld_str.cend(), ' ' ) ) }, - n{ 0 }; - if ( fld == "request_full" ) { - n += 2ul; - } else if ( fld == "date_time_mcs" ) { - n += 4ul; - } else if ( fld == "date_time_ncsa" ) { - n += 1ul; - } else if ( fld == "date_time_gmt" ) { - n += 3ul; - } - if ( n > 0ul && c < n ) { - // loop until the correct number of whitespaces is reached - size_t aux_start = stop+1ul; - while ( c < n ) { - aux_stop = line.find( sep, aux_start ); - if ( aux_stop == std::string::npos ) { - // not found - ok &= false; - break; - } - aux_start = aux_stop+1ul; - c++; - } - } - - } else if ( sep.front() == '"' && fld == "user_agent" ) { - // atm the only support is for escaped quotes - if ( fld_str.back() == '\\' ) { - size_t aux_start = stop + sep_size; - while (true) { - aux_stop = line.find( sep, aux_start ); - if ( aux_stop == std::string::npos ) { - // not found - break; - } else if ( line.at( aux_stop-1ul ) != '\\' ) { - // non-backslashed quotes - break; - } - aux_start = aux_stop + sep_size; - } - } - } - - // finally update if needed - if ( ok && aux_stop >= stop ) { - stop = aux_stop; - fld_str = StringOps::strip( line.substr(start, stop-start), ' ' ); - } - } - - if ( ! fld_str.empty() ) { - // process the field - const int& fld_id{ this->field2id.at(fld) }; - if ( fld_id > 0 ) { - // no need to process, append directly if non-empty - if ( fld_id == 13 && fld_str == "-" ) { - continue; - } - data.emplace( fld_id, fld_str ); - - } else { - // process the field - - // process the date to get year, month, day, hour and minute - if ( fld.rfind("date_time",0ul) == 0ul ) { - const auto dt = DateTimeOps::processDateTime( fld_str, fld.substr( 10 ) ); // cut away the "date_time_" part - if ( ! dt.at( 0 ).empty() ) { - // year - data.emplace( this->field2id.at("date_time_year"), dt.at( 0 ) ); - } - if ( ! dt.at( 1 ).empty() ) { - // month - data.emplace( this->field2id.at("date_time_month"), dt.at( 1 ) ); - } - if ( ! dt.at( 2 ).empty() ) { - // day - data.emplace( this->field2id.at("date_time_day"), dt.at( 2 ) ); - } - if ( ! dt.at( 3 ).empty() ) { - // hour - if ( dt.at( 3 ) == "PM" ) { - add_pm |= true; - } else { - data.emplace( this->field2id.at("date_time_hour"), dt.at( 3 ) ); - } - } - if ( ! dt.at( 4 ).empty() ) { - // minute - data.emplace( this->field2id.at("date_time_minute"), dt.at( 4 ) ); - } - if ( ! dt.at( 5 ).empty() ) { - // second - data.emplace( this->field2id.at("date_time_second"), dt.at( 5 ) ); - } - - - // process the request to get the protocol, method, resource and query - } else if ( fld == "request_full" ) { - size_t aux; - std::string protocol, method, uri, query, - aux_fld{ fld_str }; - // method - aux = aux_fld.find( ' ' ); - if ( aux != std::string::npos ) { - method = aux_fld.substr( 0ul, aux ); - aux_fld = StringOps::lstrip( aux_fld.substr( aux+1ul ) ); - - // page & query - aux = aux_fld.find( ' ' ); - if ( aux != std::string::npos ) { - const std::string aux_str{ aux_fld.substr( 0ul, aux ) }; - // search for the query - const size_t aux_{ aux_str.find( '?' ) }; - if ( aux_ != std::string::npos ) { - uri = aux_str.substr( 0ul, aux_ ); - query = aux_str.substr( aux_+1ul ); - } else { - // query not found - uri = aux_str; - } - // protocol - protocol = StringOps::lstrip( aux_fld.substr( aux+1ul ) ); - } - } - // append non-empty data - if ( ! protocol.empty() ) { - data.emplace( this->field2id.at("request_protocol"), protocol ); - } - if ( ! method.empty() ) { - data.emplace( this->field2id.at("request_method"), method ); - } - if ( ! uri.empty() ) { - data.emplace( this->field2id.at("request_uri"), uri ); - } - if ( ! query.empty() ) { - data.emplace( this->field2id.at("request_query"), query ); - } - - - // process the request to get uri and query - } else if ( fld == "request_uri_query" ) { - // search for the query - std::string uri, query; - const size_t aux_{ fld_str.find( '?' ) }; - if ( aux_ != std::string::npos ) { - uri = fld_str.substr( 0ul, aux_ ); - query = fld_str.substr( aux_+1ul ); - } else { - // query not found - uri = fld_str; - } - if ( ! uri.empty() ) { - data.emplace( this->field2id.at("request_uri"), uri ); - } - if ( ! query.empty() ) { - data.emplace( this->field2id.at("request_query"), query ); - } - - - // process the time taken to convert to milliseconds - } else if ( fld.rfind("time_taken_",0ul) == 0ul ) { - float t{ std::stof( fld_str ) }; - const std::string u{ fld.substr( 11ul ) }; - if ( u == "us" ) { - // from microseconds - t /= 1000.0f; - } else if ( u == "s" || u == "s.ms" ) { - // from seconds - t *= 1000.0f; - } - data.emplace( this->field2id.at("time_taken"), std::to_string( static_cast( t ) ) ); - - - // something went wrong - } else { - // hmmm.. no... - throw LogParserException( "Unexpected LogField", fld ); - } - } - } - } - - // update the stop for the next start - stop += sep_size; - sep_i++; - if ( stop > line_size ) { - // this was the final separator - break; - } - } - - if ( add_pm ) { - try { - // add +12 hours for PM - data.at( 4 ) = std::to_string( 12 + std::stoi(data.at( 4 )) ); - } catch (...) { - // no hour data - } - } - - this->data_collection.push_back( data ); - // update performance data - this->parsed_size += line_size; - this->parsed_lines ++; - this->sendPerfData(); - }; - - - // parse all the lines - if ( this->proceed.load() ) { - const logs_lines_t& log_lines{ f_log_lines.get() }; - const size_t n_lines{ log_lines.size() }; - const size_t nl{ this->logs_format.new_lines }; - if ( nl == 0ul ) { - const size_t size{ this->data_collection.size() + n_lines }; - this->data_collection.reserve( size ); - for ( const std::string& line : log_lines ) { - parseLine( line ); - } - } else { - const size_t size{ this->data_collection.size() + (n_lines/(nl+1ul)) }; - this->data_collection.reserve( size ); - for ( size_t i{0ul}; idb_data_path ) }; - QString db_name{ QString::fromStdString( this->db_data_path.substr( this->db_data_path.find_last_of( '/' ) + 1ul ) ) }; - - QSqlDatabase db{ QSqlDatabase::addDatabase("QSQLITE") }; - db.setDatabaseName( db_path ); - - if ( ! CheckSec::checkDatabaseFile( this->db_data_path, db_name ) ) { - this->proceed.store( false ); - - } else if ( ! db.open() ) { - // error opening database - this->proceed.store( false ); - QString err_msg; - if ( this->dialogs_level == 2 ) { - err_msg = db.lastError().text(); - } - emit this->showDialog( WorkerDialog::errDatabaseFailedOpening, - {db_name, err_msg} ); - - } else { - - try { - // ACID transaction - if ( ! db.transaction() ) { - // error opening database - this->proceed.store( false ); - QString stmt_msg, err_msg; - if ( this->dialogs_level > 0 ) { - stmt_msg = "db.transaction()"; - if ( this->dialogs_level == 2 ) { - err_msg = db.lastError().text(); - } - } - emit this->showDialog( WorkerDialog::errDatabaseFailedExecuting, - {db_name, stmt_msg, err_msg} ); - } - - if ( this->proceed && !this->data_collection.empty() ) { - this->proceed.store( this->storeData( db ) ); - } - - if ( this->proceed.load() ) { - // commit the transaction - if ( ! db.commit() ) { - // error opening database - this->proceed.store( false ); - QString stmt_msg, err_msg; - if ( this->dialogs_level > 0 ) { - stmt_msg = "db.commit()"; - if ( this->dialogs_level == 2 ) { - err_msg= db.lastError().text(); - } - } - emit this->showDialog( WorkerDialog::errDatabaseFailedExecuting, - {db_name, stmt_msg, err_msg} ); - } - } - if ( ! proceed ) { - // rollback - throw (std::exception()); - } - - } catch (...) { - // wrongthing w3nt some.,. - this->proceed.store( false ); - bool err_shown = false; - // rollback the transaction - if ( ! db.rollback() ) { - // error rolling back commits - QString stmt_msg, err_msg; - if ( this->dialogs_level > 0 ) { - stmt_msg = "db.rollback()"; - if ( this->dialogs_level == 2 ) { - err_msg = db.lastError().text(); - } - } - emit this->showDialog( WorkerDialog::errDatabaseFailedExecuting, - {db_name, stmt_msg, err_msg} ); - err_shown = true; - } - if ( ! err_shown ) { - // show a message - emit this->showDialog( - WorkerDialog::errGeneric, - {QString("%1\n\n%2").arg( - DialogSec::tr("An error occured while working on the database"), - DialogSec::tr("Aborting") )} ); - } - } - - if ( db.isOpen() ) { - db.close(); - } - } - -} - -bool CraplogParserAsync::storeData( QSqlDatabase& db ) -{ - const QString db_name{ QString::fromStdString( - this->db_data_path.substr( - this->db_data_path.find_last_of( '/' ) + 1ul ) ) }; - - // get blacklist/warnlist items - const bool check_bl_cli { this->blacklists.at( 20 ).used }; - const bool check_wl_met { this->warnlists.at( 11 ).used }; - const bool check_wl_req { this->warnlists.at( 12 ).used }; - const bool check_wl_cli { this->warnlists.at( 20 ).used }; - const bool check_wl_ua { this->warnlists.at( 21 ).used }; - - const std::vector empty; - const std::vector& bl_cli_list{ (check_bl_cli) - ? this->blacklists.at( 20 ).list - : empty }; - - const std::vector& wl_met_list{ (check_wl_met) - ? this->warnlists.at( 11 ).list - : empty }; - - const std::vector& wl_req_list{ (check_wl_req) - ? this->warnlists.at( 12 ).list - : empty }; - - const std::vector& wl_cli_list{ (check_wl_cli) - ? this->warnlists.at( 20 ).list - : empty }; - - const std::vector& wl_ua_list{ (check_wl_ua) - ? this->warnlists.at( 21 ).list - : empty }; - - // prepare the database related studd - QString table; - switch ( this->wsID ) { - case APACHE_ID: - table += "apache"; - break; - case NGINX_ID: - table += "nginx"; - break; - case IIS_ID: - table += "iis"; - break; - default: - // wrong WebServerID, but should be unreachable because of the previous operations - throw WebServerException( "Unexpected WebServerID: " + std::to_string(this->wsID) ); - } - - - /*int perf_size;*/ - bool warning{ false }; - QSqlQuery query{ db }; - // parse every row of data - for ( const log_line_data_t& row : this->data_collection ) { - - // check blacklisted clients - if ( check_bl_cli ) { - if ( row.find( 20 ) != row.end() ) { - // this row does contain this row item, check if they match - const std::string& target{ row.at( 20 ) }; - if ( std::any_of( bl_cli_list.cbegin(), bl_cli_list.cend(), - [&target]( const std::string& item ) - { return target.rfind( item, 0ul ) == 0ul; }) ) { - // append every field to ignored size - this->blacklisted_size += std::accumulate( row.cbegin(), row.cend(), 0ul, - []( size_t size, const auto& item ) - { return size + item.second.size(); }); - continue; - } - } - } - - // check warnlisted clients - if ( check_wl_cli ) { - if ( row.find( 20 ) != row.end() ) { - // this row do contains this row item, check if they match - const std::string& target{ row.at( 20 ) }; - if ( std::any_of( wl_cli_list.cbegin(), wl_cli_list.cend(), - [&target]( const std::string& item ) - { return target.rfind( item, 0ul ) == 0ul; }) ) { - // match found! put a warning on this line - warning |= true; - } - } - } - // check warnlisted user-agents - if ( check_wl_ua && !warning ) { - if ( row.find( 21 ) != row.end() ) { - // this row do contains this row item, check if they match - const std::string& target{ row.at( 21 ) }; - if ( std::any_of( wl_ua_list.cbegin(), wl_ua_list.cend(), - [&target]( const std::string& item ) - { return target.rfind( item, 0ul ) == 0ul; }) ) { - // match found! skip this line - warning |= true; - } - } - } - // check warnlisted methods - if ( check_wl_met && !warning ) { - if ( row.find( 11 ) != row.end() ) { - // this row do contains this row item, check if they match - const std::string& target{ row.at( 11 ) }; - if ( std::any_of( wl_met_list.cbegin(), wl_met_list.cend(), - [&target]( const std::string& item ) - { return item == target; }) ) { - // match found! skip this line - warning |= true; - } - } - } - // check warnlisted requests URIs - if ( check_wl_req && !warning ) { - if ( row.find( 12 ) != row.end() ) { - // this row do contains this row item, check if they match - const std::string& target{ row.at( 12 ) }; - if ( std::any_of( wl_req_list.cbegin(), wl_req_list.cend(), - [&target]( const std::string& item ) - { return target.rfind( item, 0ul ) == 0ul; }) ) { - // match found! skip this line - warning |= true; - } - } - } - - - // initialize the SQL statement - QString query_stmt{ "INSERT INTO \""+table+"\" (\"warning\", \"year\", \"month\", \"day\", \"hour\", \"minute\", \"second\", \"protocol\", \"method\", \"uri\", \"query\", \"response\", \"time_taken\", \"bytes_sent\", \"bytes_received\", \"referrer\", \"client\", \"user_agent\", \"cookie\") " - "VALUES (" }; - - // complete and execute the statement, binding NULL if not found - - // warning - if ( warning ) { - warning &= false; - this->warnlisted_size += std::accumulate( row.cbegin(), row.cend(), 0ul, - []( size_t size, const auto& item ) - { return size + item.second.size(); }); - query_stmt += "1"; - } else { - query_stmt += "0"; - } - - // date and time - for ( int i{1}; i<7; i++ ) { - query_stmt += ", "; - if ( row.find( i ) == row.cend() ) { - // no value found in the collection, bind NULL - query_stmt += "NULL"; - } else { - // value found, bind it - query_stmt += QString::fromStdString( row.at( i ) ).replace("'","''"); - } - } - - // request - for ( int i{10}; i<14; i++ ) { - query_stmt += ", "; - if ( row.find( i ) == row.cend() ) { - // no value found in the collection, bind NULL - query_stmt += "NULL"; - } else { - // value found, bind it - query_stmt += QString("'%1'").arg( QString::fromStdString( row.at( i ) ).replace("'","''") ); - } - } - - for ( int i{14}; i<18; i++ ) { - query_stmt += ", "; - if ( row.find( i ) == row.cend() ) { - // no value found in the collection, bind NULL - query_stmt += "NULL"; - } else { - // value found, bind it - query_stmt += QString::fromStdString( row.at( i ) ).replace("'","''"); - } - } - - // client data and referrer - for ( const int& i : std::vector{18,20,21,22} ) { - query_stmt += ", "; - if ( row.find( i ) == row.cend() ) { - // no value found in the collection, bind NULL - query_stmt += "NULL"; - } else { - // value found, bind it - if ( i == 21 && this->wsID == IIS_ID ) { - // iis logs the user-agent using '+' instead of ' ' (spaces) - QString str = QString::fromStdString( row.at( i ) ).replace("+"," "); - query_stmt += QString("'%1'").arg( str.replace("'","''") ); - } else { - query_stmt += QString("'%1'").arg( QString::fromStdString( row.at( i ) ).replace("'","''") ); - } - } - } - - query_stmt += ");"; - - // encode the statement - if ( ! query.prepare( query_stmt ) ) { - // error opening database - QString query_msg, err_msg; - if ( this->dialogs_level > 0 ) { - query_msg = "query.prepare()"; - if ( this->dialogs_level == 2 ) { - err_msg = query.lastError().text(); - } - } - emit this->showDialog( WorkerDialog::errDatabaseFailedExecuting, - {db_name, query_msg, err_msg} ); - return false; - } - - // finalize this statement - if ( ! query.exec() ) { - // error finalizing step - QString query_msg, err_msg; - if ( this->dialogs_level > 0 ) { - query_msg = "query.exec()"; - if ( this->dialogs_level == 2 ) { - err_msg = query.lastError().text(); - } - } - emit this->showDialog( WorkerDialog::errDatabaseFailedExecuting, - {db_name, query_msg, err_msg} ); - return false; - } - - // reset the statement to prepare for the next one - query.finish(); - } - - return true; -} diff --git a/logdoctor/modules/craplog/modules/workers/parser_async.h b/logdoctor/modules/craplog/modules/workers/parser_async.h deleted file mode 100644 index b43d1b6f..00000000 --- a/logdoctor/modules/craplog/modules/workers/parser_async.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef LOGDOCTOR__CRAPLOG__WORKERS__PARSER_ASYNC_H -#define LOGDOCTOR__CRAPLOG__WORKERS__PARSER_ASYNC_H - - -#include "parser_interface.h" - -#include -#include - - -class CraplogParserAsync : public CraplogParserInterface -{ - using logs_lines_t = std::vector; - -public: - - explicit CraplogParserAsync( - const unsigned web_server_id, - const unsigned dialogs_level, - const std::string& db_data_path, - const std::string& db_hashes_path, - const LogsFormat& logs_format, - const bw_lists_t& blacklists, - const bw_lists_t& warnlists, - const worker_files_t& log_files, - QObject* parent=nullptr - ); - -public slots: - - void work() override; - -private: - - std::atomic proceed{ true }; - - //! Reads the selected files and append the resulting lines to the list - /*! - \throw GenericException - */ - void joinLogLines( std::promise& log_lines, const logs_file_t& logs_file ); - - //! Parses the lines in the list and stores their data in the data collection - /*! - \throw LogParserException - */ - void parseLogLines( std::future& log_lines ); - - //! Handles the process of storing data in the database - /*! - \see storeData() - */ - void storeLogLines(); - - //! Stores the data collection in the logs Collection database - /*! - \param db A database instance, already initizlized - \return Whether the operation has been successful or not - \throw WebServerException - */ - bool storeData( QSqlDatabase& db ); - -}; - - -#endif // LOGDOCTOR__CRAPLOG__WORKERS__PARSER_ASYNC_H diff --git a/logdoctor/modules/craplog/modules/workers/parser_interface.cpp b/logdoctor/modules/craplog/modules/workers/parser_interface.cpp deleted file mode 100644 index aaa2c35f..00000000 --- a/logdoctor/modules/craplog/modules/workers/parser_interface.cpp +++ /dev/null @@ -1,36 +0,0 @@ - -#include "parser_interface.h" - - -CraplogParserInterface::CraplogParserInterface( const unsigned web_server_id, const unsigned dialogs_level, const std::string& db_data_path, const std::string& db_hashes_path, const LogsFormat& logs_format, const bw_lists_t& blacklists, const bw_lists_t& warnlists, const worker_files_t& log_files, QObject* parent ) - : QObject { parent } - , wsID { web_server_id } - , dialogs_level { dialogs_level } - , db_data_path { db_data_path } - , db_hashes_path { db_hashes_path } - , logs_format { logs_format } - , files_to_use { log_files } - , blacklists { blacklists } - , warnlists { warnlists } -{ - -} - - -void CraplogParserInterface::sendPerfData() -{ - emit this->perfData( - this->parsed_size, - this->parsed_lines - ); -} - -void CraplogParserInterface::sendChartData() -{ - emit this->chartData( - this->total_size, - this->total_lines, - this->warnlisted_size, - this->blacklisted_size - ); -} diff --git a/logdoctor/modules/craplog/modules/workers/parser_interface.h b/logdoctor/modules/craplog/modules/workers/parser_interface.h deleted file mode 100644 index 4cb64071..00000000 --- a/logdoctor/modules/craplog/modules/workers/parser_interface.h +++ /dev/null @@ -1,179 +0,0 @@ -#ifndef LOGDOCTOR__CRAPLOG__WORKERS__PARSER_INTERFACE_H -#define LOGDOCTOR__CRAPLOG__WORKERS__PARSER_INTERFACE_H - - -#include - -#include "modules/craplog/modules/lib.h" - -#include // leave this here for clang - -enum class WorkerDialog; - -class QSqlDatabase; - - -class CraplogParserInterface : public QObject -{ - Q_OBJECT - -protected: - - using logs_file_t = std::tuple; - using worker_files_t = std::vector; - using log_line_data_t = std::map; - using bw_lists_t = std::unordered_map; - - explicit CraplogParserInterface( - const unsigned web_server_id, - const unsigned dialogs_level, - const std::string& db_data_path, - const std::string& db_hashes_path, - const LogsFormat& logs_format, - const bw_lists_t& blacklists, - const bw_lists_t& warnlists, - const worker_files_t& log_files, - QObject* parent=nullptr - ); - - virtual ~CraplogParserInterface() = default; - -signals: - - void perfData( - const size_t parsed_size, - const size_t parsed_lines ); - - void chartData( - const size_t total_size, - const size_t total_lines, - const size_t warnlisted_size, - const size_t blacklisted_size ); - - void showDialog( - const WorkerDialog dialog_type, - const QStringList arg ); - - void startedParsing(); - - void finishedParsing(); - - void done( const bool successful ); - - void retire(); - -public slots: - - virtual void work() = 0; - - virtual void sendPerfData(); - - virtual void sendChartData(); - -protected: - - const unsigned wsID; - - const unsigned dialogs_level; - - /////////////////// - //// DATABASES //// - - bool db_edited{ false }; - std::string db_data_path; - std::string db_hashes_path; - - ////////////// - //// LOGS //// - - LogsFormat logs_format; - - // the selected log files to be parsed during the process - const worker_files_t files_to_use; - - // collection of logs items, each item results from a log line - /* structure - [ { log_field_id : "data" } ] - - log_field_ids - 99: warning, - 1: year, 2: month, 3: day, 4: hour, 5: minute, 6:second, - 10: request_protocol, 11: request_method, 12: request_uri, 13: request_query, 14: response_code, - 15: time_taken, 16: bytes_sent, 17: bytes_received, 18: referrer, - 20: client, 21: user_agent, 22: cookie - */ - std::vector data_collection; - - ////////////////////// - //// PERFORMANCES //// - - size_t total_lines { 0ul }; - size_t parsed_lines { 0ul }; - size_t total_size { 0ul }; - size_t parsed_size { 0ul }; - size_t warnlisted_size { 0ul }; - size_t blacklisted_size { 0ul }; - - ////////////////////////////// - //// BLACKLIST / WARNLIST //// - - // { log_field_id : BWlist } - const bw_lists_t blacklists; - const bw_lists_t warnlists; - - //////////////////////// - //// LOG FIELDS IDs //// - - // Map to convert log fields to field IDs - const std::unordered_map field2id{ - // date-time - {"date_time_year", 1}, - {"date_time_month", 2}, - {"date_time_day", 3}, - {"date_time_hour", 4}, - {"date_time_minute", 5}, - {"date_time_second", 6}, - {"date_time_ncsa", 0}, - {"date_time_iso", 0}, - {"date_time_mcs", 0}, - {"date_time_gmt", 0}, - {"date_time_utc_d", 0}, - {"date_time_utc_t", 0}, - {"date_time_epoch_s", 0}, - {"date_time_epoch_s.ms", 0}, - {"date_time_epoch_ms", 0}, - {"date_time_epoch_us", 0}, - {"date_time_YYYYMMDD", 0}, - {"date_time_MMDDYY", 0}, - {"date_time_MDYYYY", 0}, - {"date_time_year_short", 0}, - {"date_time_month_str", 0}, - {"date_time_clock_12", 0}, - {"date_time_clock_24", 0}, - {"date_time_clock_short", 0}, - // request - {"request_protocol", 10}, - {"request_method", 11}, - {"request_uri", 12}, - {"request_query", 13}, - {"response_code", 14}, - {"request_full", 0}, - // performance - {"time_taken_ms", 15}, - {"time_taken_us", 0}, - {"time_taken_s.ms", 0}, - {"time_taken_s", 0}, - {"bytes_sent", 16}, - {"bytes_received", 17}, - // referer - {"referer", 18}, - // client data - {"client", 20}, - {"user_agent", 21}, - {"cookie", 22} - }; - -}; - - -#endif // LOGDOCTOR__CRAPLOG__WORKERS__PARSER_INTERFACE_H diff --git a/logdoctor/modules/crapup/crapup.cpp b/logdoctor/modules/crapup/crapup.cpp index d2232223..dc477d84 100644 --- a/logdoctor/modules/crapup/crapup.cpp +++ b/logdoctor/modules/crapup/crapup.cpp @@ -38,9 +38,7 @@ Crapup::Crapup( QWidget* parent ) { this->ui->setupUi(this); - QString stylesheet; - StyleSec::Crapup::getStyleSheet( stylesheet ); - this->setStyleSheet( stylesheet ); + this->setStyleSheet( StyleSec::Crapup::getStyleSheet() ); // fonts const QString ff{ QFontDatabase::applicationFontFamilies( diff --git a/logdoctor/modules/crapup/crapup.h b/logdoctor/modules/crapup/crapup.h index a95e9a1d..ee2f876f 100644 --- a/logdoctor/modules/crapup/crapup.h +++ b/logdoctor/modules/crapup/crapup.h @@ -18,18 +18,15 @@ namespace Ui { /*! */ -class Crapup : public QWidget +class Crapup final : public QWidget { Q_OBJECT public: - //! Class constructor - /*! - \param parent The parent Widget - */ explicit Crapup( QWidget* parent=nullptr ); ~Crapup(); + Q_DISABLE_COPY_MOVE(Crapup) //! Performs a version check diff --git a/logdoctor/modules/crapup/modules/stylesheets.cpp b/logdoctor/modules/crapup/modules/stylesheets.cpp index ff47ca3a..ff3a2a75 100644 --- a/logdoctor/modules/crapup/modules/stylesheets.cpp +++ b/logdoctor/modules/crapup/modules/stylesheets.cpp @@ -6,6 +6,7 @@ #include "modules/exceptions.h" #include +#include #include @@ -21,7 +22,7 @@ enum StyleId : uint32_t { using StyleMap = std::unordered_map; -const StyleMap makeStyleMap() +StyleMap makeStyleMap() { switch ( GlobalConfigs::window_theme ) { case WindowTheme::Light: @@ -33,7 +34,6 @@ const StyleMap makeStyleMap() {WINDOW_SECONDARY, "rgb( 230, 230, 230 )"} }; - break; case WindowTheme::Dark: return { {TEXT, @@ -43,34 +43,33 @@ const StyleMap makeStyleMap() {WINDOW_SECONDARY, "rgb( 27, 30, 33 )"} }; - break; default: - throw GenericException( "Unexpected WindowTheme: "+std::to_string(static_cast(GlobalConfigs::window_theme)), true ); - break; + throw DoNotCatchException( "Unexpected WindowTheme", std::to_string(static_cast(GlobalConfigs::window_theme)) ); } } -} // namespacce (private) +} //namespace (private) namespace StyleSec::Crapup { -void getStyleSheet( QString& stylesheet ) +QString getStyleSheet() { - if ( GlobalConfigs::window_theme != WindowTheme::Native ) { - const StyleMap style{ makeStyleMap() }; - stylesheet = - "* {" - " color: "+style.at(TEXT)+";" - "}" - "QWidget#Crapup {" - " background-color: "+style.at(WINDOW_SECONDARY)+";" - "}" - "QFrame {" - " background-color: "+style.at(WINDOW_PRIMARY)+";" - "}"; + if ( GlobalConfigs::window_theme == WindowTheme::Native ) { + return ""; } + const StyleMap style{ makeStyleMap() }; + return + "* {" + " color: "% style.at(TEXT) %";" + "}" + "QWidget#Crapup {" + " background-color: "% style.at(WINDOW_SECONDARY) %";" + "}" + "QFrame {" + " background-color: "% style.at(WINDOW_PRIMARY) %";" + "}"; } } // namespacce StyleSec::Crapup diff --git a/logdoctor/modules/crapup/modules/stylesheets.h b/logdoctor/modules/crapup/modules/stylesheets.h index 6b17fc49..9f7f6f69 100644 --- a/logdoctor/modules/crapup/modules/stylesheets.h +++ b/logdoctor/modules/crapup/modules/stylesheets.h @@ -8,7 +8,11 @@ class QString; namespace StyleSec::Crapup { -void getStyleSheet( QString& stylesheet ); +//! Returns the proper style sheet +/*! + \throw DoNotCatchException +*/ +QString getStyleSheet(); } // namespacce StyleSec::Crapup diff --git a/logdoctor/modules/crapview/crapview.cpp b/logdoctor/modules/crapview/crapview.cpp index f7550eb2..c5579add 100644 --- a/logdoctor/modules/crapview/crapview.cpp +++ b/logdoctor/modules/crapview/crapview.cpp @@ -1,84 +1,82 @@ #include "crapview.h" +#include "globals/db_names.h" + +#include "utilities/arrays.h" #include "utilities/printables.h" #include "utilities/strings.h" +#include "utilities/vectors.h" + +#include "modules/dialogs.h" +#include "modules/exceptions.h" + +#include "modules/warnlists/modules/warnlist.h" + +#include "modules/crapview/modules/lib.h" #include #include -int Crapview::getDialogsLevel() const +DialogsLevel Crapview::getDialogsLevel() const noexcept { return this->dialogs_level; } -void Crapview::setDialogsLevel( const int new_level ) +void Crapview::setDialogsLevel( const DialogsLevel new_level ) noexcept { this->dialogs_level = new_level; } -void Crapview::setDbPath( const std::string& path ) +void Crapview::setDbPath( const std::string& path ) noexcept { - this->dbQuery.setDbPath( path + "/collection.db" ); + this->dbQuery.setDbPath( path + "/" + DatabasesNames::data ); } -QString Crapview::getLogFieldString ( const size_t field_id ) const +int Crapview::getMonthNumber( const QString& month_str ) const noexcept { - return TR::tr( this->dbQuery.FIELDS.at( field_id ).c_str() ); -} - -int Crapview::getLogFieldID ( const QString& field_str ) const -{ - int f{ 0 }; - for ( const auto& [id,str] : this->dbQuery.FIELDS ) { - if ( TR::tr(str.c_str()) == field_str ) { - f = id; - break; - } + const auto pos{ std::find_if( this->dbQuery.MONTHS.cbegin(), this->dbQuery.MONTHS.cend(), + [&month_str](const auto& it){ return TR::tr(it.second.c_str()) == month_str; } ) }; + if ( pos != this->dbQuery.MONTHS.cend() ) { + return pos->first; } - return f; -} - - -int Crapview::getMonthNumber( const QString& month_str ) const -{ - int m{ 0 }; - for ( const auto& [num,str] : this->dbQuery.MONTHS ) { - if ( TR::tr(str.c_str()) == month_str ) { - m = num; - break; - } - } - return m; + return 0; } void Crapview::refreshDates() { - std::optional result; - this->dbQuery.refreshDates( result ); + std::optional result; + + try { + + this->dbQuery.refreshDates( result ); + + } catch ( const VoidException& ) { + // dialog already shown + return; + } + if ( result ) { - this->dates.clear(); // std::unordered_map>>> // { web_server_id : { year : { month : [ days ] } } } - this->dates = std::move( result.value() ); + this->dates = std::move( *result ); } } -void Crapview::clearDates() +void Crapview::clearDates() noexcept { this->dates.clear(); } -QStringList Crapview::getYears( const QString& web_server ) const +QStringList Crapview::getYears( const QString& web_server ) const noexcept { QStringList years; if ( ! this->dates.empty() ) { const int ws{ this->WebServer_s2i.value( web_server ) }; - if ( ! this->dates.at( ws ).empty() ) { - const auto& y{ this->dates.at( ws ) }; + if ( const auto& y{ this->dates.at( ws ) }; !y.empty() ) { std::transform( y.cbegin(), y.cend(), std::back_inserter( years ), [](const auto& p){ return QString::number( p.first ); } ); @@ -86,15 +84,14 @@ QStringList Crapview::getYears( const QString& web_server ) const } return years; } -QStringList Crapview::getMonths( const QString& web_server, const QString& year ) const +QStringList Crapview::getMonths( const QString& web_server, const QString& year ) const noexcept { QStringList months; if ( ! this->dates.empty() ) { const int ws{ this->WebServer_s2i.value( web_server ) }; - if ( ! this->dates.at( ws ).empty() ) { - const int y{ year.toInt() }; - if ( ! this->dates.at( ws ).at( y ).empty() ) { - const auto& m{ this->dates.at( ws ).at( y ) }; + if ( const auto& y{ this->dates.at( ws ) }; !y.empty() ) { + const int year_{ year.toInt() }; + if ( const auto& m{ this->dates.at( ws ).at( year_ ) }; !m.empty() ) { const auto& m_tr{ this->dbQuery.MONTHS }; std::transform( m.cbegin(), m.cend(), std::back_inserter( months ), @@ -104,17 +101,16 @@ QStringList Crapview::getMonths( const QString& web_server, const QString& year } return months; } -QStringList Crapview::getDays( const QString& web_server, const QString& year, const QString& month ) const +QStringList Crapview::getDays( const QString& web_server, const QString& year, const QString& month ) const noexcept { QStringList days; if ( ! this->dates.empty() ) { const int ws{ this->WebServer_s2i.value( web_server ) }; - if ( ! this->dates.at( ws ).empty() ) { - const int y{ year.toInt() }; - if ( ! this->dates.at( ws ).at( y ).empty() ) { - const int m{ this->getMonthNumber( month ) }; - if ( ! this->dates.at( ws ).at( y ).at( m ).empty() ) { - const auto& d{ this->dates.at( ws ).at( y ).at( m ) }; + if ( const auto& y{ this->dates.at( ws ) }; !y.empty() ) { + const int year_{ year.toInt() }; + if ( const auto& m{ this->dates.at( ws ).at( year_ ) }; !m.empty() ) { + const int month_{ this->getMonthNumber( month ) }; + if ( const auto& d{ m.at( month_ ) }; !d.empty() ) { std::transform( d.cbegin(), d.cend(), std::back_inserter( days ), [](const int day){ return QString::number( day ); } ); @@ -124,19 +120,44 @@ QStringList Crapview::getDays( const QString& web_server, const QString& year, c } return days; } -QStringList Crapview::getHours() const +QStringList Crapview::getHours() const noexcept { - return QStringList{"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"}; + static const QStringList hours{"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"}; + return hours; } -QStringList Crapview::getFields( const std::string& tab ) const +QStringList Crapview::getWarnHeaderColumns() const noexcept { - QStringList list; - const auto& f{ this->fields.at( tab ) }; - std::transform( f.cbegin(), f.cend(), - std::back_inserter( list ), - [](const auto& field){ return TR::tr( field.c_str() ); } ); - return list; + return { + TR::tr( FIELDS__WARNING.c_str() ), + TR::tr( WORDS__DATE.c_str() ), + TR::tr( WORDS__TIME.c_str() ), + TR::tr( FIELDS__PROTOCOL.c_str() ), + TR::tr( FIELDS__METHOD.c_str() ), + TR::tr( FIELDS__URI.c_str() ), + TR::tr( FIELDS__QUERY.c_str() ), + TR::tr( FIELDS__RESPONSE_CODE.c_str() ), + TR::tr( FIELDS__USER_AGENT.c_str() ), + TR::tr( FIELDS__CLIENT.c_str() ), + TR::tr( FIELDS__COOKIE.c_str() ), + TR::tr( FIELDS__REFERRER.c_str() ), + TR::tr( FIELDS__BYTES_RECEIVED.c_str() ), + TR::tr( FIELDS__BYTES_SENT.c_str() ), + TR::tr( FIELDS__TIME_TAKEN.c_str() ) + }; +} + +QStringList Crapview::getSpeedHeaderColumns() const noexcept +{ + return { + TR::tr( FIELDS__TIME_TAKEN.c_str() ), + TR::tr( FIELDS__URI.c_str() ), + TR::tr( FIELDS__QUERY.c_str() ), + TR::tr( FIELDS__METHOD.c_str() ), + TR::tr( FIELDS__PROTOCOL.c_str() ), + TR::tr( FIELDS__RESPONSE_CODE.c_str() ), + TR::tr( WORDS__TIME.c_str() ) + }; } @@ -150,799 +171,860 @@ void Crapview::sliceClicked( QPieSlice* slice ) } -void Crapview::updateWarn( QTableWidget* table , const QString& web_server ) const -{ - std::vector> updates; // { (rowid, warn) } - for ( int i{0}; irowCount(); i++ ) { - QTableWidgetItem* item = table->item( i, 0 ); - if ( item->checkState() == Qt::CheckState::Checked && item->text() == TR::tr( BOOLS__FALSE.c_str() ) ) { - // remove warning - updates.push_back( std::make_tuple( table->item( i, table->columnCount()-1 )->text().toInt(), 1 ) ); - } else if (item->checkState() == Qt::CheckState::Unchecked && item->text() == TR::tr( BOOLS__TRUE.c_str() ) ) { - // add warning - updates.push_back( std::make_tuple( table->item( i, table->columnCount()-1 )->text().toInt(), 0 ) ); - } - } - this->dbQuery.updateWarnings( web_server, updates ); -} - -void Crapview::drawWarn( QTableWidget* table, QChartView* chart, const QChart::ChartTheme& theme, const QString& web_server, const QString& year, const QString& month, const QString& day, const QString& hour ) const +void Crapview::drawWarn( QTableWidget* table, QChartView* chart, const QChart::ChartTheme& theme, const QString web_server, const QString year, const QString month, const QString day, const QString hour, const Warnlist& warnlist ) const { std::optional result; - this->dbQuery.getWarnCounts( - result, - web_server, - year, month, day, hour ); - if ( result ) { - // std::vector>>> - // day -> [ hours[ 10th_minutes[ lines[ log_data ] ] ] ] - // hour -> [ 10th_minutes[ minute[ lines[ log_data ] ] ] ] - auto& items{ result.value() }; - // bars - std::vector> sets; + try { - // build the bars and the table upon data - QString date; - QColor warn_col{ 255, 140, 0, 255 }; - int norm_count, warn_count, sum_count, max_count=0, n_rows=0; - if ( hour.isEmpty() ) { - // entire day - for ( int i{0}; i<6; i++ ) { - sets.push_back( std::vector() ); - sets.back().push_back( new QBarSet("") ); - sets.back().push_back( new QBarSet("") ); - } - for ( size_t h{0}; h<24ul; h++ ) { - for ( size_t m{0}; m<6ul; m++ ) { - const auto& data{ items.at( h ).at( m ) }; - norm_count = warn_count = 0; - for ( const std::vector& line : data ) { - table->insertRow( n_rows ); - table->setItem( n_rows, 0, new QTableWidgetItem( PrintSec::printableBool( line.at( 0 ).toInt() ))); - if ( line.at( 0ul ).toInt() != 0 ) { - table->item( n_rows, 0 )->setForeground( warn_col ); - table->item( n_rows, 0 )->setCheckState( Qt::CheckState::Checked ); - } else { - table->item( n_rows, 0 )->setCheckState( Qt::CheckState::Unchecked ); - } - table->setItem( n_rows, 1, new QTableWidgetItem( PrintSec::printableDate( line.at( 1 ).toInt(), line.at( 2 ).toInt(), line.at( 3 ).toInt() ))); - table->setItem( n_rows, 2, new QTableWidgetItem( PrintSec::printableTime( line.at( 4 ).toInt(), line.at( 5 ).toInt(), line.at( 6 ).toInt() ))); - int col{ 3 }; - const size_t max{ line.size() }; - for ( size_t i{7ul}; i= 12) && !line.at(i).isEmpty() ) { - itm = new QTableWidgetItem(); - itm->setData( Qt::DisplayRole, line.at( i ).toInt() ); - } else { - itm = new QTableWidgetItem( line.at( i ) ); - } - table->setItem( n_rows, col, itm ); - col ++; - } - if ( line.at( 0ul ) == "0" ) { - norm_count ++; - } else { - warn_count ++; - } - n_rows ++; - } - sets.at( m ).at( 0ul )->append( norm_count ); - sets.at( m ).at( 1ul )->append( warn_count ); - sum_count = norm_count + warn_count; - if ( sum_count > max_count ) { - max_count = sum_count; - } - } - } - date = PrintSec::printableDate( year, this->getMonthNumber( month ), day ); - } else { - // 1 hour - for ( int i{0}; i<10; i++ ) { - sets.push_back( std::vector() ); - sets.back().push_back( new QBarSet("") ); - sets.back().push_back( new QBarSet("") ); - } - for ( size_t g{0ul}; g<6ul; g++ ) { - for ( size_t m{0ul}; m<10ul; m++ ) { - const auto& data{ items.at( g ).at( m ) }; - norm_count = warn_count = 0; - for ( const std::vector& line : data ) { - n_rows = table->rowCount(); - table->insertRow( n_rows ); - table->setItem( n_rows, 0, new QTableWidgetItem( PrintSec::printableBool( line.at( 0 ).toInt() ))); - if ( line.at( 0ul ).toInt() != 0 ) { - table->item( n_rows, 0 )->setForeground( warn_col ); - table->item( n_rows, 0 )->setCheckState( Qt::CheckState::Checked ); - } else { - table->item( n_rows, 0 )->setCheckState( Qt::CheckState::Unchecked ); - } - table->setItem( n_rows, 1, new QTableWidgetItem( PrintSec::printableDate( line.at( 1 ).toInt(), line.at( 2 ).toInt(), line.at( 3 ).toInt() ))); - table->setItem( n_rows, 2, new QTableWidgetItem( PrintSec::printableTime( line.at( 4 ).toInt(), line.at( 5 ).toInt(), line.at( 6 ).toInt() ))); - for ( size_t i{7ul}; isetItem( n_rows, i-4, new QTableWidgetItem( line.at( i ) )); - } - if ( line.at( 0ul ) == "0" ) { - norm_count ++; - } else { - warn_count ++; - } - } - sets.at( m ).at( 0ul )->append( norm_count ); - sets.at( m ).at( 1ul )->append( warn_count ); - sum_count = norm_count + warn_count; - if ( sum_count > max_count ) { - max_count = sum_count; - } - } - } - date = PrintSec::printableDate( year, this->getMonthNumber( month ), day ) + ", h " + hour; - } - table->verticalHeader()->setVisible( false ); + this->dbQuery.getWarningsData( result, web_server, year, month, day, hour ); - // apply the colors and append to the series - QColor cols[]{ QColor(127,127,127), QColor(237,80,61) }; - //QColor cols[] = {QColor(18,175,194), QColor(237,80,61)}; - std::vector b_series; - const size_t max{ sets.size() }; - for ( size_t i{0}; isetColor( cols[ w ] ); - b_series.at( i )->append( b ); - } - } - for ( auto *s : b_series ) { - s->setBarWidth( 1 ); - } + } catch ( const DatabaseException& e ) { + DialogSec::errProcessingStatsData( e.what() ); + return; - // set-up the bars chart - QChart* b_chart{ new QChart() }; - // apply the theme - b_chart->setTheme( theme ); - // append the bars - foreach ( auto& bars, b_series ) { - b_chart->addSeries( bars ); - } - b_chart->setTitle( TR::tr( "Log Lines Marked as Warning" ) ); - b_chart->legend()->setVisible( false ); - /*b_chart->legend()->setAlignment( Qt::AlignBottom ); - b_chart->setAnimationOptions( QChart::SeriesAnimations );*/ - - // craft the X-axis labels - QStringList categories; - if ( hour.isEmpty() ) { - categories << "00" << "01" << "02" << "03" << "04" << "05" << "06" << "07" << "08" << "09" << "10" << "11" - << "12" << "13" << "14" << "15" << "16" << "17" << "18" << "19" << "20" << "21" << "22" << "23"; - } else { - categories << "00" << "10" << "20" << "30" << "40" << "50"; - } - - // set-up the time-of-day axis (X) - QBarCategoryAxis* axisX{ new QBarCategoryAxis() }; - axisX->append( categories ); - axisX->setTitleText( date ); - b_chart->addAxis( axisX, Qt::AlignBottom ); - for ( auto* s : b_series ) { - s->attachAxis( axisX ); - } - - // set-up the count values axis (Y) - QValueAxis* axisY{ new QValueAxis() }; - axisY->setLabelFormat( "%d" ); - axisY->setTickCount( ( max_count < 9 ) ? max_count+1 : 9 ); - axisY->setRange( 0, max_count ); - b_chart->addAxis( axisY, Qt::AlignLeft ); - for ( auto* s : b_series ) { - s->attachAxis( axisY ); - } - - // apply the chart to the view - chart->setChart( b_chart ); - chart->setRenderHint( QPainter::Antialiasing ); + } catch ( const VoidException& ) { + // dialog already shown + return; } + + if ( ! result ) { + DialogSec::msgNoDataForStats(); + return; + } + + // std::vector>>> + // day -> [ hours[ 10th_minutes[ lines[ log_data ] ] ] ] + // hour -> [ 10th_minutes[ minute[ lines[ log_data ] ] ] ] + const auto items{ std::move(*result) }; + + const auto check_warnings{ + [&warnlist](const std::array& line)->std::tuple> + { + bool is_warning{ false }; + std::vector warning_cols; + warning_cols.reserve(4ul); + if ( warnlist.method.used ) { + if ( VecOps::contains( warnlist.method.list, line.at( 7ul ).toStdString() ) ) { + is_warning |= true; + warning_cols.emplace_back( 4 ); + } + } + if ( warnlist.uri.used ) { + const auto target{ line.at( 8ul ).toStdString() }; + const auto& list{ warnlist.uri.list }; + if ( std::any_of( list.cbegin(), list.cend(), [&target](std::string_view flag){ return StringOps::startsWith( target, flag ); } ) ) { + // match found! skip this line + is_warning |= true; + warning_cols.emplace_back( 5 ); + } + } + if ( warnlist.client.used ) { + const auto target{ line.at( 12ul ).toStdString() }; + const auto& list{ warnlist.client.list }; + if ( std::any_of( list.cbegin(), list.cend(), [&target](std::string_view flag){ return StringOps::startsWith( target, flag ); } ) ) { + // match found! skip this line + is_warning |= true; + warning_cols.emplace_back( 9 ); + } + } + if ( warnlist.user_agent.used ) { + const auto target{ line.at( 11ul ).toStdString() }; + const auto& list{ warnlist.user_agent.list }; + if ( std::any_of( list.cbegin(), list.cend(), [&target](std::string_view flag){ return StringOps::startsWith( target, flag ); } ) ) { + // match found! skip this line + is_warning |= true; + warning_cols.emplace_back( 8 ); + } + } + return std::make_tuple( is_warning, warning_cols ); + } + }; + + const QColor& warn_color{ this->warning_color }; + + const auto append_to_table{ + [&table,&warn_color](const std::array& line, const bool is_warning, const std::vector& warning_cols ) + { + const int n_rows{ table->rowCount() }; + table->insertRow( n_rows ); + table->setItem( n_rows, 0, new QTableWidgetItem( PrintSec::printableBool( is_warning ))); + table->setItem( n_rows, 1, new QTableWidgetItem( PrintSec::printableDate( line.at( 0 ).toInt(), line.at( 1 ).toInt(), line.at( 2 ).toInt() ))); + table->setItem( n_rows, 2, new QTableWidgetItem( PrintSec::printableTime( line.at( 3 ).toInt(), line.at( 4 ).toInt(), line.at( 5 ).toInt() ))); + int col{ 3 }; + for ( size_t i{6ul}; i<18ul; ++i ) { + QTableWidgetItem* itm; + if ( (col == 7 || col >= 12) && !line.at(i).isEmpty() ) { + itm = new QTableWidgetItem(); + itm->setData( Qt::DisplayRole, line.at( i ).toInt() ); + } else { + itm = new QTableWidgetItem( line.at( i ) ); + } + table->setItem( n_rows, col, itm ); + ++ col; + } + if ( is_warning ) { + table->item( n_rows, 0 )->setForeground( warn_color ); + for ( const int col : warning_cols ) { + table->item( n_rows, col )->setForeground( warn_color ); + } + } + } + }; + + // bars + std::vector> sets; + + // build the bars and the table upon data + QString date; + int norm_count, warn_count, sum_count, max_count=0; + if ( hour.isEmpty() ) { + // entire day + for ( int i{0}; i<6; ++i ) { + sets.push_back( std::vector() ); + sets.back().push_back( new QBarSet("") ); + sets.back().push_back( new QBarSet("") ); + } + for ( size_t h{0}; h<24ul; ++h ) { + for ( size_t m{0}; m<6ul; ++m ) { + const auto& data{ items.at( h ).at( m ) }; + norm_count = warn_count = 0; + for ( const std::array& line : data ) { + const auto [is_warning, warning_cols]{ check_warnings( line ) }; + append_to_table( line, is_warning, warning_cols ); + is_warning ? ++warn_count : ++norm_count; + } + sets.at( m ).at( 0ul )->append( norm_count ); + sets.at( m ).at( 1ul )->append( warn_count ); + sum_count = norm_count + warn_count; + if ( sum_count > max_count ) { + max_count = sum_count; + } + } + } + date = PrintSec::printableDate( year, this->getMonthNumber( month ), day ); + } else { + // 1 hour + for ( int i{0}; i<10; ++i ) { + sets.push_back( std::vector() ); + sets.back().push_back( new QBarSet("") ); + sets.back().push_back( new QBarSet("") ); + } + for ( size_t g{0ul}; g<6ul; ++g ) { + for ( size_t m{0ul}; m<10ul; ++m ) { + const auto& data{ items.at( g ).at( m ) }; + norm_count = warn_count = 0; + for ( const std::array& line : data ) { + const auto [is_warning, warning_cols]{ check_warnings( line ) }; + append_to_table( line, is_warning, warning_cols ); + is_warning ? ++warn_count : ++norm_count; + } + sets.at( m ).at( 0ul )->append( norm_count ); + sets.at( m ).at( 1ul )->append( warn_count ); + sum_count = norm_count + warn_count; + if ( sum_count > max_count ) { + max_count = sum_count; + } + } + } + date = PrintSec::printableDate( year, this->getMonthNumber( month ), day ) + ", h " + hour; + } + table->verticalHeader()->setVisible( false ); + + // apply the colors and append to the series + QColor cols[]{ QColor(127,127,127), QColor(237,80,61) }; + std::vector b_series; + const size_t max{ sets.size() }; + for ( size_t i{0}; isetColor( cols[ w ] ); + b_series.at( i )->append( b ); + } + } + for ( auto *s : b_series ) { + s->setBarWidth( 1 ); + } + + // set-up the bars chart + QChart* b_chart{ new QChart() }; + // apply the theme + b_chart->setTheme( theme ); + // append the bars + foreach ( auto& bars, b_series ) { + b_chart->addSeries( bars ); + } + b_chart->setTitle( TR::tr( "Log Lines Marked as Warning" ) ); + b_chart->legend()->setVisible( false ); + /*b_chart->legend()->setAlignment( Qt::AlignBottom ); + b_chart->setAnimationOptions( QChart::SeriesAnimations );*/ + + // craft the X-axis labels + QStringList categories; + if ( hour.isEmpty() ) { + categories = this->getHours(); + } else { + categories << "00" << "10" << "20" << "30" << "40" << "50"; + } + + // set-up the time-of-day axis (X) + QBarCategoryAxis* axisX{ new QBarCategoryAxis() }; + axisX->append( categories ); + axisX->setTitleText( date ); + b_chart->addAxis( axisX, Qt::AlignBottom ); + for ( auto* s : b_series ) { + s->attachAxis( axisX ); + } + + // set-up the count values axis (Y) + QValueAxis* axisY{ new QValueAxis() }; + axisY->setLabelFormat( "%d" ); + axisY->setTickCount( ( max_count < 9 ) ? max_count+1 : 9 ); + axisY->setRange( 0, max_count ); + b_chart->addAxis( axisY, Qt::AlignLeft ); + for ( auto* s : b_series ) { + s->attachAxis( axisY ); + } + + // apply the chart to the view + chart->setChart( b_chart ); + chart->setRenderHint( QPainter::Antialiasing ); } -void Crapview::drawSpeed( QTableWidget* table, QChartView* chart, const QChart::ChartTheme& theme, const QString& web_server, const QString& year, const QString& month, const QString& day, const QString& protocol, const QString& method, const QString& uri, const QString& query, const QString& response ) const +void Crapview::drawSpeed( QTableWidget* table, QChartView* chart, const QChart::ChartTheme& theme, const QString web_server, const QString year, const QString month, const QString day, const QString protocol, const QString method, const QString uri, const QString query, const QString response ) const { std::optional result; - this->dbQuery.getSpeedData( - result, - web_server, - year, month, day, - protocol, method, uri, query, response ); - if ( result ) { - // std::vector>> - // [ ( epoch_msec, [ log_data ] ) ] - auto& items{ result.value() }; - // draw the speed chart - QLineSeries* line{ new QLineSeries() }; + try { - // build the line upon data - size_t i{ 0 }; - const size_t max_i{ items.size() }; - int value{0}, aux_value, max_value{0}, n_rows{0}; - long long time /* xD */, aux_time, count{1}; - bool first_count{ true }; - time = std::get<0>(items.at(0ul)); - QDateTime dt; - std::vector data; - for ( const auto& item : items ) { - i++; - // append a value to the chart - aux_time = std::get<0>(item); - data = std::get<1>(item); - aux_value = data.at( 0ul ).toInt(); - // append only if the second is different, else sum - if ( aux_time > time ) { - value = value/count; + this->dbQuery.getSpeedData( result, web_server, year, month, day, protocol, method, uri, query, response ); + + } catch ( const DatabaseException& e ) { + DialogSec::errProcessingStatsData( e.what() ); + return; + + } catch ( const VoidException& ) { + // dialog already shown + return; + } + + if ( ! result ) { + DialogSec::msgNoDataForStats(); + return; + } + + // std::vector>> + // [ ( epoch_msec, [ log_data ] ) ] + const auto items{ std::move(*result) }; + + // draw the speed chart + QLineSeries* line{ new QLineSeries() }; + + // build the line upon data + size_t i{ 0 }; + const size_t max_i{ items.size() }; + int value{0}, count{1}, aux_value, max_value{0}, n_rows{0}; + bool first_count{ true }; + qint64 time{ std::get<0>(items.at(0ul)) }; + QDateTime dt; + for ( const auto& item : items ) { + ++i; + // append a value to the chart + const qint64 aux_time{ std::get<0>(item) }; + const std::array& data{ std::get<1>(item) }; + aux_value = data.at( 0ul ).toInt(); + // append only if the second is different, else sum + if ( aux_time > time ) { + value = value/count; + line->append( time, value ); + if ( value > max_value ) { + max_value = value; + } + time = aux_time; + value = aux_value; + count = 1; + first_count |= true; + if ( i == max_i ) { + // final line->append( time, value ); if ( value > max_value ) { max_value = value; } - time = aux_time; - value = aux_value; - count = 1; - first_count |= true; - if ( i == max_i ) { - // final - line->append( time, value ); - if ( value > max_value ) { - max_value = value; - } - } + } + } else { + if ( first_count ) { + first_count &= false; } else { - if ( first_count ) { - first_count &= false; - } else { - count ++; - } - value += aux_value; - if ( i == max_i ) { - // final - value = value/count; - line->append( aux_time, value ); - if ( value > max_value ) { - max_value = value; - } + ++ count; + } + value += aux_value; + if ( i == max_i ) { + // final + value = value/count; + line->append( aux_time, value ); + if ( value > max_value ) { + max_value = value; } } - // fill the teble with data - if ( !data.at(0ul).isEmpty() || !data.at(1ul).isEmpty() || !data.at(2ul).isEmpty() || !data.at(3ul).isEmpty() || !data.at(4ul).isEmpty() || !data.at(5ul).isEmpty() ) { - table->insertRow( n_rows ); - auto* tt{ new QTableWidgetItem() }; - tt->setData( Qt::DisplayRole, aux_value ); - table->setItem( n_rows, 0, tt ); - table->setItem( n_rows, 1, new QTableWidgetItem( data.at(1ul) )); - table->setItem( n_rows, 2, new QTableWidgetItem( data.at(2ul) )); - table->setItem( n_rows, 3, new QTableWidgetItem( data.at(3ul) )); - table->setItem( n_rows, 4, new QTableWidgetItem( data.at(4ul) )); - table->setItem( n_rows, 5, new QTableWidgetItem( data.at(5ul) )); - dt = QDateTime::fromMSecsSinceEpoch( aux_time ); - table->setItem( n_rows, 6, new QTableWidgetItem( dt.time().toString("hh:mm:ss") )); - n_rows ++; - } } - table->verticalHeader()->setVisible( false ); - - // fictitious line - QLineSeries* line_{ new QLineSeries() }; - - // color the area - QColor col1{ Qt::GlobalColor::red }, - col2{ Qt::GlobalColor::green }, - col3{ Qt::GlobalColor::blue }; - //area->setColor( col ); - QLinearGradient gradient{ QPointF(0, 0), QPointF(0, 1) }; - gradient.setColorAt(0.3, col1.lighter( 90 ) ); - gradient.setColorAt(0.7, col2.lighter( 90 ) ); - gradient.setColorAt(1.0, col3.lighter( 90 ) ); - gradient.setCoordinateMode(QGradient::ObjectMode); - - QPen pen{ line->pen() }; - pen.setBrush( gradient ); - pen.setWidth( 1 ); - line->setPen(pen); - - pen = line_->pen(); - pen.setBrush( gradient ); - pen.setWidth( 1 ); - line_->setPen(pen); - - // build the chart - QChart* l_chart{ new QChart() }; - l_chart->setTheme( theme ); - l_chart->addSeries( line ); - l_chart->addSeries( line_ ); - l_chart->setTitle( TR::tr( "Time Taken to Serve Requests" ) ); - /*l_chart->legend()->setAlignment( Qt::AlignBottom );*/ - l_chart->legend()->setVisible( false ); - - // set-up the date-time axis (X) - QDateTimeAxis* axisX{ new QDateTimeAxis() }; - axisX->setFormat( "hh:mm" ); - axisX->setTickCount( 25 ); - axisX->setTitleText( PrintSec::printableDate( year, this->getMonthNumber(month), day ) ); - l_chart->addAxis( axisX, Qt::AlignBottom ); - line->attachAxis( axisX ); - - // set-up the count values axis (Y) - QValueAxis* axisY{ new QValueAxis() }; - axisY->setLabelFormat( "%d" ); - axisY->setTickCount( ( max_value < 9 ) ? max_value+1 : 9 ); - axisY->setMinorTickCount( 4 ); - if ( max_value == 1 ) { - max_value = 0; + // fill the teble with data + if ( !data.at(0ul).isEmpty() || !data.at(1ul).isEmpty() || !data.at(2ul).isEmpty() || !data.at(3ul).isEmpty() || !data.at(4ul).isEmpty() || !data.at(5ul).isEmpty() ) { + table->insertRow( n_rows ); + auto* tt{ new QTableWidgetItem() }; + tt->setData( Qt::DisplayRole, aux_value ); + table->setItem( n_rows, 0, tt ); + table->setItem( n_rows, 1, new QTableWidgetItem( data.at(1ul) )); + table->setItem( n_rows, 2, new QTableWidgetItem( data.at(2ul) )); + table->setItem( n_rows, 3, new QTableWidgetItem( data.at(3ul) )); + table->setItem( n_rows, 4, new QTableWidgetItem( data.at(4ul) )); + table->setItem( n_rows, 5, new QTableWidgetItem( data.at(5ul) )); + dt = QDateTime::fromMSecsSinceEpoch( aux_time ); + table->setItem( n_rows, 6, new QTableWidgetItem( dt.time().toString("hh:mm:ss") )); + ++ n_rows; } - axisY->setRange( 0, max_value ); - l_chart->addAxis( axisY, Qt::AlignLeft ); - line->attachAxis( axisY) ; - - // add the chart to the view - chart->setChart( l_chart ); - chart->setRenderHint(QPainter::Antialiasing); } + table->verticalHeader()->setVisible( false ); + + // fictitious line + QLineSeries* line_{ new QLineSeries() }; + + // color the area + QColor col1{ Qt::GlobalColor::red }, + col2{ Qt::GlobalColor::green }, + col3{ Qt::GlobalColor::blue }; + //area->setColor( col ); + QLinearGradient gradient{ QPointF(0, 0), QPointF(0, 1) }; + gradient.setColorAt(0.3, col1.lighter( 90 ) ); + gradient.setColorAt(0.7, col2.lighter( 90 ) ); + gradient.setColorAt(1.0, col3.lighter( 90 ) ); + gradient.setCoordinateMode(QGradient::ObjectMode); + + QPen pen{ line->pen() }; + pen.setBrush( gradient ); + pen.setWidth( 1 ); + line->setPen(pen); + + pen = line_->pen(); + pen.setBrush( gradient ); + pen.setWidth( 1 ); + line_->setPen(pen); + + // build the chart + QChart* l_chart{ new QChart() }; + l_chart->setTheme( theme ); + l_chart->addSeries( line ); + l_chart->addSeries( line_ ); + l_chart->setTitle( TR::tr( "Time Taken to Serve Requests" ) ); + /*l_chart->legend()->setAlignment( Qt::AlignBottom );*/ + l_chart->legend()->setVisible( false ); + + // set-up the date-time axis (X) + QDateTimeAxis* axisX{ new QDateTimeAxis() }; + axisX->setFormat( "hh:mm" ); + axisX->setTickCount( 25 ); + axisX->setTitleText( PrintSec::printableDate( year, this->getMonthNumber(month), day ) ); + l_chart->addAxis( axisX, Qt::AlignBottom ); + line->attachAxis( axisX ); + + // set-up the count values axis (Y) + QValueAxis* axisY{ new QValueAxis() }; + axisY->setLabelFormat( "%d" ); + axisY->setTickCount( ( max_value < 9 ) ? max_value+1 : 9 ); + axisY->setMinorTickCount( 4 ); + if ( max_value == 1 ) { + max_value = 0; + } + axisY->setRange( 0, max_value ); + l_chart->addAxis( axisY, Qt::AlignLeft ); + line->attachAxis( axisY) ; + + // add the chart to the view + chart->setChart( l_chart ); + chart->setRenderHint(QPainter::Antialiasing); } -void Crapview::drawCount( QTableWidget* table, QChartView* chart, const QChart::ChartTheme& theme, const QString& web_server, const QString& year, const QString& month, const QString& day, const QString& field ) const +void Crapview::drawCount( QTableWidget* table, QChartView* chart, const QChart::ChartTheme& theme, const QString web_server, const QString year, const QString month, const QString day, const QString field ) const { std::optional result; - this->dbQuery.getItemsCount( - result, - web_server, - year, month, day, - field ); - if ( result ) { - // std::vector> - // [ ( log_item, count ) ] - auto& items{ result.value() }; - // make the pie - QPieSeries* pie{ new QPieSeries() }; - // cut off exdceeding elements for the chart - const int max_items{ 15 }; - int count, oth_count{0}, n_rows{0}; - QString item; - // bring items in reverse order - stats_count_items_t::const_reverse_iterator iter = items.crbegin(); - while ( iter != items.crend() ) { - item = iter->second; - count = iter->first; - ++iter; - if ( n_rows >= max_items ) { - oth_count += count; - } else { - pie->append( item, count ); - } - table->insertRow( n_rows ); - auto* ic{ new QTableWidgetItem() }; - ic->setData( Qt::DisplayRole, count ); - table->setItem( n_rows, 0, ic ); - table->setItem( n_rows, 1, new QTableWidgetItem( item )); - n_rows ++; - } - table->verticalHeader()->setVisible( false ); + try { - if ( oth_count > 0 ) { - pie->append( TR::tr( "Others" ), oth_count ); - QPieSlice* slice = pie->slices().at( pie->count()-1 ); - slice->setBrush( Qt::gray ); - } - pie->setPieSize( 0.60 ); - pie->setLabelsVisible( false ); - connect( pie, &QPieSeries::clicked, this, &Crapview::sliceClicked ); + this->dbQuery.getItemsCount( result, web_server, year, month, day, field ); - QChart* p_chart{ new QChart() }; - p_chart->setTheme( theme ); - p_chart->addSeries( pie ); - p_chart->setTitle( field ); - p_chart->legend()->hide(); + } catch ( const DatabaseException& e ) { + DialogSec::errProcessingStatsData( e.what() ); + return; - chart->setChart( p_chart ); - chart->setRenderHint( QPainter::Antialiasing ); + } catch ( const VoidException& ) { + // dialog already shown + return; } + + if ( ! result ) { + DialogSec::msgNoDataForStats(); + return; + } + + // std::vector> + // [ ( log_item, count ) ] + const auto items{ std::move(*result) }; + + // make the pie + QPieSeries* pie{ new QPieSeries() }; + // cut off exdceeding elements for the chart + const int max_items{ 15 }; + int count, oth_count{0}, n_rows{0}; + QString item; + // bring items in reverse order + stats_count_items_t::const_reverse_iterator iter = items.crbegin(); + while ( iter != items.crend() ) { + item = iter->second; + count = iter->first; + ++iter; + if ( n_rows >= max_items ) { + oth_count += count; + } else { + pie->append( item, count ); + } + table->insertRow( n_rows ); + auto* ic{ new QTableWidgetItem() }; + ic->setData( Qt::DisplayRole, count ); + table->setItem( n_rows, 0, ic ); + table->setItem( n_rows, 1, new QTableWidgetItem( item )); + ++ n_rows; + } + table->verticalHeader()->setVisible( false ); + + if ( oth_count > 0 ) { + pie->append( TR::tr( "Others" ), oth_count ); + QPieSlice* slice = pie->slices().at( pie->count()-1 ); + slice->setBrush( Qt::gray ); + } + pie->setPieSize( 0.60 ); + pie->setLabelsVisible( false ); + connect( pie, &QPieSeries::clicked, this, &Crapview::sliceClicked ); + + QChart* p_chart{ new QChart() }; + p_chart->setTheme( theme ); + p_chart->addSeries( pie ); + p_chart->setTitle( field ); + p_chart->legend()->hide(); + + chart->setChart( p_chart ); + chart->setRenderHint( QPainter::Antialiasing ); } -void Crapview::drawDay( QChartView* chart, const QChart::ChartTheme& theme, const QString& web_server, const QString& from_year, const QString& from_month, const QString& from_day, const QString& to_year, const QString& to_month, const QString& to_day, const QString& field , const QString& filter ) const +void Crapview::drawDay( QChartView* chart, const QChart::ChartTheme& theme, const QString web_server, const QString from_year, const QString from_month, const QString from_day, const QString to_year, const QString to_month, const QString to_day, const QString field_str, const LogField field, const QString filter ) const { std::optional result; - this->dbQuery.getDaytimeCounts( - result, - web_server, - from_year, from_month, from_day, - to_year, to_month, to_day, - field, filter ); - if ( result ) { - // std::unordered_map> - // { hour : { 10th_minutes : count } } - auto& items{ result.value() }; - // draw the chart - QString date; - QColor col{ Qt::GlobalColor::darkGreen }; - QBarSet* b_10{ new QBarSet( "" ) }; - b_10->setColor( col ); - QBarSet* b_20{ new QBarSet( "" ) }; - b_20->setColor( col ); - QBarSet* b_30{ new QBarSet( "" ) }; - if ( to_year.isEmpty() || to_month.isEmpty() || to_day.isEmpty() ) { - date = PrintSec::printableDate( from_year, this->getMonthNumber(from_month), from_day ); - } else { - date = QString("%1 %2 %3 %4") - .arg( TR::tr( "from" ), - PrintSec::printableDate( from_year, this->getMonthNumber(from_month), from_day ), - TR::tr( "to" ), - PrintSec::printableDate( to_year, this->getMonthNumber(to_month), to_day ) ); - } - b_30->setColor( col ); - QBarSet* b_40{ new QBarSet( "" ) }; - b_40->setColor( col ); - QBarSet* b_50{ new QBarSet( "" ) }; - b_50->setColor( col ); - QBarSet* b_60{ new QBarSet( "" ) }; - b_60->setColor( col ); + try { - // build the bars upon data - int count, max_count{0}; - for ( size_t h{0ul}; h<24ul; h++ ) { - auto& data = items.at( h ); - count = data.at( 0ul ); - *b_10 << count; - if ( count > max_count ) { - max_count = count; - } - count = data.at( 10ul ); - *b_20 << count; - if ( count > max_count ) { - max_count = count; - } - count = data.at( 20ul ); - *b_30 << count; - if ( count > max_count ) { - max_count = count; - } - count = data.at( 30ul ); - *b_40 << count; - if ( count > max_count ) { - max_count = count; - } - count = data.at( 40ul ); - *b_50 << count; - if ( count > max_count ) { - max_count = count; - } - count = data.at( 50ul ); - *b_60 << count; - if ( count > max_count ) { - max_count = count; - } - } + this->dbQuery.getDaytimeCounts( result, web_server, from_year, from_month, from_day, to_year, to_month, to_day, field, filter ); - // apply the bars to the bars serie - QBarSeries* bars{ new QBarSeries() }; - bars->append( b_10 ); bars->append( b_20 ); bars->append( b_30 ); - bars->append( b_40 ); bars->append( b_50 ); bars->append( b_60 ); - bars->setBarWidth( 1 ); + } catch ( const DatabaseException& e ) { + DialogSec::errProcessingStatsData( e.what() ); + return; - // set-up the bars chart - QChart* b_chart{ new QChart() }; - b_chart->setTheme( theme ); - b_chart->addSeries( bars ); - b_chart->setTitle( QString("%1: %2").arg( TR::tr( "Time of Day Count" ), field ) ); - b_chart->legend()->setVisible( false ); - /*b_chart->legend()->setAlignment( Qt::AlignBottom ); - b_chart->setAnimationOptions( QChart::SeriesAnimations );*/ - - // craft the X-axis labels - QStringList categories; - categories << "00" << "01" << "02" << "03" << "04" << "05" << "06" << "07" << "08" << "09" << "10" << "11" - << "12" << "13" << "14" << "15" << "16" << "17" << "18" << "19" << "20" << "21" << "22" << "23"; - - // set-up the time-of-day axis (X) - QBarCategoryAxis* axisX{ new QBarCategoryAxis() }; - axisX->append( categories ); - axisX->setTitleText( date ); - b_chart->addAxis( axisX, Qt::AlignBottom ); - bars->attachAxis( axisX ); - - // set-up the count values axis (Y) - QValueAxis* axisY{ new QValueAxis() }; - axisY->setLabelFormat( "%d" ); - axisY->setTickCount( ( max_count < 9 ) ? max_count+1 : 9 ); - axisY->setRange( 0, max_count ); - b_chart->addAxis( axisY, Qt::AlignLeft ); - bars->attachAxis( axisY) ; - - // apply the chart to the view - chart->setChart( b_chart ); - chart->setRenderHint( QPainter::Antialiasing ); + } catch ( const VoidException& ) { + // dialog already shown + return; } + + if ( ! result ) { + DialogSec::msgNoDataForStats(); + return; + } + + // std::unordered_map> + // { hour : { 10th_minutes : count } } + const auto items{ std::move(*result) }; + + // draw the chart + QString date; + QColor col{ Qt::GlobalColor::darkGreen }; + QBarSet* b_10{ new QBarSet("") }; + b_10->setColor( col ); + QBarSet* b_20{ new QBarSet("") }; + b_20->setColor( col ); + QBarSet* b_30{ new QBarSet("") }; + if ( to_year.isEmpty() || to_month.isEmpty() || to_day.isEmpty() ) { + date = PrintSec::printableDate( from_year, this->getMonthNumber(from_month), from_day ); + } else { + date = QStringLiteral("%1 %2 %3 %4") + .arg( TR::tr( "from" ), + PrintSec::printableDate( from_year, this->getMonthNumber(from_month), from_day ), + TR::tr( "to" ), + PrintSec::printableDate( to_year, this->getMonthNumber(to_month), to_day ) ); + } + b_30->setColor( col ); + QBarSet* b_40{ new QBarSet("") }; + b_40->setColor( col ); + QBarSet* b_50{ new QBarSet("") }; + b_50->setColor( col ); + QBarSet* b_60{ new QBarSet("") }; + b_60->setColor( col ); + + // build the bars upon data + int count, max_count{0}; + for ( size_t h{0ul}; h<24ul; ++h ) { + auto& data = items.at( h ); + count = data.at( 0ul ); + *b_10 << count; + if ( count > max_count ) { + max_count = count; + } + count = data.at( 10ul ); + *b_20 << count; + if ( count > max_count ) { + max_count = count; + } + count = data.at( 20ul ); + *b_30 << count; + if ( count > max_count ) { + max_count = count; + } + count = data.at( 30ul ); + *b_40 << count; + if ( count > max_count ) { + max_count = count; + } + count = data.at( 40ul ); + *b_50 << count; + if ( count > max_count ) { + max_count = count; + } + count = data.at( 50ul ); + *b_60 << count; + if ( count > max_count ) { + max_count = count; + } + } + + // apply the bars to the bars serie + QBarSeries* bars{ new QBarSeries() }; + bars->append( b_10 ); bars->append( b_20 ); bars->append( b_30 ); + bars->append( b_40 ); bars->append( b_50 ); bars->append( b_60 ); + bars->setBarWidth( 1 ); + + // set-up the bars chart + QChart* b_chart{ new QChart() }; + b_chart->setTheme( theme ); + b_chart->addSeries( bars ); + b_chart->setTitle( QStringLiteral("%1: %2").arg( TR::tr( "Time of Day Count" ), field_str ) ); + b_chart->legend()->setVisible( false ); + /*b_chart->legend()->setAlignment( Qt::AlignBottom ); + b_chart->setAnimationOptions( QChart::SeriesAnimations );*/ + + // craft the X-axis labels + const QStringList categories{ this->getHours() }; + + // set-up the time-of-day axis (X) + QBarCategoryAxis* axisX{ new QBarCategoryAxis() }; + axisX->append( categories ); + axisX->setTitleText( date ); + b_chart->addAxis( axisX, Qt::AlignBottom ); + bars->attachAxis( axisX ); + + // set-up the count values axis (Y) + QValueAxis* axisY{ new QValueAxis() }; + axisY->setLabelFormat( "%d" ); + axisY->setTickCount( ( max_count < 9 ) ? max_count+1 : 9 ); + axisY->setRange( 0, max_count ); + b_chart->addAxis( axisY, Qt::AlignLeft ); + bars->attachAxis( axisY) ; + + // apply the chart to the view + chart->setChart( b_chart ); + chart->setRenderHint( QPainter::Antialiasing ); } -void Crapview::drawRelat( QChartView* chart, const QChart::ChartTheme& theme, const QString& web_server, const QString& from_year, const QString& from_month, const QString& from_day, const QString& to_year, const QString& to_month, const QString& to_day, const QString& field_1, const QString& filter_1, const QString& field_2, const QString& filter_2 ) const +void Crapview::drawRelat( QChartView* chart, const QChart::ChartTheme& theme, const QString web_server, const QString from_year, const QString from_month, const QString from_day, const QString to_year, const QString to_month, const QString to_day, const QString field_1_str, const LogField field_1, const QString filter_1, const QString field_2_str, const LogField field_2, const QString filter_2 ) const { const bool period{ from_day != to_day || from_month != to_month || from_year != to_year }; + std::optional result; - if ( ! period ) { - this->dbQuery.getRelationalCountsDay( - result, - web_server, - from_year, from_month, from_day, - field_1, filter_1, - field_2, filter_2 ); - } else { - this->dbQuery.getRelationalCountsPeriod( - result, - web_server, - from_year, from_month, from_day, - to_year, to_month, to_day, - field_1, filter_1, - field_2, filter_2 ); - } - if ( result ) { - // std::vector> - // [ ( epoch_ms, count ) ] - auto& items{ result.value() }; + try { - // draw the relational chart - QLineSeries* line{ new QLineSeries() }; - // build the line upon data - int count, max_count{0}; - long long time; // xD - for ( const auto& item : items ) { - time = std::get<0>(item); - count = std::get<1>(item); - line->append( static_cast(time), static_cast(count) ); - if ( count > max_count ) { - max_count = count; - } - } - - // build the area - QString date; - QAreaSeries* area{ new QAreaSeries( line ) }; if ( ! period ) { - date = PrintSec::printableDate( from_year, this->getMonthNumber(from_month), from_day ); + this->dbQuery.getRelationalCountsDay( result, web_server, from_year, from_month, from_day, field_1, filter_1, field_2, filter_2 ); } else { - date = QString("%1 %2 %3 %4") - .arg( TR::tr( "from" ), - PrintSec::printableDate( from_year, this->getMonthNumber(from_month), from_day ), - TR::tr( "to" ), - PrintSec::printableDate( to_year, this->getMonthNumber(to_month), to_day )); + this->dbQuery.getRelationalCountsPeriod( result, web_server, from_year, from_month, from_day, to_year, to_month, to_day, field_1, filter_1, field_2, filter_2 ); } + } catch ( const DatabaseException& e ) { + DialogSec::errProcessingStatsData( e.what() ); + return; - // color the area - QColor col1{ Qt::GlobalColor::red }, - col2{ Qt::GlobalColor::yellow }, - col3{ Qt::GlobalColor::magenta }; - //area->setColor( col ); - QLinearGradient gradient{ QPointF(0, 0), QPointF(0, 1) }; - gradient.setColorAt(0.25, col3.lighter( 70 ) ); - gradient.setColorAt(0.5, col1.lighter( 80 ) ); - gradient.setColorAt(1.0, col2.lighter( 90 ) ); - gradient.setCoordinateMode(QGradient::ObjectBoundingMode); - area->setBrush( gradient ); - area->setBorderColor( col1.lighter( 50 ) ); - - // fictitious area, just to have another label - QAreaSeries* area_{ new QAreaSeries( ) }; - area_->setBrush( gradient ); - area_->setBorderColor( col1.lighter( 50 ) ); - - // build the area - QChart* a_chart{ new QChart() }; - a_chart->setTheme( theme ); - a_chart->addSeries( area ); - a_chart->addSeries( area_ ); - a_chart->setTitle( QString("%1: %2 -> %3").arg( TR::tr( "Time of Day Count" ), field_1, field_2) ); - a_chart->legend()->setVisible( false ); - /*a_chart->legend()->setFont( fonts.at( "main_small" ) ); - a_chart->legend()->setAlignment( Qt::AlignBottom );*/ - - // set-up the date-time axis (X) - QDateTimeAxis* axisX{ new QDateTimeAxis() }; - if ( period ) { - //axisX->setLabelsVisible( false ); - axisX->setFormat( "yyyy-MM" ); - int ticks{ this->dbQuery.countMonths( from_year, from_month, to_year, to_month ) }; - if ( ticks == 1 ) { - axisX->setFormat( "yyyy-MM-dd" ); - ticks = to_day.toInt() - from_day.toInt() +2; - } - axisX->setTickCount( ticks+1 ); - } else { - axisX->setFormat( "hh:mm" ); - axisX->setTickCount( 25 ); - } - axisX->setTitleText( date ); - a_chart->addAxis( axisX, Qt::AlignBottom ); - area->attachAxis( axisX ); - - // set-up the count values axis (Y) - QValueAxis* axisY{ new QValueAxis() }; - axisY->setLabelFormat( "%d" ); - axisY->setTickCount( ( max_count < 9 ) ? max_count+1 : 9 ); - axisY->setRange( 0, max_count ); - a_chart->addAxis( axisY, Qt::AlignLeft ); - area->attachAxis( axisY) ; - - // add the chart to the view - chart->setChart( a_chart ); - chart->setRenderHint(QPainter::Antialiasing); + } catch ( const VoidException& ) { + // dialog already shown + return; } + + if ( ! result ) { + DialogSec::msgNoDataForStats(); + return; + } + + // std::vector> + // [ ( epoch_ms, count ) ] + const auto items{ std::move(*result) }; + + // draw the relational chart + QLineSeries* line{ new QLineSeries() }; + // build the line upon data + int max_count{0}; + for ( const auto& item : items ) { + const qint64 time{ std::get<0>(item) }; + const int count{ std::get<1>(item) }; + line->append( static_cast(time), static_cast(count) ); + if ( count > max_count ) { + max_count = count; + } + } + + // build the area + QString date; + QAreaSeries* area{ new QAreaSeries( line ) }; + if ( ! period ) { + date = PrintSec::printableDate( from_year, this->getMonthNumber(from_month), from_day ); + } else { + date = QStringLiteral("%1 %2 %3 %4") + .arg( TR::tr( "from" ), + PrintSec::printableDate( from_year, this->getMonthNumber(from_month), from_day ), + TR::tr( "to" ), + PrintSec::printableDate( to_year, this->getMonthNumber(to_month), to_day )); + } + + // color the area + QColor col1{ Qt::GlobalColor::red }, + col2{ Qt::GlobalColor::yellow }, + col3{ Qt::GlobalColor::magenta }; + //area->setColor( col ); + QLinearGradient gradient{ QPointF(0, 0), QPointF(0, 1) }; + gradient.setColorAt(0.25, col3.lighter( 70 ) ); + gradient.setColorAt(0.5, col1.lighter( 80 ) ); + gradient.setColorAt(1.0, col2.lighter( 90 ) ); + gradient.setCoordinateMode(QGradient::ObjectBoundingMode); + area->setBrush( gradient ); + area->setBorderColor( col1.lighter( 50 ) ); + + // fictitious area, just to have another label + QAreaSeries* area_{ new QAreaSeries( ) }; + area_->setBrush( gradient ); + area_->setBorderColor( col1.lighter( 50 ) ); + + // build the area + QChart* a_chart{ new QChart() }; + a_chart->setTheme( theme ); + a_chart->addSeries( area ); + a_chart->addSeries( area_ ); + a_chart->setTitle( QStringLiteral("%1: %2 -> %3").arg( TR::tr( "Time of Day Count" ), field_1_str, field_2_str) ); + a_chart->legend()->setVisible( false ); + /*a_chart->legend()->setFont( fonts.at( "main_small" ) ); + a_chart->legend()->setAlignment( Qt::AlignBottom );*/ + + // set-up the date-time axis (X) + QDateTimeAxis* axisX{ new QDateTimeAxis() }; + if ( period ) { + //axisX->setLabelsVisible( false ); + axisX->setFormat( "yyyy-MM" ); + int ticks{ this->dbQuery.countMonths( from_year, from_month, to_year, to_month ) }; + if ( ticks == 1 ) { + axisX->setFormat( "yyyy-MM-dd" ); + ticks = to_day.toInt() - from_day.toInt() +2; + } + axisX->setTickCount( ticks+1 ); + } else { + axisX->setFormat( "hh:mm" ); + axisX->setTickCount( 25 ); + } + axisX->setTitleText( date ); + a_chart->addAxis( axisX, Qt::AlignBottom ); + area->attachAxis( axisX ); + + // set-up the count values axis (Y) + QValueAxis* axisY{ new QValueAxis() }; + axisY->setLabelFormat( "%d" ); + axisY->setTickCount( ( max_count < 9 ) ? max_count+1 : 9 ); + axisY->setRange( 0, max_count ); + a_chart->addAxis( axisY, Qt::AlignLeft ); + area->attachAxis( axisY) ; + + // add the chart to the view + chart->setChart( a_chart ); + chart->setRenderHint(QPainter::Antialiasing); } // calculate global informations -bool Crapview::calcGlobals( std::vector>& recur_list, std::vector>& traffic_list, std::vector>& perf_list, std::vector& work_list, const QString& web_server ) const +bool Crapview::calcGlobals( std::vector>& recur_list, std::vector>& traffic_list, std::vector>& perf_list, std::vector& work_list, const QString web_server ) const { - bool result{ false }; - - if ( ! this->dates.at( this->WebServer_s2i.value( web_server ) ).empty() ) { - - // { { item, count } } // 0:protocol, 1:method, 1:uri, 3:user-agent - std::vector> recurs{ {}, {}, {}, {} }; - // ( date_str, count ) - std::tuple traf_date; - // { day_name : total_count } - std::unordered_map traf_day{ {1,0}, {2,0}, {3,0}, {4,0}, {5,0}, {6,0}, {7,0} }; - // { hour : total_count } - std::unordered_map traf_hour{ - {0,0}, {1,0}, {2,0}, {3,0}, {4,0}, {5,0}, {6,0}, {7,0}, {8,0}, {9,0}, {10,0}, {11,0}, - {12,0}, {13,0}, {14,0}, {15,0}, {16,0}, {17,0}, {18,0}, {19,0}, {20,0}, {21,0}, {22,0}, {23,0} }; - // [ max, total, num ] - std::vector perf_time; - // [ max, total, num ] - std::vector perf_sent; - // [ max, total, num ] - std::vector perf_receiv; - // count - long req_count{ 0 }; - - result = this->dbQuery.getGlobalCounts( - web_server, this->dates.at( this->WebServer_s2i.value( web_server ) ), - recurs, - traf_date, traf_day, traf_hour, - perf_time, perf_sent, perf_receiv, - req_count ); - - if ( result ) { - // compose the results - - // max request elements - for ( size_t i{0}; i<4ul; i++ ) { - unsigned max{ 0 }; - QString max_str{ "-" }; - const auto& aux{ recurs.at( i ) }; - for ( const auto& [s,c] : aux ) { - if ( c > max ) { - max = c; - max_str = s; - } - } - recur_list.push_back( std::make_tuple( max_str, QString("%1").arg(max) ) ); - } - - // max date ever - traffic_list.push_back( std::make_tuple( std::get<0>(traf_date), QString("%1").arg( std::get<1>(traf_date) ) ) ); - - // max day of the week - double max{ 0.0 }; - int max_{ 0 }; - for ( const auto& [d,c] : traf_day ) { - if ( c > max ) { - max = c; - max_ = d; - } - } - if ( max_ == 0.0 ) { - traffic_list.push_back( std::make_tuple( "-", "0" ) ); - } else { - const int f{ static_cast(max) }; - const int d{ (max<10.0) ? static_cast(max*100.0)%100 : static_cast(max*10.0)%10 }; - QString count{ QString("%1").arg( f ) }; - if ( d > 0 ) { - count += QString(".%1").arg( d ); - } - traffic_list.push_back( std::make_tuple( TR::tr(this->dbQuery.DAYS.at(max_).c_str()), count )); - } - - // max hour of the day - max=0.0, max_=-1.0; - for ( const auto& [h,c] : traf_hour ) { - if ( c > max ) { - max = c; - max_ = h; - } - } - if ( max_ < 0 ) { - traffic_list.push_back( std::make_tuple( "", "0" ) ); - } else { - const int f{ static_cast(max) }; - const int d{ (max<10.0) ? static_cast(max*100.0)%100 : static_cast(max*10.0)%10 }; - QString count = QString("%1").arg( f ); - if ( d > 0 ) { - count += QString(".%1").arg( d ); - } - QString h{ (max_<10) ? QString("0%1").arg(max_) : QString("%1").arg(max_) }; - traffic_list.push_back( std::make_tuple( h, count ) ); - } - - // mean/max time-taken - perf_list.push_back( std::make_tuple( - QString("%1 ms").arg( (perf_time.at(2ul)>0ll) ? perf_time.at(1ul)/perf_time.at(2ul) : perf_time.at(1ul) ), - QString("%1 ms").arg( perf_time.at(0ul) ) )); - perf_list.push_back( std::make_tuple( - QString("%1 B").arg( (perf_sent.at(2ul)>0ll) ? perf_sent.at(1ul)/perf_sent.at(2ul) : perf_time.at(1ul) ), - QString("%1 B").arg( perf_sent.at(0ul) ) )); - perf_list.push_back( std::make_tuple( - QString("%1 B").arg( (perf_receiv.at(2ul)>0ll) ? perf_receiv.at(1ul)/perf_receiv.at(2ul) : perf_receiv.at(1ul) ), - QString("%1 B").arg( perf_receiv.at(0ul) ) )); - - // overall work list - work_list.push_back( QString("%1").arg( req_count ) ); - - float t = static_cast( perf_time.at(1ul) ); - if ( t < 0.f ) { - work_list.push_back( "0" ); - } else { - int h{0}, m{0}, s{0}, ms{0}; - if ( t > 1000.f ) { - ms = static_cast( t ) %1000; - t /= 1000.f; - } - if ( t > 60.f ) { - s = static_cast( t ); - s /= 60; - if ( s > 60 ) { - m = s/60; - s = s%60; - if ( m > 60 ) { - h = m/60; - m = m%60; - } - } - } - work_list.push_back( QString("%1 h %2 m %3.%4 s").arg(h).arg(m).arg(s).arg(ms) ); - } - - float b = static_cast( perf_sent.at(1ul) ); - if ( b < 0.f ) { - work_list.push_back( "0" ); - } else { - int f{0}, d{0}; - QString sfx{ "B" }; - if ( b > 1024.f ) { - b /= 1024.f; - sfx = "KiB"; - if ( b > 1024.f ) { - b /= 1024.f; - sfx = "MiB"; - if ( b > 1024.f ) { - b /= 1024.f; - sfx = "GiB"; - } - } - } - f = static_cast( b ); - d = static_cast( b*1000.f ) %1000; - work_list.push_back( QString("%1.%2 %3").arg(f).arg(d).arg(sfx) ); - } - } + const auto& avl_dates{ this->dates.at( this->WebServer_s2i.value( web_server ) ) }; + if ( avl_dates.empty() ) { + return false; } - return result; + std::optional result; + + try { + + this->dbQuery.getGlobalCounts( result, web_server, avl_dates ); + + } catch ( const DatabaseException& e ) { + DialogSec::errProcessingStatsData( e.what() ); + return false; + + } catch ( const VoidException& ) { + // dialog already shown + return false; + } + + if ( ! result ) { + DialogSec::msgNoDataForStats(); + return false; + } + + // std::vector> + // [ ( epoch_ms, count ) ] + const GlobalsData data{ std::move(*result) }; + + // compose the results + const QString __dash{ QStringLiteral("-") }; + const QString __zero{ QStringLiteral("0") }; + + // most recurrent request elements + { + const auto max_of{ + [&__dash,&recur_list](const auto& rec) + { + size_t max{ 0 }; + QStringView max_str{ __dash }; + std::for_each( rec.begin(), rec.end(), + [&max,&max_str](const auto sc) + { if (auto& [s,c]{sc}; c>max){ max=c; max_str=s; } }); + recur_list.push_back( + std::make_tuple( max_str.toString(), QString::number(max) ) ); + } + }; + max_of( data.recurs.protocol.asKeyValueRange() ); + max_of( data.recurs.method.asKeyValueRange() ); + max_of( data.recurs.uri.asKeyValueRange() ); + max_of( data.recurs.user_agent.asKeyValueRange() ); + } + + // most trafficked + { + traffic_list.push_back( std::move( data.traf.date ) ); + const auto max_of{ + [this,&__dash,&__zero,&traffic_list](const auto& traf, const bool op) + { + double max_c{ 0.0 }; + size_t max_i{ traf.size() }; + /*std::ranges::for_each( std::views::enumerate(traf), + [&max_c,&max_i](const auto ic) + { if (auto& [i,c]{ic}; c>max_c){ max_c=c; max_i=i; } });*/ + for( const auto [index,count] : ArrayOps::enumerate(traf) ) { + if ( count > max_c ) { + max_c = count; + max_i = index; + } + }; + if ( max_i == traf.size() ) { + traffic_list.emplace_back( __dash, __zero ); + } else { + const size_t f{ static_cast(max_c) }; + const size_t d{ max_c<10.0 ? static_cast(max_c*100.0)%100ul : static_cast(max_c*10.0)%10ul }; + QString count{ QString::number( f ) }; + if ( d > 0 ) { + count += QString::number( d ).prepend(QLatin1Char('.')); + } + const QString value{ op ? TR::tr(this->dbQuery.DAYS.at(max_i+1).c_str()) + : QStringLiteral("%1").arg(max_i, 2, 10, QChar('0')) }; + traffic_list.emplace_back( value, count ); + } + } + }; + max_of( data.traf.day, true ); + max_of( data.traf.hour, false ); + } + + // mean/max performances + perf_list.push_back( std::make_tuple( + QStringLiteral("%1 ms").arg( data.perf.time_taken.count > 0ul + ? data.perf.time_taken.total / data.perf.time_taken.count + : data.perf.time_taken.total ), + QStringLiteral("%1 ms").arg( data.perf.time_taken.max ) )); + perf_list.push_back( std::make_tuple( + QStringLiteral("%1 B").arg( data.perf.bytes_sent.count > 0ul + ? data.perf.bytes_sent.total / data.perf.bytes_sent.count + : data.perf.bytes_sent.total ), + QStringLiteral("%1 B").arg( data.perf.bytes_sent.max ) )); + perf_list.push_back( std::make_tuple( + QStringLiteral("%1 B").arg( data.perf.bytes_recv.count > 0ul + ? data.perf.bytes_recv.total / data.perf.bytes_recv.count + : data.perf.bytes_recv.total ), + QStringLiteral("%1 B").arg( data.perf.bytes_recv.max ) )); + + // overall work list + work_list.push_back( QString::number( data.req_count ) ); + + float t{ static_cast( data.perf.time_taken.total ) }; + if ( t < 0.f ) { + work_list.push_back( __zero ); + } else { + int h{0}, m{0}, s{0}, ms{0}; + if ( t > 1000.f ) { + ms = static_cast( t ) %1000; + t /= 1000.f; + } + if ( t > 60.f ) { + s = static_cast( t ); + s /= 60; + if ( s > 60 ) { + m = s/60; + s = s%60; + if ( m > 60 ) { + h = m/60; + m = m%60; + } + } + } + work_list.push_back( QStringLiteral("%1 h %2 m %3.%4 s").arg(h).arg(m).arg(s).arg(ms) ); + } + + float b{ static_cast( data.perf.bytes_sent.total ) }; + if ( b < 0.f ) { + work_list.push_back( __zero ); + } else { + int f{0}, d{0}; + QString sfx{ "B" }; + if ( b > 1024.f ) { + b /= 1024.f; + sfx = "KiB"; + if ( b > 1024.f ) { + b /= 1024.f; + sfx = "MiB"; + if ( b > 1024.f ) { + b /= 1024.f; + sfx = "GiB"; + } + } + } + f = static_cast( b ); + d = static_cast( b*1000.f ) %1000; + work_list.push_back( QStringLiteral("%1.%2 %3").arg(f).arg(d).arg(sfx) ); + } + + return true; } diff --git a/logdoctor/modules/crapview/crapview.h b/logdoctor/modules/crapview/crapview.h index 6a43eeba..b191665d 100644 --- a/logdoctor/modules/crapview/crapview.h +++ b/logdoctor/modules/crapview/crapview.h @@ -2,13 +2,15 @@ #define LOGDOCTOR__CRAPVIEW_H -#include -#include - #include "modules/crapview/modules/query.h" +#include + #include + +struct Warnlist; + class QTableWidget; @@ -16,18 +18,21 @@ class QTableWidget; /*! Performs operations related to the visualization of the statistics */ -class Crapview : public QObject +class Crapview final : public QObject { Q_OBJECT - DATA_TYPEDEFS + CRAPVIEW_DATA_TYPEDEFS public: + explicit Crapview() noexcept {} + Q_DISABLE_COPY_MOVE(Crapview) + //! Returns the Dialogs level - int getDialogsLevel() const; + DialogsLevel getDialogsLevel() const noexcept; //! Sets the new Dialogs level - void setDialogsLevel( const int new_level ); + void setDialogsLevel( const DialogsLevel new_level ) noexcept; /*//! Sets the new charts theme to use @@ -38,23 +43,7 @@ public: /*! \see DbQuery::setDbPath() */ - void setDbPath( const std::string& path ); - - - //! Returns the printable log field corresponding to the given ID - /*! - The field gets translated to be printable before being returned - \param field_id The ID of the log fiels - \return The printable field - */ - QString getLogFieldString ( const size_t field_id ) const; - - //! Returns the log field ID corresponding to the given printable field - /*! - \param field_str The log field - \return The ID of the log field - */ - int getLogFieldID ( const QString& field_str ) const; + void setDbPath( const std::string& path ) noexcept; //! Returns the month number corresponding to the given printable month @@ -62,14 +51,14 @@ public: \param month_Str The printable month name \return The month number */ - int getMonthNumber( const QString& month_str ) const; + int getMonthNumber( const QString& month_str ) const noexcept; //! Refreshes the list of the dates which are available in the database void refreshDates(); //! Erases the list of available dates - void clearDates(); + void clearDates() noexcept; //! Returns le list of available years, for the given web server @@ -77,7 +66,7 @@ public: \param web_server The printable Web Server name \return The list of yearss which are avaliable */ - QStringList getYears( const QString& web_server ) const; + QStringList getYears( const QString& web_server ) const noexcept; //! Returns le list of available months in the given year, for the given web server /*! @@ -85,7 +74,7 @@ public: \param year The year \return The list of printable month names which are avaliable */ - QStringList getMonths( const QString& web_server, const QString& year ) const; + QStringList getMonths( const QString& web_server, const QString& year ) const noexcept; //! Returns le list of available days in the given month and year, for the given web server /*! @@ -94,32 +83,28 @@ public: \param month The printable month name \return The list of days which are avaliable */ - QStringList getDays( const QString& web_server, const QString& year, const QString& month ) const; + QStringList getDays( const QString& web_server, const QString& year, const QString& month ) const noexcept; //! Returns all the hours of the day /*! \return The list of all the hours */ - QStringList getHours() const; + QStringList getHours() const noexcept; - //! Returns a list of the fields for the given tab + //! Returns a list of the translated columns /*! - \param tab The stats tab + To be inserted in a header \return The list of fields */ - QStringList getFields( const std::string& tab ) const; + QStringList getWarnHeaderColumns() const noexcept; - - //! Updates the database applying the changes which have been made to the table + //! Returns a list of the translated columns /*! - \param table The Warnings stats table - \param web_server The printable Web Server name + To be inserted in a header + \return The list of fields */ - void updateWarn( - QTableWidget* table, - const QString& web_server - ) const; + QStringList getSpeedHeaderColumns() const noexcept; //! Draws the chart and fills the table for the Warnings stats @@ -132,12 +117,14 @@ public: \param month The printable month name \param day The day \param hout The hour + \param warnlist The warnlists to check against */ void drawWarn( QTableWidget* table, QChartView* chart, const QChart::ChartTheme& theme, - const QString& web_server, - const QString& year, const QString& month, const QString& day, const QString& hour + const QString web_server, + const QString year, const QString month, const QString day, const QString hour, + const Warnlist& warnlist ) const; @@ -159,9 +146,9 @@ public: void drawSpeed( QTableWidget* table, QChartView* chart, const QChart::ChartTheme& theme, - const QString& web_server, - const QString& year, const QString& month, const QString& day, - const QString& protocol, const QString& method, const QString& uri, const QString& query, const QString& response + const QString web_server, + const QString year, const QString month, const QString day, + const QString protocol, const QString method, const QString uri, const QString query, const QString response ) const; @@ -179,9 +166,9 @@ public: void drawCount( QTableWidget* table, QChartView* chart, const QChart::ChartTheme& theme, - const QString& web_server, - const QString& year, const QString& month, const QString& day, - const QString& field + const QString web_server, + const QString year, const QString month, const QString day, + const QString field ) const; @@ -202,10 +189,10 @@ public: void drawDay( QChartView* chart, const QChart::ChartTheme& theme, - const QString& web_server, - const QString& from_year, const QString& from_month, const QString& from_day, - const QString& to_year, const QString& to_month, const QString& to_day, - const QString& field, const QString& filter + const QString web_server, + const QString from_year, const QString from_month, const QString from_day, + const QString to_year, const QString to_month, const QString to_day, + const QString field_str, const LogField field, const QString filter ) const; @@ -228,11 +215,11 @@ public: void drawRelat( QChartView* chart, const QChart::ChartTheme& theme, - const QString& web_server, - const QString& from_year, const QString& from_month, const QString& from_day, - const QString& to_year, const QString& to_month, const QString& to_day, - const QString& field_1, const QString& filter_1, - const QString& field_2, const QString& filter_2 + const QString web_server, + const QString from_year, const QString from_month, const QString from_day, + const QString to_year, const QString to_month, const QString to_day, + const QString field_1_str, const LogField field_1, const QString filter_1, + const QString field_2_str, const LogField field_2, const QString filter_2 ) const; @@ -250,7 +237,7 @@ public: std::vector>& traffic_list, std::vector>& perf_list, std::vector& work_list, - const QString& web_server + const QString web_server ) const; @@ -262,48 +249,25 @@ private slots: private: // quantity of information to display throught dialogs - int dialogs_level{ 2 }; // 0: essential, 1: usefull, 2: explanatory + DialogsLevel dialogs_level{ DL_NORMAL }; // charts theme ID int charts_theme{ 0 }; + const QColor warning_color{ 255, 140, 0, 255 }; + DbQuery dbQuery; // collection of available dates // db_dates_t = std::unordered_map>>> // { web_server_id : { year : { month : [ days ] } } } - stats_dates_t dates; - - // collection of available fields, for tabs which needs them - // { tab : [ fields ] } - const std::unordered_map> fields{ - {"Daytime", { - this->dbQuery.FIELDS.at(0),this->dbQuery.FIELDS.at(10),this->dbQuery.FIELDS.at(11),this->dbQuery.FIELDS.at(12),this->dbQuery.FIELDS.at(13),this->dbQuery.FIELDS.at(14),this->dbQuery.FIELDS.at(18),this->dbQuery.FIELDS.at(22),this->dbQuery.FIELDS.at(21),this->dbQuery.FIELDS.at(20)} }, - {"Relational", { - this->dbQuery.FIELDS.at(0),this->dbQuery.FIELDS.at(10),this->dbQuery.FIELDS.at(11),this->dbQuery.FIELDS.at(12),this->dbQuery.FIELDS.at(13),this->dbQuery.FIELDS.at(14),this->dbQuery.FIELDS.at(15),this->dbQuery.FIELDS.at(16),this->dbQuery.FIELDS.at(17),this->dbQuery.FIELDS.at(18),this->dbQuery.FIELDS.at(22),this->dbQuery.FIELDS.at(21),this->dbQuery.FIELDS.at(20)} } - }; + database_dates_t dates; // converr Web Servers names to Web Server IDs const QHash WebServer_s2i{ {"apache",11}, {"nginx",12}, {"iis",13} }; - // convert log fields to log fields IDs - const QHash LogFields_s2i{ - {QString::fromStdString(this->dbQuery.FIELDS.at( 0)), 0}, - {QString::fromStdString(this->dbQuery.FIELDS.at(10)), 10}, - {QString::fromStdString(this->dbQuery.FIELDS.at(11)), 11}, - {QString::fromStdString(this->dbQuery.FIELDS.at(12)), 12}, - {QString::fromStdString(this->dbQuery.FIELDS.at(13)), 13}, - {QString::fromStdString(this->dbQuery.FIELDS.at(14)), 14}, - {QString::fromStdString(this->dbQuery.FIELDS.at(15)), 15}, - {QString::fromStdString(this->dbQuery.FIELDS.at(16)), 16}, - {QString::fromStdString(this->dbQuery.FIELDS.at(17)), 17}, - {QString::fromStdString(this->dbQuery.FIELDS.at(18)), 18}, - {QString::fromStdString(this->dbQuery.FIELDS.at(20)), 20}, - {QString::fromStdString(this->dbQuery.FIELDS.at(21)), 21}, - {QString::fromStdString(this->dbQuery.FIELDS.at(22)), 22}}; - // convert months names to months numbers const QHash Months_s2i{ {QString::fromStdString(this->dbQuery.MONTHS.at(1)), 1}, diff --git a/logdoctor/modules/crapview/lib.h b/logdoctor/modules/crapview/lib.h new file mode 100644 index 00000000..c0f905ab --- /dev/null +++ b/logdoctor/modules/crapview/lib.h @@ -0,0 +1,31 @@ +#ifndef LOGDOCTOR__CRAPVIEW__LIB_H +#define LOGDOCTOR__CRAPVIEW__LIB_H + + +#include + + +enum class LogField +{ + Warning, + // request + Protocol, + Method, + Uri, + Query, + // server + ResponseCode, + TimeTaken, + BytesSent, + BytesReceived, + // client + Client, + Cookie, + UserAgent, + Referrer +}; + +Q_DECLARE_METATYPE(LogField) + + +#endif // LOGDOCTOR__CRAPVIEW__LIB_H diff --git a/logdoctor/modules/crapview/modules/filters.cpp b/logdoctor/modules/crapview/modules/filters.cpp index a51d7fea..3ee56371 100644 --- a/logdoctor/modules/crapview/modules/filters.cpp +++ b/logdoctor/modules/crapview/modules/filters.cpp @@ -3,160 +3,122 @@ #include "utilities/strings.h" -#include +#include namespace FilterOps { -std::optional parseNull( const QString& filter_str, const bool to_clean ) +std::optional parseNull( const QString& filter_str, const bool to_clean ) noexcept { std::optional result; const QString aux{ ( to_clean ) ? filter_str.simplified().toUpper() : filter_str }; if ( !aux.isEmpty() ) { // here an empty string is considered invalid - if ( aux == "NULL" ) { - result.emplace( "NULL" ); - } else if ( aux == "NOT NULL" || aux == "! NULL" || aux == "!NULL" ) { - result.emplace( "NOT NULL" ); + if ( aux == "NULL" || aux == "NOT NULL" ) { + result.emplace( QStringLiteral(" IS %1").arg( aux ) ); + } else if ( aux == "! NULL" || aux == "!NULL" ) { + result.emplace( QStringLiteral(" IS NOT NULL") ); } } return result; } -std::optional parseBooleanFilter( const QString& filter_str ) +std::optional parseNumericFilter( const QString& filter_str ) noexcept { using opt_t = std::optional; - opt_t result; - if ( filter_str.isEmpty() ) { - // an empty filter is not invalid - result.emplace(""); - return result; - } - QString str{ filter_str.simplified().toUpper() }; - // check if the filter is NULL or NOT NULL - if ( opt_t aux=parseNull( str, false ); aux.has_value() ) { - return aux; - } - // normalize the string - if ( str.startsWith("==") ) { - str.remove(0, 2); - } else if ( str.startsWith("=") ) { - str.remove(0, 1); - } else if ( str.startsWith("!=") ) { - str.replace("!=", "NOT "); - } else if ( str.startsWith("!") ) { - str.replace("!", "NOT "); - } - str = str.replace("0", "FALSE").replace("1", "TRUE").simplified(); - // apply if valid - if ( str == "TRUE" || str == "NOT FALSE" ) { - result.emplace("= 1"); - } else if ( str == "FALSE" || str == "NOT TRUE" ) { - result.emplace("= 0"); - } - return result; -} - -std::optional parseNumericFilter( const QString& filter_str ) -{ - using opt_t = std::optional; - opt_t result; - if ( filter_str.isEmpty() ) { - // an empty filter is not invalid - result.emplace(""); - return result; - } - // check if the filter is NULL or NOT NULL - if ( opt_t aux=parseNull( filter_str ); aux.has_value() ) { - return aux; - } - // normalize the comparison operator - QString aux{ filter_str.simplified() }; - if ( aux.startsWith("==") ) { - aux.replace("==", "= "); - } else if ( aux.startsWith("=") ) { - aux.replace("=", "= "); - } else if ( aux.startsWith("!=") ) { - aux.replace("!=", "!= "); - } else if ( aux.startsWith("!") ) { - aux.replace("!", "!= "); - } else if ( aux.startsWith("<=") ) { - aux.replace("<=", "<= "); - } else if ( aux.startsWith("<") ) { - aux.replace("<", "< "); - } else if ( aux.startsWith(">=") ) { - aux.replace(">=", ">= "); - } else if ( aux.startsWith(">") ) { - aux.replace(">", "> "); - } else if ( aux.startsWith("eq ") ) { - aux.replace("eq ", "= "); - } else if ( aux.startsWith("ne ") ) { - aux.replace("ne ", "!= "); - } else if ( aux.startsWith("lt ") ) { - aux.replace("lt ", "< "); - } else if ( aux.startsWith("le ") ) { - aux.replace("le ", "<= "); - } else if ( aux.startsWith("gt ") ) { - aux.replace("gt ", "> "); - } else if ( aux.startsWith("ge ") ) { - aux.replace("ge ", ">= "); - } - const std::string str{ aux.simplified().toStdString() }; - if ( StringOps::isNumeric( str ) ) { - // string is numeric, no need to check further - result.emplace( QString("= %1").arg(str.c_str()) ); - return result; - } // a valid string is only composed by a comparison operator followed by a number - size_t i{ 0ul }; - const size_t max{ str.size() }; - if ( char c=str.at(i); c == '=' || c == '!' || c == '<' || c == '>' ) { - i ++; - if ( i >= max ) { - return result; - } - if ( str.at(i) == '=' ) { - i ++; - if ( i >= max ) { - return result; - } - } - if ( str.at(i) == ' ' ) { - i ++; - if ( i >= max ) { - return result; - } - } - if ( !StringOps::isNumeric( str.substr(i) ) ) { - return result; - } - result.emplace( QString::fromStdString( str ) ); + static const QRegularExpression expected("^(=|==|!=|<|<=|>=|>)[0-9]+$"); + // remove every space from the filter + static const QRegularExpression spaces(R"(\s*)"); + + if ( filter_str.isEmpty() ) { + // an empty filter is not invalid + return {filter_str}; + } + + // check if the filter is NULL or NOT NULL + if ( const opt_t aux{ parseNull( filter_str ) }; aux.has_value() ) { + return aux; + } + + if ( expected.matchView( filter_str ).hasMatch() ) { + return {filter_str}; + } + + opt_t result; + // normalize the comparison operator + QString aux{ filter_str.toUpper().remove(spaces) }; + if ( aux.isEmpty() ) { + return {aux}; + + } else if ( StringOps::isNumeric( aux ) ) { + aux.prepend( QLatin1Char('=') ); + + } else if ( aux.at(0) == QLatin1Char('!') && aux.at(1) != QLatin1Char('=') ) { + aux.insert(1, QLatin1Char('=')); + + } else if ( aux.startsWith(QLatin1String("EQ")) ) { + aux.replace(0, 2, QLatin1Char('=')); + + } else if ( aux.startsWith(QLatin1String("NE")) ) { + aux.replace(0, 2, QLatin1Char('=')).prepend(QLatin1Char('!')); + + } else if ( aux.startsWith(QLatin1String("LT")) ) { + aux.replace(0, 2, QLatin1Char('<')); + + } else if ( aux.startsWith(QLatin1String("LE")) ) { + aux.replace(0, 2, QLatin1Char('=')).prepend(QLatin1Char('<')); + + } else if ( aux.startsWith(QLatin1String("GT")) ) { + aux.replace(0, 2, QLatin1Char('>')); + + } else if ( aux.startsWith(QLatin1String("GE")) ) { + aux.replace(0, 2, QLatin1Char('=')).prepend(QLatin1Char('>')); + } + + // final check + if ( expected.matchView( aux ).hasMatch() ) { + result.emplace( aux ); } return result; } -std::optional parseTextualFilter( const QString& filter_str ) +std::optional parseTextualFilter( const QString& filter_str ) noexcept { using opt_t =std::optional; - opt_t result; + if ( filter_str.isEmpty() ) { // an empty filter is not invalid - result.emplace(""); - return result; + return {filter_str}; } + // check if the filter is NULL or NOT NULL - if ( opt_t aux=parseNull( filter_str ); aux.has_value() ) { + if ( const opt_t aux{ parseNull( filter_str ) }; aux.has_value() ) { return aux; } - if ( filter_str == "*" ) { - result.emplace("NOT NULL"); + + opt_t result; + QString aux{ filter_str.trimmed() }; + if ( aux.isEmpty() ) { + return {aux}; + + } else if ( aux == "*" ) { + result.emplace(QStringLiteral(" IS NOT NULL")); + } else { - result.emplace( filter_str.trimmed() ); + if ( aux.startsWith(QLatin1Char('!')) ) { + result.emplace( QStringLiteral(" NOT LIKE '%1'").arg( aux.removeFirst().trimmed().replace(QLatin1Char('\''),QLatin1String("''")) ) ); + } else { + if ( aux.startsWith(QLatin1Char('\\')) ) { + aux.removeFirst(); + } + result.emplace( QStringLiteral(" LIKE '%1'").arg( aux.replace(QLatin1Char('\''),QLatin1String("''")) ) ); + } } return result; } diff --git a/logdoctor/modules/crapview/modules/filters.h b/logdoctor/modules/crapview/modules/filters.h index 1d148689..4a15fbec 100644 --- a/logdoctor/modules/crapview/modules/filters.h +++ b/logdoctor/modules/crapview/modules/filters.h @@ -1,5 +1,5 @@ -#ifndef LOGDOCTOR__CRAPVIEW__FILTERS_H -#define LOGDOCTOR__CRAPVIEW__FILTERS_H +#ifndef LOGDOCTOR__CRAPVIEW__MODULES__FILTERS_H +#define LOGDOCTOR__CRAPVIEW__MODULES__FILTERS_H #include @@ -23,17 +23,7 @@ namespace FilterOps \param to_clean Whether the filter_str should be cleaned before parsing (trimmed and uppercased) \return The resulting filter to apply to the query, if valid */ -std::optional parseNull( const QString& filter_str, const bool to_clean=true ); - -//! Parses a filter for a database field with boolean type -/*! - Boolean filters are not locale-dependant, - meaning that English syntax must be used: 'TRUE', 'FALSE'. - This filter is case-insensitive. - \param field_str The given filter - \return The resulting filter to apply to the query, if valid -*/ -std::optional parseBooleanFilter( const QString& filter_str ); +std::optional parseNull( const QString& filter_str, const bool to_clean=true ) noexcept; //! Parses a filter for a log field with integer type /*! @@ -44,7 +34,7 @@ std::optional parseBooleanFilter( const QString& filter_str ); \param field_str The given filter \return The resulting filter to apply to the query, if valid */ -std::optional parseNumericFilter( const QString& filter_str ); +std::optional parseNumericFilter( const QString& filter_str ) noexcept; //! Parses a filter for a log field with text type /*! @@ -53,9 +43,9 @@ std::optional parseNumericFilter( const QString& filter_str ); \param field_str The given filter \return The resulting filter to apply to the query, if valid */ -std::optional parseTextualFilter( const QString& filter_str ); +std::optional parseTextualFilter( const QString& filter_str ) noexcept; } -#endif // LOGDOCTOR__CRAPVIEW__FILTERS_H +#endif // LOGDOCTOR__CRAPVIEW__MODULES__FILTERS_H diff --git a/logdoctor/modules/crapview/modules/lib.h b/logdoctor/modules/crapview/modules/lib.h new file mode 100644 index 00000000..097ba2bf --- /dev/null +++ b/logdoctor/modules/crapview/modules/lib.h @@ -0,0 +1,68 @@ +#ifndef LOGDOCTOR__CRAPVIEW__MODULES__LIB_H +#define LOGDOCTOR__CRAPVIEW__MODULES__LIB_H + + +#include +#include + +#include + + +#define CRAPVIEW_DATA_TYPEDEFS\ + using stats_dates_t = std::map>>;\ + using stats_warn_items_t = std::vector>>>;\ + using stats_speed_items_t = std::vector>>;\ + using stats_day_items_t = std::unordered_map>;\ + using stats_relat_items_t = std::vector>;\ + using stats_count_items_t = std::multimap;\ + using database_dates_t = std::map; + + +struct RecurrenceData final +{ + QHash protocol; + QHash method; + QHash uri; + QHash user_agent; +}; + +struct TrafficData final +{ + // ( date_str, count ) + std::tuple date; + // { day_name : total_count } // 0:monday, ..., 7:sunday + std::array day{ 0, 0, 0, 0, 0, 0, 0 }; + // { hour : total_count } + std::array hour{ .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0 }; +}; + +struct Perfs final +{ + size_t max{ 0ul }; + size_t total{ 0ul }; + size_t count{ 0ul }; +}; +struct PerformanceData final +{ + // [ max, total, count ] + Perfs time_taken; + // [ max, total, count ] + Perfs bytes_sent; + // [ max, total, count ] + Perfs bytes_recv; +}; + +struct GlobalsData final +{ + RecurrenceData recurs; + TrafficData traf; + PerformanceData perf; + size_t req_count{ 0 }; // total number of requests + + GlobalsData() noexcept = default; + GlobalsData(GlobalsData&&) noexcept = default; + GlobalsData& operator =(GlobalsData&&) noexcept = default; + Q_DISABLE_COPY(GlobalsData) +}; + +#endif // LOGDOCTOR__CRAPVIEW__MODULES__LIB_H diff --git a/logdoctor/modules/crapview/modules/query.cpp b/logdoctor/modules/crapview/modules/query.cpp index 077b60be..6f42f3cb 100644 --- a/logdoctor/modules/crapview/modules/query.cpp +++ b/logdoctor/modules/crapview/modules/query.cpp @@ -1,31 +1,80 @@ #include "query.h" +#include "modules/database/database.h" + #include "modules/dialogs.h" #include "modules/exceptions.h" -#include "utilities/checks.h" +#include "utilities/arrays.h" +#include "utilities/printables.h" #include "utilities/strings.h" -#include -#include -#include -#include #include -#include #include #include -void DbQuery::setDialogLevel(const int new_level ) +int toInt( const QString& str ) +{ + bool ok; + const int result{ str.toInt( &ok ) }; + if ( ! ok ) { + DialogSec::errConvertingData( + QStringLiteral("QString"), + QStringLiteral("int"), + str ); + throw VoidException{}; + } + return result; +} +int toInt( QStringView str ) +{ + bool ok; + const int result{ str.toInt( &ok ) }; + if ( ! ok ) { + DialogSec::errConvertingData( + QStringLiteral("QStringView"), + QStringLiteral("int"), + str.toString() ); + throw VoidException{}; + } + return result; +} +int toInt( const QVariant& v ) +{ + if ( ! v.canConvert( QMetaType(QMetaType::Int) ) ) { + DialogSec::errConvertingData( + QStringLiteral("QVariant"), + QStringLiteral("int"), + v.toString() ); + throw VoidException{}; + } + return v.toInt(); +} + +QString toString( const QVariant& v ) +{ + if ( ! v.canConvert( QMetaType(QMetaType::QString) ) ) { + DialogSec::errConvertingData( + QStringLiteral("QVariant"), + QStringLiteral("QString"), + v.toString() ); + throw VoidException{}; + } + return v.toString(); +} + + +void DbQuery::setDialogLevel( const DialogsLevel new_level ) noexcept { this->dialog_level = new_level; } -void DbQuery::setDbPath( const std::string& path ) +void DbQuery::setDbPath( std::string&& path ) noexcept { - this->db_path = path; + this->db_path = std::move(path); this->db_name = QString::fromStdString( this->db_path.substr( this->db_path.find_last_of( '/' ) + 1ul ) ); } @@ -35,7 +84,7 @@ int DbQuery::getMinuteGap( const int minute, const int gap ) int m{ -1 }; if ( minute < 0 || minute >= 60 ) { // unexpected value - throw DateTimeException( "Unexpected Minute: "+std::to_string( minute ) ); + throw DateTimeException( "Unexpected Minute", std::to_string( minute ) ); } int n{ 0 }; for ( int g{0}; g<60; g+=gap ) { @@ -43,7 +92,7 @@ int DbQuery::getMinuteGap( const int minute, const int gap ) m = gap * n; break; } - n++; + ++n; } return m; } @@ -66,22 +115,20 @@ int DbQuery::getMonthDays( const int year, const int month ) case 12: n_days = 31; break; default: // unexpected month - throw DateTimeException( "Unexpected Month: "+std::to_string( month ) ); + throw DateTimeException( "Unexpected Month number", std::to_string( month ) ); } return n_days; } -int DbQuery::getMonthNumber( const QString& month_str ) const +int DbQuery::getMonthNumber( QStringView month_str ) const { - int m{ 0 }; for ( const auto& [num,str] : this->MONTHS ) { if ( TR::tr(str.c_str()) == month_str ) { - m = num; - break; + return num; } } - return m; + throw DateTimeException( "Unexpected Month name", month_str.toString().toStdString() ); } @@ -95,7 +142,7 @@ int DbQuery::countDays( const int from_year, const int from_month, const int fro n_days += to_day - from_day + 1; } else { n_days += getMonthDays( from_year, from_month ) - from_day; // first month's days - for ( int month=from_month+1; monthgetMonthNumber( from_month ); - to_year_ = ( to_year.isEmpty() ) ? from_year_ : to_year.toInt() ; - to_month_ = ( to_month.isEmpty() ) ? from_month_ : this->getMonthNumber( to_month ) ; - } catch (...) { - // failed to convert to integers - throw DateTimeException( "Failed to convert Month from string to int" ); // leave un-catched - } - return countMonths( from_year_, from_month_, to_year_, to_month_ ); + const int from_year_{ toInt( from_year ) }, + from_month_{ this->getMonthNumber( from_month ) }; + + return this->countMonths( + toInt( from_year ), + this->getMonthNumber( from_month ), + to_year.isEmpty() ? from_year_ : toInt( to_year ), + to_month.isEmpty() ? from_month_ : this->getMonthNumber( to_month ) + ); } -/*const int DbQuery::getLogFieldID ( const QString& field_str ) +const QString& DbQuery::getDbField( const LogField fld ) const { - int f=0; - for ( const auto& [id,str] : this->MONTHS ) { - if ( TR::tr(str.c_str()) == field_str ) { - f = id; - break; - } - } - return f; -}*/ + return this->LogFields_to_DbFields.at( fld ); +} -QString DbQuery::getDbField( const QString& tr_fld ) const +const QString& DbQuery::getDbField( QStringView tr_fld ) const { - QString f; for ( const auto& [id,str] : this->FIELDS ) { if ( TR::tr(str.c_str()) == tr_fld ) { - f = this->LogFields_to_DbFields.at( str ); - break; + return this->LogFields_to_DbFields.at( id ); } } - return f; + throw DatabaseException( std::move(QStringLiteral("Unexpected DbField: ").append(tr_fld)) ); } // get a fresh map of available dates -void DbQuery::refreshDates( std::optional& result ) +void DbQuery::refreshDates( std::optional& result ) noexcept { - bool successful{ true }; - stats_dates_t dates{ // std::unordered_map>>> + database_dates_t dates{ // std::unordered_map>>> {11, {}}, {12, {}}, {13, {}} }; - QSqlDatabase db; - if ( QSqlDatabase::contains("qt_sql_default_connection") ) { - db = QSqlDatabase::database("qt_sql_default_connection"); - } else { - db = QSqlDatabase::addDatabase("QSQLITE"); - } - db.setDatabaseName( QString::fromStdString( this->db_path )); + DatabaseWrapper db{ DatabaseHandler::get( DatabaseType::Data, DB_READONLY ) }; - if ( ! CheckSec::checkDatabaseFile( db_path, db_name ) ) { - successful &= false; + db.open( this->db_path, this->dialog_level==DL_EXPLANATORY ); - } else if ( ! db.open() ) { - // error opening database - successful &= false; - QString err_msg; - if ( this->dialog_level == 2 ) { - err_msg = db.lastError().text(); - } - DialogSec::errDatabaseFailedOpening( this->db_name, err_msg ); + // recursively query years, months and days for every WebServer + static const std::vector> tables{ + std::make_tuple(11,"apache"), + std::make_tuple(12,"nginx"), + std::make_tuple(13,"iis") }; - } else { - // recursively query years, months and days for every WebServer - const std::vector> tables{ - std::make_tuple(11,"apache"), - std::make_tuple(12,"nginx"), - std::make_tuple(13,"iis") }; + for ( const auto& [ws,tbl] : tables ) { - QSqlQuery Y_query{ db }, - M_query{ db }, - D_query{ db }; + QueryWrapper query{ db.getQuery() }; - for ( const auto& table : tables ) { - if ( ! successful ) { break; } + query( QStringLiteral(R"(SELECT DISTINCT "year", "month", "day" FROM "%1" ORDER BY "year", "month", "day" ASC;)").arg(tbl) ); - const int ws{ std::get<0>(table) }; - const QString tbl{ std::get<1>(table) }; + auto& years = dates.at( ws ); - if ( ! Y_query.exec( QString("SELECT DISTINCT \"year\" FROM \"%1\" ORDER BY \"year\" ASC;").arg(tbl) ) ) { - // error querying database - successful &= false; - DialogSec::errDatabaseFailedExecuting( this->db_name, Y_query.lastQuery(), Y_query.lastError().text() ); - break; - - } else { - int year, month, day; - auto& years = dates.at( ws ); - while ( Y_query.next() ) { - try { - year = Y_query.value(0).toInt(); - } catch (...) { - // failed to convert to integer - successful &= false; - QString err_msg{ TR::tr(this->MSG_ERR_PARSING_YMD.c_str()).arg( TR::tr(this->WORD_YEARS.c_str()) ) }; - if ( this->dialog_level > 0 ) { - err_msg += QString("\n\n%1:\n%2").arg( TR::tr(this->MSG_RESPONSIBLE_VALUE.c_str()), Y_query.value(0).toString() ); - if ( this->dialog_level == 2 ) { - err_msg += QString("\n\n%1:\n%2").arg( TR::tr(this->MSG_TABLE_NAME.c_str()), tbl ); - } - } - DialogSec::errGeneric( err_msg ); - break; - } - // successfully get the year - years.emplace( year, std::map>() ); - // query any available month - if ( ! M_query.exec( QString("SELECT DISTINCT \"month\" FROM \"%1\" WHERE \"year\"=%2 ORDER BY \"month\" ASC;").arg(tbl).arg(year) ) ) { - // error querying database - successful &= false; - DialogSec::errDatabaseFailedExecuting( this->db_name, M_query.lastQuery(), M_query.lastError().text() ); - break; - - } else { - auto& months{ years.at( year ) }; - while ( M_query.next() ) { - try { - month = M_query.value(0).toInt(); - } catch (...) { - // failed to convert to integer - successful &= false; - QString err_msg{ TR::tr(this->MSG_ERR_PARSING_YMD.c_str()).arg( TR::tr(this->WORD_MONTHS.c_str()) ) }; - if ( this->dialog_level > 0 ) { - err_msg += QString("\n\n%1:\n%2").arg( TR::tr(this->MSG_RESPONSIBLE_VALUE.c_str()), M_query.value(0).toString() ); - if ( this->dialog_level == 2 ) { - err_msg += QString("\n\n%1:\n%2").arg( TR::tr(this->MSG_TABLE_NAME.c_str()), tbl ); - } - } - DialogSec::errGeneric( err_msg ); - break; - } - // successfully get the month - months[ month ] = std::vector(); - // query any available day - if ( ! D_query.exec( QString("SELECT DISTINCT \"day\" FROM \"%1\" WHERE \"year\"=%2 AND \"month\"=%3 ORDER BY \"day\" ASC;").arg(tbl).arg(year).arg(month) ) ) { - // error querying database - successful &= false; - DialogSec::errDatabaseFailedExecuting( this->db_name, D_query.lastQuery(), D_query.lastError().text() ); - break; - - } else if ( D_query.last() ) { - auto& days{ months.at( month ) }; - days.reserve( D_query.at() ); - D_query.first(); - D_query.previous(); - - while ( D_query.next() ) { - try { - day = D_query.value(0).toInt(); - } catch (...) { - // failed to convert to integer - successful &= false; - QString err_msg{ TR::tr(this->MSG_ERR_PARSING_YMD.c_str()).arg( TR::tr(this->WORD_DAYS.c_str()) ) }; - if ( this->dialog_level > 0 ) { - err_msg += QString("\n\n%1:\n%2").arg( TR::tr(this->MSG_RESPONSIBLE_VALUE.c_str()), D_query.value(0).toString() ); - if ( this->dialog_level == 2 ) { - err_msg += QString("\n\n%1:\n%2").arg( TR::tr(this->MSG_TABLE_NAME.c_str()), tbl ); - } - } - DialogSec::errGeneric( err_msg ); - break; - } - // successfully get the day - days.push_back( day ); - } - D_query.finish(); - // break if something went wrong - if ( ! successful ) { break; } - } - } - M_query.finish(); - // break if something went wrong - if ( ! successful ) { break; } - } - } - Y_query.finish(); - // break if something went wrong - if ( ! successful ) { break; } - } + while ( query->next() ) { + years.try_emplace( toInt( query[0] ), std::map>{} ) + .first->second + .try_emplace( toInt( query[1] ), std::vector{} ) + .first->second + .emplace_back( toInt( query[2] ) ); } } - if ( db.isOpen() ) { - db.close(); - } - if ( successful ) { - result.emplace( dates ); - } -} - - -// update the values for the warnings -void DbQuery::updateWarnings( const QString& web_server, const std::vector>& updates ) const -{ - QSqlDatabase db; - if ( QSqlDatabase::contains("qt_sql_default_connection") ) { - db = QSqlDatabase::database("qt_sql_default_connection"); - } else { - db = QSqlDatabase::addDatabase("QSQLITE"); - } - db.setDatabaseName( QString::fromStdString( this->db_path )); - - if ( ! CheckSec::checkDatabaseFile( db_path, db_name ) ) { - return; - - } else if ( ! db.open() ) { - // error opening database - QString err_msg; - if ( this->dialog_level == 2 ) { - err_msg = db.lastError().text(); - } - DialogSec::errDatabaseFailedOpening( this->db_name, err_msg ); - - } else { - if ( web_server != "apache" && web_server != "nginx" && web_server != "iis" ) { - // unexpected WebServer - DialogSec::errGeneric( QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true ); - - } else { - // update the database - QSqlQuery query{ db }; - - for ( const auto& data : updates ) { - // build the query statement - QString stmt = QString("UPDATE \"%1\" SET warning=%2 WHERE rowid=%3;") - .arg( web_server ) - .arg( std::get<1>(data) ) - .arg( std::get<0>(data) ); - - if ( ! query.exec( stmt.replace("'","''") ) ) { - // error querying database - DialogSec::errDatabaseFailedExecuting( this->db_name, query.lastQuery(), query.lastError().text() ); - break; - } - } - } - } - if ( db.isOpen() ) { - db.close(); - } + result.emplace( std::move(dates) ); } // get daytime values for the warnings -void DbQuery::getWarnCounts( std::optional& result, const QString& web_server, const QString& year_, const QString& month_, const QString& day_, const QString& hour_ ) const +void DbQuery::getWarningsData( std::optional& result, QStringView web_server, QStringView year_, QStringView month_, QStringView day_, QStringView hour_ ) const { - bool successful{ true }; - stats_warn_items_t items; // std::vector>>> + stats_warn_items_t items; // std::vector>>> - QSqlDatabase db; - if ( QSqlDatabase::contains("qt_sql_default_connection") ) { - db = QSqlDatabase::database("qt_sql_default_connection"); - } else { - db = QSqlDatabase::addDatabase("QSQLITE"); - } - db.setDatabaseName( QString::fromStdString( this->db_path )); + DatabaseWrapper db{ DatabaseHandler::get( DatabaseType::Data, DB_READONLY ) }; - if ( ! CheckSec::checkDatabaseFile( db_path, db_name ) ) { - successful &= false; + db.open( this->db_path, this->dialog_level==DL_EXPLANATORY ); - } else if ( ! db.open() ) { - // error opening database - successful &= false; - QString err_msg; - if ( this->dialog_level == 2 ) { - err_msg = db.lastError().text(); + // setup period limits + const int year{ toInt( year_ ) }; + const int month{ this->getMonthNumber( month_ ) }; + const int day{ toInt( day_ ) }; + const int hour{ hour_.isEmpty() ? -1 : toInt( hour_ ) }; + + const auto from_query_data{ + [](const QueryWrapper& query)->std::array + { + return { + toString(query[0]), toString(query[1]), toString(query[2]), // year, month, day + toString(query[3]), toString(query[4]), toString(query[5]), // hour, minute, second + toString(query[6]), toString(query[7]), // protocol, method + toString(query[8]), toString(query[9]), // uri, query + toString(query[10]), // response + toString(query[15]), // user agent + toString(query[14]), // client + toString(query[16]), // cookie + toString(query[17]), // referer + toString(query[13]), // bytes received + toString(query[12]), // bytes sent + toString(query[11]) // time taken + }; } - DialogSec::errDatabaseFailedOpening( this->db_name, err_msg ); + }; - } else { - if ( web_server != "apache" && web_server != "nginx" && web_server != "iis" ) { - // unexpected WebServer - successful &= false; - DialogSec::errGeneric( QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true ); - } - int year, month, day, hour; - if ( successful ) { - // setup period limits - try { - year = year_.toInt(); - month = this->getMonthNumber( month_ ); - day = day_.toInt(); - if ( ! hour_.isEmpty() ) { - hour = hour_.toInt(); - } - } catch (...) { - // failed to convert to integers - successful &= false; - DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING_DATES.c_str()), true ); + QueryWrapper query{ db.getQuery() }; + + query << QStringLiteral(R"(SELECT * FROM "%1" WHERE "year"=%2 AND "month"=%3 AND "day"=%4)") + .arg( web_server ) + .arg( year ).arg( month ).arg( day ); + + if ( hour == -1 ) { + // entire day + items.reserve( 24ul ); + for ( size_t h{0ul}; h<24ul; ++h ) { + items.emplace_back( std::vector>>{} ); + auto& aux{ items.at( h ) }; + aux.reserve( 6ul ); + for ( int m{0}; m<60; m+=10 ) { + aux.emplace_back( std::vector>{} ); } } - if ( successful ) { - // build the query statement - QSqlQuery query{ db }; - QString stmt{ QString("SELECT rowid, * FROM \"%1\" WHERE \"year\"=%2 AND \"month\"=%3 AND \"day\"=%4") - .arg( web_server ) - .arg( year ).arg( month ).arg( day ) }; - if ( hour_.isEmpty() ) { - // entire day - items.reserve( 24 ); - for ( size_t h{0}; h<24ul; h++ ) { - items.push_back( std::vector>>() ); - auto& aux{ items.at( h ) }; - aux.reserve( 6 ); - for ( int m{0}; m<60; m+=10 ) { - aux.push_back( std::vector>() ); - } - } + query << R"( ORDER BY "hour","minute","second" ASC;)"; - stmt += " ORDER BY \"hour\",\"minute\",\"second\" ASC;"; - if ( ! query.exec( stmt.replace("'","''") ) ) { - // error querying database - successful &= false; - DialogSec::errDatabaseFailedExecuting( this->db_name, query.lastQuery(), query.lastError().text() ); + query(); - } else { - try { - // get query data - while ( query.next() ) { - std::vector aux; - aux.reserve( 20 ); - for ( int i{1}; i<13; i++ ) { - aux.push_back( query.value( i ).toString() ); - } - for ( int i{19}; i>12; i-- ) { - aux.push_back( query.value( i ).toString() ); - } - aux.push_back( query.value( 0 ).toString() ); - // append the line - items.at( query.value(5).toInt() ) - .at( getMinuteGap( query.value(6).toInt() )/10 ) - .push_back( aux ); - } - } catch (...) { - // something failed - successful &= false; - DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING.c_str()), true ); - } - } + while ( query->next() ) { + // append the line + items.at( static_cast( toInt( query[3] ) ) ) + .at( static_cast( this->getMinuteGap( toInt( query[4] ) )/10 ) ) + .push_back( from_query_data( query ) ); + } - } else { - // 1 hour - items.reserve( 6 ); - for ( size_t g{0}; g<6ul; g++ ) { - items.push_back( std::vector>>() ); - auto& aux{ items.at( g ) }; - aux.reserve( 10ul ); - for ( int m{0}; m<10; m++ ) { - aux.push_back( std::vector>() ); - } - } - - stmt += QString(" AND \"hour\"=%5 ORDER BY \"minute\",\"second\" ASC;").arg( hour ); - if ( ! query.exec( stmt.replace("'","''") ) ) { - // error querying database - successful &= false; - DialogSec::errDatabaseFailedExecuting( this->db_name, query.lastQuery(), query.lastError().text() ); - - } else { - try { - // get query data - while ( query.next() ) { - std::vector aux; - aux.reserve( 20 ); - for ( int i{1}; i<13; i++ ) { - aux.push_back( query.value( i ).toString() ); - } - for ( int i{19}; i>12; i-- ) { - aux.push_back( query.value( i ).toString() ); - } - aux.push_back( query.value( 0 ).toString() ); - // append the line - items.at( static_cast( getMinuteGap( query.value(6).toInt() )/10 ) ) - .at( static_cast( query.value(6).toInt()%10 ) ) - .push_back( aux ); - } - } catch (...) { - // something failed - successful &= false; - DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING.c_str()), true ); - } - } + } else { + // 1 hour + items.reserve( 6ul ); + for ( size_t g{0ul}; g<6ul; ++g ) { + items.emplace_back( std::vector>>{} ); + auto& aux{ items.at( g ) }; + aux.reserve( 10ul ); + for ( int m{0}; m<10; ++m ) { + aux.emplace_back( std::vector>{} ); } } - } - if ( db.isOpen() ) { - db.close(); + + query << QStringLiteral(R"( AND "hour"=%5 ORDER BY "minute","second" ASC;)") + .arg( hour ); + + query(); + + while ( query->next() ) { + // append the line + const int min{ toInt( query[4] ) }; + items.at( static_cast( this->getMinuteGap( min )/10 ) ) + .at( static_cast( min % 10 ) ) + .push_back( from_query_data( query ) ); + } } - if ( successful ) { - result.emplace( items ); - } + result.emplace( std::move(items) ); } // get day-time values for the time-taken field -void DbQuery::getSpeedData( std::optional& result, const QString& web_server, const QString& year_, const QString& month_, const QString& day_, const QString& protocol_f, const QString& method_f, const QString& uri_f, const QString& query_f, const QString& response_f ) const +void DbQuery::getSpeedData( std::optional& result, QStringView web_server, QStringView year_, QStringView month_, QStringView day_, QStringView protocol_f, QStringView method_f, QStringView uri_f, QStringView query_f, QStringView response_f ) const { - bool successful{ true }; - stats_speed_items_t data; // std::vector>> + stats_speed_items_t data; // std::vector>> - QSqlDatabase db; - if ( QSqlDatabase::contains("qt_sql_default_connection") ) { - db = QSqlDatabase::database("qt_sql_default_connection"); - } else { - db = QSqlDatabase::addDatabase("QSQLITE"); - } - db.setDatabaseName( QString::fromStdString( this->db_path )); + DatabaseWrapper db{ DatabaseHandler::get( DatabaseType::Data, DB_READONLY ) }; - if ( ! CheckSec::checkDatabaseFile( db_path, db_name ) ) { - successful &= false; + db.open( this->db_path, this->dialog_level==DL_EXPLANATORY ); - } else if ( ! db.open() ) { - // error opening database - successful &= false; - QString err_msg; - if ( this->dialog_level == 2 ) { - err_msg = db.lastError().text(); - } - DialogSec::errDatabaseFailedOpening( this->db_name, err_msg ); + const int year{ toInt( year_ ) }; + const int month{ this->getMonthNumber( month_ ) }; + const int day{ toInt( day_ ) }; - } else { - if ( web_server != "apache" && web_server != "nginx" && web_server != "iis" ) { - // unexpected WebServer - successful &= false; - DialogSec::errGeneric( QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true ); - } - int year, month, day; - if ( successful ) { - // setup period limits - try { - year = year_.toInt(); - month = this->getMonthNumber( month_ ); - day = day_.toInt(); - } catch (...) { - // failed to convert to integers - successful &= false; - DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING_DATES.c_str()), true ); - } - } - if ( successful ) { - QDateTime time; - time.setDate( QDate( year, month , day ) ); - // build the query statement - QSqlQuery query{ db }; - QString stmt; + QueryWrapper query{ db.getQuery() }; - // prepare the statement - stmt = QString("SELECT \"hour\",\"minute\",\"second\",\"time_taken\",\"uri\",\"query\",\"method\",\"protocol\",\"response\" FROM \"%1\" WHERE \"year\"=%2 AND \"month\"=%3 AND \"day\"=%4 AND \"time_taken\" IS NOT NULL") + query << QStringLiteral(R"(SELECT "hour","minute","second","time_taken","uri","query","method","protocol","response" FROM "%1" WHERE "year"=%2 AND "month"=%3 AND "day"=%4 AND "time_taken" IS NOT NULL)") .arg( web_server ) .arg( year ).arg( month ).arg( day ); - // apply a filter if present - if ( ! protocol_f.isEmpty() ) { - if ( protocol_f == "NULL" ) { - // only select NULL values - stmt += QString(" AND \"protocol\" IS NULL"); - } else if ( protocol_f == "NOT NULL" ) { - // only select non-NULL values - stmt += QString(" AND \"protocol\" IS NOT NULL"); - } else { - stmt += QString(" AND \"protocol\" LIKE '%1'") - .arg( QString(protocol_f).replace("'","''") ); - } - } - if ( ! method_f.isEmpty() ) { - if ( method_f == "NULL" ) { - // only select NULL values - stmt += QString(" AND \"method\" IS NULL"); - } else if ( method_f == "NOT NULL" ) { - // only select non-NULL values - stmt += QString(" AND \"method\" IS NOT NULL"); - } else { - stmt += QString(" AND \"method\" LIKE '%1'") - .arg( QString(method_f).replace("'","''") ); - } - } - if ( ! uri_f.isEmpty() ) { - if ( uri_f == "NULL" ) { - // only select NULL values - stmt += QString(" AND \"uri\" IS NULL"); - } else if ( uri_f == "NOT NULL" ) { - // only select non-NULL values - stmt += QString(" AND \"uri\" IS NOT NULL"); - } else { - stmt += QString(" AND \"uri\" LIKE '%1'") - .arg( QString(uri_f).replace("'","''") ); - } - } - if ( ! query_f.isEmpty() ) { - if ( query_f == "NULL" ) { - // only select NULL values - stmt += QString(" AND \"query\" IS NULL"); - } else if ( query_f == "NOT NULL" ) { - // only select non-NULL values - stmt += QString(" AND \"query\" IS NOT NULL"); - } else { - stmt += QString(" AND \"query\" LIKE '%1'") - .arg( QString(query_f).replace("'","''") ); - } - } - if ( ! response_f.isEmpty() ) { - // numbers - if ( response_f == "NULL" ) { - // only select NULL values - stmt += QString(" AND \"response\" IS NULL"); - } else if ( response_f == "NOT NULL" ) { - // only select non-NULL values - stmt += QString(" AND \"response\" IS NOT NULL"); - } else { - QString filter; - if ( StringOps::isNumeric( response_f.toStdString() ) ) { - // no operator found, set defult to '=' - filter = QString("=%1").arg( response_f ); - } else { - filter = response_f; - } - stmt += QString(" AND \"response\"%1") - .arg( filter.replace("'","''") ); - } - } + if ( ! protocol_f.isEmpty() ) { + query << QStringLiteral(R"( AND "protocol")").append( protocol_f ); + } - stmt += QString(" ORDER BY \"hour\",\"minute\",\"second\" ASC;"); - if ( ! query.exec( stmt ) ) { - // error querying database - successful &= false; - DialogSec::errDatabaseFailedExecuting( this->db_name, query.lastQuery(), query.lastError().text() ); + if ( ! method_f.isEmpty() ) { + query << QStringLiteral(R"( AND "method")").append( method_f ); + } + if ( ! uri_f.isEmpty() ) { + query << QStringLiteral(R"( AND "uri")").append( uri_f ); + } + + if ( ! query_f.isEmpty() ) { + query << QStringLiteral(R"( AND "query")").append( query_f ); + } + + if ( ! response_f.isEmpty() ) { + query << QStringLiteral(R"( AND "response")").append( response_f ); + } + + query << R"( ORDER BY "hour","minute","second" ASC;)"; + + query(); + + if ( const size_t size{ query.size() }; size > 0ul ) { + data.reserve( size * 3 ); + } else { + return; + } + + int h, m, s; + const auto prev_instant{ + [&h,&m,&s](const int hour, const int minute, const int second) + { + h=hour; m=minute; s=second; + if ( --s < 0 ) { s=59; + if ( --m < 0 ) { m=59; + if ( --h < 0 ) { h=m=s=0; }}} + } + }; + const auto next_instant{ + [&h,&m,&s](const int hour, const int minute, const int second) + { + h=hour; m=minute; s=second; + if ( ++s > 59 ) { s=0; + if ( ++m > 59 ) { m=0; + if ( ++h > 23 ) { h=23;m=59;s=59; }}} + } + }; + + using data_t = std::array; + + QDateTime time{ + QDate( year, month, day ), + QTime( 0, 0, 0 ) + }; + + const auto push_empty{ + [&data,&time]() + { + data.emplace_back( time.toMSecsSinceEpoch(), data_t{} ); + } + }; + const auto push_data{ + [&data,&time](const auto ...args) + { + data.emplace_back( time.toMSecsSinceEpoch(), data_t{args...} ); + } + }; + + const auto set_time{ + [&time](const auto ...args) + { + time.setTime( QTime(args...) ); + } + }; + + int hour{-1}, next_hour, prev_hour{0}, + minute{0}, next_minute, prev_minute{0}, + second{0}, next_second, prev_second{0}; + QString tt, ur, qr, mt, pt, rs; + + // append the first ficticious count + time.setMSecsSinceEpoch( time.toMSecsSinceEpoch() - 1000 ); // -1s + push_empty(); + time.setMSecsSinceEpoch( time.toMSecsSinceEpoch() + 1000 ); // +1s + + while ( query->next() ) { + next_hour = toInt( query[0] ); + next_minute = toInt( query[1] ); + next_second = toInt( query[2] ); + + if ( next_hour == hour && next_minute == minute && next_second == second ) { + set_time( hour, minute, second ); + push_data( tt,ur,qr,mt,pt,rs ); + } else { + if ( next_hour == hour ) { + prev_instant( hour, minute, second ); + // append the second before the last one found, if it is not equal to the prev + if ( prev_hour < h || prev_minute < m || prev_second < s ) { + set_time( h, m, s ); + push_empty(); + } + // same hour new minute/second, append the last count + set_time( hour, minute, second ); + push_data( tt,ur,qr,mt,pt,rs ); + // append the second after the last one found, if it is not equal to the next + next_instant( hour, minute, second ); + if ( next_hour > h || next_minute > m || next_second > s ) { + set_time( h, m, s ); + push_empty(); + } + prev_hour = hour; // update now to avoid getting next_hour's value } else { - - try { - // append the first fictitious count - time.setDate( QDate( year, month, day ) ); - time.setTime( QTime( 0, 0, 0 )); - data.push_back( std::make_tuple( - time.toMSecsSinceEpoch(), - std::vector{"","","","","",""} )); - - if ( query.last() ) { - data.clear(); - data.reserve( static_cast( query.at()*2 ) ); - query.first(); - query.previous(); - - // get query data - int hour{-1}, aux_hour, prev_hour{0}, h, - minute{0}, aux_minute, prev_minute{0}, m, - second{0}, aux_second, prev_second{0}, s; - QString tt, ur, qr, mt, pt, rs; - while ( query.next() ) { - aux_hour = query.value(0).toInt(); - aux_minute = query.value(1).toInt(); - aux_second = query.value(2).toInt(); - - if ( aux_hour == hour && aux_minute == minute && aux_second == second ) { - time.setTime( QTime( hour, minute, second )); - data.push_back( std::make_tuple( - time.toMSecsSinceEpoch(), - std::vector{tt,ur,qr,mt,pt,rs} )); - } else { - if ( aux_hour == hour ) { - h=hour; m=minute; s=second-1; - if ( s < 0 ) { - s=59; m--; - if ( m < 0 ) { - m=59; h--; - if ( h < 0 ) { - h=m=s=0; - } - } - } - // append the second before the last one found, if it is not equal to the prev - if ( prev_hour < h || prev_minute < m || prev_second < s ) { - time.setTime( QTime( h, m, s )); - data.push_back( std::make_tuple( - time.toMSecsSinceEpoch(), - std::vector{"","","","","",""} )); - } - // same hour new minute/second, append the last count - time.setTime( QTime( hour, minute, second )); - data.push_back( std::make_tuple( - time.toMSecsSinceEpoch(), - std::vector{tt,ur,qr,mt,pt,rs} )); - // append the second after the last one found, if it is not equal to the next - h=hour; m=minute; s=second+1; - if ( s > 59 ) { - s=0; m++; - if ( m > 59 ) { - m=0; h++; - if ( h > 23 ) { - h=23;m=59;s=59; - } - } - } - if ( aux_hour > h || aux_minute > m || aux_second > s ) { - time.setTime( QTime( h, m, s )); - data.push_back( std::make_tuple( - time.toMSecsSinceEpoch(), - std::vector{"","","","","",""} )); - } - prev_hour = hour; // update now to avoid getting aux_hour's value - } else { - // minute & second are always different when the hour is different - if ( hour >= 0 ) { - // here only in the first round of the loop - // append the prev as zero - h=hour; m=minute; s=second-1; - if ( s < 0 ) { - s=59; m--; - if ( m < 0 ) { - m=59; h--; - if ( h < 0 ) { - h=m=s=0; - } - } - } - if ( prev_hour < h || prev_minute < m || prev_second < s ) { - time.setTime( QTime( h, m, s )); - data.push_back( std::make_tuple( - time.toMSecsSinceEpoch(), - std::vector{"","","","","",""} )); - } - // apend the last p count if not in the first round of the loop - time.setTime( QTime( hour, minute, second )); - data.push_back( std::make_tuple( - time.toMSecsSinceEpoch(), - std::vector{tt,ur,qr,mt,pt,rs} )); - // append the next as zero - h=hour; m=minute; s=second+1; - if ( s > 59 ) { - s=0; m++; - if ( m > 59 ) { - m=0; h++; - if ( h > 23 ) { - h=23;m=59;s=59; - } - } - } - if ( aux_hour > h || aux_minute > m || aux_second > s ) { - time.setTime( QTime( h, m, s )); - data.push_back( std::make_tuple( - time.toMSecsSinceEpoch(), - std::vector{"","","","","",""} )); - } - } else { - // append the second 0 of the day, if it is not the one found - if ( aux_hour > 0 || aux_minute > 0 || aux_second > 0 ) { - time.setTime( QTime( 0, 0, 0 )); - data.push_back( std::make_tuple( - time.toMSecsSinceEpoch(), - std::vector{"","","","","",""} )); - // append the second before the first found - h=aux_hour; m=aux_minute; s=aux_second-1; - if ( s < 0 ) { - s=59; m--; - if ( m < 0 ) { - m=59; h--; - if ( h < 0 ) { - // abort - h=m=s=0; - } - } - } - if ( h > 0 || m > 0 || s > 0 ) { - time.setTime( QTime( h, m, s )); - data.push_back( std::make_tuple( - time.toMSecsSinceEpoch(), - std::vector{"","","","","",""} )); - } - } - } - prev_hour = hour; - hour = aux_hour; - } - prev_minute = minute; - minute = aux_minute; - prev_second = second; - second = aux_second; - } - tt = query.value(3).toString(); // time taken - ur = query.value(4).toString(); // uri - qr = query.value(5).toString(); // query - mt = query.value(6).toString(); // method - pt = query.value(7).toString(); // protocol - rs = query.value(8).toString(); // response - } - // last one, append the prev - h=hour; m=minute; s=second-1; - if ( s < 0 ) { - s=59; m--; - if ( m < 0 ) { - m=59; h--; - if ( h < 0 ) { - h=m=s=0; - } - } - } - if ( prev_hour < h || prev_minute < m || prev_second < s ) { - time.setTime( QTime( h, m, s )); - data.push_back( std::make_tuple( - time.toMSecsSinceEpoch(), - std::vector{"","","","","",""} )); - } - // append the last count - time.setTime( QTime( hour, minute, second )); - data.push_back( std::make_tuple( - time.toMSecsSinceEpoch(), - std::vector{tt,ur,qr,mt,pt,rs} )); - // append 1 second after the last - h=hour; m=minute; s=second+1; - if ( s > 59 ) { - s=0; m++; - if ( m > 59 ) { - m=0; h++; - if ( h > 23 ) { - h=23;m=59;s=59; - } - } - } - if ( h > hour || m > minute || s > second ) { - time.setTime( QTime( h, m, s )); - data.push_back( std::make_tuple( - time.toMSecsSinceEpoch(), - std::vector{"","","","","",""} )); + // minute & second are always different when the hour is different + if ( hour >= 0 ) { + // append the prev as zero + prev_instant( hour, minute, second ); + if ( prev_hour < h || prev_minute < m || prev_second < s ) { + set_time( h, m, s ); + push_empty(); + } + // apend the last p count if not in the first round of the loop + set_time( hour, minute, second ); + push_data( tt,ur,qr,mt,pt,rs ); + // append the next as zero + next_instant( hour, minute, second ); + if ( next_hour > h || next_minute > m || next_second > s ) { + set_time( h, m, s ); + push_empty(); + } + } else { + // hout < 0 only in the first round of the loop + // append the second 0 of the day, if it is not the one found + if ( next_hour > 0 || next_minute > 0 || next_second > 0 ) { + push_empty(); + // append the second before the first found + prev_instant( next_hour, next_minute, next_second ); + if ( h > 0 || m > 0 || s > 0 ) { + set_time( h, m, s ); + push_empty(); } } - // append the last fictitious count - day ++; - if ( day > getMonthDays( year, month ) ) { - day = 1; - month ++; - if ( month > 12 ) { - month = 1; - year ++; - } - } - time.setDate( QDate( year, month , day ) ); - time.setTime( QTime( 0, 0, 0 )); - data.push_back( std::make_tuple( - time.toMSecsSinceEpoch(), - std::vector{"","","","","",""} )); - } catch (...) { - // something failed - successful = false; - DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING.c_str()), true ); } + prev_hour = hour; + hour = next_hour; } + prev_minute = minute; + minute = next_minute; + prev_second = second; + second = next_second; } + tt = toString( query[3] ); // time taken + ur = toString( query[4] ); // uri + qr = toString( query[5] ); // query + mt = toString( query[6] ); // method + pt = toString( query[7] ); // protocol + rs = toString( query[8] ); // response } - if ( db.isOpen() ) { - db.close(); + // last one, append the prev count + prev_instant( hour, minute, second ); + if ( prev_hour < h || prev_minute < m || prev_second < s ) { + set_time( h, m, s ); + push_empty(); + } + // append the last count + set_time( hour, minute, second ); + push_data( tt,ur,qr,mt,pt,rs ); + if ( hour < 23 && minute < 59 && second < 59 ) { + // append 1 second after the last + next_instant( hour, minute, second ); + set_time( h, m, s ); + push_empty(); + } + // append the last fictitious count + time.setTime( QTime( 23, 59, 59 ) ); + time.setMSecsSinceEpoch( time.toMSecsSinceEpoch() + 1000 ); // +1s + push_empty(); + + if ( data.capacity() > data.size() ) { + data.shrink_to_fit(); } - if ( successful ) { - if ( data.capacity() > data.size() ) { - data.shrink_to_fit(); - } - result.emplace( data ); - } + result.emplace( std::move(data) ); } // get, group and count identical items of a specific field in a date -void DbQuery::getItemsCount( std::optional& result, const QString& web_server, const QString& year, const QString& month, const QString& day, const QString& log_field ) const +void DbQuery::getItemsCount( std::optional& result, QStringView web_server, QStringView year, QStringView month, QStringView day, QStringView log_field ) const { - bool successful{ true }; QHash aux_items; stats_count_items_t items; // std::map> - QSqlDatabase db; - if ( QSqlDatabase::contains("qt_sql_default_connection") ) { - db = QSqlDatabase::database("qt_sql_default_connection"); - } else { - db = QSqlDatabase::addDatabase("QSQLITE"); - } - db.setDatabaseName( QString::fromStdString( this->db_path )); + DatabaseWrapper db{ DatabaseHandler::get( DatabaseType::Data, DB_READONLY ) }; - if ( ! CheckSec::checkDatabaseFile( db_path, db_name ) ) { - successful &= false; + db.open( this->db_path, this->dialog_level==DL_EXPLANATORY ); - } else if ( ! db.open() ) { - // error opening database - successful &= false; - QString err_msg; - if ( this->dialog_level == 2 ) { - err_msg = db.lastError().text(); - } - DialogSec::errDatabaseFailedOpening( this->db_name, err_msg ); + QueryWrapper query{ db.getQuery() }; - } else { - if ( web_server != "apache" && web_server != "nginx" && web_server != "iis" ) { - // unexpected WebServer - successful = false; - DialogSec::errGeneric( QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true ); - } - if ( successful ) { - // build the query statement - QSqlQuery query{ db }; - QString stmt{ QString("SELECT \"%1\" FROM \"%2\" WHERE \"%3\" IS NOT NULL AND \"year\"=%4 AND \"month\"=%5 AND \"day\"=%6;") + query << QStringLiteral(R"(SELECT "%1" FROM "%2" WHERE "%3" IS NOT NULL AND "year"=%4 AND "month"=%5 AND "day"=%6;)") .arg( this->getDbField( log_field ), web_server, this->getDbField( log_field ), year, - QString::fromStdString( std::to_string( this->getMonthNumber( month ) )), - day ) }; - // quary the database - if ( ! query.exec( stmt.replace("'","''") ) ) { - // error querying database - successful &= false; - DialogSec::errDatabaseFailedExecuting( this->db_name, query.lastQuery(), query.lastError().text() ); + QString::number( this->getMonthNumber( month ) ), + day ) + .replace(QChar('\''),QLatin1String("''")); - } else if ( query.last() ) { - aux_items.reserve( query.at() ); - query.first(); - query.previous(); + query(); - try { - // get data - QString item; - while ( query.next() ) { - item = query.value(0).toString(); - if ( ! item.isEmpty() ) { - aux_items[ item ] ++; - } - } - } catch (...) { - // something failed - successful &= false; - DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING.c_str()), true ); - } - } + if ( const size_t size{ query.size() }; size > 0ul ) { + aux_items.reserve( size * 3 ); + } else { + return; + } + + while ( query->next() ) { + const QString item{ toString( query[0] ) }; + if ( ! item.isEmpty() ) { + ++ aux_items[ item ]; } - if ( successful ) { // sort the list - // morph tha QHash into an ordered map - QHashIterator iter{ aux_items }; - while ( iter.hasNext() ) { - iter.next(); - items.emplace( iter.value(), iter.key() ); - } - } - aux_items.clear(); - } - if ( db.isOpen() ) { - db.close(); } - if ( successful ) { - result.emplace( items ); + // morph tha QHash into an ordered map + QHashIterator iter{ aux_items }; + while ( iter.hasNext() ) { + iter.next(); + items.emplace( iter.value(), iter.key() ); } + + result.emplace( std::move(items) ); } // get and count items with a 10 minutes gap for every hour of the day -void DbQuery::getDaytimeCounts( std::optional& result, const QString& web_server, const QString& from_year_, const QString& from_month_, const QString& from_day_, const QString& to_year_, const QString& to_month_, const QString& to_day_, const QString& log_field_, const QString& field_filter ) const +void DbQuery::getDaytimeCounts( std::optional& result, QStringView web_server, QStringView from_year_, QStringView from_month_, QStringView from_day_, QStringView to_year_, QStringView to_month_, QStringView to_day_, const LogField log_field_, QStringView field_filter ) const { - bool successful{ true }; stats_day_items_t data{ // std::unordered_map> {0, {{0,0},{10,0},{20,0},{30,0},{40,0},{50,0}}}, {1, {{0,0},{10,0},{20,0},{30,0},{40,0},{50,0}}}, {2, {{0,0},{10,0},{20,0},{30,0},{40,0},{50,0}}}, {3, {{0,0},{10,0},{20,0},{30,0},{40,0},{50,0}}}, @@ -1024,1185 +625,732 @@ void DbQuery::getDaytimeCounts( std::optional& result, const {22, {{0,0},{10,0},{20,0},{30,0},{40,0},{50,0}}}, {23, {{0,0},{10,0},{20,0},{30,0},{40,0},{50,0}}}, }; - QSqlDatabase db; - if ( QSqlDatabase::contains("qt_sql_default_connection") ) { - db = QSqlDatabase::database("qt_sql_default_connection"); - } else { - db = QSqlDatabase::addDatabase("QSQLITE"); - } - db.setDatabaseName( QString::fromStdString( this->db_path )); + DatabaseWrapper db{ DatabaseHandler::get( DatabaseType::Data, DB_READONLY ) }; - if ( ! CheckSec::checkDatabaseFile( db_path, db_name ) ) { - successful &= false; + db.open( this->db_path, this->dialog_level==DL_EXPLANATORY ); - } else if ( ! db.open() ) { - // error opening database - successful &= false; - QString err_msg; - if ( this->dialog_level == 2 ) { - err_msg = db.lastError().text(); - } - DialogSec::errDatabaseFailedOpening( this->db_name, err_msg ); + const int from_year{ toInt( from_year_ ) }; + const int from_month{ this->getMonthNumber( from_month_ ) }; + const int from_day{ toInt( from_day_ ) }; + const int to_year{ to_year_.isEmpty() ? from_year : toInt( to_year_ ) }; + const int to_month{ to_month_.isEmpty() ? from_month : this->getMonthNumber( to_month_ ) }; + const int to_day{ to_day_.isEmpty() ? from_day : toInt( to_day_ ) }; - } else { - if ( web_server != "apache" && web_server != "nginx" && web_server != "iis" ) { - // unexpected WebServer - successful &= false; - DialogSec::errGeneric( QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true ); - } - int from_year, from_month, from_day, - to_year, to_month, to_day; - if ( successful ) { - // setup period limits - try { - from_year = from_year_.toInt(); - from_month = this->getMonthNumber( from_month_ ); - from_day = from_day_.toInt(); - to_year = ( to_year_.isEmpty() ) ? from_year : to_year_.toInt() ; - to_month = ( to_month_.isEmpty() ) ? from_month : this->getMonthNumber( to_month_ ) ; - to_day = ( to_day_.isEmpty() ) ? from_day : to_day_.toInt() ; - } catch (...) { - // failed to convert to integers - successful &= false; - DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING_DATES.c_str()), true ); - } - } - if ( successful ) { - // build the query statement - QSqlQuery query{ db }; - QString stmt; - QString log_field{ this->getDbField( log_field_ ) }; + const QString& log_field{ this->getDbField( log_field_ ) }; - int n_days { 0 }, - n_months { countMonths( from_year, from_month, to_year, to_month ) }; + int n_days { 0 }, + n_months { this->countMonths( from_year, from_month, to_year, to_month ) }; - int year { from_year }, - month { from_month }, - day, hour, minute; - std::unordered_map days_l; - days_l.reserve( 31ul ); + int year { from_year }, + month { from_month }; + std::unordered_map days_l; + days_l.reserve( 31ul ); - if ( n_months == 1 ) { - // 1 month, no need to loop - stmt = QString("SELECT \"day\", \"hour\", \"minute\" FROM \"%1\" WHERE \"year\"=%2 AND \"month\"=%3 AND \"day\">=%4 AND \"day\"<=%5") + if ( n_months == 1 ) { + // 1 month, no need to loop + QueryWrapper query{ db.getQuery() }; + + query << QStringLiteral(R"(SELECT "day", "hour", "minute" FROM "%1" WHERE "year"=%2 AND "month"=%3 AND "day">=%4 AND "day"<=%5)") .arg( web_server ) .arg( year ).arg( month ) .arg( from_day ).arg( to_day ); - // apply a filter if present - if ( ! field_filter.isEmpty() ) { - QString filter{ field_filter }; - if ( filter == "NULL" ) { - // only select NULL values - stmt += QString(" AND \"%1\" IS NULL") - .arg( log_field.replace("'","''") ); - } else if ( filter == "NOT NULL" ) { - // only select non-NULL values - stmt += QString(" AND \"%1\" IS NOT NULL") - .arg( log_field.replace("'","''") ); - } else { - // filter - if ( log_field == "warning" - || log_field == "response" - || log_field == "time_taken" - || log_field == "bytes_sent" - || log_field == "bytes_received" ) { - // numbers - if ( StringOps::isNumeric( field_filter.toStdString() ) ) { - // no operator found, set defult to '=' - filter = QString("=%1").arg( field_filter ); - } - stmt += QString(" AND \"%1\"%2") - .arg( log_field.replace("'","''"), - filter.replace("'","''") ); + if ( ! field_filter.isEmpty() ) { + query << QStringLiteral(R"( AND "%1"%2)").arg( log_field, field_filter ); + } - } else { - stmt += QString(" AND \"%1\" LIKE '%2'") - .arg( log_field.replace("'","''"), - filter.replace("'","''") ); - } - } - } + query << ";"; - stmt += ";"; - if ( ! query.exec( stmt ) ) { - // error querying database - successful &= false; - DialogSec::errDatabaseFailedExecuting( this->db_name, query.lastQuery(), query.lastError().text() ); + query(); - } else { - try { - // get query data - while ( query.next() ) { - day = query.value(0).toInt(); - hour = query.value(1).toInt(); - minute = query.value(2).toInt(); - // increase the count - data.at( hour ).at( getMinuteGap( minute ) ) ++; - // append the day as newly found if not found yet - days_l[ day ] ++; - } - n_days += static_cast(days_l.size()); - } catch (...) { - // something failed - successful &= false; - DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING.c_str()), true ); - } - } + while ( query->next() ) { + const int day{ toInt( query[0] ) }; + const int hour{ toInt( query[1] ) }; + const int minute{ toInt( query[2] ) }; + // increase the count + ++ data.at( hour ).at( this->getMinuteGap( minute ) ); + // append the day as newly found if not found yet + ++ days_l[ day ]; + } + n_days += static_cast(days_l.size()); - } else { - for ( int m=1; m<=n_months; m++ ) { - stmt = QString("SELECT \"day\", \"hour\", \"minute\" FROM \"%1\" WHERE \"year\"=%2 AND \"month\"=%3") + } else { + for ( int m{1}; m<=n_months; ++m ) { + + QueryWrapper query{ db.getQuery() }; + + query << QStringLiteral(R"(SELECT "day", "hour", "minute" FROM "%1" WHERE "year"=%2 AND "month"=%3)") .arg( web_server ) .arg( year ).arg( month ); - if ( m == 1 ) { - // first month, only get the days starting from the beginning day - stmt += QString(" AND \"day\">=%1").arg( from_day ); - } else if ( m == n_months ) { - // last month, only get the days until the ending day - stmt += QString(" AND \"day\"<=%1").arg( to_day ); - } - // apply a filter if present - if ( ! field_filter.isEmpty() ) { - QString filter = field_filter; - if ( filter == "NULL" ) { - // only select NULL values - stmt += QString(" AND \"%1\" IS NULL") - .arg( log_field.replace("'","''") ); - } else if ( filter == "NOT NULL" ) { - // only select non-NULL values - stmt += QString(" AND \"%1\" IS NOT NULL") - .arg( log_field.replace("'","''") ); - } else { - // filter - if ( log_field == "warning" - || log_field == "response" - || log_field == "time_taken" - || log_field == "bytes_sent" - || log_field == "bytes_received" ) { - // numbers - if ( StringOps::isNumeric( field_filter.toStdString() ) ) { - // no operator found, set defult to '=' - filter = QString("=%1").arg( field_filter ); - } - stmt += QString(" AND \"%1\"%2") - .arg( log_field.replace("'","''"), - filter.replace("'","''") ); - - } else { - // only values starting-with - stmt += QString(" AND \"%1\" LIKE '%2'") - .arg( log_field.replace("'","''"), - filter.replace("'","''") ); - } - } - } - - // quary the database - stmt += ";"; - if ( ! query.exec( stmt ) ) { - // error querying database - successful &= false; - DialogSec::errDatabaseFailedExecuting( this->db_name, query.lastQuery(), query.lastError().text() ); - - } else { - try { - // clear the list of found days - days_l.clear(); - // get query data - while ( query.next() ) { - day = query.value(0).toInt(); - hour = query.value(1).toInt(); - minute = query.value(2).toInt(); - // increase the count - data.at( hour ).at( getMinuteGap( minute ) ) ++; - // append the day as newly found if not found yet - days_l[ day ] ++; - } - n_days += static_cast(days_l.size()); - month ++; - if ( month > 12 ) { - month = 1; - year ++; - } - } catch (...) { - // something failed - successful &= false; - DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING.c_str()), true ); - break; - } - query.finish(); - } - } + if ( m == 1 ) { + // first month, only get the days starting from the beginning day + query << QStringLiteral(R"( AND "day">=%1)").arg( from_day ); + } else if ( m == n_months ) { + // last month, only get the days until the ending day + query << QStringLiteral(R"( AND "day"<=%1)").arg( to_day ); } - if ( successful && n_days > 0 ) { - // divide the count by the number of days to get the mean value - for ( const auto& [h,data_] : data ) { - for ( const auto& [m,c] : data_ ) { - int& count{ data.at( h ).at( m ) }; - if ( count > 0 ) { - count /= n_days; - if ( count == 0 ) { - count++; - } - } - } + + if ( ! field_filter.isEmpty() ) { + query << QStringLiteral(R"( AND "%1"%2)").arg( log_field, field_filter ); + } + + query << ";"; + + query(); + + while ( query->next() ) { + const int day{ toInt( query[0] ) }; + const int hour{ toInt( query[1] ) }; + const int minute{ toInt( query[2] ) }; + // increase the count + ++ data.at( hour ).at( this->getMinuteGap( minute ) ); + // append the day as newly found if not found yet + ++ days_l[ day ]; + } + n_days += static_cast(days_l.size()); + ++ month; + if ( month > 12 ) { + month = 1; + ++ year; + } + } + } + if ( n_days == 0 ) { + // no data + return; + } + + // divide the count by the number of days to get the mean value + for ( const auto& [h,data_] : data ) { + for ( const auto& [m,c] : data_ ) { + int& count{ data.at( h ).at( m ) }; + if ( count > 0 ) { + count /= n_days; + if ( count == 0 ) { + ++ count; } } } } - if ( db.isOpen() ) { - db.close(); - } - if ( successful ) { - result.emplace( data ); - } + result.emplace( std::move(data) ); } // get and count how many times a specific item value brought to another -void DbQuery::getRelationalCountsDay( std::optional& result, const QString& web_server, const QString& year_, const QString& month_, const QString& day_, const QString& log_field_1_, const QString& field_filter_1, const QString& log_field_2_, const QString& field_filter_2 ) const +void DbQuery::getRelationalCountsDay( std::optional& result, QStringView web_server, QStringView year_, QStringView month_, QStringView day_, const LogField log_field_1_, QStringView field_filter_1, const LogField log_field_2_, QStringView field_filter_2 ) const { - bool successful{ true }; - stats_relat_items_t data; // std::vector> + stats_relat_items_t data; // std::vector> int gap = 20; - QSqlDatabase db; - if ( QSqlDatabase::contains("qt_sql_default_connection") ) { - db = QSqlDatabase::database("qt_sql_default_connection"); - } else { - db = QSqlDatabase::addDatabase("QSQLITE"); - } - db.setDatabaseName( QString::fromStdString( this->db_path )); + DatabaseWrapper db{ DatabaseHandler::get( DatabaseType::Data, DB_READONLY ) }; - if ( ! CheckSec::checkDatabaseFile( db_path, db_name ) ) { - successful &= false; + db.open( this->db_path, this->dialog_level==DL_EXPLANATORY ); - } else if ( ! db.open() ) { - // error opening database - successful &= false; - QString err_msg; - if ( this->dialog_level == 2 ) { - err_msg = db.lastError().text(); - } - DialogSec::errDatabaseFailedOpening( this->db_name, err_msg ); + const int year{ toInt( year_ ) }; + const int month{ this->getMonthNumber( month_ ) }; + const int day{ toInt( day_ ) }; - } else { - if ( web_server != "apache" && web_server != "nginx" && web_server != "iis" ) { - // unexpected WebServer - successful &= false; - DialogSec::errGeneric( QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true ); - } + const QString& log_field_1{ this->getDbField( log_field_1_ ) }; + const QString& log_field_2{ this->getDbField( log_field_2_ ) }; - int year, month, day; - if ( successful ) { - // setup period limits - try { - year = year_.toInt(); - month = this->getMonthNumber( month_ ); - day = day_.toInt(); - } catch (...) { - // failed to convert to integers - successful &= false; - DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING_DATES.c_str()), true ); - } - } - if ( successful ) { - QDateTime time; - time.setDate( QDate( year, month , day ) ); - // build the query statement - QSqlQuery query{ db }; - QString stmt; - QString log_field_1{ this->getDbField( log_field_1_ ) }, - log_field_2{ this->getDbField( log_field_2_ ) }; + QueryWrapper query{ db.getQuery() }; - // 1 day, no need to loop - stmt = QString("SELECT \"hour\", \"minute\" FROM \"%1\" WHERE \"year\"=%2 AND \"month\"=%3 AND \"day\"=%4") + query << QStringLiteral(R"(SELECT "hour", "minute" FROM "%1" WHERE "year"=%2 AND "month"=%3 AND "day"=%4)") .arg( web_server ) .arg( year ).arg( month ).arg( day ); - // apply a filter if present - if ( ! field_filter_1.isEmpty() ) { - QString filter{ field_filter_1 }; - if ( filter == "NULL" ) { - // only select NULL values - stmt += QString(" AND \"%1\" IS NULL") - .arg( log_field_1.replace("'","''") ); - } else if ( filter == "NOT NULL" ) { - // only select non-NULL values - stmt += QString(" AND \"%1\" IS NOT NULL") - .arg( log_field_1.replace("'","''") ); - } else { - // filter - if ( log_field_1 == "warning" - || log_field_1 == "response" - || log_field_1 == "time_taken" - || log_field_1 == "bytes_sent" - || log_field_1 == "bytes_received" ) { - // numbers - if ( StringOps::isNumeric( field_filter_1.toStdString() ) ) { - // no operator found, set defult to '=' - filter = QString("=%1").arg( field_filter_1 ); - } - stmt += QString(" AND \"%1\"%2") - .arg( log_field_1.replace("'","''"), - filter.replace("'","''") ); + if ( ! field_filter_1.isEmpty() ) { + query << QStringLiteral(R"( AND "%1"%2)").arg( log_field_1, field_filter_1 ); + } - } else { - // only values starting-with - stmt += QString(" AND \"%1\" LIKE '%2'") - .arg( log_field_1.replace("'","''"), - filter.replace("'","''") ); - } + if ( ! field_filter_2.isEmpty() ) { + query << QStringLiteral(R"( AND "%1"%2)").arg( log_field_2, field_filter_2 ); + } + + query << QStringLiteral(R"( ORDER BY "hour","minute" ASC;)"); + + query(); + + if ( query.size() == 0ul ) { + return; + } + + QDateTime time{ + QDate( year, month, day ), + QTime( 0, 0, 0 ) + }; + + data.reserve( static_cast( 24*(60/gap) ) ); + + const auto push_data{ + [&data,&time](const int count) + { + data.emplace_back( time.toMSecsSinceEpoch(), count ); + } + }; + + const auto set_time{ + [&time](const auto ...args) + { + time.setTime( QTime(args...) ); + } + }; + + int hour{-1}, next_hour, + minute{0}, next_minute, + count{0}; + + while ( query->next() ) { + next_hour = toInt( query[0] ); + next_minute = this->getMinuteGap( toInt( query[1] ), gap ); + if ( next_hour == hour && next_minute == minute ) { + ++ count; + } else { + if ( next_hour == hour ) { + // same hour new minute gap, append the last count + set_time( hour, minute ); + push_data( count ); + // and any missing gap + for ( int m{minute+gap}; mdb_name, query.lastQuery(), query.lastError().text() ); - - } else if ( ! query.last() ) { - // no result found, fill with 0 values - for ( int h{0}; h<24; h++ ) { - for ( int m{0}; m<60; m+=gap ) { - time.setTime( QTime( h, m ) ); - data.push_back( std::make_tuple( time.toMSecsSinceEpoch(), 0 ) ); - } - } - } else { - query.first(); - query.previous(); - - try { - data.reserve( static_cast( 24*(60/gap) ) ); - // get query data - int hour{-1}, aux_hour, - minute{0}, aux_minute, - count{0}; - while ( query.next() ) { - aux_hour = query.value(0).toInt(); - aux_minute = getMinuteGap( query.value(1).toInt(), gap ); - if ( aux_hour == hour && aux_minute == minute ) { - count ++; - } else { - if ( aux_hour == hour ) { - // same hour new minute gap, append the last count - time.setTime( QTime( hour, minute ) ); - data.push_back( std::make_tuple( time.toMSecsSinceEpoch(), count ) ); - // and any missing gap - for ( int m{minute+gap}; m= 0 ) { - // apend the last minute-gap count if not in the first round of the loop - time.setTime( QTime( hour, minute ) ); - data.push_back( std::make_tuple( time.toMSecsSinceEpoch(), count ) ); - // append any missing gap in the current hour - for ( int m{minute+gap}; m<60; m+=gap ) { - time.setTime( QTime( hour, m ) ); - data.push_back( std::make_tuple( time.toMSecsSinceEpoch(), 0 ) ); - } - hour ++; - } else { - // prepare to add missing gaps from 00:00 (+gap will be added to the minute) - hour = 0; - } - // append any missing gap in every hour between the current and the next found (aux) - for ( int h{hour}; h= 0 ) { + // apend the last minute-gap count if not in the first round of the loop + set_time( hour, minute ); + push_data( count ); + // append any missing gap in the current hour for ( int m{minute+gap}; m<60; m+=gap ) { - time.setTime( QTime( hour, m ) ); - data.push_back( std::make_tuple( time.toMSecsSinceEpoch(), 0 ) ); + set_time( hour, m ); + push_data( 0 ); } - for ( int h{hour+1}; h<24; h++ ) { - for ( int m{0}; m<60; m+=gap ) { - time.setTime( QTime( h, m ) ); - data.push_back( std::make_tuple( time.toMSecsSinceEpoch(), 0 ) ); - } - } - // append the real last fictitious count - day ++; - if ( day > getMonthDays( year, month ) ) { - day = 1; - month ++; - if ( month > 12 ) { - month = 1; - year ++; - } - } - time.setDate( QDate( year, month , day ) ); - time.setTime( QTime( 0, 0 ) ); - //time.setTime( QTime( 23, 59, 59, 999 ) ); - data.push_back( std::make_tuple( time.toMSecsSinceEpoch(), 0 ) ); - } catch (...) { - // something failed - successful &= false; - DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING.c_str()), true ); + ++ hour; + } else { + // prepare to add missing gaps from 00:00 (+gap will be added to the minute) + hour = 0; } + // append any missing gap in every hour between the current and the next found (aux) + for ( int h{hour}; h this->getMonthDays( year, month ) ) { + if ( ++m > 12 ) { + m = 1; + ++y; + } + d = 1; + } + time.setDate( QDate( y, m , d ) ); + time.setTime( QTime( 0, 0, 0 ) ); + push_data( 0 ); - if ( successful ) { - result.emplace( data ); - } + result.emplace( std::move(data) ); } -void DbQuery::getRelationalCountsPeriod( std::optional& result, const QString& web_server, const QString& from_year_, const QString& from_month_, const QString& from_day_, const QString& to_year_, const QString& to_month_, const QString& to_day_, const QString& log_field_1_, const QString& field_filter_1, const QString& log_field_2_, const QString& field_filter_2 ) const +void DbQuery::getRelationalCountsPeriod( std::optional& result, QStringView web_server, QStringView from_year_, QStringView from_month_, QStringView from_day_, QStringView to_year_, QStringView to_month_, QStringView to_day_, const LogField log_field_1_, QStringView field_filter_1, const LogField log_field_2_, QStringView field_filter_2 ) const { - bool successful{ true }; - stats_relat_items_t data; // std::vector> + stats_relat_items_t data; // std::vector> - QSqlDatabase db; - if ( QSqlDatabase::contains("qt_sql_default_connection") ) { - db = QSqlDatabase::database("qt_sql_default_connection"); - } else { - db = QSqlDatabase::addDatabase("QSQLITE"); - } - db.setDatabaseName( QString::fromStdString( this->db_path )); + DatabaseWrapper db{ DatabaseHandler::get( DatabaseType::Data, DB_READONLY ) }; - if ( ! CheckSec::checkDatabaseFile( db_path, db_name ) ) { - successful &= false; + db.open( this->db_path, this->dialog_level==DL_EXPLANATORY ); - } else if ( ! db.open() ) { - // error opening database - successful &= false; - QString err_msg; - if ( this->dialog_level == 2 ) { - err_msg = db.lastError().text(); + const int from_year{ toInt( from_year_ ) }; + const int from_month{ this->getMonthNumber( from_month_ ) }; + const int from_day{ toInt( from_day_ ) }; + const int to_year{ to_year_.isEmpty() ? from_year : toInt( to_year_ ) }; + const int to_month{ to_month_.isEmpty() ? from_month : this->getMonthNumber( to_month_ ) }; + const int to_day{ to_day_.isEmpty() ? from_day : toInt( to_day_ ) }; + + const QString& log_field_1{ this->getDbField( log_field_1_ ) }; + const QString& log_field_2{ this->getDbField( log_field_2_ ) }; + + const int n_months{ this->countMonths( from_year, from_month, to_year, to_month ) }; + + QDateTime time; + + const auto set_date{ + [&time](const auto ...args) + { + time.setDate( QDate(args...) ); } - DialogSec::errDatabaseFailedOpening( this->db_name, err_msg ); + }; - } else { - if ( web_server != "apache" && web_server != "nginx" && web_server != "iis" ) { - // unexpected WebServer - successful &= false; - DialogSec::errGeneric( QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true ); + const auto push_data{ + [&data,&time](const int count) + { + data.emplace_back( time.toMSecsSinceEpoch(), count ); } - int from_year, from_month, from_day, - to_year, to_month, to_day; - if ( successful ) { - // setup period limits - try { - from_year = from_year_.toInt(); - from_month = this->getMonthNumber( from_month_ ); - from_day = from_day_.toInt(); - to_year = ( to_year_.isEmpty() ) ? from_year : to_year_.toInt() ; - to_month = ( to_month_.isEmpty() ) ? from_month : this->getMonthNumber( to_month_ ) ; - to_day = ( to_day_.isEmpty() ) ? from_day : to_day_.toInt() ; - } catch (...) { - // failed to convert to integers - successful &= false; - DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING_DATES.c_str()), true ); + }; + + const auto prev_instant{ + [this](int& y, int& m, int& d) + { + if ( --d < 1 ) { + if ( --m < 1 ) { + m=12; --y; + } + d = this->getMonthDays( y, m ); } } - if ( successful ) { - // build the query statement - QSqlQuery query{ db }; - QString stmt; - QString log_field_1{ this->getDbField( log_field_1_ ) }, - log_field_2{ this->getDbField( log_field_2_ ) }; + }; + const auto next_instant{ + [this](int& y, int& m, int& d) + { + if ( ++d > this->getMonthDays( y, m ) ) { + if ( ++m > 12 ) { + m=1; ++y; + } + d = 1; + } + } + }; - const int n_months{ countMonths( from_year, from_month, to_year, to_month ) }; + int year { from_year }, + month { from_month }; - QDateTime time; - int year { from_year }, - month { from_month }, - day, aux_day, count; + if ( n_months == 1 ) { + // 1 month, no need to loop + QueryWrapper query{ db.getQuery() }; - if ( n_months == 1 ) { - // 1 month, no need to loop - stmt = QString("SELECT \"day\" FROM \"%1\" WHERE \"year\"=%2 AND \"month\"=%3 AND \"day\">=%4 AND \"day\"<=%5") + query << QStringLiteral(R"(SELECT "day" FROM "%1" WHERE "year"=%2 AND "month"=%3 AND "day">=%4 AND "day"<=%5)") .arg( web_server ) .arg( year ).arg( month ) .arg( from_day ).arg( to_day ); - // only select non-NULL values - stmt += QString(" AND \"%1\" IS NOT NULL") - .arg( log_field_1.replace("'","''") ); - // apply a filter if present - if ( ! field_filter_1.isEmpty() ) { - QString filter{ field_filter_1 }; - if ( log_field_1 == "warning" - || log_field_1 == "response" - || log_field_1 == "time_taken" - || log_field_1 == "bytes_sent" - || log_field_1 == "bytes_received" ) { - // numbers - if ( StringOps::isNumeric( field_filter_1.toStdString() ) ) { - // no operator found, set defult to '=' - filter = QString("=%1").arg( field_filter_1 ); - } - stmt += QString(" AND \"%1\"%2") - .arg( log_field_1.replace("'","''"), - filter.replace("'","''") ); + if ( ! field_filter_1.isEmpty() ) { + query << QStringLiteral(R"( AND "%1"%2)").arg( log_field_1, field_filter_1 ); + } - } else { - stmt += QString(" AND \"%1\" LIKE '%2'") - .arg( log_field_1.replace("'","''"), - filter.replace("'","''") ); - } + if ( ! field_filter_2.isEmpty() ) { + query << QStringLiteral(R"( AND "%1"%2)").arg( log_field_2, field_filter_2 ); + } + + query << R"( ORDER BY "day" ASC;)"; + + query(); + + if ( query.size() == 0ul ) { + return; + } + + data.reserve( to_day - from_day ); + + int day{0}, count{0}; + + while ( query->next() ) { + const int next_day{ toInt( query[0] ) }; + if ( next_day == day ) { + ++ count; + continue; // avoids resetting the count at the end + + } else if ( day > 0 ) { + // any loop-round except the first + set_date( year, month , day ); + push_data( count ); + for ( int d{day+1}; ddb_name, query.lastQuery(), query.lastError().text() ); - - } else if ( ! query.last() ) { - // no days found, append missing days with 0 value - for ( int d{from_day}; d<=to_day; d++ ) { - time.setDate( QDate( year, month , d ) ); - data.push_back( std::make_tuple( time.toMSecsSinceEpoch(), 0 ) ); - } - - } else { - query.first(); - query.previous(); - - try { - data.reserve( to_day - from_day ); - // get query data - day = count = 0; - while ( query.next() ) { - aux_day = query.value(0).toInt(); - if ( aux_day == day ) { - count ++; - } else { - if ( day > 0 ) { - // any loop-round except the first - time.setDate( QDate( year, month , day ) ); - data.push_back( std::make_tuple( time.toMSecsSinceEpoch(), count ) ); - for ( int d{day+1}; d getMonthDays( y, m ) ) { - d = 1; - m ++; - if ( m > 12 ) { - m = 1; - y ++; - } - } - time.setDate( QDate( y, m , d ) ); - data.push_back( std::make_tuple( time.toMSecsSinceEpoch(), 0 ) ); - } - } - day = aux_day; - count = 1; - } - } - // append the last count - time.setDate( QDate( year, month , day ) ); - data.push_back( std::make_tuple( time.toMSecsSinceEpoch(), count ) ); - // append any missing day from the last found until 1 day before the last one - day++; - if ( day > getMonthDays( year, month ) ) { - month ++; - if ( month > 12 ) { - month = 1; - year ++; - } - day = getMonthDays( year, month ); - } - to_day += 2; - if ( to_day > getMonthDays( year, month ) ) { - int m{ month + 1 }, - y{ year }; - if ( m > 12 ) { - m = 1; - y ++; - } - to_day = getMonthDays( y, m ); - } - for ( ; day!=to_day; day++ ) { - if ( day > getMonthDays( year, month ) ) { - day = 1; - month ++; - if ( month > 12 ) { - month = 1; - year ++; - } - } - time.setDate( QDate( year, month , day ) ); - data.push_back( std::make_tuple( time.toMSecsSinceEpoch(), 0 ) ); - } - } catch (...) { - // something failed - successful &= false; - DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING.c_str()), true ); - } - } - } else { - data.reserve( countDays( from_year, from_month, from_day, to_year, to_month, to_day ) ); - for ( int m{1}; m<=n_months; m++ ) { - stmt = QString("SELECT \"day\" FROM \"%1\" WHERE \"year\"=%2 AND \"month\"=%3") + // day == 0 only in the first round of the loop + // append any missing day from 1 day before the first until the next found + int d{ from_day }, m{ month }, y{ year }; + prev_instant( y, m, d ); + while ( d!=next_day ) { + set_date( y, m , d ); + push_data( 0 ); + next_instant( y, m, d ); + } + } + day = next_day; + count = 1; + } + // append the last count + set_date( year, month , day ); + push_data( count ); + // append any missing day from the last found until 1 day after the last one + next_instant( year, month, day ); + int max_day{ to_day }, max_month{ to_month }, max_year{ to_year }; + next_instant( max_year, max_month, max_day ); + while ( year<=max_year && month<=max_month && day<=max_day ) { + set_date( year, month , day ); + push_data( 0 ); + next_instant( year, month, day ); + } + + + } else { + data.reserve( this->countDays( from_year, from_month, from_day, to_year, to_month, to_day ) ); + bool no_data{ true }; + + const QString query_filters{ QStringLiteral("%1%2").arg( + !field_filter_1.isEmpty() ? QStringLiteral(R"( AND "%1"%2)").arg( log_field_1, field_filter_1 ) : QString(), + !field_filter_2.isEmpty() ? QStringLiteral(R"( AND "%1"%2)").arg( log_field_2, field_filter_2 ) : QString()) + }; + + for ( int m{1}; m<=n_months; ++m ) { + + QueryWrapper query{ db.getQuery() }; + + query << QStringLiteral(R"(SELECT "day" FROM "%1" WHERE "year"=%2 AND "month"=%3)") .arg( web_server ) .arg( year ).arg( month ); - if ( m == 1 ) { - // first month, only get the day from the beginning day - stmt += QString(" AND \"day\">=%1").arg( from_day ); - } else if ( m == n_months ) { - // last month, only get the days until the ending day - stmt += QString(" AND \"day\"<=%1").arg( to_day ); - } + if ( m == 1 ) { + // first month, only get the day from the beginning day + query << QStringLiteral(R"( AND "day">=%1)").arg( from_day ); + } else if ( m == n_months ) { + // last month, only get the days until the ending day + query << QStringLiteral(R"( AND "day"<=%1)").arg( to_day ); + } - // only select non-NULL values - stmt += QString(" AND \"%1\" IS NOT NULL") - .arg( log_field_1.replace("'","''") ); - // apply a filter if present - if ( ! field_filter_1.isEmpty() ) { - QString filter = field_filter_1; - if ( log_field_1 == "warning" - || log_field_1 == "response" - || log_field_1 == "time_taken" - || log_field_1 == "bytes_sent" - || log_field_1 == "bytes_received" ) { - // numbers - if ( StringOps::isNumeric( field_filter_1.toStdString() ) ) { - // no operator found, set defult to '=' - filter = QString("=%1").arg( field_filter_1 ); - } - stmt += QString(" AND \"%1\"%2") - .arg( log_field_1.replace("'","''"), - filter.replace("'","''") ); + if ( ! query_filters.isEmpty() ) { + query << query_filters; + } - } else { - stmt += QString(" AND \"%1\" LIKE '%2'") - .arg( log_field_1.replace("'","''"), - filter.replace("'","''") ); + query << R"( ORDER BY "day" ASC;)"; + + query(); + + if ( query.size() == 0ul ) { + // no data found for this month, append missing days with 0 value + const int max_d{ m==n_months ? to_day : this->getMonthDays( year, month ) }; + int d{ m==1 ? from_day : 1 }; + for ( ; d<=max_d; ++d ) { + set_date( year, month , d ); + push_data( 0 ); + } + + } else { + no_data &= false; + + int day{0}, count{0}; + while ( query->next() ) { + const int next_day{ toInt( query[0] ) }; + if ( next_day == day ) { + ++ count; + continue; // avoids resetting the count at the end + + } else if ( day > 0 ) { + // any loop-round except the first + set_date( year, month, day++ ); + push_data( count ); + while ( daydb_name, query.lastQuery(), query.lastError().text() ); } else { - try { - if ( ! query.last() ) { - // no days found, append missing days with 0 value - int f_d{ 1 }, - t_d{ getMonthDays( year, month ) }; - if ( m == 1 ) { - // first month, only get the day from the beginning day - f_d = from_day; - } else if ( m == n_months ) { - // last month, only get the days until the ending day - t_d = to_day; - } - for ( ; f_d<=t_d; f_d++ ) { - time.setDate( QDate( year, month , f_d ) ); - data.push_back( std::make_tuple( time.toMSecsSinceEpoch(), 0 ) ); - } - - } else { - query.first(); - query.previous(); - // get query data - day = count = 0; - while ( query.next() ) { - aux_day = query.value(0).toInt(); - if ( aux_day == day ) { - count ++; - } else { - if ( day > 0 ) { - // any loop-round except the first - time.setDate( QDate( year, month , day ) ); - data.push_back( std::make_tuple( time.toMSecsSinceEpoch(), count ) ); - for ( int d{day+1}; d 0 ) { - time.setDate( QDate( year, month , day ) ); - data.push_back( std::make_tuple( time.toMSecsSinceEpoch(), count ) ); - } - // append any missing day to the end of the month with a zero value - for ( int d{day+1}; d<=getMonthDays(year,month); d++ ) { - time.setDate( QDate( year, month , d ) ); - data.push_back( std::make_tuple( time.toMSecsSinceEpoch(), 0 ) ); - } - } - // increase the month - month ++; - if ( month > 12 ) { - month = 1; - year ++; - } - } catch (...) { - // something failed - successful &= false; - DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING.c_str()), true ); - break; + // day == 0 only in the first round of the loop + // append any missing day until one before the next day with a zero value + int d{ m==1 ? from_day : 2 }, m{ month }, y{ year }; + prev_instant( y, m, d ); + while ( y<=year && m<=month && d 12 ) { - month = 1; - year ++; + // append the last count + if ( day > 0 ) { + set_date( year, month , day ); + push_data( count ); } - time.setDate( QDate( year, month , day ) ); - data.push_back( std::make_tuple( time.toMSecsSinceEpoch(), 0 ) ); + // append any missing day up to the last one with a zero value + const int max_d{ m==n_months ? to_day : this->getMonthDays( year, month ) }; + int d{ day>0 ? day : 1 }, m{ month }, y{ year }; + while ( y<=year && m<=month && d<=max_d ) { + set_date( y, m, d ); + push_data( 0 ); + next_instant( y, m, d ); + } + } + // increase the month + if ( ++month > 12 ) { + month = 1; + ++year; } } - } - if ( db.isOpen() ) { - db.close(); + if ( no_data ) { + return; + } + // append one day after the last one + int day{ to_day }; + next_instant( year, month, day ); + set_date( year, month , day ); + push_data( 0 ); } - if ( successful ) { - if ( data.capacity() > data.size() ) { - data.shrink_to_fit(); - } - result.emplace( data ); + if ( data.capacity() > data.size() ) { + data.shrink_to_fit(); } + + result.emplace( std::move(data) ); } -bool DbQuery::getGlobalCounts( const QString& web_server, const std::map>>& dates, std::vector>& recurs, std::tuple& traf_date, std::unordered_map& traf_day, std::unordered_map& traf_hour, std::vector& perf_time, std::vector& perf_sent, std::vector& perf_receiv, long& req_count ) const +void DbQuery::getGlobalCounts( std::optional& result, QStringView web_server, const stats_dates_t& dates ) const { - bool successful{ true }; + DatabaseWrapper db{ DatabaseHandler::get( DatabaseType::Data, DB_READONLY ) }; - QSqlDatabase db; - if ( QSqlDatabase::contains("qt_sql_default_connection") ) { - db = QSqlDatabase::database("qt_sql_default_connection"); - } else { - db = QSqlDatabase::addDatabase("QSQLITE"); - } - db.setDatabaseName( QString::fromStdString( this->db_path )); + db.open( this->db_path, this->dialog_level==DL_EXPLANATORY ); - if ( ! CheckSec::checkDatabaseFile( db_path, db_name ) ) { - successful &= false; + bool no_data{ true }; + int max_date_year, max_date_month, max_date_day; + double n_days{0.0}; + size_t max_date_count{0}; + std::array week_days_count{ 0, 0, 0, 0, 0, 0, 0 }; - } else if ( ! db.open() ) { - // error opening database - successful &= false; - QString err_msg; - if ( this->dialog_level == 2 ) { - err_msg = db.lastError().text(); - } - DialogSec::errDatabaseFailedOpening( this->db_name, err_msg ); + GlobalsData data; - } else { - if ( web_server != "apache" && web_server != "nginx" && web_server != "iis" ) { - // unexpected WebServer - successful &= false; - DialogSec::errGeneric( QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true ); - } - } + const auto week_day_from{ + [](const int y, const int m, const int d)->size_t + { return static_cast( QDate(y,m,d).dayOfWeek()-1 ); } + }; - if ( successful ) { - QSqlQuery query{ db }; - int d, h, tt, bs, br, - day, hour, week_day, - max_tt{0}, tot_tt{0}, num_tt{0}, - max_bs{0}, tot_bs{0}, num_bs{0}, - max_br{0}, tot_br{0}, num_br{0}, - n_days{0}; - unsigned day_count, hour_count, max_date_count{0}; - QString protocol, method, uri, user_agent, max_date_str; - std::unordered_map num_day_count{ - {1,0}, {2,0}, {3,0}, {4,0}, {5,0}, {6,0}, {7,0} }; - // get years - for ( const auto& [year, dates_] : dates ) { - // get months of the year - for ( const auto& [month, dates__] : dates_ ) { - - hour=-1; hour_count=0; - day=-1; day_count=0; - - if ( ! query.exec( QString("SELECT \"day\",\"hour\",\"protocol\",\"method\",\"uri\",\"user_agent\",\"time_taken\",\"bytes_sent\",\"bytes_received\" FROM \"%1\" WHERE \"year\"=%2 AND \"month\"=%3 ORDER BY \"day\",\"hour\" ASC;") - .arg( web_server ).arg( year ).arg( month ).replace("'","''") ) ) { - // error querying database - successful &= false; - DialogSec::errDatabaseFailedExecuting( this->db_name, query.lastQuery(), query.lastError().text() ); - break; - - } else if ( query.last() ) { - query.first(); - query.previous(); - - while ( query.next() ) { - try { - // day - if ( query.value(0).isNull() ) { - d = -1; - } else { - d = query.value(0).toInt(); - } - // hour - if ( query.value(1).isNull() ) { - h = -1; - } else { - h = query.value(1).toInt(); - } - // protocol - if ( query.value(2).isNull() ) { - protocol.clear(); - } else { - protocol = query.value(2).toString(); - } - // method - if ( query.value(3).isNull() ) { - method.clear(); - } else { - method = query.value(3).toString(); - } - // uri - if ( query.value(4).isNull() ) { - uri.clear(); - } else { - uri = query.value(4).toString(); - } - // user agent - if ( query.value(5).isNull() ) { - user_agent.clear(); - } else { - user_agent = query.value(5).toString(); - } - // time taken - if ( query.value(6).isNull() ) { - tt = -1; - } else { - tt = query.value(6).toInt(); - } - // bytes sent - if ( query.value(7).isNull() ) { - bs = -1; - } else { - bs = query.value(7).toInt(); - } - // bytes received - if ( query.value(8).isNull() ) { - br = -1; - } else { - br = query.value(8).toInt(); - } - } catch (...) { - // failed to convert to integer - successful &= false; - QString err_msg; - if ( this->dialog_level == 2 ) { - err_msg = TR::tr(this->MSG_ERR_PROCESSING.c_str()); - } - DialogSec::errGeneric( err_msg ); - break; - } - if ( successful ) { - - // process the day count - if ( d > 0 ) { - if ( day == -1 ) { - day = d; - } - if ( d == day ) { - day_count ++; - } else { - n_days ++; - // sum the day count to the total count - req_count += day_count; - // sum the day count to the relative day of the week count - week_day = QDate(year,month,day).dayOfWeek(); - traf_day.at( week_day ) += day_count; - num_day_count.at( week_day ) ++; - // check the max date count - const QString m_str{ (month<10) ? QString("0%1").arg(month) : QString("%1").arg(month) }; - const QString d_str{ (day<10) ? QString("0%1").arg(day) : QString("%1").arg(day) }; - if ( day_count > max_date_count ) { - max_date_count = day_count; - max_date_str = QString("%1-%2-%3").arg( year ).arg( m_str, d_str ); - } - day_count = 1; - day = d; - } - } - - // process the hour count - if ( h >= 0 ) { - if ( hour == -1 ) { - hour = h; - } - if ( h == hour ) { - hour_count ++; - } else { - traf_hour.at( hour ) += hour_count; - hour_count = 1; - hour = h; - } - } - - // sum the time taken - if ( tt >= 0 ) { - if ( tt > max_tt ) { - max_tt = tt; - } - tot_tt += tt; - num_tt ++; - } - - // sum the bytes sent - if ( bs >= 0 ) { - if ( bs > max_bs ) { - max_bs = bs; - } - tot_bs += bs; - num_bs ++; - } - - // sum the bytes received - if ( br >= 0 ) { - if ( br > max_br ) { - max_br = br; - } - tot_br += br; - num_br ++; - } - - // process the protocol - if ( ! protocol.isEmpty() ) { - recurs.at( 0 )[ protocol ] ++; - } - - // process the method - if ( ! method.isEmpty() ) { - recurs.at( 1 )[ method ] ++; - } - - // process the uri - if ( ! uri.isEmpty() ) { - recurs.at( 2 )[ uri ] ++; - } - - // process the user-agent - if ( ! user_agent.isEmpty() ) { - recurs.at( 3 )[ user_agent ] ++; - } - } + const auto update_perf{ + [](Perfs& perf, const int val) + { + if ( val >= 0 ) { + if ( const size_t v{static_cast(val)}; v > 0ul) [[likely]] { + if ( v > perf.max ) { + perf.max = v; } - // complete the remaining stats - if ( successful ) { - // append the last hour - if ( hour >= 0 ) { - traf_hour.at( hour ) += hour_count; - } + perf.total += v; + } + ++ perf.count; + } + } + }; + for ( const auto& [year, dates_] : dates ) { + for ( const auto& [month, dates__] : dates_ ) { + + int d{-1}, h{-1}, tt{-1}, bs{-1}, br{-1}, + day{-1}, hour{-1}; + double hour_count{0}; + size_t day_count{0}; + QString protocol, method, uri, user_agent; + + QueryWrapper query{ db.getQuery() }; + + query( QStringLiteral(R"(SELECT "day","hour","protocol","method","uri","user_agent","time_taken","bytes_sent","bytes_received" FROM "%1" WHERE "year"=%2 AND "month"=%3 ORDER BY "day","hour" ASC;)") + .arg( web_server ) + .arg( year ).arg( month ) ); + + if ( query.size() == 0ul ) { + // no data in this month + continue; + } + no_data &= false; + + while ( query->next() ) { + + // day + if ( ! query[0].isNull() ) { + d = toInt( query[0] ); + } + // hour + if ( ! query[1].isNull() ) { + h = toInt( query[1] ); + } + // protocol + if ( ! query[2].isNull() ) { + protocol = toString( query[2] ); + } + // method + if ( ! query[3].isNull() ) { + method = toString( query[3] ); + } + // uri + if ( ! query[4].isNull() ) { + uri = toString( query[4] ); + } + // user agent + if ( ! query[5].isNull() ) { + user_agent = toString( query[5] ); + } + // time taken + if ( ! query[6].isNull() ) { + tt = toInt( query[6] ); + } + // bytes sent + if ( ! query[7].isNull() ) { + bs = toInt( query[7] ); + } + // bytes received + if ( ! query[8].isNull() ) { + br = toInt( query[8] ); + } + + // process the day count + if ( d > 0 ) { + if ( day == -1 ) { + day = d; + } + if ( d == day ) { + ++ day_count; + } else { + ++ n_days; // sum the day count to the total count - req_count += day_count; - + data.req_count += day_count; // sum the day count to the relative day of the week count - week_day = QDate(year,month,day).dayOfWeek(); - traf_day.at( week_day ) += day_count; - num_day_count.at( week_day ) ++; - + const size_t week_day{ week_day_from(year,month,day) }; + data.traf.day[ week_day ] += static_cast(day_count); + ++ week_days_count[ week_day ]; // check the max date count - const QString m_str{ (month<10) ? QString("0%1").arg(month) : QString("%1").arg(month) }; - const QString d_str{ (day<10) ? QString("0%1").arg(day) : QString("%1").arg(day) }; if ( day_count > max_date_count ) { max_date_count = day_count; - max_date_str = QString("%1-%2-%3").arg( year ).arg( m_str, d_str ); + max_date_year = year; + max_date_month = month; + max_date_day = day; } + day_count = 1; + day = d; } } - query.finish(); - if ( ! successful ) { break; } + + // process the hour count + if ( h >= 0 ) { + if ( hour == -1 ) { + hour = h; + } + if ( h == hour ) { + ++ hour_count; + } else { + data.traf.hour[ hour ] += hour_count; + hour_count = 1; + hour = h; + } + } + + // sum the time taken + update_perf( data.perf.time_taken, tt ); + + // sum the bytes sent + update_perf( data.perf.bytes_sent, bs ); + + // sum the bytes received + update_perf( data.perf.bytes_recv, br ); + + // process the protocol + if ( ! protocol.isEmpty() ) { + ++ data.recurs.protocol[ protocol ]; + } + + // process the method + if ( ! method.isEmpty() ) { + ++ data.recurs.method[ method ]; + } + + // process the uri + if ( ! uri.isEmpty() ) { + ++ data.recurs.uri[ uri ]; + } + + // process the user-agent + if ( ! user_agent.isEmpty() ) { + ++ data.recurs.user_agent[ user_agent ]; + } + } + + // complete the remaining stats + + // append the last hour + if ( hour >= 0 ) { + data.traf.hour[ hour ] += hour_count; + } + + // sum the day count to the total count + data.req_count += day_count; + + // sum the day count to the relative day of the week count + const size_t week_day{ week_day_from(year,month,day) }; + data.traf.day[ week_day ] += static_cast(day_count); + ++ week_days_count[ week_day ]; + + // check the max date count + if ( day_count > max_date_count ) { + max_date_count = day_count; + max_date_year = year; + max_date_month = month; + max_date_day = day; } - if ( ! successful ) { break; } } + } + if ( no_data ) { + return; + } - // final process for some of the values - if ( successful ) { + // finally process some of the values - // process the hours of the day - for ( int i{0}; i<24; i++ ) { - if ( n_days > 0 ) { - traf_hour.at( i ) /= n_days; - } - } + // process the hours of the day + if ( n_days > 0.0 ) { + std::transform( data.traf.hour.cbegin(), data.traf.hour.cend(), data.traf.hour.begin(), + [n_days](const double count){ return count / n_days; } ); + } - // process the day of the week - for ( int i{1}; i<8; i++ ) { - const int& x{ num_day_count.at( i ) }; - if ( x > 0 ) { - traf_day.at( i ) /= x; - } - } - - // make the max-date tuple - traf_date = std::make_tuple( max_date_str, max_date_count ); - - // time-taken perfs - perf_time = { max_tt, tot_tt, num_tt }; - // bytes-sent perfs - perf_sent = { max_bs, tot_bs, num_bs }; - // bytes-received perfs - perf_receiv = { max_br, tot_br, num_br }; + // process the day of the week + /*std::ranges::for_each( std::views::zip( data.traf.day, week_days_count ), + [](auto tc){ if (auto& [t,c]{tc}; c>0.0){ t/=c; } });*/ + for ( auto [total,count] : ArrayOps::zip( data.traf.day, week_days_count ) ) { + if ( count > 0.0 ) { + total /= count; } } - return successful; + // make the max-date tuple + data.traf.date = std::make_tuple( + PrintSec::printableDate( max_date_year, max_date_month, max_date_day ), + QString::number( max_date_count ) ); + + result.emplace( std::move(data) ); } diff --git a/logdoctor/modules/crapview/modules/query.h b/logdoctor/modules/crapview/modules/query.h index 7b5254d9..0d78e449 100644 --- a/logdoctor/modules/crapview/modules/query.h +++ b/logdoctor/modules/crapview/modules/query.h @@ -1,59 +1,66 @@ -#ifndef LOGDOCTOR__CRAPVIEW__QUERY_H -#define LOGDOCTOR__CRAPVIEW__QUERY_H +#ifndef LOGDOCTOR__CRAPVIEW__MODULES__QUERY_H +#define LOGDOCTOR__CRAPVIEW__MODULES__QUERY_H +#include "lib.h" + +#include "main_lib.h" #include "modules/shared.h" +#include "modules/crapview/lib.h" + #include #include -#define DATA_TYPEDEFS\ - using stats_dates_t = std::map>>>;\ - using stats_warn_items_t = std::vector>>>;\ - using stats_speed_items_t = std::vector>>;\ - using stats_day_items_t = std::unordered_map>;\ - using stats_relat_items_t = std::vector>;\ - using stats_count_items_t = std::multimap; - -class DbQuery +class DbQuery final { - DATA_TYPEDEFS + CRAPVIEW_DATA_TYPEDEFS public: - // convert log fields IDs to log fields - const std::unordered_map FIELDS{ - {0, FIELDS__WARNING}, - {10,FIELDS__PROTOCOL}, {11,FIELDS__METHOD}, - {12,FIELDS__URI}, {13,FIELDS__QUERY}, {14,FIELDS__RESPONSE_CODE}, - {15,FIELDS__TIME_TAKEN}, {16,FIELDS__BYTES_SENT}, {17,FIELDS__BYTES_RECEIVED}, - {18,FIELDS__REFERRER}, {22,FIELDS__COOKIE}, - {20,FIELDS__CLIENT}, {21,FIELDS__USER_AGENT} }; + explicit DbQuery() noexcept {} + Q_DISABLE_COPY_MOVE(DbQuery) + + // log fields enums to log fields strings + const std::unordered_map FIELDS{ + {LogField::Warning, FIELDS__WARNING}, + {LogField::Protocol, FIELDS__PROTOCOL}, + {LogField::Method, FIELDS__METHOD}, + {LogField::Uri, FIELDS__URI}, + {LogField::Query, FIELDS__QUERY}, + {LogField::ResponseCode, FIELDS__RESPONSE_CODE}, + {LogField::TimeTaken, FIELDS__TIME_TAKEN}, + {LogField::BytesSent, FIELDS__BYTES_SENT}, + {LogField::BytesReceived, FIELDS__BYTES_RECEIVED}, + {LogField::Referrer, FIELDS__REFERRER}, + {LogField::Cookie, FIELDS__COOKIE}, + {LogField::Client, FIELDS__CLIENT}, + {LogField::UserAgent, FIELDS__USER_AGENT} }; // convert month numbers to month names const std::unordered_map MONTHS{ - {1, MONTHS__JANUARY}, {2, MONTHS__FEBRUARY}, {3, MONTHS__MARCH}, - {4, MONTHS__APRIL}, {5, MONTHS__MAY}, {6, MONTHS__JUNE}, - {7, MONTHS__JULY}, {8, MONTHS__AUGUST}, {9, MONTHS__SEPTEMBER}, - {10,MONTHS__OCTOBER}, {11,MONTHS__NOVEMBER}, {12,MONTHS__DECEMBER} }; + {1, MONTHS__JANUARY}, {2, MONTHS__FEBRUARY}, {3, MONTHS__MARCH}, + {4, MONTHS__APRIL}, {5, MONTHS__MAY}, {6, MONTHS__JUNE}, + {7, MONTHS__JULY}, {8, MONTHS__AUGUST}, {9, MONTHS__SEPTEMBER}, + {10,MONTHS__OCTOBER}, {11,MONTHS__NOVEMBER}, {12,MONTHS__DECEMBER} }; // convert week-day numbers to day names const std::unordered_map DAYS{ - {1, DAYS__SUNDAY}, {2, DAYS__MONDAY}, {3, DAYS__TUESDAY}, - {4, DAYS__WEDNESDAY}, {5, DAYS__THURSDAY}, {6, DAYS__FRIDAY}, - {7, DAYS__SATURDAY} }; + {1, DAYS__MONDAY}, {2, DAYS__TUESDAY}, {3, DAYS__WEDNESDAY}, + {4, DAYS__THURSDAY}, {5, DAYS__FRIDAY}, {6, DAYS__SATURDAY}, + {7, DAYS__SUNDAY} }; //! Returns the Dialogs level - void setDialogLevel( const int new_level ); + void setDialogLevel( const DialogsLevel new_level ) noexcept; //! Sets the path for the logs Collection database /*! \see Crapview::setDbPath() */ - void setDbPath( const std::string& path ); + void setDbPath( std::string&& path ) noexcept; /*const std::string getDbPath( const int web_server );*/ @@ -65,33 +72,26 @@ public: \param to_year The final Year \param to_month The final month \return The number of months in the period + \throw ConversionException \throw DateTimeException */ int countMonths( - const QString& from_year, - const QString& from_month, - const QString& to_year, - const QString& to_month + QStringView from_year, + QStringView from_month, + QStringView to_year, + QStringView to_month ) const; //! Refreshes the dates which are available in the database /*! \param result Holds the data only if the operation completed succssfully + \throw VoidException + \throw ConversionException */ - void refreshDates( std::optional& result ); + void refreshDates( std::optional& result ) noexcept; - //! Updates the database applying the changes made in the Warnings statistics table - /*! - \param web_server The ID of the Web Server to use - \param updates The list of rowids to update and the corresponding warning values - */ - void updateWarnings( - const QString& web_server, - const std::vector>& updates - ) const; - //! Retrieves the data needed for the Warnings statistics /*! \param result Holds the data only if the operation completed succssfully @@ -100,14 +100,17 @@ public: \param month_ The month \param day_ The day \param hour_ The hour + \throw VoidException + \throw ConversionException + \throw DateTimeException */ - void getWarnCounts( + void getWarningsData( std::optional& result, - const QString& web_server, - const QString& year_, - const QString& month_, - const QString& day_, - const QString& hour_ + QStringView web_server, + QStringView year_, + QStringView month_, + QStringView day_, + QStringView hour_ ) const; @@ -123,18 +126,22 @@ public: \param uri_f The filter for the URI field \param query_f The filter for the Query field \param response_f The filter for the Response field + \throw VoidException + \throw CrapviewException + \throw ConversionException + \throw DateTimeException */ void getSpeedData( std::optional& result, - const QString& web_server, - const QString& year_, - const QString& month_, - const QString& day_, - const QString& protocol_f, - const QString& method_f, - const QString& uri_f, - const QString& query_f, - const QString& response_f + QStringView web_server, + QStringView year_, + QStringView month_, + QStringView day_, + QStringView protocol_f, + QStringView method_f, + QStringView uri_f, + QStringView query_f, + QStringView response_f ) const; @@ -146,14 +153,17 @@ public: \param month The month \param day The day \param log_field The log field + \throw VoidException + \throw CrapviewException + \throw DateTimeException */ void getItemsCount( std::optional& result, - const QString& web_server, - const QString& year, - const QString& month, - const QString& day, - const QString& log_field + QStringView web_server, + QStringView year, + QStringView month, + QStringView day, + QStringView log_field ) const; @@ -169,13 +179,17 @@ public: \param to_day_ The final day \param log_field_ The log field to filter \param field_filter The filter to apply + \throw VoidException + \throw CrapviewException + \throw ConversionException + \throw DateTimeException */ void getDaytimeCounts( std::optional& result, - const QString& web_server, - const QString& from_year_, const QString& from_month_, const QString& from_day_, - const QString& to_year_, const QString& to_month_, const QString& to_day_, - const QString& log_field_, const QString& field_filter + QStringView web_server, + QStringView from_year_, QStringView from_month_, QStringView from_day_, + QStringView to_year_, QStringView to_month_, QStringView to_day_, + const LogField log_field_, QStringView field_filter ) const; @@ -191,14 +205,18 @@ public: \param field_filter_1 The filter to apply to the first field \param log_field_2_ The second log field to filter \param field_filter_2 The filter to apply to the second fiend + \throw VoidException + \throw CrapviewException + \throw ConversionException + \throw DateTimeException \see getRelationalCountsPeriod() */ void getRelationalCountsDay( std::optional& result, - const QString& web_server, - const QString& year_, const QString& month_, const QString& day_, - const QString& log_field_1_, const QString& field_filter_1, - const QString& log_field_2_, const QString& field_filter_2 + QStringView web_server, + QStringView year_, QStringView month_, QStringView day_, + const LogField log_field_1_, QStringView field_filter_1, + const LogField log_field_2_, QStringView field_filter_2 ) const; //! Retrieves the data needed for the Relational statistics @@ -216,43 +234,35 @@ public: \param field_filter_1 The filter to apply to the first field \param log_field_2_ The second log field to filter \param field_filter_2 The filter to apply to the second fiend + \throw VoidException + \throw CrapviewException + \throw ConversionException + \throw DateTimeException \see getRelationalCountsDay() */ void getRelationalCountsPeriod( std::optional& result, - const QString& web_server, - const QString& from_year_, const QString& from_month_, const QString& from_day_, - const QString& to_year_, const QString& to_month_, const QString& to_day_, - const QString& log_field_1_, const QString& field_filter_1, - const QString& log_field_2_, const QString& field_filter_2 + QStringView web_server, + QStringView from_year_, QStringView from_month_, QStringView from_day_, + QStringView to_year_, QStringView to_month_, QStringView to_day_, + const LogField log_field_1_, QStringView field_filter_1, + const LogField log_field_2_, QStringView field_filter_2 ) const; //! Retrieves the data needed for the Global statistics /*! + \param result Holds the data only if the operation completed succssfully \param web_server The ID of the Web Server to use \param dates The dates to query - \param recurs Will hold the recurrencies of the items - \param traf_date Will hold the most trafficked date and the count - \param traf_day Will hold the most trafficked day of the week and the count - \param traf_hour Will hold the most trafficked hour of the day and the count - \param perf_time Will hold the overallo time taken - \param perf_sent Will hold the overall Bytes sent - \param perf_receiv Will hold the overall Bytes received - \param req_count Will hold the number of requests examined by the query - \return Whether the operation has been successful or not + \throw VoidException + \throw CrapviewException + \throw ConversionException */ - bool getGlobalCounts( - const QString& web_server, - const std::map>>& dates, - std::vector>& recurs, - std::tuple& traf_date, - std::unordered_map& traf_day, - std::unordered_map& traf_hour, - std::vector& perf_time, - std::vector& perf_sent, - std::vector& perf_receiv, - long& req_count + void getGlobalCounts( + std::optional& result, + QStringView web_server, + const stats_dates_t& dates ) const; @@ -270,36 +280,43 @@ private: const std::string MSG_TABLE_NAME{ TR::tr("Database table name").toStdString() }; // quantity of information to display throught dialogs - int dialog_level{ 2 }; // 0: essential, 1: usefull, 2: explanatory + DialogsLevel dialog_level{ DL_NORMAL }; std::string db_path; QString db_name; // convert log fields to database fields - const std::unordered_map LogFields_to_DbFields{ - {this->FIELDS.at( 0), "warning"}, - {this->FIELDS.at(10), "protocol"}, - {this->FIELDS.at(11), "method"}, - {this->FIELDS.at(12), "uri"}, - {this->FIELDS.at(13), "query"}, - {this->FIELDS.at(14), "response"}, - {this->FIELDS.at(15), "time_taken"}, - {this->FIELDS.at(16), "bytes_sent"}, - {this->FIELDS.at(17), "bytes_received"}, - {this->FIELDS.at(18), "referrer"}, - {this->FIELDS.at(20), "client"}, - {this->FIELDS.at(21), "user_agent"}, - {this->FIELDS.at(22), "cookie"} + const std::unordered_map LogFields_to_DbFields{ + {LogField::Warning, "warning"}, + {LogField::Protocol, "protocol"}, + {LogField::Method, "method"}, + {LogField::Uri, "uri"}, + {LogField::Query, "query"}, + {LogField::ResponseCode, "response"}, + {LogField::TimeTaken, "time_taken"}, + {LogField::BytesSent, "bytes_sent"}, + {LogField::BytesReceived, "bytes_received"}, + {LogField::Referrer, "referrer"}, + {LogField::Client, "client"}, + {LogField::UserAgent, "user_agent"}, + {LogField::Cookie, "cookie"} }; + //! Returns the database field corresponding to the relative log field + /*! + \param fld The log field + \return The database field + \throw CrapviewException + */ + const QString& getDbField( const LogField fld ) const; + //! Returns the database field corresponding to the relative log field /*! \param tr_fld The log field, hendles translated text \return The database field + \throw CrapviewException */ - QString getDbField( const QString& tr_fld ) const; - - /*const int getLogFieldID ( const QString& field_str );*/ + const QString& getDbField( QStringView tr_fld ) const; //! Returns the minute gap for the given minute with the given gap @@ -325,8 +342,9 @@ private: /*! \param month_str The month \return The month number + \throw DateTimeException */ - int getMonthNumber( const QString& month_str ) const; + int getMonthNumber( QStringView month_str ) const; //! Returns the number of days in a given period @@ -342,7 +360,8 @@ private: */ static int countDays( const int from_year, const int from_month, const int from_day, - const int to_year, const int to_month, const int to_day ); + const int to_year, const int to_month, const int to_day + ); //! Returns the number of months in a given period @@ -355,8 +374,9 @@ private: */ static int countMonths( const int from_year, const int from_month, - const int to_year, const int to_month ); + const int to_year, const int to_month + ) noexcept; }; -#endif // LOGDOCTOR__CRAPVIEW__QUERY_H +#endif // LOGDOCTOR__CRAPVIEW__MODULES__QUERY_H diff --git a/logdoctor/modules/database/database.cpp b/logdoctor/modules/database/database.cpp new file mode 100644 index 00000000..50669f06 --- /dev/null +++ b/logdoctor/modules/database/database.cpp @@ -0,0 +1,157 @@ + +#include "database.h" + +#include "globals/db_names.h" + +#include "modules/dialogs.h" + +#include "utilities/checks.h" + +#include + +#include + + +////////////////////////// +//// DATABASE WRAPPER //// +////////////////////////// + +DatabaseWrapper::DatabaseWrapper( const QString& database, const QString& name, const bool readonly ) + : db{ QSqlDatabase::database( database, false ) } + , db_name{ name } + , ongoing_transaction{ false } +{ + if ( readonly ) { + this->db.setConnectOptions( QStringLiteral("QSQLITE_OPEN_READONLY=1") ); + } +} + +DatabaseWrapper::~DatabaseWrapper() +{ + if ( this->ongoing_transaction ) { + std::cerr << "LogDoctor: DatabaseWrapper: Instance destroyed whithin ongoing transaction" << std::endl; + if ( ! this->db.rollback() ) { + std::cerr << "LogDoctor: DatabaseWrapper: Failed to rollback ongoing transaction" << std::endl; + } + } + if ( this->db.isOpen() ) { + this->db.close(); + } +} + +void DatabaseWrapper::open( const std::string& path, const bool explain_err ) +{ + this->db.setDatabaseName( QString::fromStdString( path )); + if ( ! CheckSec::checkDatabaseFile( path, this->db_name ) ) { + throw VoidException(); + } else if ( ! this->db.open() ) { + DialogSec::errDatabaseFailedOpening( this->db_name, explain_err ? this->db.lastError().text() : QString{} ); + throw VoidException(); + } +} + +void DatabaseWrapper::openNew( const std::string& path ) +{ + this->db.setDatabaseName( QString::fromStdString( path )); + if ( ! this->db.open() ) { + DialogSec::errDatabaseFailedOpening( this->db_name, db.lastError().text() ); + throw VoidException(); + } +} + +void DatabaseWrapper::startTransaction(const bool explain_msg, const bool explain_err ) +{ + if ( ! this->db.transaction() ) { + DialogSec::errDatabaseFailedExecuting( + db_name, + explain_msg ? QStringLiteral("db.transaction()") : QString(), + explain_err ? this->db.lastError().text() : QString() ); + throw VoidException(); + } + this->ongoing_transaction |= true; +} + +void DatabaseWrapper::commitTransaction( const bool explain_msg, const bool explain_err ) +{ + if ( ! db.commit() ) { + DialogSec::errDatabaseFailedExecuting( + db_name, + explain_msg ? QStringLiteral("db.commit()") : QString(), + explain_err ? this->db.lastError().text() : QString() ); + throw VoidException(); + } + this->ongoing_transaction &= false; +} + +void DatabaseWrapper::rollbackTransaction( const bool explain_msg, const bool explain_err ) +{ + if ( ! db.rollback() ) { + DialogSec::errDatabaseFailedExecuting( + db_name, + explain_msg ? QStringLiteral("db.rollback()") : QString(), + explain_err ? this->db.lastError().text() : QString() ); + throw VoidException(); + } + this->ongoing_transaction &= false; +} + +QueryWrapper DatabaseWrapper::getQuery() noexcept +{ + return QueryWrapper( *this ); +} + + +/////////////////////// +//// QUERY WRAPPER //// +/////////////////////// + +void QueryWrapper::operator()( const QString& text ) +{ + if ( !query.exec( text ) ) { + DialogSec::errDatabaseFailedExecuting( db_name, query.lastQuery(), query.lastError().text() ); + throw VoidException(); + } +} + +size_t QueryWrapper::size() +{ + if ( !query.last() ) { + return 0ul; + } + const auto sz{ static_cast( query.at()+1 ) }; + if ( !query.first() ) { + throw DatabaseException( QStringLiteral("Failed to move back to first record") ); + } + query.previous(); + return sz; +} + + +////////////////////////// +//// DATABASE HANDLER //// +////////////////////////// + +DatabaseHandler::DatabaseHandler() +{ + QSqlDatabase::addDatabase( "QSQLITE", DatabasesConnections::data ); + QSqlDatabase::addDatabase( "QSQLITE", DatabasesConnections::hashes ); +} + +DatabaseHandler::~DatabaseHandler() +{ + QSqlDatabase::removeDatabase( DatabasesConnections::data ); + QSqlDatabase::removeDatabase( DatabasesConnections::hashes ); +} + +DatabaseWrapper DatabaseHandler::get( const DatabaseType db_type, const bool readonly ) +{ + switch ( db_type ) { + case DatabaseType::Data: + return DatabaseWrapper( DatabasesConnections::data, QString(DatabasesNames::data), readonly ); + case DatabaseType::Hashes: + return DatabaseWrapper( DatabasesConnections::hashes, QString(DatabasesNames::hashes), readonly ); + default: + throw DoNotCatchException( "Unexpected DatabaseType", std::to_string(static_cast(db_type)) ); + } + +} diff --git a/logdoctor/modules/database/database.h b/logdoctor/modules/database/database.h new file mode 100644 index 00000000..6f159c6d --- /dev/null +++ b/logdoctor/modules/database/database.h @@ -0,0 +1,174 @@ +#ifndef LOGDOCTOR__DATABASE_H +#define LOGDOCTOR__DATABASE_H + + +#include "modules/exceptions.h" + +#include +#include +#include + + +class QueryWrapper; + + +//! Represents a database +enum class DatabaseType +{ + Data, + Hashes +}; + + + +//! DatabaseWrapper +/*! + A wrapper around a QSqlDatabase +*/ +class DatabaseWrapper final +{ + QSqlDatabase db; + QString db_name; + bool ongoing_transaction; +public: + explicit DatabaseWrapper( const QString& database, const QString& name, const bool readonly ); + ~DatabaseWrapper(); + Q_DISABLE_COPY_MOVE(DatabaseWrapper) + + //! Returns a pointer to the underlying QSqlDatabase instance + inline QSqlDatabase* operator ->() noexcept + { return &db; } + + //! Returns a reference to the underlying QSqlDatabase instance + inline QSqlDatabase& operator *() noexcept + { return db; } + + //! Returns the name of the database + inline const QString& name() const noexcept + { return db_name; } + + //! Opens the database file at the given path + /*! + Throws if the file cannot be opened or if opening fails + \throw VoidException + */ + void open( const std::string& path, const bool explain_err ); + + //! Opens the database file at the given path + /*! + Used when creating a new database file. + Throws if opening fails. + \throw VoidException + */ + void openNew( const std::string& path ); + + //! Starts an ACID transaction on the database + /*! + Throws in case of failure + \throw VoidException + */ + void startTransaction( const bool explain_msg, const bool explain_err ); + + //! Commits an ongoing transaction + /*! + Throws in case of failure + \throw VoidException + */ + void commitTransaction( const bool explain_msg, const bool explain_err ); + + //! Rolls back an ongoing transaction + /*! + Throws in case of failure + \throw VoidException + */ + void rollbackTransaction( const bool explain_msg, const bool explain_err ); + + //! Returns an instance of a QueryWrapper associated with the database + QueryWrapper getQuery() noexcept; +}; + + + +//! QueryWrapper +/*! + A wrapper around a QSqlQuery, associated with a database +*/ +class QueryWrapper final +{ + QSqlQuery query; + QString stmt; + QString db_name; +public: + explicit QueryWrapper( DatabaseWrapper& db ) + : query{ *db }, db_name{ db.name() } {} + ~QueryWrapper() = default; + Q_DISABLE_COPY_MOVE(QueryWrapper) + + //! Returns a pointer to the underlying QSqlQuery instance + inline QSqlQuery* operator ->() noexcept + { return &query; } + + //! Appends the given text to the internal statement + inline void operator <<( const char* text ) noexcept + { stmt.append(text); } + + //! Appends the given text to the internal statement + inline void operator <<( const QString& text ) noexcept + { stmt.append(text); } + + //! Executes the query using the internal statement + /*! + Throws in case of failure + \throw VoidException + */ + inline void operator ()() + { operator()(stmt); } + + //! Executes the query using the given statement + /*! + Throws in case of failure + \throw VoidException + */ + void operator ()( const QString& text ); + + //! Returns the query value at the given index of the current record + inline QVariant operator []( const int idx ) const noexcept + { return query.value(idx); } + + //! Returns the number of records in the query result + /*! + Throws if the query cannot be restored at the initial position + \throw DatabaseException + */ + size_t size(); + + //! Returns the name of the associated database + const QString& dbName() const noexcept + { return db_name; } +}; + + + +struct DatabaseHandler +{ + DatabaseHandler(); + ~DatabaseHandler(); + Q_DISABLE_COPY_MOVE(DatabaseHandler) + + //! Checks the presence of the QSQLITE driver + inline bool checkDriver() const + { return QSqlDatabase::drivers().contains("QSQLITE"); } + + //! Returns an instance of the requested database + /*! + \param readonly Whether the database whould be initialized in readonly mode + \throw DoNotCatchException + */ + static DatabaseWrapper get( const DatabaseType db_type, const bool readonly=false ); +}; + + +#define DB_READONLY true + + +#endif // LOGDOCTOR__DATABASE_H diff --git a/logdoctor/modules/dialogs.cpp b/logdoctor/modules/dialogs.cpp index bc4e5e40..a1fe96e4 100644 --- a/logdoctor/modules/dialogs.cpp +++ b/logdoctor/modules/dialogs.cpp @@ -13,22 +13,22 @@ void DialogSec::errLangLocaleInvalid( const QString& locale, QWidget* parent ) { DialogMsg dialog{ DialogSec::tr("Invalid locale"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("Unexpected locale format"), locale, DialogSec::tr("If you haven't manually edited the configuration file,\nplease report this issue") ), - "", MsgType::Error, parent }; + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } void DialogSec::errLangNotAccepted( const QString& locale, QWidget* parent ) { DialogMsg dialog{ DialogSec::tr("Invalid locale"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("The given locale is not an accepted language"), locale, DialogSec::tr("If you'd like to have this locale in LogDoctor,\nplease follow the instruction on the repository page") ), - "", MsgType::Error, parent }; + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } @@ -41,11 +41,11 @@ void DialogSec::warnConfFileNotFound( const QString& file, QWidget* parent ) { DialogMsg dialog{ DialogSec::tr("Configuration file not found"), - QString("%1%2\n\n%3").arg( + QStringLiteral("%1%2\n\n%3").arg( DialogSec::tr("Unable to retrieve the configuration file"), (file.isEmpty()) ? file : ":\n"+file, DialogSec::tr("Skipping") ), - "", MsgType::Warning, parent }; + QString(), MsgType::Warning, parent }; std::ignore = dialog.exec(); } @@ -53,7 +53,7 @@ void DialogSec::errConfFailedWriting( const QString& msg, const QString& err, QW { DialogMsg dialog{ DialogSec::tr("Failed to write the configuration file"), - QString("%1%2\n\n%3").arg( + QStringLiteral("%1%2\n\n%3").arg( DialogSec::tr("An error occured while handling the configuration file"), (msg.isEmpty()) ? msg : ":\n"+msg, DialogSec::tr("Current configuration not saved") ), @@ -65,7 +65,7 @@ void DialogSec::errConfFileNotReadable( const QString& file, const QString& err, { DialogMsg dialog{ DialogSec::tr("File not readable"), - QString("%1\n\n%2%3").arg( + QStringLiteral("%1\n\n%2%3").arg( DialogSec::tr("An error occured while handling the configuration file"), DialogSec::tr("The file is not readable"), (file.isEmpty()) ? file : ":\n"+file ), @@ -76,7 +76,7 @@ void DialogSec::errConfFileNotWritable( const QString& file, const QString& err, { DialogMsg dialog{ DialogSec::tr("File not writable"), - QString("%1\n\n%2%3").arg( + QStringLiteral("%1\n\n%2%3").arg( DialogSec::tr("An error occured while handling the configuration file"), DialogSec::tr("The file is not writable"), (file.isEmpty()) ? file : ":\n"+file ), @@ -89,7 +89,7 @@ void DialogSec::errConfDirNotWritable( const QString& dir, const QString& err, Q { DialogMsg dialog{ DialogSec::tr("Directory not writable"), - QString("%1\n\n%2%3").arg( + QStringLiteral("%1\n\n%2%3").arg( DialogSec::tr("An error occured while handling the configuration file"), DialogSec::tr("The directory is not writable"), (dir.isEmpty()) ? dir : ":\n"+dir ), @@ -98,18 +98,43 @@ void DialogSec::errConfDirNotWritable( const QString& dir, const QString& err, Q } -void DialogSec::errFailedApplyingConfigs( const QString& msg, QWidget* parent ) +void DialogSec::errFailedApplyingConfigsItem( const QString& msg, QWidget* parent ) { DialogMsg dialog{ DialogSec::tr("Failed applying configuration"), - QString("%1\n%2").arg( - (msg.isEmpty()) ? msg : QString("%1\n").arg(msg), - DialogSec::tr("Aborting") ), - "", MsgType::Error, parent }; + QStringLiteral("%1\n%2").arg( + (msg.isEmpty()) ? msg : QString(msg).append(QLatin1Char('\n')), + DialogSec::tr("Skipping") ), + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } +void DialogSec::warnInvalidConfigsList( const QStringList& list, QWidget* parent ) +{ + DialogMsg dialog{ + DialogSec::tr("Invalid configuration lines"), + QStringLiteral("%1\n%2").arg( + DialogSec::tr("Has not been possible to apply some of the configurations"), + DialogSec::tr("If you haven't manually edited the configuration file,\nplease report this issue") ), + list.join('\n'), + MsgType::Warning, parent }; + std::ignore = dialog.exec(); +} + + +bool DialogSec::choiceFailedApplyingConfigs( const QString& msg, QWidget* parent ) +{ + DialogBool dialog{ + DialogSec::tr("Failed applying configuration"), + QStringLiteral("%1\n\n%2").arg( + msg, + DialogSec::tr("If you choose to proceed, all of the unapplied configurations will be lost\nContinue?") ), + parent }; + return dialog.exec(); +} + + ////////////// //// HELP //// @@ -118,12 +143,12 @@ void DialogSec::errHelpFailed( const QString& link, const QString& msg, QWidget* { DialogMsg dialog{ DialogSec::tr("Failed to retrieve the help file"), - QString("%1%2\n\n%3%4").arg( + QStringLiteral("%1%2\n\n%3%4").arg( DialogSec::tr("An error occured while getting the help file"), (msg.isEmpty()) ? msg : ":\n"+msg, DialogSec::tr("Additional resources can be downloaded from the git repo"), (link.isEmpty()) ? link : ":\n"+link ), - "", MsgType::Error, parent }; + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } @@ -153,7 +178,7 @@ void DialogSec::warnInvalidItemBW( QWidget* parent ) DialogMsg dialog{ DialogSec::tr("Invalid string"), DialogSec::tr("The given string is invalid and cannot be added to the list\n\nPlease correct it and retry"), - "", MsgType::Warning, parent }; + QString(), MsgType::Warning, parent }; std::ignore = dialog.exec(); } @@ -166,11 +191,11 @@ void DialogSec::errSqlDriverNotFound( const QString& driver, QWidget* parent ) { DialogMsg dialog{ DialogSec::tr("QSql driver not found"), - QString("%1:\n%2\n\n%3").arg( - DialogSec::tr("Failed to retrieve the driver neede to handle the database"), + QStringLiteral("%1:\n%2\n\n%3").arg( + DialogSec::tr("Failed to retrieve the driver needed to handle the database"), driver, DialogSec::tr("Aborting") ), - "", MsgType::Error, parent }; + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } @@ -178,7 +203,7 @@ bool DialogSec::choiceDatabaseNotFound( const QString& db_name, QWidget* parent { DialogBool dialog{ DialogSec::tr("File not found"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("Failed to retrieve the database file"), db_name, DialogSec::tr("Create a new database?") ), @@ -188,7 +213,7 @@ bool DialogSec::choiceDatabaseNotFound( const QString& db_name, QWidget* parent bool DialogSec::choiceDatabaseWrongTable(const QString& db_name, const QString& table_name, QWidget* parent ) { - QString msg{ QString("%1:\n%2 -> %3").arg( + const QString msg{ QStringLiteral("%1:\n%2 -> %3").arg( DialogSec::tr("The database contains an unexpected table"), db_name, table_name ) }; return choiceDatabaseRenew( @@ -198,7 +223,7 @@ bool DialogSec::choiceDatabaseWrongTable(const QString& db_name, const QString& } bool DialogSec::choiceDatabaseMissingTable( const QString& db_name, const QString& table_name, QWidget* parent ) { - QString msg{ QString("%1:\n%2 -> %3").arg( + QString msg{ QStringLiteral("%1:\n%2 -> %3").arg( DialogSec::tr("It seems that the database is missing a table"), db_name, table_name ) }; return choiceDatabaseRenew( @@ -208,7 +233,7 @@ bool DialogSec::choiceDatabaseMissingTable( const QString& db_name, const QStrin } bool DialogSec::choiceDatabaseWrongColumn( const QString& db_name, const QString& table_name, const QString& column_name, QWidget* parent ) { - QString msg{ QString("%1:\n%2 -> %3 -> %4").arg( + QString msg{ QStringLiteral("%1:\n%2 -> %3 -> %4").arg( DialogSec::tr("The database contains an unexpected column"), db_name, table_name, column_name ) }; return choiceDatabaseRenew( @@ -218,7 +243,7 @@ bool DialogSec::choiceDatabaseWrongColumn( const QString& db_name, const QString } bool DialogSec::choiceDatabaseMissingColumn( const QString& db_name, const QString& table_name, const QString& column_name, QWidget* parent ) { - QString msg{ QString("%1:\n%2 -> %3 -> %4").arg( + QString msg{ QStringLiteral("%1:\n%2 -> %3 -> %4").arg( DialogSec::tr("It seems that the table is missing a column"), db_name, table_name, column_name ) }; return choiceDatabaseRenew( @@ -228,7 +253,7 @@ bool DialogSec::choiceDatabaseMissingColumn( const QString& db_name, const QStri } bool DialogSec::choiceDatabaseWrongDataType( const QString& db_name, const QString& table_name, const QString& column_name, const QString& data_type, QWidget* parent ) { - QString msg{ QString("%1:\n%2 -> %3 -> %4 -> %5").arg( + QString msg{ QStringLiteral("%1:\n%2 -> %3 -> %4 -> %5").arg( DialogSec::tr("A column has an unexpected data-type"), db_name, table_name, column_name, data_type ) }; return choiceDatabaseRenew( @@ -240,9 +265,9 @@ bool DialogSec::choiceDatabaseRenew( const QString& title, const QString& msg, Q { DialogBool dialog{ title, - QString("%1\n\n%2").arg( + QStringLiteral("%1\n\n%2").arg( msg, - DialogSec::tr("This database will renamed with a trailing '.copy' and a new one will be created.\nContinue?") ), + DialogSec::tr("This database will be renamed with a trailing '.copy' and a new one will be created.\nContinue?") ), parent }; return dialog.exec(); } @@ -250,10 +275,10 @@ void DialogSec::msgDatabaseCreated( const QString& db_name, QWidget* parent ) { DialogMsg dialog{ DialogSec::tr("Database created"), - QString("%1:\n%2").arg( + QStringLiteral("%1:\n%2").arg( DialogSec::tr("Successfully created a new database"), db_name ), - "", MsgType::Info, parent }; + QString(), MsgType::Info, parent }; std::ignore = dialog.exec(); } @@ -261,10 +286,10 @@ void DialogSec::errDatabaseNotFound( const QString& db_name, QWidget* parent ) { DialogMsg dialog{ DialogSec::tr("File not found"), - QString("%1:\n%2").arg( + QStringLiteral("%1:\n%2").arg( DialogSec::tr("Failed to retrieve the database file"), db_name ), - "", MsgType::Error, parent }; + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } @@ -272,12 +297,12 @@ void DialogSec::errDatabaseNotFile( const QString& db_name, QWidget* parent ) { DialogMsg dialog{ DialogSec::tr("Not a file"), - QString("%1\n\n%2:\n%3\n\n%4").arg( + QStringLiteral("%1\n\n%2:\n%3\n\n%4").arg( DialogSec::tr("Failed to retrieve the database file"), DialogSec::tr("The path was supposed to point to a file, but it doesn't"), db_name, DialogSec::tr("Please remove the conflict and retry") ), - "", MsgType::Error, parent }; + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } @@ -285,11 +310,11 @@ void DialogSec::errDatabaseNotReadable( const QString& db_name, QWidget* parent { DialogMsg dialog{ DialogSec::tr("File not readable"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("The database file is not readable"), db_name, DialogSec::tr("Please set the proper permissions and retry\nIf this error persists, please report this issue") ), - "", MsgType::Error, parent }; + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } @@ -297,11 +322,11 @@ void DialogSec::errDatabaseNotWritable( const QString& db_name, QWidget* parent { DialogMsg dialog{ DialogSec::tr("File not writable"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("The database file is not writable"), db_name, DialogSec::tr("Please set the proper permissions and retry\nIf this error persists, please report this issue") ), - "", MsgType::Error, parent }; + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } @@ -309,11 +334,11 @@ void DialogSec::errDatabaseFailedCreating( const QString& db_name, QWidget* pare { DialogMsg dialog{ DialogSec::tr("Failed creating database"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("An error occured while creating the database"), db_name, DialogSec::tr("Aborting") ), - "", MsgType::Error, parent }; + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } @@ -321,7 +346,7 @@ void DialogSec::errDatabaseFailedOpening( const QString& db_name, const QString& { DialogMsg dialog{ DialogSec::tr("Failed opening database"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("An error occured while opening the database"), db_name, DialogSec::tr("Aborting") ), @@ -333,10 +358,10 @@ void DialogSec::errDatabaseFailedExecuting( const QString& db_name, const QStrin { DialogMsg dialog{ DialogSec::tr("Failed executing on database"), - QString("%1:\n%2%3\n\n%4").arg( + QStringLiteral("%1:\n%2%3\n\n%4").arg( DialogSec::tr("An error occured while executing a statement on the database"), db_name, - (statement.size()>0) ? "\n"+statement : "", + !statement.isEmpty() ? "\n"+statement : QString(), DialogSec::tr("Aborting") ), err, MsgType::Error, parent }; std::ignore = dialog.exec(); @@ -346,7 +371,7 @@ void DialogSec::errDatabaseFailedBackup( const QString& msg, const QString& err, { DialogMsg dialog{ DialogSec::tr("Failed to backup database"), - QString("%1\n\n%2").arg( + QStringLiteral("%1\n\n%2").arg( msg, DialogSec::tr("Please report this issue") ), err, MsgType::Error, parent }; @@ -371,9 +396,8 @@ void DialogSec::errLogFormatNotSet( QWidget* parent ) { DialogMsg dialog{ DialogSec::tr("Log format error"), - QString("%1").arg( - DialogSec::tr("The log format has not been set, or is invalid\nPlease add a valid one in the configurations") ), - "", MsgType::Error, parent }; + DialogSec::tr("The log format has not been set, or is invalid\nPlease add a valid one in the configurations"), + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } @@ -381,10 +405,10 @@ void DialogSec::errLogFormatNoFields( QWidget* parent ) { DialogMsg dialog{ DialogSec::tr("Misconfigured log format"), - QString("%1\n\n%2").arg( + QStringLiteral("%1\n\n%2").arg( DialogSec::tr("No log field has been set in the current logs format,\nmaking it useless to parse logs"), DialogSec::tr("Please set up a format which contains at least one field") ), - "", MsgType::Error, parent }; + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } @@ -392,10 +416,10 @@ void DialogSec::errLogFormatNoSeparators( QWidget* parent ) { DialogMsg dialog{ DialogSec::tr("Misconfigured log format"), - QString("%1\n\n%2").arg( + QStringLiteral("%1\n\n%2").arg( DialogSec::tr("A separator is missing between one or more fields,\nmaking it hard to establish net bounds,\nand possibly leading to store incorrect data"), DialogSec::tr("Please set up a format which contains separators between fields") ), - "", MsgType::Error, parent }; + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } @@ -404,7 +428,7 @@ void DialogSec::errFailedParsingLogs( const QString& message, QWidget* parent ) DialogMsg dialog{ DialogSec::tr("An error occured while parsing logs"), message, - "", MsgType::Error, parent }; + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } @@ -417,10 +441,10 @@ void DialogSec::errFailedDefiningLogType( const QString& file, QWidget* parent ) { DialogMsg dialog{ DialogSec::tr("Failed defining type"), - QString("%1:\n%2").arg( + QStringLiteral("%1:\n%2").arg( DialogSec::tr("Failed to determine the log type"), file ), - "", MsgType::Error, parent }; + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } @@ -429,7 +453,7 @@ int DialogSec::choiceFileAlreadyUsed( const QString& msg, QWidget* parent ) { DialogIda dialog{ DialogSec::tr("File already used"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("The file has probably been used already"), msg, DialogSec::tr("Ignore the warning and use it anyway, Discard it and continue, or Abort the entire process?") ), @@ -442,7 +466,7 @@ int DialogSec::choiceDuplicateFile( const QString& msg, QWidget* parent ) { DialogIda dialog{ DialogSec::tr("Duplicate file"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("The file appears twice in the list of selections"), msg, DialogSec::tr("Ignore the warning and use it anyway, Discard it and continue, or Abort the entire process?") ), @@ -450,12 +474,23 @@ int DialogSec::choiceDuplicateFile( const QString& msg, QWidget* parent ) return dialog.exec(); } +void DialogSec::errFailedInsertUsedHashes( QWidget* parent ) +{ + DialogMsg dialog{ + DialogSec::tr("Failed updating hashes"), + QStringLiteral("%1\n\n%2").arg( + DialogSec::tr("An error occured while inserting the parsed files hashes into the database"), + DialogSec::tr("Aborting") ), + QString(), MsgType::Error, parent }; + std::ignore = dialog.exec(); +} + int DialogSec::choiceFileSizeWarning( const QString& msg, QWidget* parent ) { DialogIda dialog{ DialogSec::tr("File exceeds warning size"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("The file's size exceeds the warning size"), msg, DialogSec::tr("Ignore the warning and use it anyway, Discard it and continue, or Abort the entire process?") ), @@ -466,7 +501,7 @@ bool DialogSec::choiceFileSizeWarning2( const QString& msg, QWidget* parent ) { DialogBool dialog{ DialogSec::tr("File exceeds warning size"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("The file's size exceeds the warning size"), msg, DialogSec::tr("Proceed anyway?") ), @@ -478,11 +513,11 @@ void DialogSec::msgNotEnoughMemory( const QString& msg, QWidget* parent ) { DialogMsg dialog{ DialogSec::tr("Not enough memory"), - QString("%1%2\n\n%3").arg( + QStringLiteral("%1%2\n\n%3").arg( DialogSec::tr("The total size of the selected files exceeds the available memory"), msg, DialogSec::tr("Please free some resources, parse the files in different steps or split them into smaller units") ), - "", MsgType::Error, parent }; + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } @@ -491,10 +526,11 @@ void DialogSec::errFailedReadFile( const QString& file , const bool skipping, QW { DialogMsg dialog{ DialogSec::tr("Failed reading"), - QString("%1:\n%2").arg( - DialogSec::tr("An error accured while reading the file"), - file + ((skipping) ? DialogSec::tr("Skipping") : "") ), - "", MsgType::Error, parent }; + QStringLiteral("%1:\n%2%3").arg( + DialogSec::tr("An error occured while reading the file"), + file, + skipping ? DialogSec::tr("Skipping").prepend("\n\n") : QString() ), + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } @@ -502,11 +538,11 @@ void DialogSec::errFailedReadFile( const QString& file , const bool skipping, QW { DialogMsg dialog{ DialogSec::tr("Failed writing"), - QString("%1:\n%2%3").arg( - DialogSec::tr("An error accured while writing the file"), + QStringLiteral("%1:\n%2%3").arg( + DialogSec::tr("An error occured while writing the file"), file, - (skipping) ? QString("\n\n%1").arg(DialogSec::tr("Skipping")) : "" ), - "", MsgType::Error, parent }; + (skipping) ? QStringLiteral("\n\n%1").arg(DialogSec::tr("Skipping")) : QString() ), + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); }*/ @@ -515,11 +551,11 @@ void DialogSec::warnEmptyFile( const QString& file, QWidget* parent ) { DialogMsg dialog{ DialogSec::tr("File is empty"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("The file is blank"), file, DialogSec::tr("Skipping") ), - "", MsgType::Warning, parent }; + QString(), MsgType::Warning, parent }; std::ignore = dialog.exec(); } @@ -527,11 +563,11 @@ void DialogSec::errFileNotFound( const QString& file , const bool report, QWidge { DialogMsg dialog{ DialogSec::tr("File not found"), - QString("%1:\n%2%3").arg( + QStringLiteral("%1:\n%2%3").arg( DialogSec::tr("Unable to retrieve the file"), file, - ( report ) ? QString("\n\n%1").arg(DialogSec::tr("Please report this issue")) : "" ), - "", MsgType::Error, parent }; + report ? DialogSec::tr("Please report this issue").prepend("\n\n") : QString() ), + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } @@ -539,11 +575,11 @@ void DialogSec::warnFileNotReadable( const QString& file, QWidget* parent ) { DialogMsg dialog{ DialogSec::tr("File not readable"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("The file is not readable"), file, DialogSec::tr("Skipping") ), - "", MsgType::Warning, parent }; + QString(), MsgType::Warning, parent }; std::ignore = dialog.exec(); } @@ -553,7 +589,7 @@ int DialogSec::choiceSelectedFileNotFound( const QString& file, QWidget* parent { DialogIda dialog{ DialogSec::tr("File not found"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("Failed to retrieve the selected file"), file, DialogSec::tr("Discard it and continue, or Abort all and exit?") ), @@ -565,10 +601,10 @@ void DialogSec::msgNoFileToParse( QWidget* parent ) { DialogMsg dialog{ DialogSec::tr("No file to parse"), - QString("%1\n\n%2").arg( + QStringLiteral("%1\n\n%2").arg( DialogSec::tr("The list of files to parse is empty"), DialogSec::tr("Aborting") ), - "", MsgType::Error, parent }; + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } @@ -581,10 +617,10 @@ void DialogSec::errDirNotExists( const QString& dir, QWidget* parent ) { DialogMsg dialog{ DialogSec::tr("Directory not found"), - QString("%1:\n%2").arg( + QStringLiteral("%1:\n%2").arg( DialogSec::tr("The directory does not exists"), dir ), - "", MsgType::Error, parent }; + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } @@ -592,7 +628,7 @@ void DialogSec::errDirNotExists( const QString& dir, QWidget* parent ) { DialogDia dialog{ DialogSec::tr("Directory not found"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("The directory does not exists"), dir, DialogSec::tr("Discard it and continue, or Abort all and exit?") ), @@ -605,7 +641,7 @@ void DialogSec::errDirNotReadable( const QString& dir, const QString& err, QWidg { DialogMsg dialog{ DialogSec::tr("Directory not readable"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("The directory is not readable"), dir, DialogSec::tr("Please set the proper permissions and retry\nIf this error persists, please report this issue") ), @@ -616,10 +652,10 @@ void DialogSec::warnDirNotReadable( QWidget* parent ) { DialogMsg dialog{ DialogSec::tr("Directory not readable"), - QString("%1\n\n%2").arg( + QStringLiteral("%1\n\n%2").arg( DialogSec::tr("The directory is not readable"), DialogSec::tr("Please set the proper permissions before to start") ), - "", MsgType::Warning, parent }; + QString(), MsgType::Warning, parent }; std::ignore = dialog.exec(); } @@ -627,7 +663,7 @@ void DialogSec::errDirNotWritable( const QString& dir, const QString& err, QWidg { DialogMsg dialog{ DialogSec::tr("Directory not writable"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("The directory is not writable"), dir, DialogSec::tr("Please set the proper permissions and retry\nIf this error persists, please report this issue") ), @@ -638,10 +674,10 @@ void DialogSec::warnDirNotWritable( QWidget* parent ) { DialogMsg dialog{ DialogSec::tr("Directory not writable"), - QString("%1\n\n%2").arg( + QStringLiteral("%1\n\n%2").arg( DialogSec::tr("The directory is not writable"), DialogSec::tr("Please set the proper permissions before to start") ), - "", MsgType::Warning, parent }; + QString(), MsgType::Warning, parent }; std::ignore = dialog.exec(); } @@ -649,7 +685,7 @@ void DialogSec::errFailedMakeDir( const QString& msg, const QString& err, QWidge { DialogMsg dialog{ DialogSec::tr("Failed creating directory"), - QString("%1\n\n%2").arg( + QStringLiteral("%1\n\n%2").arg( msg, DialogSec::tr("Please set the proper permissions and retry\nIf this error persists, please report this issue") ), err, MsgType::Error, parent }; @@ -657,6 +693,44 @@ void DialogSec::errFailedMakeDir( const QString& msg, const QString& err, QWidge } +////////////// +//// DATA //// +////////////// +void DialogSec::errConvertingData( const QString& fromType, const QString& intoType, const QString& value, QWidget* parent ) +{ + DialogMsg dialog{ + DialogSec::tr("Data conversion failed"), + QStringLiteral("%1:\n%2").arg( + DialogSec::tr("Failed to convert from '%1' to '%2'").arg( + fromType, intoType ), + value ), + QString(), MsgType::Error, parent }; + std::ignore = dialog.exec(); +} + + +//////////////////// +//// STATISTICS //// +//////////////////// +void DialogSec::errProcessingStatsData( const QString& err, QWidget* parent ) +{ + DialogMsg dialog{ + DialogSec::tr("Failed to create statistics"), + DialogSec::tr("An error occured while processing"), + err, MsgType::Error, parent }; + std::ignore = dialog.exec(); +} + +void DialogSec::msgNoDataForStats( QWidget* parent ) +{ + DialogMsg dialog{ + DialogSec::tr("Cannot create statistics"), + DialogSec::tr("No data has been found that matches with the currently set parameters"), + QString(), MsgType::Info, parent }; + std::ignore = dialog.exec(); +} + + ////////////////// //// GENERICS //// ////////////////// @@ -664,10 +738,10 @@ bool DialogSec::choiceDirNotDir( const QString& path, QWidget* parent ) { DialogBool dialog{ DialogSec::tr("Not a folder"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("The path was supposed to point to a folder, but it doesn't"), path, - DialogSec::tr("The entry will renamed with a trailing '.copy' and a new one will be created.\nContinue?") ), + DialogSec::tr("The entry will be renamed with a trailing '.copy' and a new one will be created.\nContinue?") ), parent }; return dialog.exec(); } @@ -675,10 +749,10 @@ bool DialogSec::choiceFileNotFile( const QString& path, QWidget* parent ) { DialogBool dialog{ DialogSec::tr("Not a file"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("The path was supposed to point to a file, but it doesn't"), path, - DialogSec::tr("The entry will renamed with a trailing '.copy' and a new one will be created.\nContinue?") ), + DialogSec::tr("The entry will be renamed with a trailing '.copy' and a new one will be created.\nContinue?") ), parent }; return dialog.exec(); } @@ -693,9 +767,9 @@ bool DialogSec::choiceFileNotFile( const QString& path, QWidget* parent ) } DialogMsg dialog{ DialogSec::tr("An error occured"), - QString("%1%2").arg( + QStringLiteral("%1%2").arg( msg, footer ), - "", MsgType::Warning, parent }; + QString(), MsgType::Warning, parent }; std::ignore = dialog.exec(); }*/ @@ -703,15 +777,12 @@ bool DialogSec::choiceFileNotFile( const QString& path, QWidget* parent ) void DialogSec::errGeneric( const QString& msg, const bool report_msg, QWidget* parent ) { - QString footer; - if ( report_msg ) { - footer += "\n\n" + DialogSec::tr("Please report this issue"); - } DialogMsg dialog{ DialogSec::tr("An error occured"), - QString("%1%2").arg( - msg, footer ), - "", MsgType::Error, parent }; + QStringLiteral("%1%2").arg( + msg, + report_msg ? DialogSec::tr("Please report this issue").prepend("\n\n") : QString() ), + QString(), MsgType::Error, parent }; std::ignore = dialog.exec(); } @@ -721,7 +792,7 @@ void DialogSec::errRenaming( const QString& path, const QString& err, QWidget* p { DialogMsg dialog{ DialogSec::tr("Failed renaming"), - QString("%1:\n%2\n\n%3").arg( + QStringLiteral("%1:\n%2\n\n%3").arg( DialogSec::tr("An error occured while renaming"), path, DialogSec::tr("Aborting") ), diff --git a/logdoctor/modules/dialogs.h b/logdoctor/modules/dialogs.h index 27aa219f..852a7567 100644 --- a/logdoctor/modules/dialogs.h +++ b/logdoctor/modules/dialogs.h @@ -10,7 +10,7 @@ Implements various dialog models \see DialogMsg, DialogBool, DialogDia */ -class DialogSec : public QObject +class DialogSec final : public QObject { Q_OBJECT @@ -57,8 +57,14 @@ public: //! Missing read permission for the configuration file's directory static void errConfDirNotWritable( const QString& dir, const QString& err, QWidget* parent=nullptr ); - //! Missing write permission for the configuration file's directory - static void errFailedApplyingConfigs( const QString& msg, QWidget* parent=nullptr ); + //! An error occured while applying the value retrieved from the conf file + static void errFailedApplyingConfigsItem( const QString& msg, QWidget* parent=nullptr ); + + //! The lines in the list caused an error and cannot be applied + static void warnInvalidConfigsList( const QStringList& list, QWidget* parent=nullptr ); + + //! Failed to apply user provided configurations + static bool choiceFailedApplyingConfigs( const QString& msg, QWidget* parent=nullptr ); ////////////// @@ -158,6 +164,9 @@ public: //! A selected log file appears twice in the selection static int choiceDuplicateFile( const QString& msg, QWidget* parent=nullptr ); + //! An error occured while inserting the new files' hashes into the daabase + static void errFailedInsertUsedHashes( QWidget* parent=nullptr ); + /////////////////// //// LOGS SIZE //// @@ -194,6 +203,16 @@ public: static void errFailedParsingLogs( const QString& message, QWidget* parent=nullptr ); + //////////////////// + //// STATISTICS //// + + //! An error occured while processing data + static void errProcessingStatsData( const QString& err, QWidget* parent=nullptr ); + + //! No data, cannot draw the chart + static void msgNoDataForStats( QWidget* parent=nullptr ); + + /////////////// //// FILES //// @@ -235,6 +254,13 @@ public: //! Failed to create a directory static void errFailedMakeDir( const QString& msg, const QString& err, QWidget* parent=nullptr ); + + ////////////// + //// DATA //// + + //! Failed to convert some data from one type into another + static void errConvertingData( const QString& fromType, const QString& intoType, const QString& value, QWidget* parent=nullptr ); + ///////////////// //// CHOICES //// diff --git a/logdoctor/modules/dialogs/boolean_dialog.cpp b/logdoctor/modules/dialogs/boolean_dialog.cpp index b577576b..af1f8577 100644 --- a/logdoctor/modules/dialogs/boolean_dialog.cpp +++ b/logdoctor/modules/dialogs/boolean_dialog.cpp @@ -48,8 +48,7 @@ QString getStylesheet() }; break; default: - throw GenericException( "Unexpected WindowTheme: "+std::to_string(static_cast(GlobalConfigs::window_theme)), true ); - break; + throw DoNotCatchException( "Unexpected WindowTheme", std::to_string(static_cast(GlobalConfigs::window_theme)) ); } return diff --git a/logdoctor/modules/dialogs/boolean_dialog.h b/logdoctor/modules/dialogs/boolean_dialog.h index 67414135..3ed72fbb 100644 --- a/logdoctor/modules/dialogs/boolean_dialog.h +++ b/logdoctor/modules/dialogs/boolean_dialog.h @@ -13,19 +13,19 @@ namespace Ui { /*! YES/NO choice dialog */ -class DialogBool : public QDialog +class DialogBool final : public QDialog { Q_OBJECT public: - //! Dialog constructor /*! \param title The title \param text The message \param parent The parent Widget */ explicit DialogBool( const QString& title, const QString& text, QWidget *parent=nullptr ); + Q_DISABLE_COPY_MOVE(DialogBool) private slots: diff --git a/logdoctor/modules/dialogs/ida_dialog.cpp b/logdoctor/modules/dialogs/ida_dialog.cpp index 0f033f9d..7a0b6a1c 100644 --- a/logdoctor/modules/dialogs/ida_dialog.cpp +++ b/logdoctor/modules/dialogs/ida_dialog.cpp @@ -48,8 +48,7 @@ QString getStylesheet() }; break; default: - throw GenericException( "Unexpected WindowTheme: "+std::to_string(static_cast(GlobalConfigs::window_theme)), true ); - break; + throw DoNotCatchException( "Unexpected WindowTheme", std::to_string(static_cast(GlobalConfigs::window_theme)) ); } return diff --git a/logdoctor/modules/dialogs/ida_dialog.h b/logdoctor/modules/dialogs/ida_dialog.h index 40406b05..71eff544 100644 --- a/logdoctor/modules/dialogs/ida_dialog.h +++ b/logdoctor/modules/dialogs/ida_dialog.h @@ -14,13 +14,12 @@ namespace Ui { /*! IGNORE/DISCARD/ABORT choice dialog */ -class DialogIda : public QDialog +class DialogIda final : public QDialog { Q_OBJECT public: - //! Dialog constructor /*! \param title The title \param text The message @@ -30,6 +29,7 @@ public: \param parent The parent Widget */ explicit DialogIda( const QString& title, const QString& text, const bool ignore=true, const bool discard=true, const bool abort=true, QWidget* parent=nullptr ); + Q_DISABLE_COPY_MOVE(DialogIda) private slots: diff --git a/logdoctor/modules/dialogs/message_dialog.cpp b/logdoctor/modules/dialogs/message_dialog.cpp index 91004323..446e67d3 100644 --- a/logdoctor/modules/dialogs/message_dialog.cpp +++ b/logdoctor/modules/dialogs/message_dialog.cpp @@ -13,9 +13,6 @@ #include // leave this here for clang -namespace /*private*/ -{ - enum StyleId : uint32_t { TEXT, WINDOW, @@ -87,8 +84,7 @@ QString getStylesheet() }; break; default: - throw GenericException( "Unexpected WindowTheme: "+std::to_string(static_cast(GlobalConfigs::window_theme)), true ); - break; + throw DoNotCatchException( "Unexpected WindowTheme", std::to_string(static_cast(GlobalConfigs::window_theme)) ); } return @@ -142,8 +138,6 @@ QString getStylesheet() "}"; } -} //namespace (private) - DialogMsg::DialogMsg(const QString& title, const QString& text, const QString& additional, const MsgType type, QWidget* parent ) : QDialog{ parent } diff --git a/logdoctor/modules/dialogs/message_dialog.h b/logdoctor/modules/dialogs/message_dialog.h index 77cd15aa..2456949a 100644 --- a/logdoctor/modules/dialogs/message_dialog.h +++ b/logdoctor/modules/dialogs/message_dialog.h @@ -21,13 +21,12 @@ namespace Ui { /*! A dialog message to provide informations to the user */ -class DialogMsg : public QDialog +class DialogMsg final : public QDialog { Q_OBJECT public: - //! Dialog constructor /*! \param title The title \param text The message @@ -35,6 +34,7 @@ public: \param parent The parent Widget */ explicit DialogMsg( const QString& title, const QString& text, const QString& additional, const MsgType type, QWidget *parent=nullptr ); + Q_DISABLE_COPY_MOVE(DialogMsg) private slots: diff --git a/logdoctor/modules/exceptions.cpp b/logdoctor/modules/exceptions.cpp index 8b1b96ce..ba6b8bf4 100644 --- a/logdoctor/modules/exceptions.cpp +++ b/logdoctor/modules/exceptions.cpp @@ -3,17 +3,21 @@ #include +#include + + +DoNotCatchException::DoNotCatchException( const char* header, const std::string& body ) +{ + std::cerr << "LogDoctor: Exception: " << header << ": " << body << std::endl; +} + ///////////////// //// GENERIC //// -GenericException::GenericException( const std::string& msg, const bool to_sys ) +GenericException::GenericException( const std::string& msg ) + : msg{ QString::fromStdString( msg ) } { - if ( to_sys ) { // when sys, leave un-catched - std::cout << "LogDoctor: Exception: " << msg << std::endl; - std::cerr << "LogDoctor: Exception: " << msg << std::endl; - } else { - this->msg = QString::fromStdString( msg ); - } + } const QString& GenericException::what() { @@ -21,25 +25,10 @@ const QString& GenericException::what() } -//////////////////// -//// WEB SERVER //// -WebServerException::WebServerException( const std::string& msg ) // leave un-catched -{ - std::cout << "LogDoctor: WebServerException: " << msg << std::endl; - std::cerr << "LogDoctor: WebServerException: " << msg << std::endl; - /*this->msg = QString::fromStdString( msg );*/ -} -/*const QString& WebServerException::what() -{ - return msg; -}*/ - - //////////////////// //// LOG FORMAT //// LogFormatException::LogFormatException( const std::string& msg ) { - std::cout << "LogDoctor: LogFormatException: " << msg << std::endl; std::cerr << "LogDoctor: LogFormatException: " << msg << std::endl; this->msg = QString::fromStdString( msg ); } @@ -53,9 +42,8 @@ const QString& LogFormatException::what() //// LOG PARSER //// LogParserException::LogParserException( const std::string& txt , const std::string& val ) { - std::cout << "LogDoctor: LogParserException: " << txt << ": '" << val << "'" << std::endl; std::cerr << "LogDoctor: LogParserException: " << txt << ": '" << val << "'" << std::endl; - this->msg = QString("%1:\n'%2'").arg( + this->msg = QStringLiteral("%1:\n'%2'").arg( QString::fromStdString( txt ), QString::fromStdString( val ) ); } @@ -67,27 +55,28 @@ const QString& LogParserException::what() /////////////////// //// DATE-TIME //// -DateTimeException::DateTimeException( const std::string& msg ) // leave un-catched +DateTimeException::DateTimeException( const char* header, const std::string& body ) { - std::cout << "LogDoctor: DateTimeException: " << msg << std::endl; - std::cerr << "LogDoctor: DateTimeException: " << msg << std::endl; - /*this->msg = QString::fromStdString( msg );*/ + std::cerr << "LogDoctor: DateTimeException: " << header << ": " << body << std::endl; } -/*const QString& DateTimeException::what() -{ - return msg; -}*/ ////////////////////////// //// BLACK/WARN LISTS //// BWlistException::BWlistException( const std::string& msg ) { - std::cout << "LogDoctor: BWlistException: " << msg << std::endl; std::cerr << "LogDoctor: BWlistException: " << msg << std::endl; - /*this->msg = QString::fromStdString( msg );*/ } -/*const QString& DateTimeException::what() + + +////////////////// +//// DATABASE //// +DatabaseException::DatabaseException( QString&& msg ) + : msg{ std::move(msg) } +{ + +} +const QString& DatabaseException::what() const noexcept { return msg; -}*/ +} diff --git a/logdoctor/modules/exceptions.h b/logdoctor/modules/exceptions.h index 1094bc4b..c3d350d3 100644 --- a/logdoctor/modules/exceptions.h +++ b/logdoctor/modules/exceptions.h @@ -4,36 +4,45 @@ #include -#include + +//! VoidException +/*! + Base class for some internal exceptions. + Used when a message has already been shown, + or there is no need to show one. +*/ +class VoidException {}; + + +//! DoNotCatchException +/*! + Thrown when something really unexptional happens. + It's not supposed to be catched. +*/ +struct DoNotCatchException final +{ + explicit DoNotCatchException( const char* header, const std::string& body ); +}; + + +//! LogDoctorException +/*! + Base class for internal exceptions +*/ +class LogDoctorException {}; //! GenericException /*! Generic exception for general purposes */ -class GenericException : public std::exception { +class GenericException final : public LogDoctorException { public: - explicit GenericException( const std::string& msg, const bool to_sys=false ); + explicit GenericException( const std::string& msg ); const QString& what(); private: QString msg; - using std::exception::what; -}; - - -//! WebServerException -/*! - Exception related to a Web Server -*/ -class WebServerException : public std::exception { -public: - explicit WebServerException( const std::string& msg ); - /*const QString& what(); - -private: - QString msg; - using std::exception::what;*/ }; @@ -41,14 +50,13 @@ private: /*! Exception related to a Logs Format */ -class LogFormatException : public std::exception { +class LogFormatException final : public LogDoctorException { public: explicit LogFormatException( const std::string& msg ); const QString& what(); private: QString msg; - using std::exception::what; }; @@ -56,14 +64,13 @@ private: /*! Exception related to the logs parser */ -class LogParserException : public std::exception { +class LogParserException final : public LogDoctorException { public: explicit LogParserException( const std::string& txt, const std::string& val ); const QString& what(); private: QString msg; - using std::exception::what; }; @@ -71,14 +78,9 @@ private: /*! Exception related to a date/time */ -class DateTimeException : public std::exception { +class DateTimeException final : public LogDoctorException { public: - explicit DateTimeException( const std::string& msg ); - /*const QString& what(); - -private: - QString msg; - using std::exception::what;*/ + explicit DateTimeException( const char* header, const std::string& body ); }; @@ -86,14 +88,23 @@ private: /*! Exception related to a blacklist/warnlist */ -class BWlistException : public std::exception { +class BWlistException final : public LogDoctorException { public: explicit BWlistException( const std::string& msg ); - /*const QString& what(); +}; + + +//! DatabaseException +/*! + Exception related to the database +*/ +class DatabaseException final : public LogDoctorException { +public: + explicit DatabaseException( QString&& msg ); + const QString& what() const noexcept; private: QString msg; - using std::exception::what;*/ }; diff --git a/logdoctor/modules/shared.cpp b/logdoctor/modules/shared.cpp deleted file mode 100644 index 45adad95..00000000 --- a/logdoctor/modules/shared.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include "shared.h" - - -TR::TR(QObject *parent) - : QObject{parent} -{ - -} diff --git a/logdoctor/modules/shared.h b/logdoctor/modules/shared.h index 4aefaf05..9a32c8f1 100644 --- a/logdoctor/modules/shared.h +++ b/logdoctor/modules/shared.h @@ -9,11 +9,11 @@ /*! Fictitious class for the translations */ -class TR : public QObject +class TR final : public QObject { Q_OBJECT public: - explicit TR( QObject* parent=nullptr ); + explicit TR( QObject* parent=nullptr ):QObject{parent}{} }; diff --git a/logdoctor/modules/tb.cpp b/logdoctor/modules/tb.cpp index 32187b84..786c04be 100644 --- a/logdoctor/modules/tb.cpp +++ b/logdoctor/modules/tb.cpp @@ -1,62 +1,64 @@ #include "tb.h" +#include "globals/global_configs.h" + // getters -bool TextBrowser::getWideLinesUsage() const +bool TextBrowser::getWideLinesUsage() const noexcept { return this->wide_lines; } -int TextBrowser::getColorSchemeID() const +ColorsScheme TextBrowser::getColorSchemeID() const noexcept { - return this->color_scheme_id; + return this->colors_scheme_id; } -const std::unordered_map& TextBrowser::getColorScheme() const +const std::unordered_map& TextBrowser::getColorScheme() const noexcept { - return this->color_scheme; + return this->colors_scheme; } -/*const int& TextBrowser::getFontSize() +/*const int& TextBrowser::getFontSize() noexcept { return this->font_size; }*/ -const QString& TextBrowser::getFontFamily() const +const QString& TextBrowser::getFontFamily() const noexcept { return this->font_family; } -const QFont& TextBrowser::getFont() const +const QFont& TextBrowser::getFont() const noexcept { return this->font; } // setters -void TextBrowser::setWideLinesUsage( const bool& use_wide_lines ) +void TextBrowser::setWideLinesUsage( const bool use_wide_lines ) noexcept { this->wide_lines = use_wide_lines; } -void TextBrowser::setColorScheme( const int& color_scheme_id, const std::unordered_map& color_scheme ) +void TextBrowser::setColorScheme( const ColorsScheme colors_scheme_id, const std::unordered_map& colors_scheme ) noexcept { - this->color_scheme_id = color_scheme_id; - this->color_scheme = color_scheme; + this->colors_scheme_id = colors_scheme_id; + this->colors_scheme = colors_scheme; } -/*void TextBrowser::setFontSize( const int& font_size ) +/*void TextBrowser::setFontSize( const int& font_size ) noexcept { this->font_size = font_size; } -void TextBrowser::setFontFamily( const QString& font_family ) +void TextBrowser::setFontFamily( const QString& font_family ) noexcept { this->font_family = font_family; }*/ -void TextBrowser::setFont( const QFont& font ) +void TextBrowser::setFont( const QFont& font ) noexcept { this->font = font; this->font_family = font.family(); @@ -64,97 +66,101 @@ void TextBrowser::setFont( const QFont& font ) // preview -void TextBrowser::makePreview( QString& content ) const +void TextBrowser::makePreview( QString& content ) const noexcept { - content += QString("color_scheme_id > 0 ) { - content += QString(" style=\"background:%1; color:%2\"") - .arg( this->color_scheme.at("background"), - this->color_scheme.at("text") ); + const bool using_colors_scheme{ this->colors_scheme_id != ColorsScheme::None }; + + const QString span_template{ QStringLiteral("") }; + + content += "colors_scheme.at("background"), + this->colors_scheme.at("text") ); } content += ">"; /*if ( this->wide_lines ) { content += "
      "; }*/ - for ( int i{0}; i<32; i++ ) { + for ( int i{0}; i<32; ++i ) { content += "

      "; content += ""; - if ( this->color_scheme_id > 0 ) { - content += QString("").arg( this->color_scheme.at("time") ); + if ( using_colors_scheme ) { + content += span_template.arg( this->colors_scheme.at("time") ); } content += "2000-01-01 23:59:59"; - if ( this->color_scheme_id > 0 ) { + if ( using_colors_scheme ) { content += ""; } content += ""; content += " "; - if ( this->color_scheme_id > 0 ) { - content += QString("").arg( this->color_scheme.at("req") ); + if ( using_colors_scheme ) { + content += span_template.arg( this->colors_scheme.at("req") ); } content += "HTTP/1.1 GET /index.php query=x"; - if ( this->color_scheme_id > 0 ) { + if ( using_colors_scheme ) { content += ""; } content += ""; content += " "; - if ( this->color_scheme_id > 0 ) { - content += QString("").arg( this->color_scheme.at("res") ); + if ( using_colors_scheme ) { + content += span_template.arg( this->colors_scheme.at("res") ); } content += "404"; - if ( this->color_scheme_id > 0 ) { + if ( using_colors_scheme ) { content += ""; } content += ""; content += " "; - if ( this->color_scheme_id > 0 ) { - content += QString("").arg( this->color_scheme.at("x") ); + if ( using_colors_scheme ) { + content += span_template.arg( this->colors_scheme.at("x") ); } content += "123 1234 1000"; - if ( this->color_scheme_id > 0 ) { + if ( using_colors_scheme ) { content += ""; } content += ""; content += " \""; - if ( this->color_scheme_id > 0 ) { - content += QString("").arg( this->color_scheme.at("x") ); + if ( using_colors_scheme ) { + content += span_template.arg( this->colors_scheme.at("x") ); } content += "http://www.referrer.site"; - if ( this->color_scheme_id > 0 ) { + if ( using_colors_scheme ) { content += ""; } content += "\""; content += " \""; - if ( this->color_scheme_id > 0 ) { - content += QString("").arg( this->color_scheme.at("x") ); + if ( using_colors_scheme ) { + content += span_template.arg( this->colors_scheme.at("x") ); } content += "aCookie=abc123"; - if ( this->color_scheme_id > 0 ) { + if ( using_colors_scheme ) { content += ""; } content += "\""; content += " \""; - if ( this->color_scheme_id > 0 ) { - content += QString("").arg( this->color_scheme.at("ua") ); + if ( using_colors_scheme ) { + content += span_template.arg( this->colors_scheme.at("ua") ); } content += "UserAgent/3.0 (Details stuff) Info/123"; - if ( this->color_scheme_id > 0 ) { + if ( using_colors_scheme ) { content += ""; } content += "\""; content += " "; - if ( this->color_scheme_id > 0 ) { - content += QString("").arg( this->color_scheme.at("ip") ); + if ( using_colors_scheme ) { + content += span_template.arg( this->colors_scheme.at("ip") ); } content += "192.168.1.123"; - if ( this->color_scheme_id > 0 ) { + if ( using_colors_scheme ) { content += ""; } content += ""; diff --git a/logdoctor/modules/tb.h b/logdoctor/modules/tb.h index d1e1188e..2d0b8145 100644 --- a/logdoctor/modules/tb.h +++ b/logdoctor/modules/tb.h @@ -8,11 +8,14 @@ #include +enum class ColorsScheme : unsigned char; + + //! TextBrowser /*! Perform operations for files visualization */ -class TextBrowser +class TextBrowser final { public: @@ -20,37 +23,37 @@ public: //// GETTERS //// //! Returns whether the wide lines option is set to be used or not - bool getWideLinesUsage() const; + bool getWideLinesUsage() const noexcept; //! Returns the ID of the color scheme in use - int getColorSchemeID() const; + ColorsScheme getColorSchemeID() const noexcept; //! Returns the color scheme in use - const std::unordered_map& getColorScheme() const; + const std::unordered_map& getColorScheme() const noexcept; - /*const int& getFontSize();*/ + /*const int& getFontSize() noexcept;*/ //! Returns the family of the font in use - const QString& getFontFamily() const; + const QString& getFontFamily() const noexcept; //! Returns the font in use - const QFont& getFont() const; + const QFont& getFont() const noexcept; ///////////////// //// SETTERS //// //! Sets whether to use wide lines or not - void setWideLinesUsage( const bool& use_wide_lines ); + void setWideLinesUsage( const bool use_wide_lines ) noexcept; //! Stes the given color scheme as the one in use - void setColorScheme( const int& color_scheme_id, const std::unordered_map& color_scheme ); + void setColorScheme( const ColorsScheme colors_scheme_id, const std::unordered_map& colors_scheme ) noexcept; - /*void setFontSize( const int& font_size ); - void setFontFamily( const QString& font_family );*/ + /*void setFontSize( const int& font_size ) noexcept; + void setFontFamily( const QString& font_family ) noexcept;*/ //! Sets the given font as the one in use - void setFont( const QFont& font ); + void setFont( const QFont& font ) noexcept; ///////////////// @@ -60,14 +63,14 @@ public: /*! \param content Will hold the preview string */ - void makePreview( QString& content ) const; + void makePreview( QString& content ) const noexcept; private: bool wide_lines{ false }; - int color_scheme_id{ 1 }; - std::unordered_map color_scheme; + ColorsScheme colors_scheme_id; + std::unordered_map colors_scheme; /*int font_size = 13;*/ QString font_family; QFont font; diff --git a/logdoctor/modules/warnlists/modules/lib.h b/logdoctor/modules/warnlists/modules/lib.h new file mode 100644 index 00000000..56416235 --- /dev/null +++ b/logdoctor/modules/warnlists/modules/lib.h @@ -0,0 +1,14 @@ +#ifndef LOGDOCTOR__WARNLISTS__LIB__H +#define LOGDOCTOR__WARNLISTS__LIB__H + + +enum class WarnlistField +{ + Method, + Uri, + Client, + UserAgent +}; + + +#endif // LOGDOCTOR__WARNLISTS__LIB__H diff --git a/logdoctor/modules/warnlists/modules/warnlist.cpp b/logdoctor/modules/warnlists/modules/warnlist.cpp new file mode 100644 index 00000000..505f6ba6 --- /dev/null +++ b/logdoctor/modules/warnlists/modules/warnlist.cpp @@ -0,0 +1,30 @@ + +#include "warnlist.h" + +#include "modules/exceptions.h" + + +Warnlist::Warnlist() noexcept + : method{ WarnlistField::Method } + , uri{ WarnlistField::Uri } + , client{ WarnlistField::Client } + , user_agent{ WarnlistField::UserAgent } +{ + +} + +WarnlistItem& Warnlist::get( const WarnlistField field ) +{ + switch (field) { + case WarnlistField::Method: + return this->method; + case WarnlistField::Uri: + return this->uri; + case WarnlistField::Client: + return this->client; + case WarnlistField::UserAgent: + return this->user_agent; + default: + throw DoNotCatchException( "Unexpected WarnlistField", std::to_string(static_cast(field)) ); + } +} diff --git a/logdoctor/modules/warnlists/modules/warnlist.h b/logdoctor/modules/warnlists/modules/warnlist.h new file mode 100644 index 00000000..2e4d47fe --- /dev/null +++ b/logdoctor/modules/warnlists/modules/warnlist.h @@ -0,0 +1,38 @@ +#ifndef LOGDOCTOR__WARNLISTS__WARNLIST__H +#define LOGDOCTOR__WARNLISTS__WARNLIST__H + + +#include "modules/warnlists/modules/warnlist_item.h" + + +struct Warnlist final +{ + WarnlistItem method; + WarnlistItem uri; + WarnlistItem client; + WarnlistItem user_agent; + + explicit Warnlist() noexcept; + + //! Returns a reference to the requested warnlist item + /*! + \throw DoNotCatchException + */ + WarnlistItem& get( const WarnlistField field ); + + //! Returns whether the requested warnlist is in use + /*! + \throw DoNotCatchException + */ + inline bool isUsed( const WarnlistField field ) + { return get( field ).used; } + + //! Sets the requested warnlist in the given in-use condition + /*! + \throw DoNotCatchException + */ + inline void setUsed( const WarnlistField field, const bool used ) + { get( field ).used = used; } +}; + +#endif // LOGDOCTOR__WARNLISTS__WARNLIST__H diff --git a/logdoctor/modules/warnlists/modules/warnlist_item.cpp b/logdoctor/modules/warnlists/modules/warnlist_item.cpp new file mode 100644 index 00000000..989b2684 --- /dev/null +++ b/logdoctor/modules/warnlists/modules/warnlist_item.cpp @@ -0,0 +1,88 @@ + +#include "warnlist_item.h" + +#include "modules/shared.h" + +#include "modules/exceptions.h" + +#include "utilities/bwlists.h" + + +const char* WarnlistItem::fieldName() const +{ + switch (this->field) { + case WarnlistField::Method: + return FIELDS__METHOD.c_str(); + case WarnlistField::Uri: + return FIELDS__URI.c_str(); + case WarnlistField::Client: + return FIELDS__CLIENT.c_str(); + case WarnlistField::UserAgent: + return FIELDS__USER_AGENT.c_str(); + default: + // should be unreachable + throw DoNotCatchException( "Unexpected WarnlistField", std::to_string(static_cast(this->field)) ); + } +} + +void WarnlistItem::set( const std::vector& new_list ) +{ + this->list.clear(); + this->list.reserve( new_list.size() ); + for ( const std::string& item : new_list ) { + this->add( item ); + } +} + +void WarnlistItem::add( const std::string& item ) +{ + this->list.push_back( this->sanitized( item ) ); +} + +void WarnlistItem::remove( const std::string& item ) +{ + if ( const auto it{ std::find( this->list.cbegin(), this->list.cend(), item ) }; it != this->list.cend() ) { + this->list.erase( it ); + } else { + throw BWlistException( "Failed to remove the item: "+item ); + } +} + +int WarnlistItem::moveUp( const std::string& item ) +{ + if ( auto it{ std::find( std::next(this->list.begin()), this->list.end(), item ) }; it != this->list.end() ) { + const int pos{ static_cast( std::distance(this->list.begin(), it) ) - 1 }; + std::swap( *it, *std::prev(it) ); + return pos; + } else { + throw BWlistException( "Failed to move up the item: "+item ); + } +} + +int WarnlistItem::moveDown( const std::string& item ) +{ + if ( auto it{ std::find( this->list.begin(), std::prev(this->list.end()), item ) }; it != this->list.end() ) { + const int pos{ static_cast( std::distance(this->list.begin(), it) ) + 1 }; + std::swap( *it, *std::next(it) ); + return pos; + } else { + throw BWlistException( "Failed to move down the item: "+item ); + } +} + +std::string WarnlistItem::sanitized( const std::string& item ) const +{ + switch (this->field) { + case WarnlistField::Method: + return BWutils::sanitizedMethod( item ); + case WarnlistField::Uri: + return BWutils::sanitizedUri( item ); + case WarnlistField::Client: + return BWutils::sanitizedClient( item ); + case WarnlistField::UserAgent: + return BWutils::sanitizedUserAgent( item ); + default: + // should be unreachable + throw DoNotCatchException( "Unexpected WarnlistField", std::to_string(static_cast(this->field)) ); + } +} diff --git a/logdoctor/modules/warnlists/modules/warnlist_item.h b/logdoctor/modules/warnlists/modules/warnlist_item.h new file mode 100644 index 00000000..9ae8b4da --- /dev/null +++ b/logdoctor/modules/warnlists/modules/warnlist_item.h @@ -0,0 +1,71 @@ +#ifndef LOGDOCTOR__WARNLISTS__WARNLISTITEM__H +#define LOGDOCTOR__WARNLISTS__WARNLISTITEM__H + + +#include "modules/warnlists/modules/lib.h" + +#include +#include + + +struct WarnlistItem final +{ + bool used; + WarnlistField field; + std::vector list; + + WarnlistItem( const WarnlistField fld ) noexcept + : used{false}, field{fld} {} + WarnlistItem( const bool use, const WarnlistField fld ) noexcept + : used{use}, field{fld} {} + + //! Returns the name of the field to which the list is associated + /*! + The name is translatable + \throw DoNotCatchException + */ + const char* fieldName() const; + + //! Replaces the current list with the one provided + /*! + All the items will be sanitized before actually + becoming part of the list + \throw BWlistException, DoNotCatchException + */ + void set( const std::vector& new_list ); + + //! Adds the provided item to the list + /*! + The item will be sanitized before actually + being added to the list + \throw BWlistException, DoNotCatchException + */ + void add( const std::string& item ); + + //! Remove the requested item from the list + /*! + \throw BWlistException + */ + void remove( const std::string& item ); + + //! Moves the requested item one position up in the list + /*! + \throw BWlistException + */ + int moveUp( const std::string& item ); + + //! Moves the requested item one position down in the list + /*! + \throw BWlistException + */ + int moveDown( const std::string& item ); + +private: + //! Returns a sanitized item + /*! + \throw BWlistException, DoNotCatchException + */ + std::string sanitized( const std::string& item ) const; +}; + +#endif // LOGDOCTOR__WARNLISTS__WARNLISTITEM__H diff --git a/logdoctor/modules/warnlists/warnlists.cpp b/logdoctor/modules/warnlists/warnlists.cpp new file mode 100644 index 00000000..412d2756 --- /dev/null +++ b/logdoctor/modules/warnlists/warnlists.cpp @@ -0,0 +1,20 @@ + +#include "warnlists.h" + +#include "modules/exceptions.h" + + +Warnlist& Warnlists::get( const WebServer ws ) +{ + switch (ws) { + case WebServer::Apache: + return this->apache; + case WebServer::Nginx: + return this->nginx; + case WebServer::IIS: + return this->iis; + default: + // should be unreachable + throw DoNotCatchException( "Unexpected WebServer", std::to_string(static_cast(ws)) ); + } +} diff --git a/logdoctor/modules/warnlists/warnlists.h b/logdoctor/modules/warnlists/warnlists.h new file mode 100644 index 00000000..d323ce71 --- /dev/null +++ b/logdoctor/modules/warnlists/warnlists.h @@ -0,0 +1,103 @@ +#ifndef LOGDOCTOR__WARNLISTS__H +#define LOGDOCTOR__WARNLISTS__H + + +#include "main_lib.h" + +#include "modules/warnlists/modules/warnlist.h" + + +struct Warnlists final +{ + Warnlist apache; + Warnlist nginx; + Warnlist iis; + + explicit Warnlists() noexcept = default; + + //! Returns whether the requested warnlist is in use + /*! + \throw DoNotCatchException + */ + inline bool isUsed( const WebServer ws, const WarnlistField fld ) + { return get( ws ).isUsed( fld ); } + + //! Sets the requested warnlist in the given in-use condition + /*! + \throw DoNotCatchException + */ + inline void setUsed( const WebServer ws, const WarnlistField fld, const bool used ) + { get( ws ).setUsed( fld, used ); } + + //! Returns a reference to the requested warnlist + /*! + \throw DoNotCatchException + */ + Warnlist& get( const WebServer ws ); + + //! Returns a reference to the requested warnlist + /*! + \throw DoNotCatchException + */ + inline WarnlistItem& get( const WebServer ws, const WarnlistField fld ) + { return get( ws ).get( fld ); } + + //! Returns a reference to the requested warnlist + /*! + \throw DoNotCatchException + */ + inline std::vector& getList( const WebServer ws, const WarnlistField fld ) + { return get( ws, fld ).list; } + + //! Returns a const reference to the requested warnlist + /*! + \throw DoNotCatchException + */ + inline const std::vector& getListConst( const WebServer ws, const WarnlistField fld ) + { return get( ws, fld ).list; } + + //! Replaces the requested warnlist with the one provided + /*! + \throw BWlistException, DoNotCatchException + */ + inline void setList( const WebServer ws, const WarnlistField fld, const std::vector& list ) + { get( ws, fld ).set( list ); } + + //! Clears the requested warnlist + /*! + \throw BWlistException, DoNotCatchException + */ + inline void clearList( const WebServer ws, const WarnlistField fld ) + { getList( ws, fld ).clear(); } + + //! Adds the provided item to the requested warnlist + /*! + \throw BWlistException, DoNotCatchException + */ + inline void addItem( const WebServer ws, const WarnlistField fld, const std::string& item ) + { get( ws, fld ).add( item ); } + + //! Remove the requested item from the requested warnlist + /*! + \throw BWlistException + */ + inline void removeItem( const WebServer ws, const WarnlistField fld, const std::string& item ) + { get( ws, fld ).remove( item ); } + + //! Moves the requested item one position up in the requested warnlist + /*! + \throw BWlistException + */ + inline int moveUpItem( const WebServer ws, const WarnlistField fld, const std::string& item ) + { return get( ws, fld ).moveUp( item ); } + + //! Moves the requested item one position down in the requested warnlist + /*! + \throw BWlistException + */ + inline int moveDownItem( const WebServer ws, const WarnlistField fld, const std::string& item ) + { return get( ws, fld ).moveDown( item ); } +}; + + +#endif // LOGDOCTOR__WARNLISTS__H diff --git a/logdoctor/resources/translations/LogDoctor_en_GB.qm b/logdoctor/resources/translations/LogDoctor_en_GB.qm index 08010d3a..6c8386d9 100644 Binary files a/logdoctor/resources/translations/LogDoctor_en_GB.qm and b/logdoctor/resources/translations/LogDoctor_en_GB.qm differ diff --git a/logdoctor/resources/translations/LogDoctor_es_ES.qm b/logdoctor/resources/translations/LogDoctor_es_ES.qm index ddaba890..ede208c7 100644 Binary files a/logdoctor/resources/translations/LogDoctor_es_ES.qm and b/logdoctor/resources/translations/LogDoctor_es_ES.qm differ diff --git a/logdoctor/resources/translations/LogDoctor_fr_FR.qm b/logdoctor/resources/translations/LogDoctor_fr_FR.qm index 66cec47d..0c07e6ce 100644 Binary files a/logdoctor/resources/translations/LogDoctor_fr_FR.qm and b/logdoctor/resources/translations/LogDoctor_fr_FR.qm differ diff --git a/logdoctor/resources/translations/LogDoctor_it_IT.qm b/logdoctor/resources/translations/LogDoctor_it_IT.qm index a4310a07..0dc36292 100644 Binary files a/logdoctor/resources/translations/LogDoctor_it_IT.qm and b/logdoctor/resources/translations/LogDoctor_it_IT.qm differ diff --git a/logdoctor/resources/translations/LogDoctor_ja_JP.qm b/logdoctor/resources/translations/LogDoctor_ja_JP.qm index 19715a8d..9608582d 100644 Binary files a/logdoctor/resources/translations/LogDoctor_ja_JP.qm and b/logdoctor/resources/translations/LogDoctor_ja_JP.qm differ diff --git a/logdoctor/resources/translations/LogDoctor_pt_BR.qm b/logdoctor/resources/translations/LogDoctor_pt_BR.qm index 825985c7..8787e1f3 100644 Binary files a/logdoctor/resources/translations/LogDoctor_pt_BR.qm and b/logdoctor/resources/translations/LogDoctor_pt_BR.qm differ diff --git a/logdoctor/tests/main.cpp b/logdoctor/tests/main.cpp index ff561367..64680836 100644 --- a/logdoctor/tests/main.cpp +++ b/logdoctor/tests/main.cpp @@ -8,6 +8,9 @@ int main() { std::cout << "STARTING TEST SUITE" << std::endl; + std::cout << "\nTESTING: operators" << std::endl; + Testing::testOperators(); + std::cout << "\nTESTING: utilities" << std::endl; Testing::testUtilities(); diff --git a/logdoctor/tests/white_box.cpp b/logdoctor/tests/white_box.cpp index 758fc37a..0035c8fa 100644 --- a/logdoctor/tests/white_box.cpp +++ b/logdoctor/tests/white_box.cpp @@ -3,6 +3,8 @@ #include #include +#include "main_lib.h" + #include "utilities/io.h" #include "utilities/strings.h" #include "utilities/vectors.h" @@ -12,6 +14,7 @@ #include "modules/craplog/modules/datetime.h" #include "modules/craplog/modules/formats.h" #include "modules/craplog/modules/logs.h" +#include "modules/craplog/modules/workers/lib.h" #include "modules/crapview/modules/filters.h" @@ -40,6 +43,150 @@ namespace Testing { +void testOperators() +{ + //// DIALOGS LEVEL //// + + assert( DialogsLevel::Essential < DialogsLevel::Normal ); + assert( DialogsLevel::Essential < DialogsLevel::Explanatory ); + assert( DialogsLevel::Normal < DialogsLevel::Explanatory ); + assert( ! (DialogsLevel::Essential < DialogsLevel::Essential) ); + assert( ! (DialogsLevel::Normal < DialogsLevel::Normal) ); + assert( ! (DialogsLevel::Explanatory < DialogsLevel::Explanatory) ); + T_PRINT("DialogsLevel::operator <"); + + assert( DialogsLevel::Essential >= DialogsLevel::Essential ); + assert( DialogsLevel::Normal >= DialogsLevel::Essential ); + assert( DialogsLevel::Normal >= DialogsLevel::Normal ); + assert( DialogsLevel::Explanatory >= DialogsLevel::Essential ); + assert( DialogsLevel::Explanatory >= DialogsLevel::Normal ); + assert( DialogsLevel::Explanatory >= DialogsLevel::Explanatory ); + assert( ! (DialogsLevel::Essential >= DialogsLevel::Normal) ); + assert( ! (DialogsLevel::Essential >= DialogsLevel::Explanatory) ); + assert( ! (DialogsLevel::Normal >= DialogsLevel::Explanatory) ); + T_PRINT("DialogsLevel::operator >="); + + //// FIELD DATA //// + + { + const FieldData fd; + assert( fd == false ); + }{ + const FieldData fd(""); + assert( fd == false ); + }{ + const FieldData fd("*"); + assert( fd == true ); + } + T_PRINT("FieldData::operator bool"); + + { + const FieldData fd; + #ifdef _MSC_VER + assert( operator+(0ul, fd) == 0ul ); + #else + assert( 0ul + fd == 0ul ); + #endif + }{ + const FieldData fd(""); + #ifdef _MSC_VER + assert( operator+(0ul, fd) == 0ul ); + #else + assert( 0ul + fd == 0ul ); + #endif + }{ + const FieldData fd("1"); + #ifdef _MSC_VER + assert(operator+(0ul, fd) == 1ul ); + #else + assert( 0ul + fd == 1ul ); + #endif + }{ + const FieldData fd("0123456789"); + #ifdef _MSC_VER + assert( operator+(10ul, fd) == 20ul ); + #else + assert( 10ul + fd == 20ul ); + #endif + assert( fd + 10ul != 20ul ); // fd evaluates to bool (aka 1) + }{ + const FieldData fd1; + const FieldData fd2; + assert( fd1 + fd2 == 0ul ); + }{ + const FieldData fd1(""); + const FieldData fd2(""); + assert( fd1 + fd2 == 0ul ); + }{ + const FieldData fd1(""); + const FieldData fd2("123"); + assert( fd1 + fd2 == 3ul ); + }{ + const FieldData fd1("123"); + const FieldData fd2("456"); + assert( fd1 + fd2 == 6ul ); + }{ + const FieldData fd1("123"); + const FieldData fd2("456"); + #ifdef _MSC_VER + assert( operator+(4ul, fd1) + fd2 == 10ul ); + #else + assert( 4ul + fd1 + fd2 == 10ul ); + #endif + }{ + const FieldData fd1("0123456789"); + const FieldData fd2("0123456789"); + const FieldData fd3("0123456789"); + assert( fd1 + fd2 + fd3 == 30ul ); + }{ + const FieldData fd1("0123456789"); + const FieldData fd2("0123456789"); + const FieldData fd3("0123456789"); + #ifdef _MSC_VER + assert( operator+(70ul, fd1) + fd2 + fd3 == 100ul ); + #else + assert( 70ul + fd1 + fd2 + fd3 == 100ul ); + #endif + }{ + const FieldData fd1("0123456789"); + const FieldData fd2("0123456789"); + const FieldData fd3("0123456789"); + assert( fd1 + fd2 + fd3 + 70ul == 100ul ); + }{ + const FieldData fd1("0123456789"); + const FieldData fd2("0123456789"); + const FieldData fd3("0123456789"); + #ifdef _MSC_VER + assert( operator+(10ul, fd1) + fd2 + fd3 + 10ul == 50ul ); + #else + assert( 10ul + fd1 + fd2 + fd3 + 10ul == 50ul ); + #endif + }{ + const FieldData fd1("0123456789"); + const FieldData fd2("0123456789"); + const FieldData fd3("0123456789"); + assert( 10ul + (fd1 + fd2) + fd3 + 10ul == 50ul ); + }{ + const FieldData fd1("0123456789"); + const FieldData fd2("0123456789"); + const FieldData fd3("0123456789"); + assert( 10ul + (fd1 + fd2) + (fd3 + 10ul) != 50ul ); // fd3 evaluates to bool (== 1) + }{ + const FieldData fd1("0123456789"); + const FieldData fd2("0123456789"); + const FieldData fd3("0123456789"); + const FieldData fd4("0123456789"); + const FieldData fd5("0123456789"); + #ifdef _MSC_VER + assert( operator+(10ul, fd1) + 20ul + fd2 + fd3 + 10ul + fd4 + 10ul + fd5 == 100ul ); + #else + assert( 10ul + fd1 + 20ul + fd2 + fd3 + 10ul + fd4 + 10ul + fd5 == 100ul ); + #endif + } + T_PRINT("FieldData::operator +"); +} + + void testUtilities() { //// IO UTILS //// @@ -65,37 +212,84 @@ void testUtilities() T_PRINT("IOutils::checkDir"); + //// CHARS //// + + { + const auto every_other_char_but = [](const std::vector& in)->std::vector{ + std::vector out( 128-in.size() ); + for (char c{0}; c<127; ++c) { + if (const auto it = std::find(in.cbegin(),in.cend(),c); it == in.cend()) { + out.push_back( c ); + } + } + out.push_back(127); + out.shrink_to_fit(); + return out; + }; + const std::vector numerical_chars + {'0','1','2','3','4','5','6','7','8','9'}; + const std::vector alphabetical_chars + {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z', + 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; + const std::vector alphanumerical_chars + {'0','1','2','3','4','5','6','7','8','9', + 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z', + 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; + const std::vector hexadecimal_chars + {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','a','b','c','d','e','f'}; + const std::vector ip_chars + {'.',':','0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','a','b','c','d','e','f'}; + + for (const char& c : numerical_chars) + assert( CharOps::isNumeric(c) == true ); + for (const char& c : every_other_char_but(numerical_chars)) + assert( CharOps::isNumeric(c) == false ); + T_PRINT("CharOps::isNumeric"); + + for (const char& c : alphabetical_chars) + assert( CharOps::isAlphabetic(c) == true ); + for (const char& c : every_other_char_but(alphabetical_chars)) + assert( CharOps::isAlphabetic(c) == false ); + T_PRINT("CharOps::isAlphabetic"); + + for (const char& c : alphanumerical_chars) + assert( CharOps::isAlnum(c) == true ); + for (const char& c : every_other_char_but(alphanumerical_chars)) + assert( CharOps::isAlnum(c) == false ); + T_PRINT("CharOps::isAlnum"); + + for (const char& c : hexadecimal_chars) + assert( CharOps::isHex(c) == true ); + for (const char& c : every_other_char_but(hexadecimal_chars)) + assert( CharOps::isHex(c) == false ); + T_PRINT("CharOps::isHex"); + + for (const char& c : ip_chars) + assert( CharOps::isIP(c) == true ); + for (const char& c : every_other_char_but(ip_chars)) + assert( CharOps::isIP(c) == false ); + T_PRINT("CharOps::isIP"); + } + + //// STRINGS //// assert( StringOps::count("test test test test ", ' ') == 7ul ); assert( StringOps::count("flagABCflagXYZflag", "flag") == 3ul ); T_PRINT("StringOps::count"); - assert( StringOps::isNumeric('0') == true ); - assert( StringOps::isNumeric(' ') == false ); assert( StringOps::isNumeric("0123456789") == true ); assert( StringOps::isNumeric("0123456789 ") == false ); T_PRINT("StringOps::isNumeric"); - assert( StringOps::isAlphabetic('a') == true ); - assert( StringOps::isAlphabetic('.') == false ); assert( StringOps::isAlphabetic("abcXYZ") == true ); assert( StringOps::isAlphabetic("abc_XYZ") == false ); T_PRINT("StringOps::isAlphabetic"); - assert( StringOps::isAlnum('X') == true ); - assert( StringOps::isAlnum('7') == true ); - assert( StringOps::isAlnum('-') == false ); assert( StringOps::isAlnum("testME123") == true ); assert( StringOps::isAlnum("Fail!") == false ); T_PRINT("StringOps::isAlnum"); - assert( StringOps::isHex('6') == true ); - assert( StringOps::isHex('a') == true ); - assert( StringOps::isHex('F') == true ); - assert( StringOps::isHex('g') == false ); - T_PRINT("StringOps::isHex"); - assert( StringOps::isIP("192.168.1.1") == true ); assert( StringOps::isIP("::1") == true ); assert( StringOps::isIP("987654321.") == true ); @@ -119,25 +313,47 @@ void testUtilities() assert( StringOps::contains("this_should_fail", "SHOULD") == false ); T_PRINT("StringOps::contains"); - assert( StringOps::strip(" ok ", ' ') == "ok" ); + assert( StringOps::strip("___test___", '_') == "test" ); + assert( StringOps::strip("test", ' ') == "test" ); + assert( StringOps::strip(" ", ' ') == "" ); + assert( StringOps::strip("", ' ') == "" ); assert( StringOps::strip("a b ctestc", " abc") == "test" ); assert( StringOps::strip("\n\t \ntest\r ") == "test" ); + assert( StringOps::strip("test") == "test" ); + assert( StringOps::strip(" \t\n\r") == "" ); + assert( StringOps::strip("") == "" ); T_PRINT("StringOps::strip"); - assert( StringOps::lstrip("___ok_", '_') == "ok_" ); + assert( StringOps::lstrip("___test_", '_') == "test_" ); + assert( StringOps::lstrip("test", ' ') == "test" ); + assert( StringOps::lstrip(" ", ' ') == "" ); + assert( StringOps::lstrip("", ' ') == "" ); assert( StringOps::lstrip("the three trees", " ethr") == "s" ); assert( StringOps::lstrip(" \n\t\rtest ") == "test " ); + assert( StringOps::lstrip("test") == "test" ); + assert( StringOps::lstrip(" \t\n\r") == "" ); + assert( StringOps::lstrip("") == "" ); T_PRINT("StringOps::lstrip"); - assert( StringOps::rstrip("_ok___", '_') == "_ok" ); + assert( StringOps::rstrip("_test___", '_') == "_test" ); + assert( StringOps::rstrip("test", ' ') == "test" ); + assert( StringOps::rstrip(" ", ' ') == "" ); + assert( StringOps::rstrip("", ' ') == "" ); assert( StringOps::rstrip("testTEST", "TEST") == "test" ); assert( StringOps::rstrip(" test\r\t\n ") == " test" ); + assert( StringOps::rstrip("test") == "test" ); + assert( StringOps::rstrip(" \t\n\r") == "" ); + assert( StringOps::rstrip("") == "" ); T_PRINT("StringOps::rstrip"); assert( StringOps::lstripUntil("is ok?", ' ') == "ok?" ); assert( StringOps::lstripUntil("yes, it is", ' ', false) == " it is" ); - assert( StringOps::lstripUntil("__fine", '_', true, false) == "_fine" ); - assert( StringOps::lstripUntil("\t\t\t\t\t\t\t\t\tx", '\t') == "x" ); + assert( StringOps::lstripUntil("__test", '_', false, false) == "__test" ); + assert( StringOps::lstripUntil("__test", '_', true, false) == "_test" ); + assert( StringOps::lstripUntil("__test", '_', true, true) == "test" ); + assert( StringOps::lstripUntil(" ", '_') == " " ); + assert( StringOps::lstripUntil(" ", ' ') == "" ); + assert( StringOps::lstripUntil("", ' ') == "" ); T_PRINT("StringOps::lstripUntil"); { @@ -200,6 +416,685 @@ void testUtilities() void testCraplogModules() { + //// LOGS FORMAT FIELDS //// + + { + // test for truth + assert( _NO_PARSE_NEEDED & date_time_year ); + assert( _NO_PARSE_NEEDED & date_time_month ); + assert( _NO_PARSE_NEEDED & date_time_day ); + assert( _NO_PARSE_NEEDED & date_time_hour ); + assert( _NO_PARSE_NEEDED & date_time_minute ); + assert( _NO_PARSE_NEEDED & date_time_second ); + assert( _NO_PARSE_NEEDED & request_protocol ); + assert( _NO_PARSE_NEEDED & request_method ); + assert( _NO_PARSE_NEEDED & request_uri ); + assert( _NO_PARSE_NEEDED & request_query ); + assert( _NO_PARSE_NEEDED & response_code ); + assert( _NO_PARSE_NEEDED & bytes_received ); + assert( _NO_PARSE_NEEDED & bytes_sent ); + assert( _NO_PARSE_NEEDED & time_taken_ms ); + assert( _NO_PARSE_NEEDED & client ); + assert( _NO_PARSE_NEEDED & user_agent ); + assert( _NO_PARSE_NEEDED & cookie ); + assert( _NO_PARSE_NEEDED & referer ); + // test for false + assert( !( _NO_PARSE_NEEDED & _INVALID ) ); + assert( !( _NO_PARSE_NEEDED & _DISCARDED ) ); + assert( !( _NO_PARSE_NEEDED & date_time_epoch_us ) ); + assert( !( _NO_PARSE_NEEDED & date_time_epoch_ms ) ); + assert( !( _NO_PARSE_NEEDED & date_time_epoch_s ) ); + assert( !( _NO_PARSE_NEEDED & date_time_epoch_s_ms ) ); + assert( !( _NO_PARSE_NEEDED & date_time_ncsa ) ); + assert( !( _NO_PARSE_NEEDED & date_time_iso ) ); + assert( !( _NO_PARSE_NEEDED & date_time_gmt ) ); + assert( !( _NO_PARSE_NEEDED & date_time_mcs ) ); + assert( !( _NO_PARSE_NEEDED & date_time_utc_d ) ); + assert( !( _NO_PARSE_NEEDED & date_time_utc_t ) ); + assert( !( _NO_PARSE_NEEDED & date_time_yyyymmdd ) ); + assert( !( _NO_PARSE_NEEDED & date_time_mmddyy ) ); + assert( !( _NO_PARSE_NEEDED & date_time_mdyyyy ) ); + assert( !( _NO_PARSE_NEEDED & date_time_year_short ) ); + assert( !( _NO_PARSE_NEEDED & date_time_month_str ) ); + assert( !( _NO_PARSE_NEEDED & date_time_clock_24 ) ); + assert( !( _NO_PARSE_NEEDED & date_time_clock_12 ) ); + assert( !( _NO_PARSE_NEEDED & date_time_clock_short ) ); + assert( !( _NO_PARSE_NEEDED & request_uri_query ) ); + assert( !( _NO_PARSE_NEEDED & request_full ) ); + assert( !( _NO_PARSE_NEEDED & time_taken_us ) ); + assert( !( _NO_PARSE_NEEDED & time_taken_s ) ); + assert( !( _NO_PARSE_NEEDED & time_taken_s_ms ) ); + }{ + // test for truth + assert( _DATE_TIME & date_time_epoch_us ); + assert( _DATE_TIME & date_time_epoch_ms ); + assert( _DATE_TIME & date_time_epoch_s ); + assert( _DATE_TIME & date_time_epoch_s_ms ); + assert( _DATE_TIME & date_time_ncsa ); + assert( _DATE_TIME & date_time_iso ); + assert( _DATE_TIME & date_time_gmt ); + assert( _DATE_TIME & date_time_mcs ); + assert( _DATE_TIME & date_time_utc_d ); + assert( _DATE_TIME & date_time_utc_t ); + assert( _DATE_TIME & date_time_yyyymmdd ); + assert( _DATE_TIME & date_time_mmddyy ); + assert( _DATE_TIME & date_time_mdyyyy ); + assert( _DATE_TIME & date_time_year_short ); + assert( _DATE_TIME & date_time_month_str ); + assert( _DATE_TIME & date_time_year ); + assert( _DATE_TIME & date_time_month ); + assert( _DATE_TIME & date_time_day ); + assert( _DATE_TIME & date_time_hour ); + assert( _DATE_TIME & date_time_minute ); + assert( _DATE_TIME & date_time_second ); + assert( _DATE_TIME & date_time_clock_short ); + assert( _DATE_TIME & date_time_clock_12 ); + assert( _DATE_TIME & date_time_clock_24 ); + // test for false + assert( !( _DATE_TIME & _INVALID ) ); + assert( !( _DATE_TIME & _DISCARDED ) ); + assert( !( _DATE_TIME & request_protocol ) ); + assert( !( _DATE_TIME & request_method ) ); + assert( !( _DATE_TIME & request_uri ) ); + assert( !( _DATE_TIME & request_query ) ); + assert( !( _DATE_TIME & request_uri_query ) ); + assert( !( _DATE_TIME & request_full ) ); + assert( !( _DATE_TIME & response_code ) ); + assert( !( _DATE_TIME & bytes_received ) ); + assert( !( _DATE_TIME & bytes_sent ) ); + assert( !( _DATE_TIME & time_taken_us ) ); + assert( !( _DATE_TIME & time_taken_ms ) ); + assert( !( _DATE_TIME & time_taken_s ) ); + assert( !( _DATE_TIME & time_taken_s_ms ) ); + assert( !( _DATE_TIME & client ) ); + assert( !( _DATE_TIME & user_agent ) ); + assert( !( _DATE_TIME & cookie ) ); + assert( !( _DATE_TIME & referer ) ); + }{ + // test for truth + assert( _DATE_TIME_FULL & date_time_epoch_us ); + assert( _DATE_TIME_FULL & date_time_epoch_ms ); + assert( _DATE_TIME_FULL & date_time_epoch_s ); + assert( _DATE_TIME_FULL & date_time_epoch_s_ms ); + assert( _DATE_TIME_FULL & date_time_ncsa ); + assert( _DATE_TIME_FULL & date_time_iso ); + assert( _DATE_TIME_FULL & date_time_gmt ); + assert( _DATE_TIME_FULL & date_time_mcs ); + // test for false + assert( !( _DATE_TIME_FULL & date_time_utc_d ) ); + assert( !( _DATE_TIME_FULL & date_time_utc_t ) ); + assert( !( _DATE_TIME_FULL & date_time_yyyymmdd ) ); + assert( !( _DATE_TIME_FULL & date_time_mmddyy ) ); + assert( !( _DATE_TIME_FULL & date_time_mdyyyy ) ); + assert( !( _DATE_TIME_FULL & date_time_year_short ) ); + assert( !( _DATE_TIME_FULL & date_time_month_str ) ); + assert( !( _DATE_TIME_FULL & date_time_year ) ); + assert( !( _DATE_TIME_FULL & date_time_month ) ); + assert( !( _DATE_TIME_FULL & date_time_day ) ); + assert( !( _DATE_TIME_FULL & date_time_hour ) ); + assert( !( _DATE_TIME_FULL & date_time_minute ) ); + assert( !( _DATE_TIME_FULL & date_time_second ) ); + assert( !( _DATE_TIME_FULL & date_time_clock_short ) ); + assert( !( _DATE_TIME_FULL & date_time_clock_12 ) ); + assert( !( _DATE_TIME_FULL & date_time_clock_24 ) ); + }{ + // test for truth + assert( _DATE_TIME_EPOCH & date_time_epoch_us ); + assert( _DATE_TIME_EPOCH & date_time_epoch_ms ); + assert( _DATE_TIME_EPOCH & date_time_epoch_s ); + assert( _DATE_TIME_EPOCH & date_time_epoch_s_ms ); + // test for false + assert( !( _DATE_TIME_EPOCH & date_time_ncsa ) ); + assert( !( _DATE_TIME_EPOCH & date_time_iso ) ); + assert( !( _DATE_TIME_EPOCH & date_time_gmt ) ); + assert( !( _DATE_TIME_EPOCH & date_time_mcs ) ); + assert( !( _DATE_TIME_EPOCH & date_time_utc_d ) ); + assert( !( _DATE_TIME_EPOCH & date_time_utc_t ) ); + assert( !( _DATE_TIME_EPOCH & date_time_yyyymmdd ) ); + assert( !( _DATE_TIME_EPOCH & date_time_mmddyy ) ); + assert( !( _DATE_TIME_EPOCH & date_time_mdyyyy ) ); + assert( !( _DATE_TIME_EPOCH & date_time_year_short ) ); + assert( !( _DATE_TIME_EPOCH & date_time_month_str ) ); + assert( !( _DATE_TIME_EPOCH & date_time_year ) ); + assert( !( _DATE_TIME_EPOCH & date_time_month ) ); + assert( !( _DATE_TIME_EPOCH & date_time_day ) ); + assert( !( _DATE_TIME_EPOCH & date_time_hour ) ); + assert( !( _DATE_TIME_EPOCH & date_time_minute ) ); + assert( !( _DATE_TIME_EPOCH & date_time_second ) ); + assert( !( _DATE_TIME_EPOCH & date_time_clock_short ) ); + assert( !( _DATE_TIME_EPOCH & date_time_clock_12 ) ); + assert( !( _DATE_TIME_EPOCH & date_time_clock_24 ) ); + }{ + // test for truth + assert( _DATE_TIME_UTC & date_time_utc_d ); + assert( _DATE_TIME_UTC & date_time_utc_t ); + // test for false + assert( !( _DATE_TIME_UTC & date_time_epoch_us ) ); + assert( !( _DATE_TIME_UTC & date_time_epoch_ms ) ); + assert( !( _DATE_TIME_UTC & date_time_epoch_s ) ); + assert( !( _DATE_TIME_UTC & date_time_epoch_s_ms ) ); + assert( !( _DATE_TIME_UTC & date_time_ncsa ) ); + assert( !( _DATE_TIME_UTC & date_time_iso ) ); + assert( !( _DATE_TIME_UTC & date_time_gmt ) ); + assert( !( _DATE_TIME_UTC & date_time_mcs ) ); + assert( !( _DATE_TIME_UTC & date_time_yyyymmdd ) ); + assert( !( _DATE_TIME_UTC & date_time_mmddyy ) ); + assert( !( _DATE_TIME_UTC & date_time_mdyyyy ) ); + assert( !( _DATE_TIME_UTC & date_time_year_short ) ); + assert( !( _DATE_TIME_UTC & date_time_month_str ) ); + assert( !( _DATE_TIME_UTC & date_time_year ) ); + assert( !( _DATE_TIME_UTC & date_time_month ) ); + assert( !( _DATE_TIME_UTC & date_time_day ) ); + assert( !( _DATE_TIME_UTC & date_time_hour ) ); + assert( !( _DATE_TIME_UTC & date_time_minute ) ); + assert( !( _DATE_TIME_UTC & date_time_second ) ); + assert( !( _DATE_TIME_UTC & date_time_clock_short ) ); + assert( !( _DATE_TIME_UTC & date_time_clock_12 ) ); + assert( !( _DATE_TIME_UTC & date_time_clock_24 ) ); + }{ + // test for truth + assert( _DATE_TIME_DATE & date_time_utc_d ); + assert( _DATE_TIME_DATE & date_time_yyyymmdd ); + assert( _DATE_TIME_DATE & date_time_mmddyy ); + assert( _DATE_TIME_DATE & date_time_mdyyyy ); + // test for false + assert( !( _DATE_TIME_DATE & date_time_epoch_us ) ); + assert( !( _DATE_TIME_DATE & date_time_epoch_ms ) ); + assert( !( _DATE_TIME_DATE & date_time_epoch_s ) ); + assert( !( _DATE_TIME_DATE & date_time_epoch_s_ms ) ); + assert( !( _DATE_TIME_DATE & date_time_ncsa ) ); + assert( !( _DATE_TIME_DATE & date_time_iso ) ); + assert( !( _DATE_TIME_DATE & date_time_gmt ) ); + assert( !( _DATE_TIME_DATE & date_time_mcs ) ); + assert( !( _DATE_TIME_DATE & date_time_utc_t ) ); + assert( !( _DATE_TIME_DATE & date_time_year_short ) ); + assert( !( _DATE_TIME_DATE & date_time_month_str ) ); + assert( !( _DATE_TIME_DATE & date_time_year ) ); + assert( !( _DATE_TIME_DATE & date_time_month ) ); + assert( !( _DATE_TIME_DATE & date_time_day ) ); + assert( !( _DATE_TIME_DATE & date_time_hour ) ); + assert( !( _DATE_TIME_DATE & date_time_minute ) ); + assert( !( _DATE_TIME_DATE & date_time_second ) ); + assert( !( _DATE_TIME_DATE & date_time_clock_short ) ); + assert( !( _DATE_TIME_DATE & date_time_clock_12 ) ); + assert( !( _DATE_TIME_DATE & date_time_clock_24 ) ); + }{ + // test for truth + assert( _DATE_TIME_YEAR & date_time_year_short ); + assert( _DATE_TIME_YEAR & date_time_year ); + // test for false + assert( !( _DATE_TIME_YEAR & date_time_epoch_us ) ); + assert( !( _DATE_TIME_YEAR & date_time_epoch_ms ) ); + assert( !( _DATE_TIME_YEAR & date_time_epoch_s ) ); + assert( !( _DATE_TIME_YEAR & date_time_epoch_s_ms ) ); + assert( !( _DATE_TIME_YEAR & date_time_ncsa ) ); + assert( !( _DATE_TIME_YEAR & date_time_iso ) ); + assert( !( _DATE_TIME_YEAR & date_time_gmt ) ); + assert( !( _DATE_TIME_YEAR & date_time_mcs ) ); + assert( !( _DATE_TIME_YEAR & date_time_utc_d ) ); + assert( !( _DATE_TIME_YEAR & date_time_utc_t ) ); + assert( !( _DATE_TIME_YEAR & date_time_yyyymmdd ) ); + assert( !( _DATE_TIME_YEAR & date_time_mmddyy ) ); + assert( !( _DATE_TIME_YEAR & date_time_mdyyyy ) ); + assert( !( _DATE_TIME_YEAR & date_time_month_str ) ); + assert( !( _DATE_TIME_YEAR & date_time_month ) ); + assert( !( _DATE_TIME_YEAR & date_time_day ) ); + assert( !( _DATE_TIME_YEAR & date_time_hour ) ); + assert( !( _DATE_TIME_YEAR & date_time_minute ) ); + assert( !( _DATE_TIME_YEAR & date_time_second ) ); + assert( !( _DATE_TIME_YEAR & date_time_clock_short ) ); + assert( !( _DATE_TIME_YEAR & date_time_clock_12 ) ); + assert( !( _DATE_TIME_YEAR & date_time_clock_24 ) ); + }{ + // test for truth + assert( _DATE_TIME_MONTH & date_time_month_str ); + assert( _DATE_TIME_MONTH & date_time_month ); + // test for false + assert( !( _DATE_TIME_MONTH & date_time_epoch_us ) ); + assert( !( _DATE_TIME_MONTH & date_time_epoch_ms ) ); + assert( !( _DATE_TIME_MONTH & date_time_epoch_s ) ); + assert( !( _DATE_TIME_MONTH & date_time_epoch_s_ms ) ); + assert( !( _DATE_TIME_MONTH & date_time_ncsa ) ); + assert( !( _DATE_TIME_MONTH & date_time_iso ) ); + assert( !( _DATE_TIME_MONTH & date_time_gmt ) ); + assert( !( _DATE_TIME_MONTH & date_time_mcs ) ); + assert( !( _DATE_TIME_MONTH & date_time_utc_d ) ); + assert( !( _DATE_TIME_MONTH & date_time_utc_t ) ); + assert( !( _DATE_TIME_MONTH & date_time_yyyymmdd ) ); + assert( !( _DATE_TIME_MONTH & date_time_mmddyy ) ); + assert( !( _DATE_TIME_MONTH & date_time_mdyyyy ) ); + assert( !( _DATE_TIME_MONTH & date_time_year_short ) ); + assert( !( _DATE_TIME_MONTH & date_time_year ) ); + assert( !( _DATE_TIME_MONTH & date_time_day ) ); + assert( !( _DATE_TIME_MONTH & date_time_hour ) ); + assert( !( _DATE_TIME_MONTH & date_time_minute ) ); + assert( !( _DATE_TIME_MONTH & date_time_second ) ); + assert( !( _DATE_TIME_MONTH & date_time_clock_short ) ); + assert( !( _DATE_TIME_MONTH & date_time_clock_12 ) ); + assert( !( _DATE_TIME_MONTH & date_time_clock_24 ) ); + }{ + // test for truth + assert( _DATE_TIME_CLOCK & date_time_clock_short ); + assert( _DATE_TIME_CLOCK & date_time_clock_12 ); + assert( _DATE_TIME_CLOCK & date_time_clock_24 ); + // test for false + assert( !( _DATE_TIME_CLOCK & date_time_epoch_us ) ); + assert( !( _DATE_TIME_CLOCK & date_time_epoch_ms ) ); + assert( !( _DATE_TIME_CLOCK & date_time_epoch_s ) ); + assert( !( _DATE_TIME_CLOCK & date_time_epoch_s_ms ) ); + assert( !( _DATE_TIME_CLOCK & date_time_ncsa ) ); + assert( !( _DATE_TIME_CLOCK & date_time_iso ) ); + assert( !( _DATE_TIME_CLOCK & date_time_gmt ) ); + assert( !( _DATE_TIME_CLOCK & date_time_mcs ) ); + assert( !( _DATE_TIME_CLOCK & date_time_utc_d ) ); + assert( !( _DATE_TIME_CLOCK & date_time_utc_t ) ); + assert( !( _DATE_TIME_CLOCK & date_time_yyyymmdd ) ); + assert( !( _DATE_TIME_CLOCK & date_time_mmddyy ) ); + assert( !( _DATE_TIME_CLOCK & date_time_mdyyyy ) ); + assert( !( _DATE_TIME_CLOCK & date_time_year_short ) ); + assert( !( _DATE_TIME_CLOCK & date_time_month_str ) ); + assert( !( _DATE_TIME_CLOCK & date_time_year ) ); + assert( !( _DATE_TIME_CLOCK & date_time_month ) ); + assert( !( _DATE_TIME_CLOCK & date_time_day ) ); + assert( !( _DATE_TIME_CLOCK & date_time_hour ) ); + assert( !( _DATE_TIME_CLOCK & date_time_minute ) ); + assert( !( _DATE_TIME_CLOCK & date_time_second ) ); + }{ + // test for truth + assert( _REQUEST & request_protocol ); + assert( _REQUEST & request_method ); + assert( _REQUEST & request_uri ); + assert( _REQUEST & request_query ); + assert( _REQUEST & request_uri_query ); + assert( _REQUEST & request_full ); + // test for false + assert( !( _REQUEST & _INVALID ) ); + assert( !( _REQUEST & _DISCARDED ) ); + assert( !( _REQUEST & date_time_epoch_us ) ); + assert( !( _REQUEST & date_time_epoch_ms ) ); + assert( !( _REQUEST & date_time_epoch_s ) ); + assert( !( _REQUEST & date_time_epoch_s_ms ) ); + assert( !( _REQUEST & date_time_ncsa ) ); + assert( !( _REQUEST & date_time_iso ) ); + assert( !( _REQUEST & date_time_gmt ) ); + assert( !( _REQUEST & date_time_mcs ) ); + assert( !( _REQUEST & date_time_utc_d ) ); + assert( !( _REQUEST & date_time_utc_t ) ); + assert( !( _REQUEST & date_time_yyyymmdd ) ); + assert( !( _REQUEST & date_time_mmddyy ) ); + assert( !( _REQUEST & date_time_mdyyyy ) ); + assert( !( _REQUEST & date_time_year_short ) ); + assert( !( _REQUEST & date_time_month_str ) ); + assert( !( _REQUEST & date_time_year ) ); + assert( !( _REQUEST & date_time_month ) ); + assert( !( _REQUEST & date_time_day ) ); + assert( !( _REQUEST & date_time_hour ) ); + assert( !( _REQUEST & date_time_minute ) ); + assert( !( _REQUEST & date_time_second ) ); + assert( !( _REQUEST & date_time_clock_short ) ); + assert( !( _REQUEST & date_time_clock_12 ) ); + assert( !( _REQUEST & date_time_clock_24 ) ); + assert( !( _REQUEST & response_code ) ); + assert( !( _REQUEST & bytes_received ) ); + assert( !( _REQUEST & bytes_sent ) ); + assert( !( _REQUEST & time_taken_us ) ); + assert( !( _REQUEST & time_taken_ms ) ); + assert( !( _REQUEST & time_taken_s ) ); + assert( !( _REQUEST & time_taken_s_ms ) ); + assert( !( _REQUEST & client ) ); + assert( !( _REQUEST & user_agent ) ); + assert( !( _REQUEST & cookie ) ); + assert( !( _REQUEST & referer ) ); + }{ + // test for truth + assert( _RESPONSE_CODE & response_code ); + // test for false + assert( !( _RESPONSE_CODE & _INVALID ) ); + assert( !( _RESPONSE_CODE & _DISCARDED ) ); + assert( !( _RESPONSE_CODE & date_time_epoch_us ) ); + assert( !( _RESPONSE_CODE & date_time_epoch_ms ) ); + assert( !( _RESPONSE_CODE & date_time_epoch_s ) ); + assert( !( _RESPONSE_CODE & date_time_epoch_s_ms ) ); + assert( !( _RESPONSE_CODE & date_time_ncsa ) ); + assert( !( _RESPONSE_CODE & date_time_iso ) ); + assert( !( _RESPONSE_CODE & date_time_gmt ) ); + assert( !( _RESPONSE_CODE & date_time_mcs ) ); + assert( !( _RESPONSE_CODE & date_time_utc_d ) ); + assert( !( _RESPONSE_CODE & date_time_utc_t ) ); + assert( !( _RESPONSE_CODE & date_time_yyyymmdd ) ); + assert( !( _RESPONSE_CODE & date_time_mmddyy ) ); + assert( !( _RESPONSE_CODE & date_time_mdyyyy ) ); + assert( !( _RESPONSE_CODE & date_time_year_short ) ); + assert( !( _RESPONSE_CODE & date_time_month_str ) ); + assert( !( _RESPONSE_CODE & date_time_year ) ); + assert( !( _RESPONSE_CODE & date_time_month ) ); + assert( !( _RESPONSE_CODE & date_time_day ) ); + assert( !( _RESPONSE_CODE & date_time_hour ) ); + assert( !( _RESPONSE_CODE & date_time_minute ) ); + assert( !( _RESPONSE_CODE & date_time_second ) ); + assert( !( _RESPONSE_CODE & date_time_clock_short ) ); + assert( !( _RESPONSE_CODE & date_time_clock_12 ) ); + assert( !( _RESPONSE_CODE & date_time_clock_24 ) ); + assert( !( _RESPONSE_CODE & request_protocol ) ); + assert( !( _RESPONSE_CODE & request_method ) ); + assert( !( _RESPONSE_CODE & request_uri ) ); + assert( !( _RESPONSE_CODE & request_query ) ); + assert( !( _RESPONSE_CODE & request_uri_query ) ); + assert( !( _RESPONSE_CODE & request_full ) ); + assert( !( _RESPONSE_CODE & bytes_received ) ); + assert( !( _RESPONSE_CODE & bytes_sent ) ); + assert( !( _RESPONSE_CODE & time_taken_us ) ); + assert( !( _RESPONSE_CODE & time_taken_ms ) ); + assert( !( _RESPONSE_CODE & time_taken_s ) ); + assert( !( _RESPONSE_CODE & time_taken_s_ms ) ); + assert( !( _RESPONSE_CODE & client ) ); + assert( !( _RESPONSE_CODE & user_agent ) ); + assert( !( _RESPONSE_CODE & cookie ) ); + assert( !( _RESPONSE_CODE & referer ) ); + }{ + // test for truth + assert( _DATA_TRANSFER & bytes_received ); + assert( _DATA_TRANSFER & bytes_sent ); + // test for false + assert( !( _DATA_TRANSFER & _INVALID ) ); + assert( !( _DATA_TRANSFER & _DISCARDED ) ); + assert( !( _DATA_TRANSFER & date_time_epoch_us ) ); + assert( !( _DATA_TRANSFER & date_time_epoch_ms ) ); + assert( !( _DATA_TRANSFER & date_time_epoch_s ) ); + assert( !( _DATA_TRANSFER & date_time_epoch_s_ms ) ); + assert( !( _DATA_TRANSFER & date_time_ncsa ) ); + assert( !( _DATA_TRANSFER & date_time_iso ) ); + assert( !( _DATA_TRANSFER & date_time_gmt ) ); + assert( !( _DATA_TRANSFER & date_time_mcs ) ); + assert( !( _DATA_TRANSFER & date_time_utc_d ) ); + assert( !( _DATA_TRANSFER & date_time_utc_t ) ); + assert( !( _DATA_TRANSFER & date_time_yyyymmdd ) ); + assert( !( _DATA_TRANSFER & date_time_mmddyy ) ); + assert( !( _DATA_TRANSFER & date_time_mdyyyy ) ); + assert( !( _DATA_TRANSFER & date_time_year_short ) ); + assert( !( _DATA_TRANSFER & date_time_month_str ) ); + assert( !( _DATA_TRANSFER & date_time_year ) ); + assert( !( _DATA_TRANSFER & date_time_month ) ); + assert( !( _DATA_TRANSFER & date_time_day ) ); + assert( !( _DATA_TRANSFER & date_time_hour ) ); + assert( !( _DATA_TRANSFER & date_time_minute ) ); + assert( !( _DATA_TRANSFER & date_time_second ) ); + assert( !( _DATA_TRANSFER & date_time_clock_short ) ); + assert( !( _DATA_TRANSFER & date_time_clock_12 ) ); + assert( !( _DATA_TRANSFER & date_time_clock_24 ) ); + assert( !( _DATA_TRANSFER & request_protocol ) ); + assert( !( _DATA_TRANSFER & request_method ) ); + assert( !( _DATA_TRANSFER & request_uri ) ); + assert( !( _DATA_TRANSFER & request_query ) ); + assert( !( _DATA_TRANSFER & request_uri_query ) ); + assert( !( _DATA_TRANSFER & request_full ) ); + assert( !( _DATA_TRANSFER & response_code ) ); + assert( !( _DATA_TRANSFER & time_taken_us ) ); + assert( !( _DATA_TRANSFER & time_taken_ms ) ); + assert( !( _DATA_TRANSFER & time_taken_s ) ); + assert( !( _DATA_TRANSFER & time_taken_s_ms ) ); + assert( !( _DATA_TRANSFER & client ) ); + assert( !( _DATA_TRANSFER & user_agent ) ); + assert( !( _DATA_TRANSFER & cookie ) ); + assert( !( _DATA_TRANSFER & referer ) ); + }{ + // test for truth + assert( _TIME_TAKEN & time_taken_us ); + assert( _TIME_TAKEN & time_taken_ms ); + assert( _TIME_TAKEN & time_taken_s ); + assert( _TIME_TAKEN & time_taken_s_ms ); + // test for false + assert( !( _TIME_TAKEN & _INVALID ) ); + assert( !( _TIME_TAKEN & _DISCARDED ) ); + assert( !( _TIME_TAKEN & date_time_epoch_us ) ); + assert( !( _TIME_TAKEN & date_time_epoch_ms ) ); + assert( !( _TIME_TAKEN & date_time_epoch_s ) ); + assert( !( _TIME_TAKEN & date_time_epoch_s_ms ) ); + assert( !( _TIME_TAKEN & date_time_ncsa ) ); + assert( !( _TIME_TAKEN & date_time_iso ) ); + assert( !( _TIME_TAKEN & date_time_gmt ) ); + assert( !( _TIME_TAKEN & date_time_mcs ) ); + assert( !( _TIME_TAKEN & date_time_utc_d ) ); + assert( !( _TIME_TAKEN & date_time_utc_t ) ); + assert( !( _TIME_TAKEN & date_time_yyyymmdd ) ); + assert( !( _TIME_TAKEN & date_time_mmddyy ) ); + assert( !( _TIME_TAKEN & date_time_mdyyyy ) ); + assert( !( _TIME_TAKEN & date_time_year_short ) ); + assert( !( _TIME_TAKEN & date_time_month_str ) ); + assert( !( _TIME_TAKEN & date_time_year ) ); + assert( !( _TIME_TAKEN & date_time_month ) ); + assert( !( _TIME_TAKEN & date_time_day ) ); + assert( !( _TIME_TAKEN & date_time_hour ) ); + assert( !( _TIME_TAKEN & date_time_minute ) ); + assert( !( _TIME_TAKEN & date_time_second ) ); + assert( !( _TIME_TAKEN & date_time_clock_short ) ); + assert( !( _TIME_TAKEN & date_time_clock_12 ) ); + assert( !( _TIME_TAKEN & date_time_clock_24 ) ); + assert( !( _TIME_TAKEN & request_protocol ) ); + assert( !( _TIME_TAKEN & request_method ) ); + assert( !( _TIME_TAKEN & request_uri ) ); + assert( !( _TIME_TAKEN & request_query ) ); + assert( !( _TIME_TAKEN & request_uri_query ) ); + assert( !( _TIME_TAKEN & request_full ) ); + assert( !( _TIME_TAKEN & response_code ) ); + assert( !( _TIME_TAKEN & bytes_received ) ); + assert( !( _TIME_TAKEN & bytes_sent ) ); + assert( !( _TIME_TAKEN & client ) ); + assert( !( _TIME_TAKEN & user_agent ) ); + assert( !( _TIME_TAKEN & cookie ) ); + assert( !( _TIME_TAKEN & referer ) ); + }{ + // test for truth + assert( _CLIENT_DATA & client ); + assert( _CLIENT_DATA & user_agent ); + assert( _CLIENT_DATA & cookie ); + assert( _CLIENT_DATA & referer ); + // test for false + assert( !( _CLIENT_DATA & _INVALID ) ); + assert( !( _CLIENT_DATA & _DISCARDED ) ); + assert( !( _CLIENT_DATA & date_time_epoch_us ) ); + assert( !( _CLIENT_DATA & date_time_epoch_ms ) ); + assert( !( _CLIENT_DATA & date_time_epoch_s ) ); + assert( !( _CLIENT_DATA & date_time_epoch_s_ms ) ); + assert( !( _CLIENT_DATA & date_time_ncsa ) ); + assert( !( _CLIENT_DATA & date_time_iso ) ); + assert( !( _CLIENT_DATA & date_time_gmt ) ); + assert( !( _CLIENT_DATA & date_time_mcs ) ); + assert( !( _CLIENT_DATA & date_time_utc_d ) ); + assert( !( _CLIENT_DATA & date_time_utc_t ) ); + assert( !( _CLIENT_DATA & date_time_yyyymmdd ) ); + assert( !( _CLIENT_DATA & date_time_mmddyy ) ); + assert( !( _CLIENT_DATA & date_time_mdyyyy ) ); + assert( !( _CLIENT_DATA & date_time_year_short ) ); + assert( !( _CLIENT_DATA & date_time_month_str ) ); + assert( !( _CLIENT_DATA & date_time_year ) ); + assert( !( _CLIENT_DATA & date_time_month ) ); + assert( !( _CLIENT_DATA & date_time_day ) ); + assert( !( _CLIENT_DATA & date_time_hour ) ); + assert( !( _CLIENT_DATA & date_time_minute ) ); + assert( !( _CLIENT_DATA & date_time_second ) ); + assert( !( _CLIENT_DATA & date_time_clock_short ) ); + assert( !( _CLIENT_DATA & date_time_clock_12 ) ); + assert( !( _CLIENT_DATA & date_time_clock_24 ) ); + assert( !( _CLIENT_DATA & request_protocol ) ); + assert( !( _CLIENT_DATA & request_method ) ); + assert( !( _CLIENT_DATA & request_uri ) ); + assert( !( _CLIENT_DATA & request_query ) ); + assert( !( _CLIENT_DATA & request_uri_query ) ); + assert( !( _CLIENT_DATA & request_full ) ); + assert( !( _CLIENT_DATA & response_code ) ); + assert( !( _CLIENT_DATA & bytes_received ) ); + assert( !( _CLIENT_DATA & bytes_sent ) ); + assert( !( _CLIENT_DATA & time_taken_us ) ); + assert( !( _CLIENT_DATA & time_taken_ms ) ); + assert( !( _CLIENT_DATA & time_taken_s ) ); + assert( !( _CLIENT_DATA & time_taken_s_ms ) ); + }{ + // test for exact matches + assert( (_NO_PARSE_NEEDED & date_time_year) == _NO_PARSE_NEEDED ); + assert( (_NO_PARSE_NEEDED & date_time_month) == _NO_PARSE_NEEDED ); + assert( (_NO_PARSE_NEEDED & date_time_day) == _NO_PARSE_NEEDED ); + assert( (_NO_PARSE_NEEDED & date_time_hour) == _NO_PARSE_NEEDED ); + assert( (_NO_PARSE_NEEDED & date_time_minute) == _NO_PARSE_NEEDED ); + assert( (_NO_PARSE_NEEDED & date_time_second) == _NO_PARSE_NEEDED ); + assert( (_NO_PARSE_NEEDED & request_protocol) == _NO_PARSE_NEEDED ); + assert( (_NO_PARSE_NEEDED & request_method) == _NO_PARSE_NEEDED ); + assert( (_NO_PARSE_NEEDED & request_uri) == _NO_PARSE_NEEDED ); + assert( (_NO_PARSE_NEEDED & request_query) == _NO_PARSE_NEEDED ); + assert( (_NO_PARSE_NEEDED & response_code) == _NO_PARSE_NEEDED ); + assert( (_NO_PARSE_NEEDED & bytes_received) == _NO_PARSE_NEEDED ); + assert( (_NO_PARSE_NEEDED & bytes_sent) == _NO_PARSE_NEEDED ); + assert( (_NO_PARSE_NEEDED & time_taken_ms) == _NO_PARSE_NEEDED ); + assert( (_NO_PARSE_NEEDED & client) == _NO_PARSE_NEEDED ); + assert( (_NO_PARSE_NEEDED & user_agent) == _NO_PARSE_NEEDED ); + assert( (_NO_PARSE_NEEDED & cookie) == _NO_PARSE_NEEDED ); + assert( (_NO_PARSE_NEEDED & referer) == _NO_PARSE_NEEDED ); + }{ + // test for exact matches + assert( (_DATE_TIME & date_time_epoch_us) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_epoch_ms) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_epoch_s) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_epoch_s_ms) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_ncsa) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_iso) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_gmt) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_mcs) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_utc_d) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_utc_t) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_yyyymmdd) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_mmddyy) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_mdyyyy) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_year_short) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_month_str) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_year) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_month) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_day) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_hour) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_minute) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_second) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_clock_short) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_clock_12) == _DATE_TIME ); + assert( (_DATE_TIME & date_time_clock_24) == _DATE_TIME ); + }{ + // test for exact matches + assert( (_DATE_TIME_FULL & date_time_epoch_us) == _DATE_TIME_FULL ); + assert( (_DATE_TIME_FULL & date_time_epoch_ms) == _DATE_TIME_FULL ); + assert( (_DATE_TIME_FULL & date_time_epoch_s) == _DATE_TIME_FULL ); + assert( (_DATE_TIME_FULL & date_time_epoch_s_ms) == _DATE_TIME_FULL ); + assert( (_DATE_TIME_FULL & date_time_ncsa) == _DATE_TIME_FULL ); + assert( (_DATE_TIME_FULL & date_time_iso) == _DATE_TIME_FULL ); + assert( (_DATE_TIME_FULL & date_time_gmt) == _DATE_TIME_FULL ); + assert( (_DATE_TIME_FULL & date_time_mcs) == _DATE_TIME_FULL ); + }{ + // test for exact matches + assert( (_DATE_TIME_EPOCH & date_time_epoch_us) == _DATE_TIME_EPOCH ); + assert( (_DATE_TIME_EPOCH & date_time_epoch_ms) == _DATE_TIME_EPOCH ); + assert( (_DATE_TIME_EPOCH & date_time_epoch_s) == _DATE_TIME_EPOCH ); + assert( (_DATE_TIME_EPOCH & date_time_epoch_s_ms) == _DATE_TIME_EPOCH ); + }{ + // test for exact matches + assert( (_DATE_TIME_UTC & date_time_utc_d) == _DATE_TIME_UTC ); + assert( (_DATE_TIME_UTC & date_time_utc_t) == _DATE_TIME_UTC ); + }{ + // test for exact matches + assert( (_DATE_TIME_DATE & date_time_utc_d) == _DATE_TIME_DATE ); + assert( (_DATE_TIME_DATE & date_time_yyyymmdd) == _DATE_TIME_DATE ); + assert( (_DATE_TIME_DATE & date_time_mmddyy) == _DATE_TIME_DATE ); + assert( (_DATE_TIME_DATE & date_time_mdyyyy) == _DATE_TIME_DATE ); + }{ + // test for exact matches + assert( (_DATE_TIME_YEAR & date_time_year_short) == _DATE_TIME_YEAR ); + assert( (_DATE_TIME_YEAR & date_time_year) == _DATE_TIME_YEAR ); + }{ + // test for exact matches + assert( (_DATE_TIME_MONTH & date_time_month_str) == _DATE_TIME_MONTH ); + assert( (_DATE_TIME_MONTH & date_time_month) == _DATE_TIME_MONTH ); + }{ + // test for exact matches + assert( (_DATE_TIME_CLOCK & date_time_clock_short) == _DATE_TIME_CLOCK ); + assert( (_DATE_TIME_CLOCK & date_time_clock_12) == _DATE_TIME_CLOCK ); + assert( (_DATE_TIME_CLOCK & date_time_clock_24) == _DATE_TIME_CLOCK ); + }{ + // test for exact matches + assert( (_REQUEST & request_protocol) == _REQUEST ); + assert( (_REQUEST & request_method) == _REQUEST ); + assert( (_REQUEST & request_uri) == _REQUEST ); + assert( (_REQUEST & request_query) == _REQUEST ); + assert( (_REQUEST & request_uri_query) == _REQUEST ); + assert( (_REQUEST & request_full) == _REQUEST ); + }{ + // test for exact matches + assert( (_RESPONSE_CODE & response_code) == _RESPONSE_CODE ); + }{ + // test for exact matches + assert( (_DATA_TRANSFER & bytes_received) == _DATA_TRANSFER ); + assert( (_DATA_TRANSFER & bytes_sent) == _DATA_TRANSFER ); + }{ + // test for exact matches + assert( (_TIME_TAKEN & time_taken_us) == _TIME_TAKEN ); + assert( (_TIME_TAKEN & time_taken_ms) == _TIME_TAKEN ); + assert( (_TIME_TAKEN & time_taken_s) == _TIME_TAKEN ); + assert( (_TIME_TAKEN & time_taken_s_ms) == _TIME_TAKEN ); + }{ + // test for exact matches + assert( (_CLIENT_DATA & client) == _CLIENT_DATA ); + assert( (_CLIENT_DATA & user_agent) == _CLIENT_DATA ); + assert( (_CLIENT_DATA & cookie) == _CLIENT_DATA ); + assert( (_CLIENT_DATA & referer) == _CLIENT_DATA ); + }{ + // test for fields which contain a fixed number of spaces + assert( _MAY_HAVE_SPACES & request_full ); + assert( _MAY_HAVE_SPACES & date_time_ncsa ); + assert( _MAY_HAVE_SPACES & date_time_gmt ); + assert( _MAY_HAVE_SPACES & date_time_mcs ); + // test for fields which doesn't (supposedly) contain spaces + assert( !( _MAY_HAVE_SPACES & date_time_epoch_us ) ); + assert( !( _MAY_HAVE_SPACES & date_time_epoch_ms ) ); + assert( !( _MAY_HAVE_SPACES & date_time_epoch_s ) ); + assert( !( _MAY_HAVE_SPACES & date_time_epoch_s_ms ) ); + assert( !( _MAY_HAVE_SPACES & date_time_iso ) ); + assert( !( _MAY_HAVE_SPACES & date_time_utc_d ) ); + assert( !( _MAY_HAVE_SPACES & date_time_utc_t ) ); + assert( !( _MAY_HAVE_SPACES & date_time_yyyymmdd ) ); + assert( !( _MAY_HAVE_SPACES & date_time_mmddyy ) ); + assert( !( _MAY_HAVE_SPACES & date_time_mdyyyy ) ); + assert( !( _MAY_HAVE_SPACES & date_time_year_short ) ); + assert( !( _MAY_HAVE_SPACES & date_time_month_str ) ); + assert( !( _MAY_HAVE_SPACES & date_time_year ) ); + assert( !( _MAY_HAVE_SPACES & date_time_month ) ); + assert( !( _MAY_HAVE_SPACES & date_time_day ) ); + assert( !( _MAY_HAVE_SPACES & date_time_hour ) ); + assert( !( _MAY_HAVE_SPACES & date_time_minute ) ); + assert( !( _MAY_HAVE_SPACES & date_time_second ) ); + assert( !( _MAY_HAVE_SPACES & date_time_clock_short ) ); + assert( !( _MAY_HAVE_SPACES & date_time_clock_12 ) ); + assert( !( _MAY_HAVE_SPACES & date_time_clock_24 ) ); + assert( !( _MAY_HAVE_SPACES & request_protocol ) ); + assert( !( _MAY_HAVE_SPACES & request_method ) ); + assert( !( _MAY_HAVE_SPACES & request_uri ) ); + assert( !( _MAY_HAVE_SPACES & request_query ) ); + assert( !( _MAY_HAVE_SPACES & request_uri_query ) ); + assert( !( _MAY_HAVE_SPACES & response_code ) ); + assert( !( _MAY_HAVE_SPACES & bytes_received ) ); + assert( !( _MAY_HAVE_SPACES & bytes_sent ) ); + assert( !( _MAY_HAVE_SPACES & time_taken_us ) ); + assert( !( _MAY_HAVE_SPACES & time_taken_ms ) ); + assert( !( _MAY_HAVE_SPACES & time_taken_s ) ); + assert( !( _MAY_HAVE_SPACES & time_taken_s_ms ) ); + assert( !( _MAY_HAVE_SPACES & client ) ); + assert( !( _MAY_HAVE_SPACES & user_agent ) ); + assert( !( _MAY_HAVE_SPACES & cookie ) ); + assert( !( _MAY_HAVE_SPACES & referer ) ); + }{ + // test for the correct amount of spaces + assert( (_COUNT_SPACES & date_time_ncsa) == 1ul ); + assert( (_COUNT_SPACES & date_time_gmt) == 3ul ); + assert( (_COUNT_SPACES & date_time_mcs) == 4ul ); + assert( (request_full & 2) == 2 ); // useless, just a reminder is should have 2 + } + T_PRINT("LogsFormatField"); + + //// DATE-TIME //// { @@ -208,39 +1103,39 @@ void testCraplogModules() const std::string e_str{ std::to_string( e ) }; const std::string epochs[4]{ e_str, e_str+".000", e_str+"000", e_str+"000000" }; std::vector target{"2000","01","01","23","59","59"}; - assert( DateTimeOps::processDateTime("[01/Jan/2000:23:59:59 +0000]", "ncsa") == target ); - assert( DateTimeOps::processDateTime("Sat Jan 01 23:59:59 2000", "mcs") == target ); - assert( DateTimeOps::processDateTime("Saturday, 01-Jan-2000 23:59:59 UTC", "gmt") == target ); - assert( DateTimeOps::processDateTime("2000-01-01T23:59:59+00:00", "iso") == target ); - assert( DateTimeOps::processDateTime(epochs[0], "epoch_s") == target ); - assert( DateTimeOps::processDateTime(epochs[1], "epoch_s.ms") == target ); - assert( DateTimeOps::processDateTime(epochs[2], "epoch_ms") == target ); - assert( DateTimeOps::processDateTime(epochs[3], "epoch_us") == target ); + assert( DateTimeOps::processDateTime("[01/Jan/2000:23:59:59 +0000]", date_time_ncsa) == target ); + assert( DateTimeOps::processDateTime("Sat Jan 01 23:59:59 2000", date_time_mcs) == target ); + assert( DateTimeOps::processDateTime("Saturday, 01-Jan-2000 23:59:59 UTC", date_time_gmt) == target ); + assert( DateTimeOps::processDateTime("2000-01-01T23:59:59+00:00", date_time_iso) == target ); + assert( DateTimeOps::processDateTime(epochs[0], date_time_epoch_s) == target ); + assert( DateTimeOps::processDateTime(epochs[1], date_time_epoch_s_ms) == target ); + assert( DateTimeOps::processDateTime(epochs[2], date_time_epoch_ms) == target ); + assert( DateTimeOps::processDateTime(epochs[3], date_time_epoch_us) == target ); target = {"2000","01","01","","",""}; - assert( DateTimeOps::processDateTime("2000-01-01", "utc_d") == target ); - assert( DateTimeOps::processDateTime("2000-01-01", "YYYYMMDD") == target ); - assert( DateTimeOps::processDateTime("01/01/00", "MMDDYY") == target ); - assert( DateTimeOps::processDateTime("1/1/2000", "MDYYYY") == target ); + assert( DateTimeOps::processDateTime("2000-01-01", date_time_utc_d) == target ); + assert( DateTimeOps::processDateTime("2000-01-01", date_time_yyyymmdd) == target ); + assert( DateTimeOps::processDateTime("01/01/00", date_time_mmddyy) == target ); + assert( DateTimeOps::processDateTime("1/1/2000", date_time_mdyyyy) == target ); target = {"","","","23","59","59"}; - assert( DateTimeOps::processDateTime("23:59:59", "utc_t") == target ); - assert( DateTimeOps::processDateTime("11:59:59 pm", "clock_12") == target ); - assert( DateTimeOps::processDateTime("23:59:59", "clock_24") == target ); + assert( DateTimeOps::processDateTime("23:59:59", date_time_utc_t) == target ); + assert( DateTimeOps::processDateTime("11:59:59 pm", date_time_clock_12) == target ); + assert( DateTimeOps::processDateTime("23:59:59", date_time_clock_24) == target ); target = {"","","","23","59",""}; - assert( DateTimeOps::processDateTime("23:59", "clock_short") == target ); - target = {"","","","PM","",""}; - assert( DateTimeOps::processDateTime("pm", "clock_meridian") == target ); + assert( DateTimeOps::processDateTime("23:59", date_time_clock_short) == target ); + /*target = {"","","","PM","",""}; + assert( DateTimeOps::processDateTime("pm", date_time_clock_meridian) == target );*/ target = {"2000","","","","",""}; - assert( DateTimeOps::processDateTime("2000", "year") == target ); + assert( DateTimeOps::processDateTime("2000", date_time_year) == target ); target = {"","01","","","",""}; - assert( DateTimeOps::processDateTime("01", "month") == target ); + assert( DateTimeOps::processDateTime("01", date_time_month) == target ); target = {"","","01","","",""}; - assert( DateTimeOps::processDateTime("01", "day") == target ); + assert( DateTimeOps::processDateTime("01", date_time_day) == target ); target = {"","","","23","",""}; - assert( DateTimeOps::processDateTime("23", "hour") == target ); + assert( DateTimeOps::processDateTime("23", date_time_hour) == target ); target = {"","","","","59",""}; - assert( DateTimeOps::processDateTime("59", "minute") == target ); + assert( DateTimeOps::processDateTime("59", date_time_minute) == target ); target = {"","","","","","59"}; - assert( DateTimeOps::processDateTime("59", "second") == target ); + assert( DateTimeOps::processDateTime("59", date_time_second) == target ); } T_PRINT("DateTimeOps::processDateTime"); @@ -249,17 +1144,22 @@ void testCraplogModules() { FormatOps fo; - std::string format_string{"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""}; - std::vector fields{"client","NONE","NONE","date_time_ncsa","request_full","response_code","NONE","referer","user_agent"}; - std::vector separators{" "," "," [","] \"","\" "," "," \"","\" \""}; - LogsFormat lf{ fo.processApacheFormatString(format_string) }; + LogsFormat lf; + std::string format_string; + std::vector fields; + std::vector separators; + // test the default string + format_string = "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""; + fields = {client,_DISCARDED,_DISCARDED,date_time_ncsa,request_full,response_code,_DISCARDED,referer,user_agent}; + separators = {" "," "," [","] \"","\" "," "," \"","\" \""}; + lf = fo.processApacheFormatString(format_string); assert( lf.initial.empty() ); assert( lf.fields == fields ); assert( lf.separators == separators ); assert( lf.final == "\"" ); // test all simple fields format_string = "%%%h %% %t\t%r\n%H %m [%U%%%q} <%s> %s %O %I %T %D %a %A %b %B %e %f %k %l %L %p %P %R %S %u %v %V %% %X%%"; - fields = {"client","date_time_ncsa","request_full","request_protocol","request_method","request_uri","request_query","response_code","response_code","response_code","bytes_sent","bytes_received","time_taken_s","time_taken_ms","NONE","NONE","NONE","NONE","NONE","NONE","NONE","NONE","NONE","NONE","NONE","NONE","NONE","NONE","NONE","NONE","NONE"}; + fields = {client,date_time_ncsa,request_full,request_protocol,request_method,request_uri,request_query,response_code,response_code,response_code,bytes_sent,bytes_received,time_taken_s,time_taken_ms,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED}; separators = {" % [","]\t","\n"," "," [","%","} <","> "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," % "}; lf = fo.processApacheFormatString(format_string); assert( lf.initial == "%" ); @@ -281,7 +1181,7 @@ void testCraplogModules() } // test client related composed fields format_string = "%{}a %{c}a %{}h %{c}h %{Cookie}i %200{Cookie}i %{User-agent}i %302,400{User-agent}i %!200{Referer}i %,200{Referer}i %{Referer}i"; - fields = {"client","client","client","client","cookie","cookie","user_agent","user_agent","referer","referer","referer"}; + fields = {client,client,client,client,cookie,cookie,user_agent,user_agent,referer,referer,referer}; separators = {" "," "," "," "," "," "," "," "," "," "}; lf = fo.processApacheFormatString(format_string); assert( lf.initial.empty() ); @@ -290,7 +1190,7 @@ void testCraplogModules() assert( lf.final.empty() ); // test unexisting/unsupported client related composed fields format_string = "%{ }a %{x}a %{NOPE}a %{ }h %{y}h %{NOPE}h %{}i %{ }i %{Random}i %{Cookies}i"; - fields = {"client","client","client","client","client","client","NONE","NONE","NONE","NONE"}; + fields = {client,client,client,client,client,client,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED}; separators = {" "," "," "," "," "," "," "," "," "}; lf = fo.processApacheFormatString(format_string); assert( lf.initial.empty() ); @@ -299,7 +1199,7 @@ void testCraplogModules() assert( lf.final.empty() ); // test date-time composed fields format_string = "%{%%}t %{%n}t %{%t}t %{}t %{sec}t %{msec}t %{usec}t %{msec_frac}t %{usec_frac}t %{%a}t %{%A}t %{%b}t %{%B}t %{%c}t %{%C}t %{%d}t %{%D}t %{%e}t %{%F}t %{%g}t %{%G}t %{%h}t %{%H}t %{%I}t %{%j}t %{%k}t %{%m}t %{%M}t %{%p}t %{%r}t %{%R}t %{%S}t %{%T}t %{%u}t %{%U}t %{%V}t %{%w}t %{%W}t %{%x}t %{%X}t %{%y}t %{%Y}t %{%z}t %{%Z}t"; - fields = {"date_time_ncsa","date_time_epoch_s","date_time_epoch_ms","date_time_epoch_us","NONE","NONE","NONE","NONE","date_time_month_str","date_time_month_str","date_time_mcs","NONE","date_time_day","date_time_MMDDYY","date_time_day","date_time_YYYYMMDD","NONE","NONE","date_time_month_str","date_time_hour","NONE","NONE","date_time_hour","date_time_month","date_time_minute","NONE","date_time_clock_12","date_time_clock_short","date_time_second","date_time_clock_24","NONE","NONE","NONE","NONE","NONE","date_time_MMDDYY","date_time_clock_24","date_time_year_short","date_time_year","NONE","NONE"}; + fields = {date_time_ncsa,date_time_epoch_s,date_time_epoch_ms,date_time_epoch_us,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,date_time_month_str,date_time_month_str,date_time_mcs,_DISCARDED,date_time_day,date_time_mmddyy,date_time_day,date_time_yyyymmdd,_DISCARDED,_DISCARDED,date_time_month_str,date_time_hour,_DISCARDED,_DISCARDED,date_time_hour,date_time_month,date_time_minute,_DISCARDED,date_time_clock_12,date_time_clock_short,date_time_second,date_time_clock_24,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,date_time_mmddyy,date_time_clock_24,date_time_year_short,date_time_year,_DISCARDED,_DISCARDED}; separators = {"] "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "}; lf = fo.processApacheFormatString(format_string); assert( lf.initial == "% \n \t [" ); @@ -308,7 +1208,7 @@ void testCraplogModules() assert( lf.final.empty() ); // test date-time composed fields, with one field only format_string = "%{}t"; - fields = {"date_time_ncsa"}; + fields = {date_time_ncsa}; lf = fo.processApacheFormatString(format_string); assert( lf.initial == "[" ); assert( lf.fields == fields ); @@ -316,7 +1216,7 @@ void testCraplogModules() assert( lf.final == "]" ); // test date-time composed fields, with many aggreagated fields format_string = "%{%%%Y_%m_%e%t%H@%M@%S%%}t"; - fields = {"date_time_year","date_time_month","date_time_day","date_time_hour","date_time_minute","date_time_second"}; + fields = {date_time_year,date_time_month,date_time_day,date_time_hour,date_time_minute,date_time_second}; separators = {"_","_","\t","@","@"}; lf = fo.processApacheFormatString(format_string); assert( lf.initial == "%" ); @@ -325,7 +1225,7 @@ void testCraplogModules() assert( lf.final == "%" ); // test date-time composed fields, with all fields aggeregated in one format_string = "%{%% %n %t %a %A %b %B %c %C %d %D %e %F %g %G %h %H %I %j %k %m %M %p %r %R %S %T %u %U %V %w %W %x %X %y %Y %z %Z}t"; - fields = {"NONE","NONE","date_time_month_str","date_time_month_str","date_time_mcs","NONE","date_time_day","date_time_MMDDYY","date_time_day","date_time_YYYYMMDD","NONE","NONE","date_time_month_str","date_time_hour","NONE","NONE","date_time_hour","date_time_month","date_time_minute","NONE","date_time_clock_12","date_time_clock_short","date_time_second","date_time_clock_24","NONE","NONE","NONE","NONE","NONE","date_time_MMDDYY","date_time_clock_24","date_time_year_short","date_time_year","NONE","NONE"}; + fields = {_DISCARDED,_DISCARDED,date_time_month_str,date_time_month_str,date_time_mcs,_DISCARDED,date_time_day,date_time_mmddyy,date_time_day,date_time_yyyymmdd,_DISCARDED,_DISCARDED,date_time_month_str,date_time_hour,_DISCARDED,_DISCARDED,date_time_hour,date_time_month,date_time_minute,_DISCARDED,date_time_clock_12,date_time_clock_short,date_time_second,date_time_clock_24,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,date_time_mmddyy,date_time_clock_24,date_time_year_short,date_time_year,_DISCARDED,_DISCARDED}; separators = {" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "}; lf = fo.processApacheFormatString(format_string); assert( lf.initial == "% \n \t " ); @@ -354,7 +1254,7 @@ void testCraplogModules() } // test time taken related composed fields format_string = "%{}T %{s}T %{ms}T %{us}T"; - fields = {"time_taken_s","time_taken_s","time_taken_ms","time_taken_us"}; + fields = {time_taken_s,time_taken_s,time_taken_ms,time_taken_us}; separators = {" "," "," "}; lf = fo.processApacheFormatString(format_string); assert( lf.initial.empty() ); @@ -371,7 +1271,7 @@ void testCraplogModules() assert( lf.final.empty() ); // test unused composed fields format_string = "%{}C %{}e %{}L %{}n %{}o %{}p %{canonical}p %{local}p %{remote}p %{}P %{pid}P %{tid}P %{hextid}P %{}^ti %{}^to"; - fields = {"NONE","NONE","NONE","NONE","NONE","NONE","NONE","NONE","NONE","NONE","NONE","NONE","NONE","NONE","NONE"}; + fields = {_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED}; separators = {" "," "," "," "," "," "," "," "," "," "," "," "," "," "}; lf = fo.processApacheFormatString(format_string); assert( lf.initial.empty() ); @@ -380,52 +1280,418 @@ void testCraplogModules() assert( lf.final.empty() ); // test unused composed fields, with random content format_string = "%{TEST}C %{TEST}e %{TEST}L %{TEST}n %{TEST}o %{TEST}p %{TEST}P %{TEST}^ti %{TEST}^to"; - fields = {"NONE","NONE","NONE","NONE","NONE","NONE","NONE"}; + fields = {_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED}; separators = {" "," "," "," "," TEST TEST "," "}; lf = fo.processApacheFormatString(format_string); assert( lf.initial.empty() ); assert( lf.fields == fields ); assert( lf.separators == separators ); assert( lf.final.empty() ); + // test the default string with dumb logging: no characters to enclose the full request + format_string = "%h %l %u %t %r %>s %b \"%{Referer}i\" \"%{User-agent}i\""; + fields = {client,_DISCARDED,_DISCARDED,date_time_ncsa,request_full,response_code,_DISCARDED,referer,user_agent}; + separators = {" "," "," [","] "," "," "," \"","\" \""}; + lf = fo.processApacheFormatString(format_string); + assert( lf.initial.empty() ); + assert( lf.fields == fields ); + assert( lf.separators == separators ); + assert( lf.final == "\"" ); + // test an empty string + format_string.erase(); + lf = fo.processApacheFormatString(format_string); + assert( lf.initial.empty() ); + assert( lf.fields.empty() ); + assert( lf.separators.empty() ); + assert( lf.final.empty() ); } T_PRINT("FormatOps::processApacheFormatString"); { FormatOps fo; - std::string format_string{"$remote_addr - $remote_user [$time_local] \"$request\" $status $bytes_sent \"$http_referer\" \"$http_user_agent\""}; - std::vector fields{"client","NONE","date_time_ncsa","request_full","response_code","bytes_sent","referer","user_agent"}; - assert( fo.processNginxFormatString(format_string).fields == fields ); + LogsFormat lf; + std::string format_string; + std::vector fields; + std::vector separators; + // test the default string + format_string = "$remote_addr - $remote_user [$time_local] \"$request\" $status $bytes_sent \"$http_referer\" \"$http_user_agent\""; + fields = {client,_DISCARDED,date_time_ncsa,request_full,response_code,bytes_sent,referer,user_agent}; + separators = {" - "," [","] \"","\" "," "," \"","\" \""}; + lf = fo.processNginxFormatString(format_string); + assert( lf.initial.empty() ); + assert( lf.fields == fields ); + assert( lf.separators == separators ); + assert( lf.final == "\"" ); + // test all the considered fields + format_string = "$remote_addr $realip_remote_addr $time_local $time_iso8601 $date_gmt $msec $request $server_protocol $request_method $request_uri $uri $query_string $status $bytes_sent $request_length $request_time $http_referer $cookie_ $http_user_agent"; + fields = {client,client,date_time_ncsa,date_time_iso,date_time_gmt,date_time_epoch_s_ms,request_full,request_protocol,request_method,request_uri_query,request_uri,request_query,response_code,bytes_sent,bytes_received,time_taken_s_ms,referer,cookie,user_agent}; + separators = {" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "}; + lf = fo.processNginxFormatString(format_string); + assert( lf.initial.empty() ); + assert( lf.fields == fields ); + assert( lf.separators == separators ); + assert( lf.final.empty() ); + // test all the non-considered fields + format_string = "$ancient_browser $arg_ $args $binary_remote_addr $body_bytes_sent $connection $connection_requests $connections_active $connections_reading $connections_waiting $connections_writing $content_length $content_type $date_local $document_root $document_uri $fastcgi_path_info $fastcgi_script_name $geoip_area_code $geoip_city $geoip_city_continent_code $geoip_city_country_code $geoip_city_country_code3 $geoip_city_country_name $geoip_country_code $geoip_country_code3 $geoip_country_name $geoip_dma_code $geoip_latitude $geoip_longitude $geoip_org $geoip_postal_code $geoip_region $geoip_region_name $gzip_ratio $host $hostname $http2 $http_ $https $invalid_referer $is_args $limit_rate $memcached_key $modern_browser $msie $nginx_version $pid $pipe $proxy_add_x_forwarded_for $proxy_host $proxy_port $proxy_protocol_addr $proxy_protocol_port $realip_remote_port $realpath_root $remote_port $remote_user $request_body $request_body_file $request_completion $request_filename $request_id $scheme $secure_link $secure_link_expires $sent_http_ $server_addr $server_name $server_port $session_log_binary_id $session_log_id $slice_range $spdy $spdy_request_priority $ssl_cipher $ssl_client_cert $ssl_client_fingerprint $ssl_client_i_dn $ssl_client_raw_cert $ssl_client_s_dn $ssl_client_serial $ssl_client_verify $ssl_protocol $ssl_server_name $ssl_session_id $ssl_session_reused $tcpinfo_rtt $tcpinfo_rttvar $tcpinfo_snd_cwnd $tcpinfo_rcv_space $uid_got $uid_reset $uid_set $upstream_addr $upstream_cache_status $upstream_connect_time $upstream_cookie_ $upstream_header_time $upstream_http_ $upstream_response_length $upstream_response_time $upstream_status"; + fields = {_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED}; + separators = {" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "}; + lf = fo.processNginxFormatString(format_string); + assert( lf.initial.empty() ); + assert( lf.fields == fields ); + assert( lf.separators == separators ); + assert( lf.final.empty() ); + // test an empty string + format_string.erase(); + lf = fo.processNginxFormatString(format_string); + assert( lf.initial.empty() ); + assert( lf.fields.empty() ); + assert( lf.separators.empty() ); + assert( lf.final.empty() ); } T_PRINT("FormatOps::processNginxFormatString"); { FormatOps fo; - std::string format_string{"date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken"}; - std::vector fields{"date_time_utc_d","date_time_utc_t","NONE","request_method","request_uri","request_query","NONE","NONE","client","user_agent","referer","response_code","NONE","NONE","time_taken_ms"}; - assert( fo.processIisFormatString(format_string, 0).fields == fields ); - format_string = "some random useless text"; - fields = {"client","NONE","NONE","date_time_ncsa","request_full","response_code","bytes_sent"}; - assert( fo.processIisFormatString(format_string, 1).fields == fields ); + LogsFormat lf; + std::string format_string; + std::vector fields; + std::vector separators; + // test the default string for the W3C module + format_string = "date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken"; + fields = {date_time_utc_d,date_time_utc_t,_DISCARDED,request_method,request_uri,request_query,_DISCARDED,_DISCARDED,client,user_agent,referer,response_code,_DISCARDED,_DISCARDED,time_taken_ms}; + separators = {" "," "," "," "," "," "," "," "," "," "," "," "," "," "}; + lf = fo.processIisFormatString(format_string, IISLogsModule::W3C); + assert( lf.initial.empty() ); + assert( lf.fields == fields ); + assert( lf.separators == separators ); + assert( lf.final.empty() ); + // test all the considered fields for the W3C module + format_string = "date time cs-version cs-method cs-uri-stem cs-uri-query sc-status sc-bytes cs-bytes time-taken cs(Referer) cs(Cookie) cs(User-Agent) c-ip"; + fields = {date_time_utc_d,date_time_utc_t,request_protocol,request_method,request_uri,request_query,response_code,bytes_sent,bytes_received,time_taken_ms,referer,cookie,user_agent,client}; + separators = {" "," "," "," "," "," "," "," "," "," "," "," "," "}; + lf = fo.processIisFormatString(format_string, IISLogsModule::W3C); + assert( lf.initial.empty() ); + assert( lf.fields == fields ); + assert( lf.separators == separators ); + assert( lf.final.empty() ); + // test all the non-considered fields for the W3C module + format_string = "s-sitename s-computername s-ip s-port cs-username cs-host sc-substatus sc-win32-status streamid"; + fields = {_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED,_DISCARDED}; + separators = {" "," "," "," "," "," "," "," "}; + lf = fo.processIisFormatString(format_string, IISLogsModule::W3C); + assert( lf.initial.empty() ); + assert( lf.fields == fields ); + assert( lf.separators == separators ); + assert( lf.final.empty() ); + // test an empty string for the W3C module format_string.erase(); - assert( fo.processIisFormatString(format_string, 1).fields == fields ); + lf = fo.processIisFormatString(format_string, IISLogsModule::W3C); + assert( lf.initial.empty() ); + assert( lf.fields.empty() ); + assert( lf.separators.empty() ); + assert( lf.final.empty() ); + // test the the NCSA module format_string = "some random useless text"; - fields = {"client","NONE","date_time_MDYYYY","date_time_utc_t","NONE","NONE","NONE","time_taken_ms","bytes_received","bytes_sent","response_code","NONE","request_method","request_uri","request_query"}; - assert( fo.processIisFormatString(format_string, 2).fields == fields ); + fields = {client,_DISCARDED,_DISCARDED,date_time_ncsa,request_full,response_code,bytes_sent}; + separators = {" "," "," [","] \"","\" "," "}; + lf = fo.processIisFormatString(format_string, IISLogsModule::NCSA); + assert( lf.initial.empty() ); + assert( lf.fields == fields ); + assert( lf.separators == separators ); + assert( lf.final.empty() ); + // test an empty string for the NCSA module format_string.erase(); - assert( fo.processIisFormatString(format_string, 2).fields == fields ); + lf = fo.processIisFormatString(format_string, IISLogsModule::NCSA); + assert( lf.initial.empty() ); + assert( lf.fields == fields ); + assert( lf.separators == separators ); + assert( lf.final.empty() ); + // test the the IIS module + format_string = "some random useless text"; + fields = {client,_DISCARDED,date_time_mdyyyy,date_time_utc_t,_DISCARDED,_DISCARDED,_DISCARDED,time_taken_ms,bytes_received,bytes_sent,response_code,_DISCARDED,request_method,request_uri,request_query}; + separators = {", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", ",", "}; + lf = fo.processIisFormatString(format_string, IISLogsModule::IIS); + assert( lf.initial.empty() ); + assert( lf.fields == fields ); + assert( lf.separators == separators ); + assert( lf.final == "," ); + // test an empty string for the IIS module + format_string.erase(); + lf = fo.processIisFormatString(format_string, IISLogsModule::IIS); + assert( lf.initial.empty() ); + assert( lf.fields == fields ); + assert( lf.separators == separators ); + assert( lf.final == "," ); } T_PRINT("FormatOps::processIisFormatString"); - //// LOGS //// + //// LOGS TYPE //// { - LogsFormat lf{ "","","]",{" ","_"},{"","",""},0 }; + LogsFormat lf{ "","","]",{" ","_"},{_DISCARDED,_DISCARDED,_DISCARDED},0 }; assert( LogOps::defineFileType({"ok ok_ok]","a a_a]","TEST TEST_TEST]"}, lf) == LogType::Access ); assert( LogOps::defineFileType({"no no no!","some thing wrong","with this file!"}, lf) == LogType::Discarded ); assert( LogOps::defineFileType({}, lf) == LogType::Failed ); } T_PRINT("LogOps::defineFileType"); + + + //// LOGS PARSING //// + + { + FormatOps fo; + LogsFormat lf; + std::string log_line; + { + lf = fo.processApacheFormatString(R"(%h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-agent}i")"); + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "GET /index.php?query=x HTTP/1.1" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.year == true && *line_data.year == "2000" ); + assert( line_data.month == true && *line_data.month == "01" ); + assert( line_data.day == true && *line_data.day == "01" ); + assert( line_data.hour == true && *line_data.hour == "23" ); + assert( line_data.minute == true && *line_data.minute == "59" ); + assert( line_data.second == true && *line_data.second == "59" ); + assert( line_data.protocol == true && *line_data.protocol == "HTTP/1.1" ); + assert( line_data.method == true && *line_data.method == "GET" ); + assert( line_data.uri == true && *line_data.uri == "/index.php" ); + assert( line_data.query == true && *line_data.query == "query=x" ); + assert( line_data.response_code == true && *line_data.response_code == "200" ); + assert( line_data.time_taken == false && *line_data.time_taken == "" ); + assert( line_data.bytes_sent == true && *line_data.bytes_sent == "1024" ); + assert( line_data.bytes_received == false && *line_data.bytes_received == "" ); + assert( line_data.client == true && *line_data.client == "192.168.1.123" ); + assert( line_data.cookie == false && *line_data.cookie == "" ); + assert( line_data.user_agent == true && *line_data.user_agent == "UserAgent/3.0 (Details stuff) Info/123" ); + assert( line_data.referrer == true && *line_data.referrer == "http://www.referrer.site" ); + }{ + // same as above but without the query + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "GET /index.php HTTP/1.1" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == true && *line_data.protocol == "HTTP/1.1" ); + assert( line_data.method == true && *line_data.method == "GET" ); + assert( line_data.uri == true && *line_data.uri == "/index.php" ); + assert( line_data.query == false && *line_data.query == "" ); + }{ + // dumb logging, without any surrounding character to enclose the request + lf = fo.processApacheFormatString(R"(%h %l %u %t %r %>s %O "%{Referer}i" "%{User-agent}i")"); + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] GET /index.php?query=x HTTP/1.1 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.year == true && *line_data.year == "2000" ); + assert( line_data.month == true && *line_data.month == "01" ); + assert( line_data.day == true && *line_data.day == "01" ); + assert( line_data.hour == true && *line_data.hour == "23" ); + assert( line_data.minute == true && *line_data.minute == "59" ); + assert( line_data.second == true && *line_data.second == "59" ); + assert( line_data.protocol == true && *line_data.protocol == "HTTP/1.1" ); + assert( line_data.method == true && *line_data.method == "GET" ); + assert( line_data.uri == true && *line_data.uri == "/index.php" ); + assert( line_data.query == true && *line_data.query == "query=x" ); + assert( line_data.response_code == true && *line_data.response_code == "200" ); + assert( line_data.time_taken == false && *line_data.time_taken == "" ); + assert( line_data.bytes_sent == true && *line_data.bytes_sent == "1024" ); + assert( line_data.bytes_received == false && *line_data.bytes_received == "" ); + assert( line_data.client == true && *line_data.client == "192.168.1.123" ); + assert( line_data.cookie == false && *line_data.cookie == "" ); + assert( line_data.user_agent == true && *line_data.user_agent == "UserAgent/3.0 (Details stuff) Info/123" ); + assert( line_data.referrer == true && *line_data.referrer == "http://www.referrer.site" ); + }{ + // dumb logging, without any surrounding character to enclose the request and the user-agent + lf = fo.processApacheFormatString(R"(%h %l %u %t %r %>s %O "%{Referer}i" %{User-agent}i)"); + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] GET /index.php?query=x HTTP/1.1 200 1024 "http://www.referrer.site" UserAgent/3.0 (Details stuff) Info/123)"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == true && *line_data.protocol == "HTTP/1.1" ); + assert( line_data.method == true && *line_data.method == "GET" ); + assert( line_data.uri == true && *line_data.uri == "/index.php" ); + assert( line_data.query == true && *line_data.query == "query=x" ); + assert( line_data.response_code == true && *line_data.response_code == "200" ); + assert( line_data.time_taken == false && *line_data.time_taken == "" ); + assert( line_data.bytes_sent == true && *line_data.bytes_sent == "1024" ); + assert( line_data.bytes_received == false && *line_data.bytes_received == "" ); + assert( line_data.client == true && *line_data.client == "192.168.1.123" ); + assert( line_data.cookie == false && *line_data.cookie == "" ); + assert( line_data.user_agent == true && *line_data.user_agent == "UserAgent/3.0 (Details stuff) Info/123" ); + assert( line_data.referrer == true && *line_data.referrer == "http://www.referrer.site" ); + }{ + // malformed request with empty method + lf = fo.processApacheFormatString(R"(%h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-agent}i")"); + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] " /index.php?query=x HTTP/1.1" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == true && *line_data.protocol == "HTTP/1.1" ); + assert( line_data.method == false && *line_data.method == "" ); + assert( line_data.uri == true && *line_data.uri == "/index.php" ); + assert( line_data.query == true && *line_data.query == "query=x" ); + }{ + // malformed request with empty protocol + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "GET /index.php?query=x " 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == false && *line_data.protocol == "" ); + assert( line_data.method == true && *line_data.method == "GET" ); + assert( line_data.uri == true && *line_data.uri == "/index.php" ); + assert( line_data.query == true && *line_data.query == "query=x" ); + }{ + // malformed request with empty uri + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "GET HTTP/1.1" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == true && *line_data.protocol == "HTTP/1.1" ); + assert( line_data.method == true && *line_data.method == "GET" ); + assert( line_data.uri == false && *line_data.uri == "" ); + assert( line_data.query == false && *line_data.query == "" ); + }{ + // malformed request with empty method and protocol + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] " /index.php?query=x " 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == false && *line_data.protocol == "" ); + assert( line_data.method == false && *line_data.method == "" ); + assert( line_data.uri == true && *line_data.uri == "/index.php" ); + assert( line_data.query == true && *line_data.query == "query=x" ); + }{ + // malformed request with empty method and uri + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] " HTTP/1.1" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == true && *line_data.protocol == "HTTP/1.1" ); + assert( line_data.method == false && *line_data.method == "" ); + assert( line_data.uri == false && *line_data.uri == "" ); + assert( line_data.query == false && *line_data.query == "" ); + }{ + // malformed request with empty uri and protocol + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "GET " 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == false && *line_data.protocol == "" ); + assert( line_data.method == true && *line_data.method == "GET" ); + assert( line_data.uri == false && *line_data.uri == "" ); + assert( line_data.query == false && *line_data.query == "" ); + }{ + // malformed request with all fields empty + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] " " 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == false && *line_data.protocol == "" ); + assert( line_data.method == false && *line_data.method == "" ); + assert( line_data.uri == false && *line_data.uri == "" ); + assert( line_data.query == false && *line_data.query == "" ); + }{ + // malformed request with missing method + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "/index.php?query=x HTTP/1.1" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == true && *line_data.protocol == "HTTP/1.1" ); + assert( line_data.method == false && *line_data.method == "" ); + assert( line_data.uri == true && *line_data.uri == "/index.php" ); + assert( line_data.query == true && *line_data.query == "query=x" ); + }{ + // malformed request with missing protocol + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "GET /index.php?query=x" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == false && *line_data.protocol == "" ); + assert( line_data.method == true && *line_data.method == "GET" ); + assert( line_data.uri == true && *line_data.uri == "/index.php" ); + assert( line_data.query == true && *line_data.query == "query=x" ); + }{ + // malformed request with missing uri + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "GET HTTP/1.1" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == true && *line_data.protocol == "HTTP/1.1" ); + assert( line_data.method == true && *line_data.method == "GET" ); + assert( line_data.uri == false && *line_data.uri == "" ); + assert( line_data.query == false && *line_data.query == "" ); + }{ + // malformed request with missing the uri but with the query + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "GET ?query=x HTTP/1.1" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == true && *line_data.protocol == "HTTP/1.1" ); + assert( line_data.method == true && *line_data.method == "GET" ); + assert( line_data.uri == false && *line_data.uri == "" ); + assert( line_data.query == true && *line_data.query == "query=x" ); + }{ + // malformed request with only the method + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "GET" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == false && *line_data.protocol == "" ); + assert( line_data.method == true && *line_data.method == "GET" ); + assert( line_data.uri == false && *line_data.uri == "" ); + assert( line_data.query == false && *line_data.query == "" ); + }{ + // malformed request with only the protocol + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "HTTP/1.1" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == true && *line_data.protocol == "HTTP/1.1" ); + assert( line_data.method == false && *line_data.method == "" ); + assert( line_data.uri == false && *line_data.uri == "" ); + assert( line_data.query == false && *line_data.query == "" ); + }{ + // malformed request with only the uri and the query + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "/index.php?query=x" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == false && *line_data.protocol == "" ); + assert( line_data.method == false && *line_data.method == "" ); + assert( line_data.uri == true && *line_data.uri == "/index.php" ); + assert( line_data.query == true && *line_data.query == "query=x" ); + }{ + // malformed request with only the uri + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "/index.php" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == false && *line_data.protocol == "" ); + assert( line_data.method == false && *line_data.method == "" ); + assert( line_data.uri == true && *line_data.uri == "/index.php" ); + assert( line_data.query == false && *line_data.query == "" ); + }{ + // malformed request with only the query + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "?query=x" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == false && *line_data.protocol == "" ); + assert( line_data.method == false && *line_data.method == "" ); + assert( line_data.uri == false && *line_data.uri == "" ); + assert( line_data.query == true && *line_data.query == "query=x" ); + }{ + // malformed request with every field missing + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == false && *line_data.protocol == "" ); + assert( line_data.method == false && *line_data.method == "" ); + assert( line_data.uri == false && *line_data.uri == "" ); + assert( line_data.query == false && *line_data.query == "" ); + }{ + // malformed request with only random data + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "M4l1C10US" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == false && *line_data.protocol == "" ); + assert( line_data.method == false && *line_data.method == "" ); + assert( line_data.uri == true && *line_data.uri == "M4l1C10US" ); + assert( line_data.query == false && *line_data.query == "" ); + }{ + // malformed request with method and protocol positions swapped + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "HTTP/1.1 /index.php?query=x GET" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == true && *line_data.protocol == "HTTP/1.1" ); + assert( line_data.method == true && *line_data.method == "GET" ); + assert( line_data.uri == true && *line_data.uri == "/index.php" ); + assert( line_data.query == true && *line_data.query == "query=x" ); + }{ + // malformed request with method and uri positions swapped + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "/index.php?query=x GET HTTP/1.1" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == true && *line_data.protocol == "HTTP/1.1" ); + assert( line_data.method == true && *line_data.method == "GET" ); + assert( line_data.uri == true && *line_data.uri == "/index.php" ); + assert( line_data.query == true && *line_data.query == "query=x" ); + }{ + // malformed request with uri and protocol positions swapped + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "GET HTTP/1.1 /index.php?query=x" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == true && *line_data.protocol == "HTTP/1.1" ); + assert( line_data.method == true && *line_data.method == "GET" ); + assert( line_data.uri == true && *line_data.uri == "/index.php" ); + assert( line_data.query == true && *line_data.query == "query=x" ); + }{ + // malformed request with all fields positions swapped + log_line = R"(192.168.1.123 - - [01/Jan/2000:23:59:59 +0000] "HTTP/1.1 GET /index.php?query=x" 200 1024 "http://www.referrer.site" "UserAgent/3.0 (Details stuff) Info/123")"; + LogLineData line_data( log_line, lf ); + assert( line_data.protocol == true && *line_data.protocol == "HTTP/1.1" ); + assert( line_data.method == true && *line_data.method == "GET" ); + assert( line_data.uri == true && *line_data.uri == "/index.php" ); + assert( line_data.query == true && *line_data.query == "query=x" ); + } + T_PRINT("LogLineData::LogLineData"); + } } @@ -433,17 +1699,21 @@ void testCrapviewModules() { //// FILTERS //// - assert( FilterOps::parseNull(" null ").value() == "NULL" ); - assert( FilterOps::parseNull(" not null ").value() == "NOT NULL" ); - assert( FilterOps::parseNull("not null").value() == "NOT NULL" ); - assert( FilterOps::parseNull("! null").value() == "NOT NULL" ); - assert( FilterOps::parseNull("null").value() == "NULL" ); - assert( FilterOps::parseNull("NULL").value() == "NULL" ); - assert( FilterOps::parseNull("not null").value() == "NOT NULL" ); - assert( FilterOps::parseNull("NOT NULL").value() == "NOT NULL" ); - assert( FilterOps::parseNull("!NULL").value() == "NOT NULL" ); - assert( FilterOps::parseNull("! NULL").value() == "NOT NULL" ); + assert( FilterOps::parseNull("null").value() == " IS NULL" ); + assert( FilterOps::parseNull("NULL").value() == " IS NULL" ); + assert( FilterOps::parseNull("not null").value() == " IS NOT NULL" ); + assert( FilterOps::parseNull("NOT NULL").value() == " IS NOT NULL" ); + assert( FilterOps::parseNull("!NULL").value() == " IS NOT NULL" ); + assert( FilterOps::parseNull("! NULL").value() == " IS NOT NULL" ); + // try to brake + assert( FilterOps::parseNull(" null ").value() == " IS NULL" ); + assert( FilterOps::parseNull(" not null ").value() == " IS NOT NULL" ); + assert( FilterOps::parseNull("not null").value() == " IS NOT NULL" ); + assert( FilterOps::parseNull("! null").value() == " IS NOT NULL" ); + // test for invalid filter assert( ! FilterOps::parseNull("").has_value() ); + assert( ! FilterOps::parseNull(" ").has_value() ); + assert( ! FilterOps::parseNull(" \t\n ").has_value() ); assert( ! FilterOps::parseNull("123").has_value() ); assert( ! FilterOps::parseNull("abc").has_value() ); assert( ! FilterOps::parseNull("*").has_value() ); @@ -452,150 +1722,118 @@ void testCrapviewModules() T_PRINT("FilterOps::parseNull"); assert( FilterOps::parseTextualFilter("").value() == "" ); - assert( FilterOps::parseTextualFilter("null").value() == "NULL" ); - assert( FilterOps::parseTextualFilter("not null").value() == "NOT NULL" ); - assert( FilterOps::parseTextualFilter("*").value() == "NOT NULL" ); - assert( FilterOps::parseTextualFilter(" a test string ").value() == "a test string" ); - assert( FilterOps::parseTextualFilter("[test 123 #!?]").value() == "[test 123 #!?]" ); + assert( FilterOps::parseTextualFilter(" ").value() == "" ); + assert( FilterOps::parseTextualFilter(" \t\n ").value() == "" ); + assert( FilterOps::parseTextualFilter("null").value() == " IS NULL" ); + assert( FilterOps::parseTextualFilter("not null").value() == " IS NOT NULL" ); + assert( FilterOps::parseTextualFilter("*").value() == " IS NOT NULL" ); + assert( FilterOps::parseTextualFilter("test").value() == " LIKE 'test'" ); + assert( FilterOps::parseTextualFilter("!test").value() == " NOT LIKE 'test'" ); + assert( FilterOps::parseTextualFilter("\\!test").value() == " LIKE '!test'" ); + assert( FilterOps::parseTextualFilter(" test").value() == " LIKE 'test'" ); + assert( FilterOps::parseTextualFilter("\\ test").value() == " LIKE ' test'" ); + // try to brake + assert( FilterOps::parseTextualFilter(" a test string ").value() == " LIKE 'a test string'" ); + assert( FilterOps::parseTextualFilter("! a test string").value() == " NOT LIKE 'a test string'" ); + assert( FilterOps::parseTextualFilter("[test 123 #!?]").value() == " LIKE '[test 123 #!?]'" ); T_PRINT("FilterOps::parseTextualFilter"); assert( FilterOps::parseNumericFilter("").value() == "" ); - assert( FilterOps::parseNumericFilter("null").value() == "NULL" ); - assert( FilterOps::parseNumericFilter("not null").value() == "NOT NULL" ); - assert( FilterOps::parseNumericFilter(" 123 ").value() == "= 123" ); - assert( FilterOps::parseNumericFilter(" = 123 ").value() == "= 123" ); - assert( FilterOps::parseNumericFilter(" ! 123 ").value() == "!= 123" ); - assert( FilterOps::parseNumericFilter("123").value() == "= 123" ); - assert( FilterOps::parseNumericFilter("=123").value() == "= 123" ); - assert( FilterOps::parseNumericFilter("= 123").value() == "= 123" ); - assert( FilterOps::parseNumericFilter("==123").value() == "= 123" ); - assert( FilterOps::parseNumericFilter("== 123").value() == "= 123" ); - assert( FilterOps::parseNumericFilter("eq 123").value() == "= 123" ); - assert( FilterOps::parseNumericFilter("!123").value() == "!= 123" ); - assert( FilterOps::parseNumericFilter("!=123").value() == "!= 123" ); - assert( FilterOps::parseNumericFilter("!= 123").value() == "!= 123" ); - assert( FilterOps::parseNumericFilter("ne 123").value() == "!= 123" ); - assert( FilterOps::parseNumericFilter(">123").value() == "> 123" ); - assert( FilterOps::parseNumericFilter("> 123").value() == "> 123" ); - assert( FilterOps::parseNumericFilter("gt 123").value() == "> 123" ); - assert( FilterOps::parseNumericFilter(">=123").value() == ">= 123" ); - assert( FilterOps::parseNumericFilter(">= 123").value() == ">= 123" ); - assert( FilterOps::parseNumericFilter("ge 123").value() == ">= 123" ); - assert( FilterOps::parseNumericFilter("<123").value() == "< 123" ); - assert( FilterOps::parseNumericFilter("< 123").value() == "< 123" ); - assert( FilterOps::parseNumericFilter("lt 123").value() == "< 123" ); - assert( FilterOps::parseNumericFilter("<=123").value() == "<= 123" ); - assert( FilterOps::parseNumericFilter("<= 123").value() == "<= 123" ); - assert( FilterOps::parseNumericFilter("le 123").value() == "<= 123" ); + assert( FilterOps::parseNumericFilter(" ").value() == "" ); + assert( FilterOps::parseNumericFilter(" \t\n ").value() == "" ); + assert( FilterOps::parseNumericFilter("null").value() == " IS NULL" ); + assert( FilterOps::parseNumericFilter("not null").value() == " IS NOT NULL" ); + assert( FilterOps::parseNumericFilter("123").value() == "=123" ); + assert( FilterOps::parseNumericFilter("=123").value() == "=123" ); + assert( FilterOps::parseNumericFilter("= 123").value() == "=123" ); + assert( FilterOps::parseNumericFilter("==123").value() == "==123" ); + assert( FilterOps::parseNumericFilter("== 123").value() == "==123" ); + assert( FilterOps::parseNumericFilter("eq 123").value() == "=123" ); + assert( FilterOps::parseNumericFilter("EQ 123").value() == "=123" ); + assert( FilterOps::parseNumericFilter("!123").value() == "!=123" ); + assert( FilterOps::parseNumericFilter("!=123").value() == "!=123" ); + assert( FilterOps::parseNumericFilter("!= 123").value() == "!=123" ); + assert( FilterOps::parseNumericFilter("ne 123").value() == "!=123" ); + assert( FilterOps::parseNumericFilter("NE 123").value() == "!=123" ); + assert( FilterOps::parseNumericFilter(">123").value() == ">123" ); + assert( FilterOps::parseNumericFilter("> 123").value() == ">123" ); + assert( FilterOps::parseNumericFilter("gt 123").value() == ">123" ); + assert( FilterOps::parseNumericFilter("GT 123").value() == ">123" ); + assert( FilterOps::parseNumericFilter(">=123").value() == ">=123" ); + assert( FilterOps::parseNumericFilter(">= 123").value() == ">=123" ); + assert( FilterOps::parseNumericFilter("ge 123").value() == ">=123" ); + assert( FilterOps::parseNumericFilter("GE 123").value() == ">=123" ); + assert( FilterOps::parseNumericFilter("<123").value() == "<123" ); + assert( FilterOps::parseNumericFilter("< 123").value() == "<123" ); + assert( FilterOps::parseNumericFilter("lt 123").value() == "<123" ); + assert( FilterOps::parseNumericFilter("LT 123").value() == "<123" ); + assert( FilterOps::parseNumericFilter("<=123").value() == "<=123" ); + assert( FilterOps::parseNumericFilter("<= 123").value() == "<=123" ); + assert( FilterOps::parseNumericFilter("le 123").value() == "<=123" ); + assert( FilterOps::parseNumericFilter("LE 123").value() == "<=123" ); + // try to brake + assert( FilterOps::parseNumericFilter(" 123 ").value() == "=123" ); + assert( FilterOps::parseNumericFilter("1 2 3").value() == "=123" ); + assert( FilterOps::parseNumericFilter(" = 12 3 ").value() == "=123" ); + assert( FilterOps::parseNumericFilter("= =123").value() == "==123" ); + assert( FilterOps::parseNumericFilter(" = = 1 2 3 ").value() == "==123" ); + assert( FilterOps::parseNumericFilter(" ! 123 ").value() == "!=123" ); + assert( FilterOps::parseNumericFilter("! =123").value() == "!=123" ); + assert( FilterOps::parseNumericFilter("! = 123").value() == "!=123" ); + assert( FilterOps::parseNumericFilter("eq123").value() == "=123" ); + assert( FilterOps::parseNumericFilter("EQ123").value() == "=123" ); + assert( FilterOps::parseNumericFilter(" E Q 1 2 3 ").value() == "=123" ); + assert( FilterOps::parseNumericFilter("ne123").value() == "!=123" ); + assert( FilterOps::parseNumericFilter("NE123").value() == "!=123" ); + assert( FilterOps::parseNumericFilter(" N E 1 2 3 ").value() == "!=123" ); + assert( FilterOps::parseNumericFilter("gt123").value() == ">123" ); + assert( FilterOps::parseNumericFilter("GT123").value() == ">123" ); + assert( FilterOps::parseNumericFilter(" G T 1 2 3 ").value() == ">123" ); + assert( FilterOps::parseNumericFilter("ge123").value() == ">=123" ); + assert( FilterOps::parseNumericFilter("GE123").value() == ">=123" ); + assert( FilterOps::parseNumericFilter(" G E 1 2 3 ").value() == ">=123" ); + assert( FilterOps::parseNumericFilter("lt123").value() == "<123" ); + assert( FilterOps::parseNumericFilter("LT123").value() == "<123" ); + assert( FilterOps::parseNumericFilter(" L T 1 2 3 ").value() == "<123" ); + assert( FilterOps::parseNumericFilter("le123").value() == "<=123" ); + assert( FilterOps::parseNumericFilter("LE123").value() == "<=123" ); + assert( FilterOps::parseNumericFilter(" L E 1 2 3 ").value() == "<=123" ); // test for invalid filter assert( ! FilterOps::parseNumericFilter("*").has_value() ); - assert( ! FilterOps::parseNumericFilter("= =123").has_value() ); - assert( ! FilterOps::parseNumericFilter("= = 123").has_value() ); assert( ! FilterOps::parseNumericFilter("===123").has_value() ); - assert( ! FilterOps::parseNumericFilter("=== 123").has_value() ); - assert( ! FilterOps::parseNumericFilter("eq123").has_value() ); - assert( ! FilterOps::parseNumericFilter("!>123").has_value() ); - assert( ! FilterOps::parseNumericFilter("!> 123").has_value() ); - assert( ! FilterOps::parseNumericFilter("!<123").has_value() ); - assert( ! FilterOps::parseNumericFilter("!< 123").has_value() ); - assert( ! FilterOps::parseNumericFilter("! =123").has_value() ); - assert( ! FilterOps::parseNumericFilter("! = 123").has_value() ); assert( ! FilterOps::parseNumericFilter("!==123").has_value() ); - assert( ! FilterOps::parseNumericFilter("!== 123").has_value() ); - assert( ! FilterOps::parseNumericFilter("ne123").has_value() ); + assert( ! FilterOps::parseNumericFilter("!>123").has_value() ); + assert( ! FilterOps::parseNumericFilter("!<123").has_value() ); assert( ! FilterOps::parseNumericFilter(">>123").has_value() ); - assert( ! FilterOps::parseNumericFilter(">> 123").has_value() ); - assert( ! FilterOps::parseNumericFilter("gt123").has_value() ); assert( ! FilterOps::parseNumericFilter("=>123").has_value() ); - assert( ! FilterOps::parseNumericFilter("=> 123").has_value() ); assert( ! FilterOps::parseNumericFilter(">==123").has_value() ); - assert( ! FilterOps::parseNumericFilter(">== 123").has_value() ); assert( ! FilterOps::parseNumericFilter(">>=123").has_value() ); - assert( ! FilterOps::parseNumericFilter(">>= 123").has_value() ); - assert( ! FilterOps::parseNumericFilter("ge123").has_value() ); assert( ! FilterOps::parseNumericFilter("<<123").has_value() ); - assert( ! FilterOps::parseNumericFilter("<< 123").has_value() ); - assert( ! FilterOps::parseNumericFilter("lt123").has_value() ); assert( ! FilterOps::parseNumericFilter("=<123").has_value() ); - assert( ! FilterOps::parseNumericFilter("=< 123").has_value() ); assert( ! FilterOps::parseNumericFilter("<==123").has_value() ); - assert( ! FilterOps::parseNumericFilter("<== 123").has_value() ); assert( ! FilterOps::parseNumericFilter("<<=123").has_value() ); - assert( ! FilterOps::parseNumericFilter("<<= 123").has_value() ); - assert( ! FilterOps::parseNumericFilter("le123").has_value() ); - assert( ! FilterOps::parseNumericFilter("eq ").has_value() ); + assert( ! FilterOps::parseNumericFilter("EQ ").has_value() ); + assert( ! FilterOps::parseNumericFilter("EQEQ 123").has_value() ); + assert( ! FilterOps::parseNumericFilter("EQ EQ 123").has_value() ); + assert( ! FilterOps::parseNumericFilter("NE ").has_value() ); + assert( ! FilterOps::parseNumericFilter("NEEQ 123").has_value() ); + assert( ! FilterOps::parseNumericFilter("NE EQ 123").has_value() ); + assert( ! FilterOps::parseNumericFilter("GT ").has_value() ); + assert( ! FilterOps::parseNumericFilter("GTEQ 123").has_value() ); + assert( ! FilterOps::parseNumericFilter("GT EQ 123").has_value() ); + assert( ! FilterOps::parseNumericFilter("GE ").has_value() ); + assert( ! FilterOps::parseNumericFilter("LT ").has_value() ); + assert( ! FilterOps::parseNumericFilter("LTEQ 123").has_value() ); + assert( ! FilterOps::parseNumericFilter("LT EQ 123").has_value() ); + assert( ! FilterOps::parseNumericFilter("LE ").has_value() ); assert( ! FilterOps::parseNumericFilter("abc").has_value() ); assert( ! FilterOps::parseNumericFilter("abc xyz").has_value() ); assert( ! FilterOps::parseNumericFilter("abc 123").has_value() ); assert( ! FilterOps::parseNumericFilter("123 abc").has_value() ); assert( ! FilterOps::parseNumericFilter("1a2b3c").has_value() ); - assert( ! FilterOps::parseNumericFilter("123 456").has_value() ); assert( ! FilterOps::parseNumericFilter("+123").has_value() ); assert( ! FilterOps::parseNumericFilter("-123").has_value() ); T_PRINT("FilterOps::parseNumericFilter"); - - assert( FilterOps::parseBooleanFilter("").value() == "" ); - assert( FilterOps::parseBooleanFilter("null").value() == "NULL" ); - assert( FilterOps::parseBooleanFilter("not null").value() == "NOT NULL" ); - // test for true - assert( FilterOps::parseBooleanFilter("1").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("true").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("TRUE").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("=true").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("=TRUE").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("= true").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("= TRUE").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("==true").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("==TRUE").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("== true").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("== TRUE").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("!=false").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("!=FALSE").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("!= false").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("!= FALSE").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("!false").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("!FALSE").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("! false").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("! FALSE").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("! false").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("! FALSE").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("not false").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("NOT FALSE").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("not false").value() == "= 1" ); - assert( FilterOps::parseBooleanFilter("NOT FALSE").value() == "= 1" ); - // test for false - assert( FilterOps::parseBooleanFilter("0").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("false").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("FALSE").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("=false").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("=FALSE").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("= false").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("= FALSE").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("==false").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("==FALSE").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("== false").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("== FALSE").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("!=true").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("!=TRUE").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("!= true").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("!= TRUE").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("!true").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("!TRUE").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("! true").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("! TRUE").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("! true").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("! TRUE").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("not true").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("NOT TRUE").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("not true").value() == "= 0" ); - assert( FilterOps::parseBooleanFilter("NOT TRUE").value() == "= 0" ); - // test for invalid filter - assert( ! FilterOps::parseBooleanFilter("*").has_value() ); - assert( ! FilterOps::parseBooleanFilter("2").has_value() ); - assert( ! FilterOps::parseBooleanFilter("0 1").has_value() ); - assert( ! FilterOps::parseBooleanFilter("abc").has_value() ); - assert( ! FilterOps::parseBooleanFilter("true false").has_value() ); - T_PRINT("FilterOps::parseBooleanFilter"); } diff --git a/logdoctor/tests/white_box.h b/logdoctor/tests/white_box.h index c012200e..ebc0ff93 100644 --- a/logdoctor/tests/white_box.h +++ b/logdoctor/tests/white_box.h @@ -9,6 +9,9 @@ namespace Testing { +//! A Test suit for the defined operators +void testOperators(); + //! A Test suit for the utilities void testUtilities(); diff --git a/logdoctor/tools/crapnote/crapnote.cpp b/logdoctor/tools/crapnote/crapnote.cpp index 3d869028..7679e6ea 100644 --- a/logdoctor/tools/crapnote/crapnote.cpp +++ b/logdoctor/tools/crapnote/crapnote.cpp @@ -2,53 +2,58 @@ #include "crapnote.h" #include "ui_crapnote.h" +#include "globals/global_configs.h" + +#include "modules/stylesheets.h" + #include "modules/exceptions.h" -Crapnote::Crapnote(QWidget *parent) +Crapnote::Crapnote( const ColorsScheme colors_scheme, QFont font, QWidget* parent ) : QWidget{ parent } , ui{ new Ui::Crapnote } { ui->setupUi(this); + + this->setColorScheme( colors_scheme ); + this->setTextFont( font ); } -void Crapnote::setTextFont( const QFont& font ) +void Crapnote::setTextFont( QFont font ) noexcept { - QFont f{ font }; - f.setPointSize( this->font_size ); - this->ui->textEdit->setFont( f ); + font.setPointSize( this->font_size ); + this->ui->text_Note->setFont( font ); } -void Crapnote::setColorScheme( const int& color_scheme_id ) +void Crapnote::setColorScheme( const ColorsScheme colors_scheme ) { - QColor b, t; - // update the colors palette - switch ( color_scheme_id ) { - case 0: - this->ui->textEdit->setPalette( QPalette() ); - break; - case 1: - // breeze - b = QColor(255,198,102); - t = QColor(31,28,27); - this->ui->textEdit->setPalette( QPalette(t,b,b,b,b,t,b) ); - break; - case 2: - // monokai - b = QColor(166,226,46); - t = QColor(39,40,34); - this->ui->textEdit->setPalette( QPalette(t,b,b,b,b,t,b) ); - break; - case 3: - // radical - b = QColor(20,19,34); - t = QColor(213,53,143); - this->ui->textEdit->setPalette( QPalette(t,b,b,b,b,t,b) ); - break; - default: - // wrong - throw GenericException( "Unexpected ColorScheme ID for Crapnote: "+std::to_string( color_scheme_id ), true ); // leave un-catched + if ( GlobalConfigs::window_theme != WindowTheme::Native ) { + this->setStyleSheet( StyleSec::Crapnote::getStyleSheet( colors_scheme ) ); + } else { + this->setStyleSheet(""); + QPalette p; + // update the colors palette + switch ( colors_scheme ) { + case ColorsScheme::None: + break; + case ColorsScheme::Breeze: + p.setColor( QPalette::Base, QColor( 255, 198, 102 ) ); + p.setColor( QPalette::Text, QColor( 31, 28, 27 ) ); + break; + case ColorsScheme::Monokai: + p.setColor( QPalette::Base, QColor( 166, 226, 46 ) ); + p.setColor( QPalette::Text, QColor( 39, 40, 34 ) ); + break; + case ColorsScheme::Radical: + p.setColor( QPalette::Base, QColor( 20, 19, 34 ) ); + p.setColor( QPalette::Text, QColor( 213, 53, 143 ) ); + break; + default: + // wrong + throw DoNotCatchException( "Unexpected ColorScheme for Crapnote", std::to_string(static_cast(colors_scheme)) ); + } + this->ui->text_Note->setPalette( p ); } } @@ -56,7 +61,7 @@ void Crapnote::setColorScheme( const int& color_scheme_id ) void Crapnote::on_spinBox_FontSize_valueChanged(int arg1) { this->font_size = arg1; - this->setTextFont( this->ui->textEdit->font() ); + this->setTextFont( this->ui->text_Note->font() ); } diff --git a/logdoctor/tools/crapnote/crapnote.h b/logdoctor/tools/crapnote/crapnote.h index ea9575d8..a2e3ca7f 100644 --- a/logdoctor/tools/crapnote/crapnote.h +++ b/logdoctor/tools/crapnote/crapnote.h @@ -5,6 +5,9 @@ #include +enum class ColorsScheme : unsigned char; + + namespace Ui { class Crapnote; } @@ -14,18 +17,23 @@ namespace Ui { /*! A simple block-note like widget */ -class Crapnote : public QWidget +class Crapnote final : public QWidget { Q_OBJECT public: - explicit Crapnote( QWidget* parent=nullptr ); + + explicit Crapnote( const ColorsScheme colors_scheme, QFont font, QWidget* parent=nullptr ); + Q_DISABLE_COPY_MOVE(Crapnote) //! Sets the given font - void setTextFont( const QFont& font ); + void setTextFont( QFont font ) noexcept; //! Sets the given color-scheme - void setColorScheme( const int& color_scheme_id ); + /*! + \throw DoNotCatchException + */ + void setColorScheme( const ColorsScheme colors_scheme ); private slots: diff --git a/logdoctor/tools/crapnote/crapnote.ui b/logdoctor/tools/crapnote/crapnote.ui index 218cb21c..1e12736e 100644 --- a/logdoctor/tools/crapnote/crapnote.ui +++ b/logdoctor/tools/crapnote/crapnote.ui @@ -58,7 +58,7 @@ Reduce the font size - + - true @@ -122,7 +122,7 @@ Increase the font size - + + true @@ -161,7 +161,7 @@ 16 - + diff --git a/logdoctor/tools/crapnote/modules/stylesheets.cpp b/logdoctor/tools/crapnote/modules/stylesheets.cpp new file mode 100644 index 00000000..6f2b2794 --- /dev/null +++ b/logdoctor/tools/crapnote/modules/stylesheets.cpp @@ -0,0 +1,168 @@ + +#include "stylesheets.h" + +#include "globals/global_configs.h" + +#include "modules/exceptions.h" + +#include +#include + +#include + + +namespace /*private*/ +{ + +enum StyleId : uint32_t { + TEXT, + WINDOW, + BORDER_PRIMARY, + BORDER_SECONDARY, + SPINBOX_TEXT, + SPINBOX_BASE, + SPINBOX_BASE_FOCUS, + SPINBOX_BASE_SELECTION +}; + +using StyleMap = std::unordered_map; + +StyleMap makeStyleMap() +{ + switch ( GlobalConfigs::window_theme ) { + case WindowTheme::Light: + return { + {TEXT, + "rgb( 22, 11, 0 )"}, + {WINDOW, + "rgb( 230, 230, 230 )"}, + {BORDER_PRIMARY, + "rgb( 205, 200, 200 )"}, + {BORDER_SECONDARY, + "rgb( 124, 119, 119 )"}, + {SPINBOX_TEXT, + "rgb( 88, 80, 80 )"}, + {SPINBOX_BASE, + "rgb( 216, 216, 216 )"}, + {SPINBOX_BASE_FOCUS, + "rgb( 209, 209, 209 )"}, + {SPINBOX_BASE_SELECTION, + "rgb( 153, 211, 255 )"} + }; + case WindowTheme::Dark: + return { + {TEXT, + "rgb( 248, 248, 248 )"}, + {WINDOW, + "rgb( 27, 30, 33 )"}, + {BORDER_PRIMARY, + "rgb( 50, 55, 59 )"}, + {BORDER_SECONDARY, + "rgb( 107, 107, 107 )"}, + {SPINBOX_TEXT, + "rgb( 210, 210, 210 )"}, + {SPINBOX_BASE, + "rgb( 41, 44, 44 )"}, + {SPINBOX_BASE_FOCUS, + "rgb( 57, 60, 60 )"}, + {SPINBOX_BASE_SELECTION, + "rgb( 47, 99, 47 )"} + }; + default: + throw DoNotCatchException( "Unexpected WindowTheme", std::to_string(static_cast(GlobalConfigs::window_theme)) ); + } +} + +} //namespace (private) + + +namespace StyleSec::Crapnote +{ + +QString getStyleSheet( const ColorsScheme colors_scheme ) +{ + QString icons_theme; + switch ( GlobalConfigs::window_theme ) { + case WindowTheme::Native: + return ""; + case WindowTheme::Light: + icons_theme = "dark"; + break; + case WindowTheme::Dark: + icons_theme = "light"; + break; + default: + throw DoNotCatchException( "Unexpected WindowTheme", std::to_string(static_cast(GlobalConfigs::window_theme)) ); + } + QString note_bg, note_txt; + switch ( colors_scheme ) { + case ColorsScheme::None: + if ( GlobalConfigs::window_theme == WindowTheme::Light ) { + note_bg = "rgb( 255, 255, 255 )"; + note_txt = "rgb( 0, 0, 0 )"; + } else { + note_bg = "rgb( 0, 0, 0 )"; + note_txt = "rgb( 255, 255, 255 )"; + } + break; + case ColorsScheme::Breeze: + note_bg = "rgb( 255, 198, 102 )"; + note_txt = "rgb( 31, 28, 27 )"; + break; + case ColorsScheme::Monokai: + note_bg = "rgb( 166, 226, 46 )"; + note_txt = "rgb( 39, 40, 34 )"; + break; + case ColorsScheme::Radical: + note_bg = "rgb( 20, 19, 34 )"; + note_txt = "rgb( 213, 53, 143 )"; + break; + default: + // wrong + throw DoNotCatchException( "Unexpected ColorScheme for Crapnote", std::to_string(static_cast(colors_scheme)) ); + } + + const StyleMap style{ makeStyleMap() }; + return + "* {" + " color: "% style.at(TEXT) %";" + "}" + "QWidget#Crapnote {" + " background-color: "% style.at(WINDOW) %";" + "}" + "QFrame {" + " background-color: transparent;" + "}" + "QTextEdit {" + " color: "% note_txt %";" + " background-color: "% note_bg %";" + "}" + "QPushButton {" + " border: 1px solid "% style.at(BORDER_PRIMARY) %";" + " border-radius: 16px;" + " background-color: transparent;" + "}" + "QPushButton:hover {" + " border: 1px solid "% style.at(BORDER_SECONDARY) %";" + "}" + "QSpinBox {" + " border: 0px solid;" + " border-radius: 4px;" + " color: "% style.at(SPINBOX_TEXT) %";" + " background-color: "% style.at(SPINBOX_BASE) %";" + " selection-color: "% style.at(SPINBOX_TEXT) %";" + " selection-background-color: "% style.at(SPINBOX_BASE_SELECTION) %";" + "}" + "QSpinBox::focus {" + " border: 1px solid "% style.at(BORDER_SECONDARY) %";" + " background-color: "% style.at(SPINBOX_BASE_FOCUS) %";" + "}" + "QPushButton#button_FontSize_Minus {" + " image: url(:/icons/icons/"% icons_theme %"/list_rem.png);" + "}" + "QPushButton#button_FontSize_Plus {" + " image: url(:/icons/icons/"% icons_theme %"/list_add.png);" + "}"; +} + +} // namespacce StyleSec::Crapnote diff --git a/logdoctor/tools/crapnote/modules/stylesheets.h b/logdoctor/tools/crapnote/modules/stylesheets.h new file mode 100644 index 00000000..fd95653d --- /dev/null +++ b/logdoctor/tools/crapnote/modules/stylesheets.h @@ -0,0 +1,22 @@ +#ifndef LOGDOCTOR__CRAPNOTE__STYLESHEETS_H +#define LOGDOCTOR__CRAPNOTE__STYLESHEETS_H + + +enum class ColorsScheme : unsigned char; + +class QString; + + +namespace StyleSec::Crapnote +{ + +//! Returns the proper style sheet +/*! + \throw DoNotCatchException +*/ +QString getStyleSheet( const ColorsScheme colors_scheme ); + +} // namespacce StyleSec::Crapnote + + +#endif // LOGDOCTOR__CRAPNOTE__STYLESHEETS_H diff --git a/logdoctor/tools/crappath/crappath.cpp b/logdoctor/tools/crappath/crappath.cpp new file mode 100644 index 00000000..5a93d7b1 --- /dev/null +++ b/logdoctor/tools/crappath/crappath.cpp @@ -0,0 +1,115 @@ + +#include "crappath.h" + +#include "globals/global_configs.h" + +#include "modules/exceptions.h" + +#include + + +namespace /*private*/ +{ + +enum StyleId : uint32_t { + BUTTONS_BASE, + BUTTONS_BASE_HOVER, + BUTTONS_BASE_FLAT, + BUTTONS_BASE_DISABLED +}; + +using StyleMap = std::unordered_map; + +StyleMap makeStyleMap() +{ + switch ( GlobalConfigs::window_theme ) { + case WindowTheme::Light: + return { + {BUTTONS_BASE, + "rgb( 99, 188, 255 )"}, + {BUTTONS_BASE_HOVER, + "rgb( 123, 201, 255 )"}, + {BUTTONS_BASE_FLAT, + "rgb( 200, 219, 238 )"}, + {BUTTONS_BASE_DISABLED, + "rgb( 200, 219, 238 )"} + }; + case WindowTheme::Dark: + return { + {BUTTONS_BASE, + "rgb( 10, 155, 10 )"}, + {BUTTONS_BASE_HOVER, + "rgb( 33, 162, 33 )"}, + {BUTTONS_BASE_FLAT, + "rgb( 21, 71, 21 )"}, + {BUTTONS_BASE_DISABLED, + "rgb( 21, 71, 21 )"} + }; + default: + throw DoNotCatchException( "Unexpected WindowTheme", std::to_string(static_cast(GlobalConfigs::window_theme)) ); + } +} + +QString makeStyleSheet() +{ + const StyleMap style{ makeStyleMap() }; + return + "QPushButton {" + " border: 0px;" + " border-radius: 8px;" + " padding-left: 4px;" + " padding-right: 4px;" + " background-color: "+style.at(BUTTONS_BASE)+";" + "}" + "QPushButton:hover {" + " background-color: "+style.at(BUTTONS_BASE_HOVER)+";" + "}" + "QPushButton::flat {" + " background-color: "+style.at(BUTTONS_BASE_FLAT)+";" + "}" + "QPushButton::disabled {" + " background-color: "+style.at(BUTTONS_BASE_DISABLED)+";" + "}"; +} + +} //namespace (private) + + + +Crappath::Crappath( QWidget* parent ) + : QFileDialog(parent) +{ + QFileDialog::setViewMode( QFileDialog::Detail ); + + QFileDialog::setFileMode( QFileDialog::Directory ); + + QFileDialog::setOptions( + QFileDialog::ShowDirsOnly | + QFileDialog::DontResolveSymlinks | + QFileDialog::ReadOnly | + QFileDialog::DontUseCustomDirectoryIcons ); + + QFileDialog::setFilter( + QDir::Dirs | + QDir::NoDot | + QDir::NoSymLinks | + QDir::Hidden ); + + QFileDialog::setLabelText( QFileDialog::Accept, Crappath::tr("Choose") ); + QFileDialog::setLabelText( QFileDialog::Reject, Crappath::tr("Cancel") ); + + switch ( GlobalConfigs::window_theme ) { + case WindowTheme::Native: + QFileDialog::setStyleSheet(""); + break; + case WindowTheme::Light: + [[fallthrough]]; + case WindowTheme::Dark: + QFileDialog::setStyleSheet( makeStyleSheet() ); + break; + default: + // wrong + throw DoNotCatchException( "Unexpected WindowTheme", std::to_string(static_cast(GlobalConfigs::window_theme)) ); + break; + } +} diff --git a/logdoctor/tools/crappath/crappath.h b/logdoctor/tools/crappath/crappath.h new file mode 100644 index 00000000..37aba19b --- /dev/null +++ b/logdoctor/tools/crappath/crappath.h @@ -0,0 +1,17 @@ +#ifndef LOGDOCTOR__CRAPPATH_H +#define LOGDOCTOR__CRAPPATH_H + + +#include + + +class Crappath : public QFileDialog +{ + Q_OBJECT + +public: + explicit Crappath( QWidget* parent=nullptr ); + Q_DISABLE_COPY_MOVE(Crappath) +}; + +#endif // LOGDOCTOR__CRAPPATH_H diff --git a/logdoctor/translations/LogDoctor_en_GB.ts b/logdoctor/translations/LogDoctor_en_GB.ts index 14c3d3e8..664d1202 100644 --- a/logdoctor/translations/LogDoctor_en_GB.ts +++ b/logdoctor/translations/LogDoctor_en_GB.ts @@ -1,6 +1,257 @@ + + Changelog + + Versions + Versions + + + Version 3 + Version 3 + + + Version 2 + Version 2 + + + Version 1 + Version 1 + + + C++17 + C++17 + + + Qt5 + Qt5 + + + Build scripts + Build scripts + + + Cross-platform compatibility: + Cross-platform compatibility: + + + Linux + Linux + + + BSD + BSD + + + Windows + Windows + + + OSX + OSX + + + Statistics: + Statistics: + + + Warnings + Warnings + + + Speed + Speed + + + Counts + Counts + + + Daytime + Daytime + + + Relational + Relational + + + Globals + Globals + + + Translations: + Translations: + + + Italian + Italian + + + Spanish + Spanish + + + French + French + + + Tools: + Tools: + + + Block note + Block note + + + Utilities: + Utilities: + + + Infos viewer + Infos viewer + + + Updates checker + Updates checker + + + Themes: + Themes: + + + Dark + Dark + + + Light + Light + + + Improvements and fixes + Improvements and fixes + + + New themes: + New themes: + + + Ash + Ash + + + Candy + Candy + + + Forest + Forest + + + Powder + Powder + + + Restyled GUI + Restyled GUI + + + Restyled dialogs + Restyled dialogs + + + Doxygen documentation + Doxygen documentation + + + Mini-Games: + Mini-Games: + + + Criss-cross + Criss-cross + + + Snake + Snake + + + Changed default paths + Changed default paths + + + New game modes for Snake + New game modes for Snake + + + Hunt + Hunt + + + Battle + Battle + + + New translations: + New translations: + + + Japanese + Japanese + + + Portuguese + Portuguese + + + Code improvements + Code improvements + + + Performance improvements + Performance improvements + + + Added tests suite: + Added tests suite: + + + white box tests + white box tests + + + Customized charts themes + Customized charts themes + + + Fixes + Fixes + + + Tests improvements + Tests improvements + + + Docker support + Docker support + + + Upgrade to C++20 + Upgrade to C++20 + + + Upgrade to Qt6 + Upgrade to Qt6 + + + Restyled themes + Restyled themes + + + Redesigned configs section + Redesigned configs section + + Crapinfo @@ -59,6 +310,17 @@ Increase the font size + + Crappath + + Choose + Choose + + + Cancel + Cancel + + Crapup @@ -234,18 +496,6 @@ version mark not found Create a new database? Create a new database? - - This database will renamed with a trailing '.copy' and a new one will be created. -Continue? - This database will renamed with a trailing '.copy' and a new one will be created. -Continue? - - - The entry will renamed with a trailing '.copy' and a new one will be created. -Continue? - The entry will renamed with a trailing '.copy' and a new one will be created. -Continue? - An error occured An error occured @@ -426,10 +676,6 @@ Continue? The file is blank The file is blank - - An error accured while reading the file - An error accured while reading the file - The path was supposed to point to a folder, but it doesn't The path was supposed to point to a folder, but it doesn't @@ -446,10 +692,6 @@ Continue? The directory is not writable The directory is not writable - - Failed to retrieve the driver neede to handle the database - Failed to retrieve the driver neede to handle the database - Failed to retrieve the database file Failed to retrieve the database file @@ -590,10 +832,6 @@ please report this issue Warning size parameter Warning size parameter - - An error accured while reading the gzipped file - An error accured while reading the gzipped file - Something failed while handling the file Something failed while handling the file @@ -602,14 +840,6 @@ please report this issue An error occured while working on the database An error occured while working on the database - - An error occured while working on the database - -Aborting - An error occured while working on the database - -Aborting - One of the lists has an invalid item One of the lists has an invalid item @@ -704,6 +934,73 @@ please follow the instruction on the repository page Please free some resources, parse the files in different steps or split them into smaller units Please free some resources, parse the files in different steps or split them into smaller units + + This database will be renamed with a trailing '.copy' and a new one will be created. +Continue? + This database will be renamed with a trailing '.copy' and a new one will be created. Continue? + + + An error occured while reading the file + An error occured while reading the file + + + The entry will be renamed with a trailing '.copy' and a new one will be created. +Continue? + The entry will be renamed with a trailing '.copy' and a new one will be created. Continue? + + + An error occured while reading the gzipped file + An error occured while reading the gzipped file + + + Invalid configuration lines + Invalid configuration lines + + + Has not been possible to apply some of the configurations + Has not been possible to apply some of the configurations + + + If you choose to proceed, all of the unapplied configurations will be lost +Continue? + If you choose to proceed, all of the unapplied configurations will be lost Continue? + + + Failed to retrieve the driver needed to handle the database + Failed to retrieve the driver needed to handle the database + + + Failed updating hashes + Failed updating hashes + + + An error occured while inserting the parsed files hashes into the database + An error occured while inserting the parsed files hashes into the database + + + Data conversion failed + Data conversion failed + + + Failed to convert from '%1' to '%2' + Failed to convert from '%1' to '%2' + + + Failed to create statistics + Failed to create statistics + + + An error occured while processing + An error occured while processing + + + Cannot create statistics + Cannot create statistics + + + No data has been found that matches with the currently set parameters + No data has been found that matches with the currently set parameters + GameDialog @@ -798,10 +1095,6 @@ please follow the instruction on the repository page Hour Hour - - Update the database with current Warning States - Update the database with current Warning States - Log line marked as Warning Log line marked as Warning @@ -1426,6 +1719,22 @@ Any field not considered by LogDoctor will appear as 'DISCARDED'Auto Auto + + Select the path through a dialog window + Select the path through a dialog window + + + Show some info about LogDoctor + Show some info about LogDoctor + + + Changelog + Changelog + + + Show the changelog + Show the changelog + RichText @@ -1519,10 +1828,6 @@ Any field not considered by LogDoctor will appear as 'DISCARDED'Parsed Parsed - - Warnings - Warnings - Blacklisted Blacklisted diff --git a/logdoctor/translations/LogDoctor_es_ES.ts b/logdoctor/translations/LogDoctor_es_ES.ts index 7e663bbf..e48d73ca 100644 --- a/logdoctor/translations/LogDoctor_es_ES.ts +++ b/logdoctor/translations/LogDoctor_es_ES.ts @@ -1,6 +1,257 @@ + + Changelog + + Versions + Versiones + + + Version 3 + Versión 3 + + + Version 2 + Versión 2 + + + Version 1 + Versión 1 + + + C++17 + C++17 + + + Qt5 + Qt5 + + + Build scripts + Archivos de compilación + + + Cross-platform compatibility: + Compatibilidad multiplataforma: + + + Linux + Linux + + + BSD + BSD + + + Windows + Windows + + + OSX + OSX + + + Statistics: + Estadísticas: + + + Warnings + Advertencias + + + Speed + Velocidad + + + Counts + Cuenta + + + Daytime + Tiempo de día + + + Relational + Relacional + + + Globals + Globales + + + Translations: + Traducciones: + + + Italian + Italiano + + + Spanish + Español + + + French + Francés + + + Tools: + Herramientas: + + + Block note + Bloc de notas + + + Utilities: + Utilidades: + + + Infos viewer + Visor de información + + + Updates checker + Comprobador de actualizaciones + + + Themes: + Temas: + + + Dark + Oscuro + + + Light + Claro + + + Improvements and fixes + Mejoramientos y correcciones + + + New themes: + Nuevos temas: + + + Ash + Ceniza + + + Candy + Dulce + + + Forest + Bosque + + + Powder + Polvo + + + Restyled GUI + GUI rediseñada + + + Restyled dialogs + Diálogos rediseñados + + + Doxygen documentation + Documentación con Doxygen + + + Mini-Games: + Mini juegos: + + + Criss-cross + Cruzada + + + Snake + Snake + + + Changed default paths + Rutas predeterminadas modificadas + + + New game modes for Snake + Nuevos modos de juego para Snake + + + Hunt + Caza + + + Battle + Batalla + + + New translations: + Nuevas traducciones: + + + Japanese + Japonés + + + Portuguese + Portugués + + + Code improvements + Mejoras de código + + + Performance improvements + Mejoras de rendimiento + + + Added tests suite: + Conjunto de pruebas agregado: + + + white box tests + pruebas de caja blanca + + + Customized charts themes + Temas de gráficos personalizados + + + Fixes + Correcciones + + + Tests improvements + Mejoras en las pruebas + + + Docker support + Soporte para Docker + + + Upgrade to C++20 + Actualizacion a C++20 + + + Upgrade to Qt6 + Actualizacion a Qt6 + + + Restyled themes + Temas rediseñados + + + Redesigned configs section + Sección de configuraciones rediseñada + + Crapinfo @@ -59,6 +310,17 @@ Aumentar el tamaño de font + + Crappath + + Choose + Elegir + + + Cancel + Cancelar + + Crapup @@ -246,12 +508,6 @@ marcador no encontrado Create a new database? Crear un nuevo database? - - This database will renamed with a trailing '.copy' and a new one will be created. -Continue? - Este database se renombrará con el final '.copia' y se creará uno nuevo. -¿Continuar? - Ignore the warning and use it anyway, Discard it and continue, or Abort the entire process? ¿Ignorar la advertencia y usarlo igualmente, Descartarlo y continuar o Anular todo el proceso? @@ -260,12 +516,6 @@ Continue? Proceed anyway? ¿Procede de todas maneras? - - The entry will renamed with a trailing '.copy' and a new one will be created. -Continue? - La entrada se renombrará con el final '.copia' y se creará una nueva. -¿Continuar? - An error occured Ocurrió un error @@ -484,10 +734,6 @@ Corrígela y vuelve a intentarlo The file is blank El archivo está vacío - - An error accured while reading the file - Error en la lectura del archivo - The path was supposed to point to a folder, but it doesn't La ruta debería apuntar a una carpeta, pero no lo hace @@ -504,10 +750,6 @@ Corrígela y vuelve a intentarlo The directory is not writable La carpeta no es escribible - - Failed to retrieve the driver neede to handle the database - Error en el recuperar el driver necesario para manejar el database - Failed to retrieve the database file Error en el recuperar el archivo del database @@ -648,10 +890,6 @@ por favor notifica este problema Warning size parameter Parámetro de advertencia del tamaño - - An error accured while reading the gzipped file - Error en la lectura del archivo gzip - Something failed while handling the file Algo falló al manejar el archivo @@ -660,14 +898,6 @@ por favor notifica este problema An error occured while working on the database Error durante el trabajo en el database - - An error occured while working on the database - -Aborting - Error durante el trabajo en el database - -Anulado - Duplicate file Archivo duplicado @@ -704,6 +934,76 @@ Anulado Please free some resources, parse the files in different steps or split them into smaller units Por favor libere algunos recursos, analice los archivos en diferentes pasos o divídalos en unidades más pequeñas + + This database will be renamed with a trailing '.copy' and a new one will be created. +Continue? + Este database se renombrará con el final '.copia' y se creará uno nuevo. +¿Continuar? + + + An error occured while reading the file + Error en la lectura del archivo + + + The entry will be renamed with a trailing '.copy' and a new one will be created. +Continue? + La entrada se renombrará con el final '.copia' y se creará una nueva. +¿Continuar? + + + An error occured while reading the gzipped file + Error en la lectura del archivo gzip + + + Invalid configuration lines + Líneas de configuración no válidas + + + Has not been possible to apply some of the configurations + No ha sido posible aplicar algunas de las configuraciones + + + If you choose to proceed, all of the unapplied configurations will be lost +Continue? + Si decide continuar, se perderán todas las configuraciones no aplicadas +¿Continuar? + + + Failed to retrieve the driver needed to handle the database + No se pudo recuperar el driver necesario para manejar la base de datos + + + Failed updating hashes + Error al actualizar hashes + + + An error occured while inserting the parsed files hashes into the database + Se produjo un error al insertar los hashes de los archivos analizados en la base de datos + + + Data conversion failed + Error en la conversión de datos + + + Failed to convert from '%1' to '%2' + Error al convertir de '%1' a '%2' + + + Failed to create statistics + Error al crear estadísticas + + + An error occured while processing + Ocurrió un error durante el procesamiento + + + Cannot create statistics + No se pueden crear estadísticas + + + No data has been found that matches with the currently set parameters + No se han encontrado datos que coincidan con los parámetros establecidos actualmente + GameDialog @@ -798,10 +1098,6 @@ Anulado Hour Hora - - Update the database with current Warning States - Actualice el database con los estados de advertencia actuales - Log line marked as Warning Línea de registro marcada como Advertencia @@ -1426,6 +1722,22 @@ Los campos marcados como 'DISCARDED' se analizaron correctamente, pero Auto Auto + + Select the path through a dialog window + Seleccione la ruta a través de una ventana de diálogo + + + Show some info about LogDoctor + Mostrar información sobre LogDoctor + + + Changelog + Registro de cambios + + + Show the changelog + Mostrar el registro de cambios + RichText @@ -1519,10 +1831,6 @@ Los campos marcados como 'DISCARDED' se analizaron correctamente, pero Parsed Analizado - - Warnings - Advertencias - Blacklisted Excluido diff --git a/logdoctor/translations/LogDoctor_fr_FR.ts b/logdoctor/translations/LogDoctor_fr_FR.ts index b80ef56b..4c88286c 100644 --- a/logdoctor/translations/LogDoctor_fr_FR.ts +++ b/logdoctor/translations/LogDoctor_fr_FR.ts @@ -1,6 +1,257 @@ + + Changelog + + Versions + Versions + + + Version 3 + Version 3 + + + Version 2 + Version 2 + + + Version 1 + Version 1 + + + C++17 + C++17 + + + Qt5 + Qt5 + + + Build scripts + Fichiers pour la construction + + + Cross-platform compatibility: + Compatibilité multiplateforme : + + + Linux + Linux + + + BSD + BSD + + + Windows + Windows + + + OSX + OSX + + + Statistics: + Statistiques: + + + Warnings + Avertissements + + + Speed + Vitesse + + + Counts + Comptes + + + Daytime + Moment de la journée + + + Relational + Relationnelle + + + Globals + Mondiales + + + Translations: + Traductions: + + + Italian + Italien + + + Spanish + Espagnol + + + French + Français + + + Tools: + Outils: + + + Block note + Bloc notes + + + Utilities: + Utilitaires : + + + Infos viewer + Visionneuse d'informations + + + Updates checker + Vérificateur de mises à jour + + + Themes: + Thèmes : + + + Dark + Sombre + + + Light + Clair + + + Improvements and fixes + Améliorations et correctifs + + + New themes: + Nouveaux thèmes : + + + Ash + Cendre + + + Candy + Bonbon + + + Forest + Forêt + + + Powder + Poudre + + + Restyled GUI + Interface graphique restylée + + + Restyled dialogs + Boîtes de dialogue restylées + + + Doxygen documentation + Documentation avec Doxygen + + + Mini-Games: + Mini-jeux: + + + Criss-cross + Sillonner + + + Snake + Snake + + + Changed default paths + Chemins par défaut modifiés + + + New game modes for Snake + Nouveaux modes de jeu pour Snake + + + Hunt + Chasse + + + Battle + Bataille + + + New translations: + Nouvelles traductions : + + + Japanese + Japonais + + + Portuguese + Portugais + + + Code improvements + Améliorations du code + + + Performance improvements + Amélioration des performances + + + Added tests suite: + Suite de tests ajoutée: + + + white box tests + tests en boîte blanche + + + Customized charts themes + Thèmes de graphiques personnalisés + + + Fixes + Correctifs + + + Tests improvements + Améliorations des tests + + + Docker support + Prise en charge avec Docker + + + Upgrade to C++20 + Mise à niveau vers C++20 + + + Upgrade to Qt6 + Mise à niveau vers Qt6 + + + Restyled themes + Thèmes restylés + + + Redesigned configs section + Section de configuration repensée + + Crapinfo @@ -59,6 +310,17 @@ Augmenter la taille de la font + + Crappath + + Choose + Choisir + + + Cancel + Annuler + + Crapup @@ -246,12 +508,6 @@ marqueur pas trouvé Create a new database? Créer un nouveau database? - - This database will renamed with a trailing '.copy' and a new one will be created. -Continue? - Cette database sera renommée avec un '.copy' à la fin et une nouvelle sera créée. -Continuer? - Ignore the warning and use it anyway, Discard it and continue, or Abort the entire process? Ignorer l'avertissement et l'utiliser quand même, Jeter el et continuer, ou Abandonner tout le processus? @@ -260,12 +516,6 @@ Continuer? Proceed anyway? Continuer malgré tout? - - The entry will renamed with a trailing '.copy' and a new one will be created. -Continue? - L'entrée sera renommée avec un « .copy » à la fin et une nouvelle sera créée. -Continuer? - An error occured Une erreur s'est produite @@ -484,10 +734,6 @@ Veuillez le corriger et réessayer The file is blank Le fichier est vide - - An error accured while reading the file - Une erreur s'est produite lors de la lecture du fichier - The path was supposed to point to a folder, but it doesn't Le chemin était censé pointer vers un dossier, mais ce n'est pas le cas @@ -504,10 +750,6 @@ Veuillez le corriger et réessayer The directory is not writable Le dossier n'est pas accessible en écriture - - Failed to retrieve the driver neede to handle the database - Impossible de récupérer le driver nécessaire pour gérer la base de données - Failed to retrieve the database file Impossible de récupérer le fichier de database @@ -648,10 +890,6 @@ merci de signaler ce problème Warning size parameter Paramètre de taille d'avertissement - - An error accured while reading the gzipped file - Une erreur s'est produite lors de la lecture du fichier gzippé - Something failed while handling the file Quelque chose a échoué lors du traitement du fichier @@ -660,14 +898,6 @@ merci de signaler ce problème An error occured while working on the database Une erreur s'est produite lors du travail sur le database - - An error occured while working on the database - -Aborting - Une erreur s'est produite lors du travail sur le database - -Abandon - Duplicate file Fichier en double @@ -704,6 +934,76 @@ Abandon Please free some resources, parse the files in different steps or split them into smaller units Veuillez libérer des ressources, analyser les fichiers en différentes étapes ou les diviser en unités plus petites + + This database will be renamed with a trailing '.copy' and a new one will be created. +Continue? + Cette database sera renommée avec un '.copy' à la fin et une nouvelle sera créée. +Continuer? + + + An error occured while reading the file + Une erreur s'est produite lors de la lecture du fichier + + + The entry will be renamed with a trailing '.copy' and a new one will be created. +Continue? + L'entrée sera renommée avec un « .copy » à la fin et une nouvelle sera créée. +Continuer? + + + An error occured while reading the gzipped file + Une erreur s'est produite lors de la lecture du fichier gzippé + + + Invalid configuration lines + Lignes de configuration invalides + + + Has not been possible to apply some of the configurations + N'a pas été possible d'appliquer certaines des configurations + + + If you choose to proceed, all of the unapplied configurations will be lost +Continue? + Si vous choisissez de continuer, toutes les configurations non appliquées seront perdues +Continuer? + + + Failed to retrieve the driver needed to handle the database + Échec de la récupération du driver nécessaire pour gérer la base de données + + + Failed updating hashes + Échec de la mise à jour des hachages + + + An error occured while inserting the parsed files hashes into the database + Une erreur s'est produite lors de l'insertion des hachages des fichiers analysés dans la base de données + + + Data conversion failed + Échec de la conversion des données + + + Failed to convert from '%1' to '%2' + Échec de la conversion de '%1' en '%2' + + + Failed to create statistics + Échec de la création de statistiques + + + An error occured while processing + Une erreur s'est produite lors du traitement + + + Cannot create statistics + Impossible de créer des statistiques + + + No data has been found that matches with the currently set parameters + Aucune donnée correspondant aux paramètres actuellement définis n'a été trouvée + GameDialog @@ -798,10 +1098,6 @@ Abandon Hour Heure - - Update the database with current Warning States - Mettre à jour le database avec les états d'avertissement actuels - Log line marked as Warning Ligne de journal marquée comme Avertissement @@ -1426,6 +1722,22 @@ Les champs marqués comme 'DISCARDED' ont été analysés correctement Auto Auto + + Select the path through a dialog window + Sélectionnez le chemin via une fenêtre de dialogue + + + Show some info about LogDoctor + Afficher quelques informations sur LogDoctor + + + Changelog + Journal des modifications + + + Show the changelog + Afficher le journal des modifications + RichText @@ -1519,10 +1831,6 @@ Les champs marqués comme 'DISCARDED' ont été analysés correctement Parsed analysé - - Warnings - Avertissements - Blacklisted Exclu diff --git a/logdoctor/translations/LogDoctor_it_IT.ts b/logdoctor/translations/LogDoctor_it_IT.ts index 1f3a4187..c8cc7b83 100644 --- a/logdoctor/translations/LogDoctor_it_IT.ts +++ b/logdoctor/translations/LogDoctor_it_IT.ts @@ -1,6 +1,257 @@ + + Changelog + + Versions + Versioni + + + Version 3 + Versione 3 + + + Version 2 + Versione 2 + + + Version 1 + Versione 1 + + + C++17 + C++17 + + + Qt5 + Qt5 + + + Build scripts + Script per la compilazione + + + Cross-platform compatibility: + Compatibilità cross-platform: + + + Linux + Linux + + + BSD + BSD + + + Windows + Windows + + + OSX + OSX + + + Statistics: + Statistiche: + + + Warnings + Avvertimenti + + + Speed + Velocità + + + Counts + Quantità + + + Daytime + Momenti del giorno + + + Relational + Relazionale + + + Globals + Globali + + + Translations: + Traduzioni: + + + Italian + Italiano + + + Spanish + Spagnolo + + + French + Francese + + + Tools: + Attrezzi: + + + Block note + Blocco note + + + Utilities: + Utilità: + + + Infos viewer + Visualizzatore di informazioni + + + Updates checker + Controllo degli aggiornamenti + + + Themes: + Temi: + + + Dark + Scuro + + + Light + Chiaro + + + Improvements and fixes + Migliramenti e correzioni + + + New themes: + Nuovi temi: + + + Ash + Cenere + + + Candy + Caramella + + + Forest + Foresta + + + Powder + Polvere + + + Restyled GUI + Interfaccia ridisegnata + + + Restyled dialogs + Dialoghi ridisegnati + + + Doxygen documentation + Documentazione con Doxygen + + + Mini-Games: + Mini giochi: + + + Criss-cross + Tris + + + Snake + Snake + + + Changed default paths + Cambiati i persorsi predefiniti + + + New game modes for Snake + Nuove modalità di gioco per Snake + + + Hunt + Caccia + + + Battle + Battaglia + + + New translations: + Nuove traduzioni: + + + Japanese + Giapponese + + + Portuguese + Portoghese + + + Code improvements + Migliramenti al codice + + + Performance improvements + Migliramenti alle prestazioni + + + Added tests suite: + Aggiunti test: + + + white box tests + test a scatola bianca + + + Customized charts themes + Temi dei grafici personalizzati + + + Fixes + Correzioni + + + Tests improvements + Migliramento dei test + + + Docker support + Supporto per Docker + + + Upgrade to C++20 + Aggiornamento a C++20 + + + Upgrade to Qt6 + Aggiornamento a Qt6 + + + Restyled themes + Nuovo stile per i temi + + + Redesigned configs section + Ridisegnata la sezione delle configurazioni + + Crapinfo @@ -59,6 +310,17 @@ Aumenta la dimensione dei caratteri + + Crappath + + Choose + Scegli + + + Cancel + Cancella + + Crapup @@ -234,18 +496,6 @@ marcatore non trovato Create a new database? Creare un nuovo database? - - This database will renamed with a trailing '.copy' and a new one will be created. -Continue? - L'attuale database verrà rinominato con estensione '.copy' e ne verrà creato uno nuovo. -Continuare? - - - The entry will renamed with a trailing '.copy' and a new one will be created. -Continue? - La risorsa attuale verrà rinominata con estensione '.copy' e ne verrà creata una nuova. -Continuare? - An error occured È avvenuto un errore @@ -426,10 +676,6 @@ Continuare? The file is blank Il file è vuoto - - An error accured while reading the file - Errore nella lettura del file - The path was supposed to point to a folder, but it doesn't Il percorso dovrebbe puntare ad una cartella, ma non è così @@ -446,10 +692,6 @@ Continuare? The directory is not writable La cartella non è scrivibile - - Failed to retrieve the driver neede to handle the database - Fallimento nel reperire il driver necessario per maneggiare il database - Failed to retrieve the database file Fallimento nel reperire il database @@ -590,10 +832,6 @@ per favore segnala questo problema Warning size parameter Dimensione di sicurezza - - An error accured while reading the gzipped file - Errore durante la lettura del file gzip - Something failed while handling the file Qualcosa è andato storto nel maneggiare il file @@ -602,14 +840,6 @@ per favore segnala questo problema An error occured while working on the database Errore durante il lavoro sul database - - An error occured while working on the database - -Aborting - Errore durante il lavoro sul database - -Annullato - One of the lists has an invalid item Una delle liste contiene un elemento non valido @@ -704,6 +934,76 @@ per favore segui le istruzioni nella pagina del repository Please free some resources, parse the files in different steps or split them into smaller units Per favore rilascia qualche risorsa, analizza i file in diversi passaggi o dividili in unità più piccole + + This database will be renamed with a trailing '.copy' and a new one will be created. +Continue? + L'attuale database verrà rinominato con estensione '.copy' e ne verrà creato uno nuovo. +Continuare? + + + An error occured while reading the file + Errore nella lettura del file + + + The entry will be renamed with a trailing '.copy' and a new one will be created. +Continue? + La risorsa attuale verrà rinominata con estensione '.copy' e ne verrà creata una nuova. +Continuare? + + + An error occured while reading the gzipped file + Errore durante la lettura del file gzip + + + Invalid configuration lines + Linee di configurazione non valide + + + Has not been possible to apply some of the configurations + Non è stato possibile applicare alcune configurazioni + + + If you choose to proceed, all of the unapplied configurations will be lost +Continue? + Scegliendo di proseguire, tutte le configurazioni non applicate andranno perse +Continuare? + + + Failed to retrieve the driver needed to handle the database + Errore nel reperire il driver necessario a maneggiare il database + + + Failed updating hashes + Aggiornamento degli hash non riuscito + + + An error occured while inserting the parsed files hashes into the database + Errore nell'inserire nel database gli hash dei file analizzati + + + Data conversion failed + Conversione dei dati fallita + + + Failed to convert from '%1' to '%2' + Conversione da '%1' a '%2' non riuscita + + + Failed to create statistics + Creazione delle statistiche non riuscita + + + An error occured while processing + È avvenuto un errore nel processare + + + Cannot create statistics + Impossibile creare le statistiche + + + No data has been found that matches with the currently set parameters + Nessun dato trovato che corrisponda ai parametri attualmente in uso + GameDialog @@ -798,10 +1098,6 @@ per favore segui le istruzioni nella pagina del repository Hour Ora - - Update the database with current Warning States - Aggiorna il database con gli Avvertimenti correnti - Log line marked as Warning Linee di log marcate come Avvertimento @@ -1427,6 +1723,22 @@ I campi non considerati da LogDocrot appariranno come 'DISCARDED'Auto Auto + + Select the path through a dialog window + Seleziona il percorso tramite una finestra di dialogo + + + Show some info about LogDoctor + Mostra alcune informazioni riguardo LogDoctor + + + Changelog + Cambiamenti + + + Show the changelog + Mostra i cambiamenti + RichText @@ -1520,10 +1832,6 @@ I campi non considerati da LogDocrot appariranno come 'DISCARDED'Parsed Analizzati - - Warnings - Avvertimenti - Blacklisted Esclusi diff --git a/logdoctor/translations/LogDoctor_ja_JP.ts b/logdoctor/translations/LogDoctor_ja_JP.ts index 38c79219..eb83756a 100644 --- a/logdoctor/translations/LogDoctor_ja_JP.ts +++ b/logdoctor/translations/LogDoctor_ja_JP.ts @@ -1,6 +1,257 @@ + + Changelog + + Versions + バージョン + + + Version 3 + バージョン3 + + + Version 2 + バージョン2 + + + Version 1 + バージョン1 + + + C++17 + C++17 + + + Qt5 + Qt5 + + + Build scripts + ビルド用のファイル + + + Cross-platform compatibility: + クロスプラットフォームの互換性: + + + Linux + Linux + + + BSD + BSD + + + Windows + Windows + + + OSX + OSX + + + Statistics: + 統計: + + + Warnings + 警告 + + + Speed + スピード + + + Counts + カウント + + + Daytime + 時刻 + + + Relational + 関連した + + + Globals + グローバル + + + Translations: + 翻訳: + + + Italian + イタリアの + + + Spanish + スペイン語 + + + French + フランス語 + + + Tools: + ツール: + + + Block note + ブロックメモ + + + Utilities: + ユーティリティ: + + + Infos viewer + 情報ビューア + + + Updates checker + アップデートチェッカー + + + Themes: + テーマ: + + + Dark + 暗い + + + Light + + + + Improvements and fixes + 改善と修正 + + + New themes: + 新しいテーマ: + + + Ash + + + + Candy + あめ + + + Forest + + + + Powder + + + + Restyled GUI + 再スタイルされた GUI + + + Restyled dialogs + 再スタイルされたダイアログ + + + Doxygen documentation + Doxygen を使用したドキュメント + + + Mini-Games: + ミニゲーム: + + + Criss-cross + 十字 + + + Snake + + + + Changed default paths + デフォルトのパスを変更しました + + + New game modes for Snake + スネークの新しいゲームモード + + + Hunt + ハント + + + Battle + 戦い + + + New translations: + 新しい翻訳: + + + Japanese + 日本語 + + + Portuguese + ポルトガル語 + + + Code improvements + コードの改善 + + + Performance improvements + パフォーマンスの向上 + + + Added tests suite: + 追加されたテストスイート: + + + white box tests + ホワイトボックステスト + + + Customized charts themes + カスタマイズされたグラフのテーマ + + + Fixes + 修正 + + + Tests improvements + テストの改善 + + + Docker support + Docker のサポート + + + Upgrade to C++20 + C++20 へのアップグレード + + + Upgrade to Qt6 + Qt6 にアップグレードする + + + Restyled themes + 再スタイルされたテーマ + + + Redesigned configs section + 再設計された構成セクション + + Crapinfo @@ -59,6 +310,17 @@ フォントサイズを大きくする + + Crappath + + Choose + 選ぶ + + + Cancel + キャンセル + + Crapup @@ -234,18 +496,6 @@ version mark not found Create a new database? 新しいデータベースを作成しますか? - - This database will renamed with a trailing '.copy' and a new one will be created. -Continue? - このデータベースは末尾に「.copy」を付けて名前が変更され、新しいデータベースが作成されます。 -継続する? - - - The entry will renamed with a trailing '.copy' and a new one will be created. -Continue? - エントリは末尾に「.copy」を付けて名前が変更され、新しいエントリが作成されます。 -継続する? - An error occured エラーが発生した @@ -426,10 +676,6 @@ Continue? The file is blank ファイルが空です - - An error accured while reading the file - ファイルの読み取り中にエラーが発生しました - The path was supposed to point to a folder, but it doesn't パスはフォルダーを指すはずでしたが、そうではありません @@ -446,10 +692,6 @@ Continue? The directory is not writable ディレクトリは書き込み不可です - - Failed to retrieve the driver neede to handle the database - データベースを処理するために必要なドライバを取得できませんでした - Failed to retrieve the database file データベース ファイルの取得に失敗しました @@ -590,10 +832,6 @@ please report this issue Warning size parameter 警告サイズ パラメータ - - An error accured while reading the gzipped file - Gzip ファイルの読み取り中にエラーが発生しました - Something failed while handling the file ファイルの処理中に何かが失敗しました @@ -602,14 +840,6 @@ please report this issue An error occured while working on the database データベースでの作業中にエラーが発生しました - - An error occured while working on the database - -Aborting - データベースの作業中にエラーが発生しました - -中止中 - One of the lists has an invalid item リストの 1 つに無効な項目があります @@ -704,6 +934,76 @@ please follow the instruction on the repository page Please free some resources, parse the files in different steps or split them into smaller units いくつかのリソースを解放し、ファイルを別の手順で解析するか、ファイルを小さな単位に分割してください + + This database will be renamed with a trailing '.copy' and a new one will be created. +Continue? + このデータベースは末尾に「.copy」を付けて名前が変更され、新しいデータベースが作成されます。 +継続する? + + + An error occured while reading the file + ファイルの読み取り中にエラーが発生しました + + + The entry will be renamed with a trailing '.copy' and a new one will be created. +Continue? + エントリは末尾に「.copy」を付けて名前が変更され、新しいエントリが作成されます。 +継続する? + + + An error occured while reading the gzipped file + Gzip ファイルの読み取り中にエラーが発生しました + + + Invalid configuration lines + 無効な設定行 + + + Has not been possible to apply some of the configurations + 一部の構成を適用できませんでした + + + If you choose to proceed, all of the unapplied configurations will be lost +Continue? + 続行を選択すると、適用されていない設定はすべて失われます +継続する? + + + Failed to retrieve the driver needed to handle the database + データベースの処理に必要なドライバーの取得に失敗しました + + + Failed updating hashes + ハッシュの更新に失敗しました + + + An error occured while inserting the parsed files hashes into the database + 解析されたファイルのハッシュをデータベースに挿入中にエラーが発生しました + + + Data conversion failed + データ変換に失敗しました + + + Failed to convert from '%1' to '%2' + '%1' から '%2' への変換に失敗しました + + + Failed to create statistics + 統計の作成に失敗しました + + + An error occured while processing + 処理中にエラーが発生しました + + + Cannot create statistics + 統計を作成できません + + + No data has been found that matches with the currently set parameters + 現在設定されているパラメータと一致するデータが見つかりませんでした + GameDialog @@ -798,10 +1098,6 @@ please follow the instruction on the repository page Hour 時間 - - Update the database with current Warning States - 現在の警告状態でデータベースを更新します - Log line marked as Warning 警告としてマークされたログ行 @@ -1426,6 +1722,22 @@ LogDoctor によって考慮されないフィールドは、「DISCARDED」と Auto 自動 + + Select the path through a dialog window + ダイアログ ウィンドウでパスを選択します + + + Show some info about LogDoctor + LogDoctor に関する情報を表示します + + + Changelog + 変更履歴 + + + Show the changelog + 変更ログを表示する + RichText @@ -1519,10 +1831,6 @@ LogDoctor によって考慮されないフィールドは、「DISCARDED」と Parsed 解析済み - - Warnings - 警告 - Blacklisted ブラックリストに登録済み diff --git a/logdoctor/translations/LogDoctor_pt_BR.ts b/logdoctor/translations/LogDoctor_pt_BR.ts index e221726f..0cfa21e6 100644 --- a/logdoctor/translations/LogDoctor_pt_BR.ts +++ b/logdoctor/translations/LogDoctor_pt_BR.ts @@ -1,6 +1,257 @@ + + Changelog + + Versions + Versões + + + Version 3 + Versão 3 + + + Version 2 + Versão 2 + + + Version 1 + Versão 1 + + + C++17 + C++17 + + + Qt5 + Qt5 + + + Build scripts + Arquivos para construção + + + Cross-platform compatibility: + Compatibilidade entre plataformas: + + + Linux + Linux + + + BSD + BSD + + + Windows + Windows + + + OSX + OSX + + + Statistics: + Estatisticas: + + + Warnings + Avisos + + + Speed + Velocidade + + + Counts + Conta + + + Daytime + Hora do dia + + + Relational + Relacional + + + Globals + Globais + + + Translations: + Traduções: + + + Italian + Italiano + + + Spanish + Espanhol + + + French + Francês + + + Tools: + Instrumentos: + + + Block note + Bloco de notas + + + Utilities: + Utilidades: + + + Infos viewer + Visualizador de informações + + + Updates checker + Verificador de atualizações + + + Themes: + Temas: + + + Dark + Escuro + + + Light + Claro + + + Improvements and fixes + Melhorias e correções + + + New themes: + Novos temas: + + + Ash + Cinzas + + + Candy + Doce + + + Forest + Floresta + + + Powder + + + + Restyled GUI + GUI reestilizada + + + Restyled dialogs + Diálogos reestilizados + + + Doxygen documentation + Documentação Doxygen + + + Mini-Games: + Mini jogos: + + + Criss-cross + Cruzada + + + Snake + Snake + + + Changed default paths + Caminhos padrão alterados + + + New game modes for Snake + Novos modos de jogo para Snake + + + Hunt + Caça + + + Battle + Batalha + + + New translations: + Novas traduções: + + + Japanese + japonês + + + Portuguese + Português + + + Code improvements + Melhorias de código + + + Performance improvements + Melhorias de desempenho + + + Added tests suite: + Conjunto de testes adicionado: + + + white box tests + testes de caixa branca + + + Customized charts themes + Temas de gráficos personalizados + + + Fixes + Correções + + + Tests improvements + Melhorias nos testes + + + Docker support + Suporte para Docker + + + Upgrade to C++20 + Atualizar para C++20 + + + Upgrade to Qt6 + Atualizar para Qt6 + + + Restyled themes + Temas reestilizados + + + Redesigned configs section + Seção de configurações redesenhada + + Crapinfo @@ -59,6 +310,17 @@ Aumentar o tamanho da fonte + + Crappath + + Choose + Escolher + + + Cancel + Cancelar + + Crapup @@ -246,12 +508,6 @@ marcador no encontrado Create a new database? Criar um novo banco de dados? - - This database will renamed with a trailing '.copy' and a new one will be created. -Continue? - Esse banco de dados terá o final renomado para '.copia' e se criará um novo. -¿Continuar? - Ignore the warning and use it anyway, Discard it and continue, or Abort the entire process? Ignorar advertência e usar normalmente, abortar e continuar ou anular todo processo? @@ -260,12 +516,6 @@ Continue? Proceed anyway? Proceder de qualquer maneira? - - The entry will renamed with a trailing '.copy' and a new one will be created. -Continue? - A entrada será renomeada '.copia' e se criará uma nova. -¿Continuar? - An error occured Ocorreu um erro @@ -484,10 +734,6 @@ Por favor, corrija e tente novamente The file is blank O arquivo está vazio - - An error accured while reading the file - Erro na leitura do arquivo - The path was supposed to point to a folder, but it doesn't A rota deveria apontar para uma pasta, mas não aponta @@ -504,10 +750,6 @@ Por favor, corrija e tente novamente The directory is not writable Pasta não escrevível - - Failed to retrieve the driver neede to handle the database - Erro ao recuperar driver necessário para administrar banco de dados - Failed to retrieve the database file Erro ao recuperar arquivo do banco de dados @@ -648,10 +890,6 @@ por favor reporte este problema Warning size parameter Parâmetro de aviso do tamanho - - An error accured while reading the gzipped file - Erro ao ler o arquivo gzip - Something failed while handling the file Algo deu errado ao manipular o arquivo @@ -660,14 +898,6 @@ por favor reporte este problema An error occured while working on the database Erro ao trabalhar no banco de dados - - An error occured while working on the database - -Aborting - Erro ao trabalhar no banco de dados - -Abortado - Duplicate file Arquivo duplicado @@ -704,6 +934,76 @@ Abortado Please free some resources, parse the files in different steps or split them into smaller units Por favor libere alguns recursos, analise os arquivos em diferentes etapas ou divida-os em unidades menores + + This database will be renamed with a trailing '.copy' and a new one will be created. +Continue? + Esse banco de dados terá o final renomado para '.copia' e se criará um novo. +¿Continuar? + + + An error occured while reading the file + Erro na leitura do arquivo + + + The entry will be renamed with a trailing '.copy' and a new one will be created. +Continue? + A entrada será renomeada '.copia' e se criará uma nova. +¿Continuar? + + + An error occured while reading the gzipped file + Erro ao ler o arquivo gzip + + + Invalid configuration lines + Linhas de configuração inválidas + + + Has not been possible to apply some of the configurations + Não foi possível aplicar algumas das configurações + + + If you choose to proceed, all of the unapplied configurations will be lost +Continue? + Se você optar por continuar, todas as configurações não aplicadas serão perdidas +Continuar? + + + Failed to retrieve the driver needed to handle the database + Falha ao recuperar o driver necessário para manipular o banco de dados + + + Failed updating hashes + Falha ao atualizar hashes + + + An error occured while inserting the parsed files hashes into the database + Ocorreu um erro ao inserir os hashes dos arquivos analisados no banco de dados + + + Data conversion failed + Falha na conversão de dados + + + Failed to convert from '%1' to '%2' + Falha ao converter de '%1' para '%2' + + + Failed to create statistics + Falha ao criar estatísticas + + + An error occured while processing + Ocorreu um erro durante o processamento + + + Cannot create statistics + Não é possível criar estatísticas + + + No data has been found that matches with the currently set parameters + Não foram encontrados dados que correspondam aos parâmetros definidos atualmente + GameDialog @@ -798,10 +1098,6 @@ Abortado Hour Hora - - Update the database with current Warning States - Atualize o banco de dados com os estados de aviso atuais - Log line marked as Warning Linha de registro marcada como Aviso @@ -1426,6 +1722,22 @@ Campos marcados como 'DISCARDED' analisados ​​corretamente, mas o Auto Auto + + Select the path through a dialog window + Selecione o caminho através de uma janela de diálogo + + + Show some info about LogDoctor + Mostrar algumas informações sobre o LogDoctor + + + Changelog + Registro de alterações + + + Show the changelog + Mostrar o registro de alterações + RichText @@ -1519,10 +1831,6 @@ Campos marcados como 'DISCARDED' analisados ​​corretamente, mas o Parsed Analizado - - Warnings - Avisos - Blacklisted Excluído diff --git a/logdoctor/utilities/arrays.h b/logdoctor/utilities/arrays.h new file mode 100644 index 00000000..52a08b03 --- /dev/null +++ b/logdoctor/utilities/arrays.h @@ -0,0 +1,142 @@ +#ifndef LOGDOCTOR__ARRAYOPS_H +#define LOGDOCTOR__ARRAYOPS_H + + +#include +#include + + +template +struct Zipperator +{ + using array_value = typename Array::value_type; + using array_iterator = typename Array::iterator; + + using iterator_category = std::forward_iterator_tag; + using difference_type = std::ptrdiff_t; + using value_type = std::tuple; + using pointer = std::tuple; + using reference = std::tuple; + + explicit Zipperator( array_iterator l, array_iterator r ) noexcept + : lit{l},rit{r} {} + + inline reference operator*() + { return std::tuple(*lit,*rit); } + + inline Zipperator& operator++() noexcept + { lit++; rit++; return *this; } + + friend bool operator!=( const Zipperator& lhs, const Zipperator& rhs ) noexcept + { return lhs.lit != rhs.lit and lhs.rit != rhs.rit; } + +private: + array_iterator lit; + array_iterator rit; +}; + + +template +struct Enumerator +{ + using array_size_t = typename Array::size_type; + using array_value = typename Array::value_type; + using array_iterator = typename Array::const_iterator; + + using iterator_category = std::forward_iterator_tag; + using difference_type = std::ptrdiff_t; + using value_type = std::tuple; + using pointer = std::tuple; + using reference = std::tuple; + + explicit Enumerator( array_iterator a ) noexcept + : idx{0},iter{a} {} + + inline reference operator*() + { return std::make_tuple(idx,*iter); } + + inline Enumerator& operator++() noexcept + { idx++; iter++; return *this; } + + friend bool operator!=( const Enumerator& lhs, const Enumerator& rhs ) noexcept + { return lhs.iter != rhs.iter; } + +private: + array_size_t idx; + array_iterator iter; +}; + + + +template +class ZippedArrays +{ + Array& larr; + Array& rarr; + +public: + explicit ZippedArrays( Array& l, Array& r ) + : larr{l},rarr{r} {} + + inline auto begin() noexcept + { return Zipperator(larr.begin(),rarr.begin()); } + + inline auto end() noexcept + { return Zipperator(larr.end(),rarr.end()); } +}; + + +template +class EnumeratdArray +{ + const Array& arr; + +public: + explicit EnumeratdArray( const Array& a ) + : arr{a} {} + + inline auto begin() noexcept + { return Enumerator(arr.cbegin()); } + + inline auto end() noexcept + { return Enumerator(arr.cend()); } +}; + + +//! ArrayOps +/*! + Utilities for the arrays +*/ +namespace ArrayOps +{ + +//! Zips two arrays +/*! + \param l_array The left-side array + \param r_array The right-side array + \return An iterator over the two arrays + \todo Replace with std::views::zip when clang will fully support it +*/ +template +inline auto zip( Array& l_array, Array& r_array ) +{ + return ZippedArrays( l_array, r_array ); +} + + +//! Enumerates an array +/*! + \param array The array + \return An iterator over the two array along with the index + \todo Replace with std::views::enumerate when clang will fully support it +*/ +template +inline auto enumerate( const Array& array ) +{ + return EnumeratdArray( array ); +} + +} // namespace ArrayOps + + +#endif // LOGDOCTOR__ARRAYOPS_H diff --git a/logdoctor/utilities/bwlists.h b/logdoctor/utilities/bwlists.h new file mode 100644 index 00000000..99d9077d --- /dev/null +++ b/logdoctor/utilities/bwlists.h @@ -0,0 +1,53 @@ +#ifndef LOGDOCTOR__UTILITIES__BWLISTS_H +#define LOGDOCTOR__UTILITIES__BWLISTS_H + + +#include + + +//! BWutils +/*! + Utilities for blacklists and warnlists + \see Blasklists, Warnlists +*/ +namespace BWutils +{ + +//! Returns a sanitized item which can be inserted in a list +/*! + This fuction doesn't check if the method is actually + a valid HTTP method, only whether the given string + is sintattically acceptable. + \throw BWlistException +*/ +std::string sanitizedMethod( const std::string& item ); + +//! Returns a sanitized item which can be inserted in a list +/*! + This function percent-encodes some of the characters + in the provided string: /#&?=+ + \throw BWlistException +*/ +std::string sanitizedUri( const std::string& item ); + +//! Returns a sanitized item which can be inserted in a list +/*! + This functions doesn't check it the client is actually + a valid IP address, only whether it is composed by the + proper set of characters (for an IPv4 or an IPv6) + \throw BWlistException +*/ +std::string sanitizedClient( const std::string& item ); + +//! Returns a sanitized item which can be inserted in a list +/*! + This function back-slashes every double-quotes in the + provided string + \throw BWlistException +*/ +std::string sanitizedUserAgent( std::string_view item ); + +} // namespace BWutils + + +#endif // LOGDOCTOR__UTILITIES__BWLISTS_H diff --git a/logdoctor/utilities/bwutils.cpp b/logdoctor/utilities/bwutils.cpp new file mode 100644 index 00000000..77a83739 --- /dev/null +++ b/logdoctor/utilities/bwutils.cpp @@ -0,0 +1,54 @@ + +#include "utilities/bwlists.h" + +#include "utilities/strings.h" + +#include "modules/exceptions.h" + +#include + + +namespace BWutils +{ + +std::string sanitizedMethod( const std::string& item ) +{ + const std::string sanitized_item{ StringOps::strip( item ) }; + if ( ! StringOps::isAlphabetic( sanitized_item ) ) { + // only letters allowed + throw BWlistException("Invalid Method"); + } + return StringOps::toUpper( sanitized_item ); +} + + +std::string sanitizedUri( const std::string& item ) +{ + const std::string sanitized_item{ StringOps::lstrip( item ) }; + if ( sanitized_item.empty() ) { + throw BWlistException("Invalid URI"); + } + return QUrl::toPercentEncoding( + QString::fromStdString( sanitized_item ), + "/#&?=+" + ).toStdString(); +} + + +std::string sanitizedClient( const std::string& item ) +{ + const std::string sanitized_item{ StringOps::strip( item ) }; + if ( ! StringOps::isIP( sanitized_item ) ) { + // only IPv4/IPv6 allowed + throw BWlistException("Invalid Client"); + } + return sanitized_item; +} + + +std::string sanitizedUserAgent( std::string_view item ) +{ + return StringOps::replace( item, R"(")", R"(\")" ); +} + +} // namespace BWutils diff --git a/logdoctor/utilities/chars.h b/logdoctor/utilities/chars.h new file mode 100644 index 00000000..5a468c52 --- /dev/null +++ b/logdoctor/utilities/chars.h @@ -0,0 +1,71 @@ +#ifndef LOGDOCTOR__UTILITIES__CHARS_H +#define LOGDOCTOR__UTILITIES__CHARS_H + + +//! CharOps +/*! + Utilities for chars +*/ +namespace CharOps +{ + +//! Checks whether a character is numeric +/*! + \param chr The target character + \return The result of the check +*/ +inline bool isNumeric( const char& chr ) noexcept +{ + return chr > 47 && chr < 58; // 0-9 +} + +//! Checks whether a character is alphabetic +/*! + \param chr The target character + \return The result of the check +*/ +inline bool isAlphabetic( const char& chr ) noexcept +{ + return (chr > 96 && chr < 123) // a-z + || (chr > 64 && chr < 91); // A-Z +} + +//! Checks whether a character is alphanumeric +/*! + \param chr The target character + \return The result of the check +*/ +inline bool isAlnum( const char& chr ) noexcept +{ + return isAlphabetic( chr ) + || isNumeric( chr ); +} + +//! Checks whether a character is hexadecimal +/*! + \param chr The target character + \return The result of the check +*/ +inline bool isHex( const char& chr ) noexcept +{ + return (chr > 47 && chr < 58) // 0-9 + || (chr > 64 && chr < 71) // A-F + || (chr > 96 && chr < 103); // a-f +} + +//! Checks whether a character can be part of an IPv4/IPv6 +/*! + \param chr The target character + \return The result of the check +*/ +inline bool isIP( const char& chr ) noexcept +{ + return chr == 46 // . + || chr == 58 // : + || isHex( chr ); +} + +} // namespace CharOps + + +#endif // LOGDOCTOR__UTILITIES__CHARS_H diff --git a/logdoctor/utilities/checks.cpp b/logdoctor/utilities/checks.cpp index c17fcf02..b72194d1 100644 --- a/logdoctor/utilities/checks.cpp +++ b/logdoctor/utilities/checks.cpp @@ -1,12 +1,14 @@ #include "checks.h" +#include "globals/db_names.h" + #include "modules/dialogs.h" +#include "modules/database/database.h" + #include "utilities/io.h" -#include -#include #include #include @@ -14,6 +16,9 @@ #include +struct MakeNewDatabase {}; + + namespace CheckSec { @@ -22,498 +27,404 @@ namespace /*private*/ //! Checks the tables' names integrity /*! - \param db Database object, already initialized - \param db_name Database's name, used by the dialogs if necessary - \return The result of the check: 0 if failed with an error, 1 if all the integrity checks passed, 2 if a rebuild is needed - \see checkCollectionDatabase(), checkHashesDatabase(), newCollectionDatabase(), newHashesDatabase() + \param query Query instance from the target database + \return Whether the database is valid or not + \throw VoidException + \throw MakeNewDatabase + \see checkCollectionDatabase(), checkHashesDatabase(), newCollectionDatabase(), newHashesDatabase() */ -int checkDatabaseTablesNames( QSqlDatabase& db, const QString& db_name ) +bool checkDatabaseTablesNames( QueryWrapper query ) { - bool make_new{false}, ok{true}; - QSqlQuery query{ QSqlQuery( db ) }; - if ( ! query.exec("SELECT name FROM sqlite_schema WHERE type = 'table';") ) { - // error querying database - ok &= false; - DialogSec::errDatabaseFailedExecuting( db_name, query.lastQuery(), query.lastError().text() ); - } else { - std::unordered_map tables_checks{ - {"apache", false}, - {"nginx", false}, - {"iis", false} }; - while ( query.next() ) { - QString table_name{ query.value(0).toString() }; - if ( tables_checks.find( table_name ) == tables_checks.end() ) { - // unexpected table name - if ( DialogSec::choiceDatabaseWrongTable( db_name, table_name ) ) { - // agreed to renew - make_new |= true; - } else { - // refused to renew - ok &= false; - } - break; + query( QStringLiteral("SELECT name FROM sqlite_schema WHERE type = 'table';") ); - } else { - // table found - tables_checks.at( table_name ) |= true; - } - } - if ( ok && !make_new ) { - for ( const auto& [ tbl, res ] : tables_checks ) { - if ( ! res ) { - // a table has not been found - if ( DialogSec::choiceDatabaseMissingTable( db_name, tbl ) ) { - // agreed to renew - make_new |= true; - } else { - // refused to renew - ok &= false; - } - break; - } - } - } - tables_checks.clear(); - } - query.finish(); - if ( ok ) { - if ( make_new ) { - return 2; + std::unordered_map checks{ + {"apache", false}, + {"nginx", false}, + {"iis", false} }; + + while ( query->next() ) { + + const QString table{ query[0].toString() }; + + if ( const auto tbl{ checks.find( table ) }; tbl != checks.end() ) { + tbl->second |= true; } else { - return 1; + // unexpected table name + if ( DialogSec::choiceDatabaseWrongTable( query.dbName(), table ) ) { + // agreed to renew + throw MakeNewDatabase{}; + } else { + // refused to renew + return false; + } } } - return 0; + + for ( const auto& [tbl,res] : checks ) { + if ( ! res ) { + // a table has not been found + if ( DialogSec::choiceDatabaseMissingTable( query.dbName(), tbl ) ) { + // agreed to renew + throw MakeNewDatabase{}; + } else { + // refused to renew + return false; + } + } + } + + return true; } //! Builds a new database for the logs Collection /*! - \param db Database object, already initialized - \param db_name Database's name, used by the dialogs if necessary - \return The result of the operation - \see checkCollectionDatabase(), checkHashesDatabase() + \param db Database object + \param db_path The database file's path + \param ws_names Database's tables names + \return The result of the operation + \see checkCollectionDatabase(), checkHashesDatabase() */ -bool newCollectionDatabase( QSqlDatabase& db, const QString& db_name, const std::vector& ws_names ) +bool newCollectionDatabase( DatabaseWrapper db, const std::string& db_path, const std::vector& ws_names ) noexcept { - bool successful{ true }; - // create the database - if ( ! db.open() ) { - // error opening database - successful &= false; - DialogSec::errDatabaseFailedOpening( db_name, db.lastError().text() ); + try { + + db.openNew( db_path ); - } else { // succesfully creted database file, now create the tables - QSqlQuery query; + const QString stmt{ QStringLiteral(R"( + CREATE TABLE "%1" ( + "year" SMALLINT, + "month" TINYINT, + "day" TINYINT, + "hour" TINYINT, + "minute" TINYINT, + "second" TINYINT, + "protocol" TEXT, + "method" TEXT, + "uri" TEXT, + "query" TEXT, + "response" SMALLINT, + "time_taken" INTEGER, + "bytes_sent" INTEGER, + "bytes_received" INTEGER, + "client" TEXT, + "user_agent" TEXT, + "cookie" TEXT, + "referrer" TEXT + );)")}; + for ( const QString& ws_name : ws_names ) { - if ( ! successful ) { break; } - // compose the statement with the table name for the access logs - query.prepare( "\ - CREATE TABLE \""+ws_name+"\" (\ - \"warning\" BOOLEAN,\ - \"year\" SMALLINT,\ - \"month\" TINYINT,\ - \"day\" TINYINT,\ - \"hour\" TINYINT,\ - \"minute\" TINYINT,\ - \"second\" TINYINT,\ - \"protocol\" TEXT,\ - \"method\" TEXT,\ - \"uri\" TEXT,\ - \"query\" TEXT,\ - \"response\" SMALLINT,\ - \"time_taken\" INTEGER,\ - \"bytes_sent\" INTEGER,\ - \"bytes_received\" INTEGER,\ - \"client\" TEXT,\ - \"user_agent\" TEXT,\ - \"cookie\" TEXT,\ - \"referrer\" TEXT\ - );"); - if ( ! query.exec() ) { + + QueryWrapper query{ db.getQuery() }; + + if ( ! query->exec( stmt.arg( ws_name ) ) ) { // error creating table - successful &= false; DialogSec::errDatabaseFailedExecuting( - QString( db_name ), - QString("CREATE TABLE \"%1\" (...)").arg( ws_name ), - QString( query.lastError().text() ) ); - + db.name(), + QStringLiteral(R"(CREATE TABLE "%1" (...))").arg( ws_name ), + query->lastError().text() ); + throw VoidException{}; } - query.finish(); } - // inform about creation - if ( successful ) { - DialogSec::msgDatabaseCreated( db_name ); - } else { - DialogSec::errDatabaseFailedCreating( db_name ); - } + } catch (...) { + DialogSec::errDatabaseFailedCreating( db.name() ); + return false; } - return successful; + + DialogSec::msgDatabaseCreated( db.name() ); + return checkCollectionDatabase( db_path ); } //! Builds a new database for the used log files' Hashes /*! - \param db Database object, already initialized - \param db_name Database's name, used by the dialogs if necessary - \return The result of the operation - \see checkCollectionDatabase(), checkHashesDatabase() + \param db Database object, already initialized + \param db_path The database file's path + \param ws_names Database's tables names + \return The result of the operation + \see checkCollectionDatabase(), checkHashesDatabase() */ -bool newHashesDatabase( QSqlDatabase& db, const QString& db_name, const std::vector& ws_names ) +bool newHashesDatabase( DatabaseWrapper db, const std::string& db_path, const std::vector& ws_names ) noexcept { - bool successful{ true }; - // create the database - if ( ! db.open() ) { - // error opening database - successful &= false; - DialogSec::errDatabaseFailedOpening( db_name, db.lastError().text() ); + try { + + db.openNew( db_path ); - } else { // succesfully creted database file, now create the tables - QSqlQuery query; + const QString stmt{ QStringLiteral(R"( + CREATE TABLE "%1" ( + "hash" TEXT + );)")}; + for ( const QString& ws_name : ws_names ) { - if ( ! successful ) { break; } - // compose the statement with the table name for the access logs - query.prepare( "\ - CREATE TABLE \""+ws_name+"\" (\ - \"hash\" TEXT\ - );"); - if ( ! query.exec() ) { + + QueryWrapper query{ db.getQuery() }; + + if ( ! query->exec( stmt.arg( ws_name ) ) ) { // error creating table - successful &= false; + DialogSec::errDatabaseFailedExecuting( - QString( db_name ), - QString("CREATE TABLE \"%1\" (...)").arg( ws_name ), - QString( query.lastError().text() ) ); - + db.name(), + QStringLiteral(R"(CREATE TABLE "%1" (...))").arg( ws_name ), + query->lastError().text() ); + throw VoidException{}; } - query.finish(); } - // inform about creation - if ( successful ) { - DialogSec::msgDatabaseCreated( db_name ); - } else { - DialogSec::errDatabaseFailedCreating( db_name ); - } + } catch (...) { + DialogSec::errDatabaseFailedCreating( db.name() ); + return false; } - return successful; + + DialogSec::msgDatabaseCreated( db.name() ); + return checkHashesDatabase( db_path ); } } // namespace (private) -bool checkCollectionDatabase( const std::string& db_path ) +bool checkCollectionDatabase( const std::string& db_path ) noexcept { - bool make_new{false}, ok{true}; - std::error_code err; - QString err_msg; - const QString db_name{ QString::fromStdString( db_path.substr( db_path.find_last_of( '/' ) + 1 ) ) }; const std::vector ws_names{ "apache", "nginx", "iis" }; - QSqlDatabase db; - if ( QSqlDatabase::contains("qt_sql_default_connection") ) { - db = QSqlDatabase::database("qt_sql_default_connection"); - } else { - db = QSqlDatabase::addDatabase("QSQLITE"); - } - db.setDatabaseName( QString::fromStdString( db_path ) ); + try { - // check the existence - if ( IOutils::exists( db_path ) ) { - // check file type and permissions - if ( ! checkDatabaseFile( db_path, db_name ) ) { - ok &= false; - - } else { - // database file seems ok, now try to open - if ( ! db.open() ) { - // error opening database - ok &= false; - DialogSec::errDatabaseFailedOpening( db_name, db.lastError().text() ); + DatabaseWrapper db{ DatabaseHandler::get( DatabaseType::Data ) }; + if ( ! IOutils::exists( db_path ) ) { + // ask to create a new one + if ( DialogSec::choiceDatabaseNotFound( db.name() ) ) { + // choosed to create it + throw MakeNewDatabase{}; } else { - // database successfully opened, now check the tables - const int check{ checkDatabaseTablesNames( db, db_name ) }; - if ( check == 0 ) { - ok &= false; - } else if ( check == 2 ) { - make_new |= true; + // refused to create it, abort + return false; + } + } + + // check file type and permissions + if ( ! checkDatabaseFile( db_path, db.name() ) ) { + return false; + } + + // file seems ok, try to open + db.open( db_path, true ); + + // check the tables + if ( ! checkDatabaseTablesNames( db.getQuery() ) ) { + return false; + } + + const QString stmt{ QStringLiteral("SELECT name, type FROM pragma_table_info('%1') AS tbinfo;") }; + + // check every WebServer table + for ( const QString& table : ws_names ) { + + bool has_warning_column{ false }; + // column's name:type associations + std::unordered_map> checks { + {"year", { "SMALLINT", false} }, + {"month", { "TINYINT", false} }, + {"day", { "TINYINT", false} }, + {"hour", { "TINYINT", false} }, + {"minute", { "TINYINT", false} }, + {"second", { "TINYINT", false} }, + {"protocol", { "TEXT", false} }, + {"method", { "TEXT", false} }, + {"uri", { "TEXT", false} }, + {"query", { "TEXT", false} }, + {"response", { "SMALLINT", false} }, + {"time_taken", { "INTEGER", false} }, + {"bytes_sent", { "INTEGER", false} }, + {"bytes_received", { "INTEGER", false} }, + {"client", { "TEXT", false} }, + {"user_agent", { "TEXT", false} }, + {"cookie", { "TEXT", false} }, + {"referrer", { "TEXT", false} } + }; + + QueryWrapper query{ db.getQuery() }; + + query( stmt.arg( table ) ); + + while ( query->next() ) { + const QString col_name{ query[0].toString() }; + const QString col_type{ query[1].toString() }; + + if ( col_name == "warning" ) { + // provide backward compatibility, this column will be removed from the table + has_warning_column |= true; + + } else if ( const auto it{ checks.find( col_name ) }; it != checks.end() ) { + // column found, check the data-type + auto& type{ it->second }; + if ( col_type == std::get<0>( type ) ) { + // same data-type + std::get<1>( type ) |= true; + } else { + // different data-type, ask to renew + if ( DialogSec::choiceDatabaseWrongDataType( db.name(), table, col_name, col_type ) ) { + // agreed to renew + throw MakeNewDatabase{}; + } else { + // refused to renew + return false; + } + } + + } else { + // unexpected column + if ( DialogSec::choiceDatabaseWrongColumn( db.name(), table, col_name ) ) { + // agreed to renew + throw MakeNewDatabase{}; + } else { + // refused to renew + return false; + } } - QSqlQuery query{ QSqlQuery( db ) }; - if ( ok && !make_new ) { + } - // check every WebServer table, both access and error - for ( const QString& table : ws_names ) { + if ( has_warning_column ) { + // provide backward compatibility + query->finish(); + query( QStringLiteral(R"(ALTER TABLE "%1" DROP COLUMN "warning";)").arg( table ) ); + } - if ( !ok || make_new ) { break; } - // column's name:type associations - std::unordered_map> - data_types { - {"warning", { "BOOLEAN", false} }, - {"year", { "SMALLINT", false} }, - {"month", { "TINYINT", false} }, - {"day", { "TINYINT", false} }, - {"hour", { "TINYINT", false} }, - {"minute", { "TINYINT", false} }, - {"second", { "TINYINT", false} }, - {"protocol", { "TEXT", false} }, - {"method", { "TEXT", false} }, - {"uri", { "TEXT", false} }, - {"query", { "TEXT", false} }, - {"response", { "SMALLINT", false} }, - {"time_taken", { "INTEGER", false} }, - {"bytes_sent", { "INTEGER", false} }, - {"bytes_received", { "INTEGER", false} }, - {"client", { "TEXT", false} }, - {"user_agent", { "TEXT", false} }, - {"cookie", { "TEXT", false} }, - {"referrer", { "TEXT", false} } - }; - - // query table's columns' infoes for access logs - if ( ! query.exec( "SELECT name, type FROM pragma_table_info('"+table+"') AS tbinfo;" ) ) { - // error opening database - ok &= false; - DialogSec::errDatabaseFailedExecuting( db_name, query.lastQuery(), query.lastError().text() ); - } - // iterate over results - while ( query.next() ) { - const QString col_name{ query.value(0).toString() }; - const QString col_type{ query.value(1).toString() }; - if ( data_types.find( col_name ) == data_types.end() ) { - // unexpected column - if ( DialogSec::choiceDatabaseWrongColumn( db_name, table, col_name ) ) { - // agreed to renew - make_new |= true; - } else { - // refused to renew - ok &= false; - } - break; - - } else { - // column found, check the data-type - const QString data_type{ std::get<0>( data_types.at( col_name ) ) }; - if ( col_type == data_type ) { - // same data-type - data_types.at( col_name ) = std::tuple( data_type, true ); - } else { - // different data-type, ask to renew - if ( DialogSec::choiceDatabaseWrongDataType( db_name, table, col_name, col_type ) ) { - // agreed to renew - make_new |= true; - } else { - // refused to renew - ok &= false; - } - break; - } - } - } - if ( ok && !make_new ) { - for ( const auto& [ col, tup ] : data_types ) { - if ( ! std::get<1>( tup ) ) { - // a table has not been found - if ( DialogSec::choiceDatabaseMissingColumn( db_name, table, col ) ) { - // agreed to renew - make_new |= true; - } else { - // refused to renew - ok &= false; - } - break; - } - } - } - - query.finish(); - if ( !ok || make_new ) { break; } + for ( const auto& [col,type] : checks ) { + if ( ! std::get<1>( type ) ) { + // a column has not been found + if ( DialogSec::choiceDatabaseMissingColumn( db.name(), table, col ) ) { + // agreed to renew + throw MakeNewDatabase{}; + } else { + // refused to renew + return false; } } } } - } else { - // database does not exist, yet, ask to create a new one - if ( DialogSec::choiceDatabaseNotFound( QString(db_name) ) ) { - // choosed to create it - make_new |= true; + } catch (const MakeNewDatabase&) { - } else { - // refused to create it, abort - ok &= false; - } - } - - if ( ok && make_new ) { - // rename the current db file as a 'copy' if ( IOutils::exists( db_path ) ) { // a database already exists, try rename it + std::error_code err; if ( ! IOutils::renameAsCopy( db_path, err ) ) { // failed to rename - ok &= false; + QString err_msg; if ( err ) { err_msg = QString::fromStdString( err.message() ); } DialogSec::errRenaming( QString::fromStdString(db_path), err_msg ); - }/* else { - // renamed successfully, make new one - }*/ - } - if ( ok ) { - ok = newCollectionDatabase( db, db_name, ws_names ); + return false; + } } + return newCollectionDatabase( DatabaseHandler::get( DatabaseType::Data ), db_path, ws_names ); + + } catch (const VoidException&) { + return false; } - if ( db.isOpen() ) { - db.close(); - } - return ok; + return true; } -bool checkHashesDatabase( const std::string& db_path ) +bool checkHashesDatabase( const std::string& db_path ) noexcept { - bool make_new{false}, ok{true}; - std::error_code err; - QString err_msg; - const QString db_name{ QString::fromStdString( db_path.substr( db_path.find_last_of( '/' ) + 1 ) ) }; const std::vector ws_names { "apache", "nginx", "iis" }; - QSqlDatabase db; - if ( QSqlDatabase::contains("qt_sql_default_connection") ) { - db = QSqlDatabase::database("qt_sql_default_connection"); - } else { - db = QSqlDatabase::addDatabase("QSQLITE"); - } - db.setDatabaseName( QString::fromStdString( db_path ) ); + try { - // check the existence - if ( IOutils::exists( db_path ) ) { - // check file type and permissions - if ( ! checkDatabaseFile( db_path, db_name ) ) { - ok &= false; - - } else { - // database file seems ok, now try to open - if ( ! db.open() ) { - // error opening database - ok &= false; - DialogSec::errDatabaseFailedOpening( db_name, db.lastError().text() ); + DatabaseWrapper db{ DatabaseHandler::get( DatabaseType::Hashes ) }; + if ( ! IOutils::exists( db_path ) ) { + // database does not exist, yet, ask to create a new one + if ( DialogSec::choiceDatabaseNotFound( db.name() ) ) { + // choosed to create it + throw MakeNewDatabase{}; } else { - // database successfully opened, now check the tables - const int check = checkDatabaseTablesNames( db, db_name ); - if ( check == 0 ) { - ok &= false; - } else if ( check == 2 ) { - make_new |= true; - } - QSqlQuery query{ QSqlQuery( db ) }; - if ( ok && !make_new ) { + // refused to create it, abort + return false; + } + } - // check every WebServer table, both access and error - for ( const QString& table : ws_names ) { + // check file type and permissions + if ( ! checkDatabaseFile( db_path, db.name() ) ) { + return false; + } - if ( !ok || make_new ) { break; } - // column's name:type associations - bool name_ok{ false }, - type_ok{ false }; + // file seems ok, try to open + db.open( db_path, true ); - // query table's columns' infoes for access logs - if ( ! query.exec( "SELECT name, type FROM pragma_table_info('"+table+"') AS tbinfo;" ) ) { - // error opening database - ok &= false; - DialogSec::errDatabaseFailedExecuting( db_name, query.lastQuery(), query.lastError().text() ); - } - // iterate over results - while ( query.next() ) { - const QString col_name{ query.value(0).toString() }; - const QString col_type{ query.value(1).toString() }; - if ( col_name != "hash" ) { - // unexpected column - if ( DialogSec::choiceDatabaseWrongColumn( db_name, table, col_name ) ) { - // agreed to renew - make_new |= true; - } else { - // refused to renew - ok &= false; - } - break; + // check the tables + if ( ! checkDatabaseTablesNames( db.getQuery() ) ) { + return false; + } - } else { - // column found, check the data-type - name_ok |= true; - if ( col_type == "TEXT" ) { - // same data-type - type_ok |= true; - } else { - // different data-type, ask to renew - if ( DialogSec::choiceDatabaseWrongDataType( db_name, table, col_name, col_type ) ) { - // agreed to renew - make_new |= true; - } else { - // refused to renew - ok &= false; - } - break; - } - } - } - if ( ok && !make_new ) { - if ( !name_ok || !type_ok ) { - ok &= false; - } - } - query.finish(); + const QString stmt{ QStringLiteral("SELECT name, type FROM pragma_table_info('%1') AS tbinfo;") }; + + // check every WebServer table, both access and error + for ( const QString& table : ws_names ) { + + QueryWrapper query{ db.getQuery() }; + + query( stmt.arg( table ) ); + + while ( query->next() ) { + const QString col_name{ query[0].toString() }; + const QString col_type{ query[1].toString() }; + + if ( col_name != "hash" ) { + // unexpected column + if ( DialogSec::choiceDatabaseWrongColumn( db.name(), table, col_name ) ) { + // agreed to renew + throw MakeNewDatabase{}; + } else { + // refused to renew + return false; + } + + } else if ( col_type != "TEXT" ) { + // different data-type, ask to renew + if ( DialogSec::choiceDatabaseWrongDataType( db.name(), table, col_name, col_type ) ) { + // agreed to renew + throw MakeNewDatabase{}; + } else { + // refused to renew + return false; } } } } - } else { - // database does not exist, yet, ask to create a new one - if ( DialogSec::choiceDatabaseNotFound( QString(db_name) ) ) { - // choosed to create it - make_new |= true; + } catch (const MakeNewDatabase&) { - } else { - // refused to create it, abort - ok &= false; - } - } - - if ( ok && make_new ) { - // rename the current db file as a 'copy' if ( IOutils::exists( db_path ) ) { // a database already exists, try rename it + std::error_code err; if ( ! IOutils::renameAsCopy( db_path, err ) ) { // failed to rename - ok &= false; + QString err_msg; if ( err ) { err_msg = QString::fromStdString( err.message() ); } DialogSec::errRenaming( QString::fromStdString(db_path), err_msg ); - }/* else { - // renamed successfully, make new one - }*/ - } - if ( ok ) { - ok = newHashesDatabase( db, db_name, ws_names ); + return false; + } } + return newHashesDatabase( DatabaseHandler::get( DatabaseType::Hashes ), db_path, ws_names ); + + } catch (const VoidException&) { + return false; } - if ( db.isOpen() ) { - db.close(); - } - return ok; + return true; } -bool checkDatabaseFile( const std::string& db_path, const QString& db_name ) +bool checkDatabaseFile( const std::string& db_path, const QString& db_name ) noexcept { if ( ! IOutils::exists( db_path ) ) { // path doesn't exists diff --git a/logdoctor/utilities/checks.h b/logdoctor/utilities/checks.h index 72e8d08b..c91dc656 100644 --- a/logdoctor/utilities/checks.h +++ b/logdoctor/utilities/checks.h @@ -14,14 +14,14 @@ class QString; namespace CheckSec { -//! Checks the database file +//! Basic checks on a database file /*! \param db_path Path of the database file \param db_name Database's name, used by the dialogs if necessary \return The result of the check \see IOutils::exists(), IOutils::isFile(), IOutils::checkFile() */ -bool checkDatabaseFile( const std::string& db_path, const QString& db_name ); +bool checkDatabaseFile( const std::string& db_path, const QString& db_name ) noexcept; //! Checks the structure's integrity of the Collection database /*! @@ -29,7 +29,7 @@ bool checkDatabaseFile( const std::string& db_path, const QString& db_name ); \return The result of the check \see checkDatabaseTablesNames(), newCollectionDatabase(), newHashesDatabase() */ -bool checkCollectionDatabase( const std::string& db_path ); +bool checkCollectionDatabase( const std::string& db_path ) noexcept; //! Checks the structure's integrity of the Hashes database /*! @@ -37,7 +37,7 @@ bool checkCollectionDatabase( const std::string& db_path ); \return The result of the check \see checkDatabaseTablesNames(), newCollectionDatabase(), newHashesDatabase() */ -bool checkHashesDatabase( const std::string& db_path ); +bool checkHashesDatabase( const std::string& db_path ) noexcept; } // namespace CheckSec diff --git a/logdoctor/utilities/colors.cpp b/logdoctor/utilities/colors.cpp index 33108eeb..78c23e05 100644 --- a/logdoctor/utilities/colors.cpp +++ b/logdoctor/utilities/colors.cpp @@ -14,7 +14,7 @@ namespace ColorSec { -std::unordered_map getColors() +std::unordered_map getColors() noexcept { return { // greyscale @@ -31,49 +31,53 @@ std::unordered_map getColors() } -std::unordered_map> getColorSchemes() +std::unordered_map> getColorSchemes() noexcept { return { - // none - {0,{{"background",""}, - {"text",""}, - {"x",""}, - {"ip",""}, - {"byte",""}, - {"time",""}, - {"ua",""}, - {"req",""}, - {"res",""} }}, - // breeze - {1,{{"background","#ffffff"}, - {"text","#9c9c9b"}, - {"x","#1f1c1b"}, - {"ip","#644a9b"}, - {"byte","#d5bc79"}, - {"time","#d685d6"}, - {"ua","#006e28"}, - {"req","#54b8ff"}, - {"res","#d24f4f"} }}, - // monokai - {2,{{"background","#272822"}, - {"text","#706c5a"}, - {"x","#a6a6a0"}, - {"ip","#57adbc"}, - {"byte","#c1b864"}, - {"time","#9773db"}, - {"ua","#a6e22e"}, - {"req","#d1d1cb"}, - {"res","#f92672"} }}, - // radical - {3,{{"background","#141322"}, - {"text","#749295"}, - {"x","#7c9c9e"}, - {"ip","#fda8bc"}, - {"byte","#ff85a1"}, - {"time","#a8c0c2"}, - {"ua","#42a784"}, - {"req","#d5358f"}, - {"res","#56e8e4"} }} + {ColorsScheme::None,{ + {"background", ""}, + {"text", ""}, + {"x", ""}, + {"ip", ""}, + {"byte", ""}, + {"time", ""}, + {"ua", ""}, + {"req", ""}, + {"res", ""}} + }, + {ColorsScheme::Breeze,{ + {"background", "#ffffff"}, + {"text", "#9c9c9b"}, + {"x", "#1f1c1b"}, + {"ip", "#644a9b"}, + {"byte", "#d5bc79"}, + {"time", "#d685d6"}, + {"ua", "#006e28"}, + {"req", "#54b8ff"}, + {"res", "#d24f4f"}} + }, + {ColorsScheme::Monokai,{ + {"background", "#272822"}, + {"text", "#706c5a"}, + {"x", "#a6a6a0"}, + {"ip", "#57adbc"}, + {"byte", "#c1b864"}, + {"time", "#9773db"}, + {"ua", "#a6e22e"}, + {"req", "#d1d1cb"}, + {"res", "#f92672"}} + }, + {ColorsScheme::Radical,{ + {"background", "#141322"}, + {"text", "#749295"}, + {"x", "#7c9c9e"}, + {"ip", "#fda8bc"}, + {"byte", "#ff85a1"}, + {"time", "#a8c0c2"}, + {"ua", "#42a784"}, + {"req", "#d5358f"}, + {"res", "#56e8e4"}} + } }; } @@ -102,7 +106,7 @@ void applyChartTheme( const std::unordered_map& fonts, QChar break; default: // shouldn't be here - throw GenericException( "Unexpeced ChartsTheme ID: "+std::to_string(static_cast(GlobalConfigs::charts_theme)), true ); + throw DoNotCatchException( "Unexpeced ChartsTheme", std::to_string(static_cast(GlobalConfigs::charts_theme)) ); break; } axis_pen.setWidthF( 1.1 ); diff --git a/logdoctor/utilities/colors.h b/logdoctor/utilities/colors.h index 6e987be7..88f9c8b0 100644 --- a/logdoctor/utilities/colors.h +++ b/logdoctor/utilities/colors.h @@ -10,6 +10,8 @@ class QString; class QColor; class QFont; +enum class ColorsScheme : unsigned char; + //! ColorSec /*! @@ -19,15 +21,16 @@ namespace ColorSec { //! Provides a map with pre-made colors -std::unordered_map getColors(); +std::unordered_map getColors() noexcept; //! Provides a map with pre-made color-schemes for the TextBrowser -std::unordered_map> getColorSchemes(); +std::unordered_map> getColorSchemes() noexcept; //! Applies the choosen theme to the given chart /*! - \param fonts The fonts set - \param chart_view The chart on which the theme will be applied + \param fonts The fonts set + \param chart_view The chart on which the theme will be applied + \throw DoNotCatchException */ void applyChartTheme( const std::unordered_map& fonts, QChartView* chart_view ); diff --git a/logdoctor/utilities/gzip.cpp b/logdoctor/utilities/gzip.cpp index 3d15eb89..a59c3196 100644 --- a/logdoctor/utilities/gzip.cpp +++ b/logdoctor/utilities/gzip.cpp @@ -24,6 +24,57 @@ #define CHUNK 16384 +//! RAII class to handle s file resource +class FileHandler final +{ + FILE* file; + +public: + explicit FileHandler( const char* path, const char* mode ) + : file{ nullptr } + { + #ifdef _MSC_VER + fopen_s( &this->file, path, mode ); + #else + this->file = fopen( path, mode ); + #endif + } + + ~FileHandler() + { + if ( this->valid() ) { + fclose( this->file ); + } + } + + Q_DISABLE_COPY_MOVE(FileHandler) + + inline operator FILE*() + { + return this->file; + } + + inline bool valid() const noexcept + { + return this->file != NULL; + } + + inline bool error() const noexcept + { + return ferror( this->file ); + } + + inline void close() + { + if ( fclose( this->file ) ) { + throw GenericException( "Failed to close file pointer" ); + } + this->file = nullptr; + } +}; + + + namespace GZutils { @@ -49,24 +100,16 @@ void readFile( const std::string& path, std::string& content ) } if ( successful ) { -#ifdef _MSC_VER - FILE* file; - const int err{ fopen_s( &file, path.c_str(), "rb" ) }; - /*FILE *dest = fopen ( out_path.c_str(), "wb" );*/ - if ( file == NULL || err != 0 ) { -#else - FILE* file = fopen( path.c_str(), "rb" ); - /*FILE *dest = fopen( out_path.c_str(), "wb" );*/ - if ( file == NULL ) { -#endif + FileHandler file{ path.c_str(), "rb" }; + if ( ! file.valid() ) { // unable to open the file - //throw("cannot read"); return; } + /*FILE *dest = fopen( out_path.c_str(), "wb" );*/ // decompress until deflate stream ends or end of file is reached do { strm.avail_in = static_cast(fread( in, 1, CHUNK, file )); - if ( ferror( file ) ) { + if ( file.error() ) { // error reading (void)inflateEnd( &strm ); /*successful = false;*/ @@ -98,7 +141,7 @@ void readFile( const std::string& path, std::string& content ) successful = false; break; }*/ - for ( unsigned i{0u}; i +//! RAII class to handle a file stream resource +template +class FileHandler final +{ + Stream file; + +public: + explicit FileHandler( const std::string& path ) + : file{ path } + { + if ( ! this->file.is_open() ) { + throw std::ios_base::failure( "file is not open" ); + } + if ( ! this->file.good() ) { + throw std::ios_base::failure( "file is not good" ); + } + } + + ~FileHandler() + { + if ( this->file.is_open() ) { + this->file.close(); + } + } + + Q_DISABLE_COPY_MOVE(FileHandler) + + inline Stream& operator*() + { + return this->file; + } + + inline void setException( const std::ios_base::iostate e ) + { + this->file.exceptions( e ); + } +}; + + + namespace IOutils { -bool exists( std::string_view path ) -{ - if ( path.empty() ) { - return false; - } - return std::filesystem::exists( path ); -} - - -bool isFile( std::string_view path ) -{ - if ( exists( path ) ) { - return std::filesystem::is_regular_file( path ); - } - return false; -} - -bool checkFile( std::string_view path, const bool readable, const bool writable ) +bool checkFile( std::string_view path, const bool readable, const bool writable ) noexcept { if ( isFile( path ) ) { // check the needed permissions @@ -51,15 +74,7 @@ bool checkFile( std::string_view path, const bool readable, const bool writable } -bool isDir( std::string_view path ) -{ - if ( exists( path )) { - return std::filesystem::is_directory( path ); - } - return false; -} - -bool checkDir( std::string_view path, const bool readable, const bool writable ) +bool checkDir( std::string_view path, const bool readable, const bool writable ) noexcept { if ( isDir( path ) ) { // check the needed permissions @@ -80,7 +95,7 @@ bool checkDir( std::string_view path, const bool readable, const bool writable ) } -bool makeDir( std::string_view path, std::error_code& err ) noexcept(true) +bool makeDir( std::string_view path, std::error_code& err ) noexcept { try { const bool failed{ !std::filesystem::create_directories( path, err ) }; @@ -95,7 +110,7 @@ bool makeDir( std::string_view path, std::error_code& err ) noexcept(true) // rename an entry with a trailing '.copy' -bool renameAsCopy( std::string_view path, std::error_code& err ) noexcept(true) +bool renameAsCopy( std::string_view path, std::error_code& err ) noexcept { try { std::string new_path{ path }; @@ -121,39 +136,22 @@ bool renameAsCopy( std::string_view path, std::error_code& err ) noexcept(true) void readFile( const std::string& path, std::string& content ) { // read the whole file - std::ifstream file; try { - /*constexpr std::size_t read_size = std::size_t(4096);*/ - file = std::ifstream(path); - if ( ! file.is_open() ) { - throw std::ios_base::failure( "file is not open" ); - } - if ( ! file.good() ) { - throw std::ios_base::failure( "file is not good" ); - } + FileHandler file{ path }; // throws std::ios_base::failure on failure // add bit exceptions - file.exceptions( std::ifstream::failbit ); - file.exceptions( std::ios_base::badbit ); + file.setException( std::ifstream::failbit ); + file.setException( std::ios_base::badbit ); // read the whole file content = std::string( - std::istreambuf_iterator( file ), + std::istreambuf_iterator( *file ), std::istreambuf_iterator() ); } catch ( const std::ios_base::failure& ) { // failed reading - if ( file.is_open() ) { - file.close(); - } throw; } catch (...) { - if ( file.is_open() ) { - file.close(); - } throw std::exception(); // already catched } - if ( file.is_open() ) { - file.close(); - } } @@ -195,7 +193,7 @@ void randomLines( const std::string& path, std::vector& lines, cons srand( (unsigned)time(&nTime) ); size_t index; std::vector picked_indexes; - for( size_t i=0ul; i(rand()) % max; if ( VecOps::contains( picked_indexes, index ) ) { @@ -205,7 +203,7 @@ void randomLines( const std::string& path, std::vector& lines, cons } const std::string& line{ aux_lines.at( index ) }; if ( StringOps::startsWith( line, '#' ) ) { // leave the "#" check for IIS logs - i--; + -- i; continue; } lines.push_back( line ); @@ -227,12 +225,12 @@ void randomLines( const std::string& path, std::vector& lines, cons } catch ( const GenericException& ) { // failed closing gzip file pointer lines.clear(); - throw GenericException( "An error accured while reading the gzipped file" ); + throw GenericException( "An error occured while reading the gzipped file" ); } catch ( const std::ios_base::failure& ) { // failed reading lines.clear(); - throw GenericException( "An error accured while reading the file" ); + throw GenericException( "An error occured while reading the file" ); } catch (...) { lines.clear(); @@ -243,37 +241,20 @@ void randomLines( const std::string& path, std::vector& lines, cons void writeOnFile( const std::string& path, std::string_view content ) { - std::ofstream file; try { - file.open( path ); - if ( ! file.is_open() ) { - throw std::ios_base::failure( "file is not open" ); - } - if ( ! file.good() ) { - throw std::ios_base::failure( "file is not good" ); - } + FileHandler file{ path }; // throws std::ios_base::failure on failure // add bit exceptions - file.exceptions( std::ifstream::failbit ); - file.exceptions( std::ios_base::badbit ); + file.setException( std::ios_base::failbit ); + file.setException( std::ios_base::badbit ); // write the content - file << content << std::endl; + *file << content << std::endl; } catch ( const std::ios_base::failure& ) { // failed writing - if ( file.is_open() ) { - file.close(); - } throw; } catch (...) { - if ( file.is_open() ) { - file.close(); - } throw std::exception(); // already catched } - - if ( file.is_open() ) { - file.close(); - } } } // namespace IOUtils diff --git a/logdoctor/utilities/io.h b/logdoctor/utilities/io.h index d83aa669..28307b4a 100644 --- a/logdoctor/utilities/io.h +++ b/logdoctor/utilities/io.h @@ -19,21 +19,36 @@ namespace IOutils \param path The path of the entry \return The result of the check */ -bool exists( std::string_view path ); +inline bool exists( std::string_view path ) noexcept +{ + return path.empty() + ? false + : std::filesystem::exists( path ); +} //! Checks if a path exists and points to a file /*! \param path The path of the entry \return The result of the check */ -bool isFile( std::string_view path ); +inline bool isFile( std::string_view path ) noexcept +{ + return exists( path ) + ? std::filesystem::is_regular_file( path ) + : false; +} //! Checks if a path exists and points to a directory /*! \param path The path of the entry \return The result of the checks */ -bool isDir( std::string_view path ); +inline bool isDir( std::string_view path ) noexcept +{ + return exists( path ) + ? std::filesystem::is_directory( path ) + : false; +} //! Checks if a path exists, if it points to a file and if the user has read and/or write permissions on it /*! @@ -42,7 +57,7 @@ bool isDir( std::string_view path ); \param writable Set to true to check for writability \return The result of the checks */ -bool checkFile( std::string_view path, const bool readable=false, const bool writable=false ); +bool checkFile( std::string_view path, const bool readable=false, const bool writable=false ) noexcept; //! Checks if a path exists, if it points to a folder and if the user has read and/or write permissions on it /*! @@ -51,14 +66,14 @@ bool checkFile( std::string_view path, const bool readable=false, const bool wri \param writable Set to true to check for writability \return The result of the checks */ -bool checkDir( std::string_view path, const bool readable=false, const bool writable=false ); +bool checkDir( std::string_view path, const bool readable=false, const bool writable=false ) noexcept; //! Creates a directory /*! \param path The path of the new entry \return Wheter the operation was successful or not */ -bool makeDir( std::string_view path, std::error_code& err ) noexcept(true); +bool makeDir( std::string_view path, std::error_code& err ) noexcept; //! Renames an entry with a trailing '.copy' /*! @@ -66,7 +81,7 @@ bool makeDir( std::string_view path, std::error_code& err ) noexcept(true); \param err Will hold the error, if any \return Wheter the operation was successful or not */ -bool renameAsCopy( std::string_view path, std::error_code& err ) noexcept(true); +bool renameAsCopy( std::string_view path, std::error_code& err ) noexcept; //! Randomly pick lines from a file /*! diff --git a/logdoctor/utilities/memory.cpp b/logdoctor/utilities/memory.cpp index f627f0f4..20cd4b74 100644 --- a/logdoctor/utilities/memory.cpp +++ b/logdoctor/utilities/memory.cpp @@ -31,10 +31,10 @@ size_t availableMemory() { mach_msg_type_number_t count{ HOST_VM_INFO_COUNT }; vm_statistics_data_t vmstat; if ( host_statistics( mach_host_self(), HOST_VM_INFO, (host_info_t)&vmstat, &count ) != KERN_SUCCESS ) { - throw GenericException("Failed to get host infos", true); + throw DoNotCatchException("Failed to get host infos", "failed"); } - natural_t n_pages{ vmstat.free_count }; - long page_size{ sysconf( _SC_PAGE_SIZE ) }; + const natural_t n_pages{ vmstat.free_count }; + const long page_size{ sysconf( _SC_PAGE_SIZE ) }; if ( n_pages < 0u || page_size < 0l ) { return 0ul; } @@ -45,15 +45,15 @@ size_t availableMemory() { size_t vmt_size{ sizeof(vmt) }; size_t uint_size{ sizeof(page_size) }; if ( sysctlbyname("vm.vmtotal", &vmt, &vmt_size, NULL, 0) < 0 ) { - throw GenericException("Failed to get vmtotal", true); + throw DoNotCatchException("Failed to get vmtotal"); } if ( sysctlbyname("vm.stats.vm.v_page_size", &page_size, &uint_size, NULL, 0) < 0 ) { - throw GenericException("Failed to get v_page_size", true); + throw DoNotCatchException("Failed to get v_page_size"); } return vmt.t_free * static_cast( page_size ); #elif defined( Q_OS_UNIX ) - long n_pages{ sysconf( _SC_AVPHYS_PAGES ) }; - long page_size{ sysconf( _SC_PAGE_SIZE ) }; + const long n_pages{ sysconf( _SC_AVPHYS_PAGES ) }; + const long page_size{ sysconf( _SC_PAGE_SIZE ) }; if ( n_pages < 0l || page_size < 0l ) { return 0ul; } diff --git a/logdoctor/utilities/memory.h b/logdoctor/utilities/memory.h index 082c6c63..f50e7fd7 100644 --- a/logdoctor/utilities/memory.h +++ b/logdoctor/utilities/memory.h @@ -14,6 +14,7 @@ namespace{ using size_t = unsigned long; } //! Returns the available (free) memory in the system /*! \return The amount of memory in Bytes + \throw DoNotCatchException */ size_t availableMemory(); diff --git a/logdoctor/utilities/printables.cpp b/logdoctor/utilities/printables.cpp index 25c814b1..570a2df4 100644 --- a/logdoctor/utilities/printables.cpp +++ b/logdoctor/utilities/printables.cpp @@ -9,7 +9,7 @@ namespace PrintSec { -QString printableSize( const size_t bytes ) +QString printableSize( const size_t bytes ) noexcept { std::string size_sfx{" B"}; double size{ static_cast(bytes) }; @@ -29,12 +29,12 @@ QString printableSize( const size_t bytes ) } size_t n_decimals{ 3ul }; if ( size >= 100.0 ) { - n_decimals --; + -- n_decimals; if ( size >= 1000.0 ) { - n_decimals --; + -- n_decimals; if ( size >= 10000.0 ) { - n_decimals --; - cut_index --; // no decimals, no "dot" + -- n_decimals; + -- cut_index; // no decimals, no "dot" } } } @@ -48,7 +48,7 @@ QString printableSize( const size_t bytes ) } -QString printableSpeed( const double bytes, const double secs_ ) +QString printableSpeed( const double bytes, const double secs_ ) noexcept { std::string speed_sfx{" B/s"}; const double secs{ ( secs_ > 0.0 ) ? secs_ : ( secs_ < 0.0 ) ? -secs_ : 0.1 }; @@ -69,12 +69,12 @@ QString printableSpeed( const double bytes, const double secs_ ) } size_t n_decimals{ 3ul }; if ( speed >= 100.0 ) { - n_decimals --; + -- n_decimals; if ( speed >= 1000.0 ) { - n_decimals --; + -- n_decimals; if ( speed >= 10000.0 ) { - n_decimals --; - cut_index --; // no decimals, no "dot" + -- n_decimals; + -- cut_index; // no decimals, no "dot" } } } @@ -88,72 +88,48 @@ QString printableSpeed( const double bytes, const double secs_ ) } -QString printableTime( const unsigned seconds ) +QString printableTime( const unsigned seconds ) noexcept { const unsigned mins{ seconds / 60u }; const unsigned secs{ seconds - (mins*60u) }; - return QString("%1:%2").arg( - (mins<10u) - ? QString("0%1").arg( mins ) - : QString::number( mins ), - (secs<10u) - ? QString("0%1").arg( secs ) - : QString::number( secs ) - ); + return QStringLiteral("%1:%2") + .arg( mins, 2, 10, QChar('0') ) + .arg( secs, 2, 10, QChar('0') ); } -QString printableTime( const int hour, const int minute, const int second ) +QString printableTime( const int hour, const int minute, const int second ) noexcept { - return QString("%1:%2:%3").arg( - (hour<10) - ? QString("0%1").arg( hour ) - : QString::number( hour ), - (minute<10) - ? QString("0%1").arg( minute ) - : QString::number( minute ), - (second<10) - ? QString("0%1").arg( second ) - : QString::number( second ) - ); + return QStringLiteral("%1:%2:%3") + .arg( hour, 2, 10, QChar('0') ) + .arg( minute, 2, 10, QChar('0') ) + .arg( second, 2, 10, QChar('0') ); } -QString printableDate( const QString& year, const int month, const QString& day ) +QString printableDate( const QString& year, const int month, const QString& day ) noexcept { - return QString("%1-%2-%3").arg( - year, - (month<10) - ? QString("0%1").arg( month ) - : QString::number( month ), - (day.size()<2) - ? QString("0%1").arg( day ) - : day - ); + return QStringLiteral("%1-%2-%3") + .arg( year ) + .arg( month, 2, 10, QChar('0') ) + .arg( day, 2, QChar('0') ); } -QString printableDate( const int year, const int month, const int day ) +QString printableDate( const int year, const int month, const int day ) noexcept { - return QString("%1-%2-%3").arg( - QString::number( year ), - (month<10) - ? QString("0%1").arg( month ) - : QString::number( month ), - (day<10) - ? QString("0%1").arg( day ) - : QString::number( day ) - ); + return QStringLiteral("%1-%2-%3") + .arg( year ) + .arg( month, 2, 10, QChar('0') ) + .arg( day, 2, 10, QChar('0') ); } -QString printableBool( const int value ) +QString printableBool( const int value ) noexcept { - if ( value == 0 ) { - return TR::tr( BOOLS__FALSE.c_str() ); - } else { - return TR::tr( BOOLS__TRUE.c_str() ); - } + return value == 0 + ? TR::tr( BOOLS__FALSE.c_str() ) + : TR::tr( BOOLS__TRUE.c_str() ); } } // namespace PrintSec diff --git a/logdoctor/utilities/printables.h b/logdoctor/utilities/printables.h index ac99b84d..81dd574e 100644 --- a/logdoctor/utilities/printables.h +++ b/logdoctor/utilities/printables.h @@ -21,7 +21,7 @@ namespace PrintSec */ QString printableSize( const size_t bytes -); +) noexcept; //! Formats the speed including the suffix, for display purposes @@ -32,7 +32,7 @@ QString printableSize( */ QString printableSpeed( const double bytes, const double seconds -); +) noexcept; //! Formats the time, for display purposes @@ -42,7 +42,7 @@ QString printableSpeed( */ QString printableTime( const unsigned seconds -); +) noexcept; //! Returns a string of the given time in the format HH:MM:SS @@ -54,7 +54,7 @@ QString printableTime( */ QString printableTime( const int hour, const int minute, const int second -); +) noexcept; //! Returns a string of the given date in the format YYYY-MM-DD @@ -67,7 +67,7 @@ QString printableTime( */ QString printableDate( const QString& year, const int month, const QString& day -); +) noexcept; //! Returns a string of the given date in the format YYYY-MM-DD @@ -79,7 +79,7 @@ QString printableDate( */ QString printableDate( const int year, const int month, const int day -); +) noexcept; //! Returns a string corresponding to the given value @@ -90,7 +90,7 @@ QString printableDate( */ QString printableBool( const int value -); +) noexcept; } // namespace PrintSec diff --git a/logdoctor/utilities/rtf.cpp b/logdoctor/utilities/rtf.cpp index 1bf6eacc..bdc9d858 100644 --- a/logdoctor/utilities/rtf.cpp +++ b/logdoctor/utilities/rtf.cpp @@ -1,24 +1,28 @@ #include "rtf.h" -#include "utilities/strings.h" -#include "modules/craplog/modules/lib.h" +#include "globals/global_configs.h" + #include "modules/tb.h" +#include "modules/craplog/modules/lib.h" + +#include "utilities/strings.h" + #include -void RichText::enrichLogs( QString& rich_content, const std::string& content, const LogsFormat& logs_format, TextBrowser& TB ) +void RichText::enrichLogs( QString& rich_content, const std::string& content, const LogsFormat& logs_format, const TextBrowser& TB ) { const std::unordered_map& colors{ TB.getColorScheme() }; - const int color_scheme{ TB.getColorSchemeID() }; + const bool using_colors_scheme{ TB.getColorSchemeID() != ColorsScheme::None }; const bool wide_lines{ TB.getWideLinesUsage() }; // enrich the text rich_content.clear(); rich_content.reserve( static_cast(content.size()*2ul) ); rich_content += " 0 ) { - rich_content += QString(" style=\"background:%1; color:%2\"") + if ( using_colors_scheme ) { + rich_content += QStringLiteral(R"( style="background:%1; color:%2")") .arg( colors.at("background"), colors.at("text") ); } rich_content += ">"; @@ -35,10 +39,10 @@ void RichText::enrichLogs( QString& rich_content, const std::string& content, co StringOps::splitrip( lines, content ); size_t lines_left{ lines.size() }; for ( const std::string& line : lines ) { - lines_left --; + -- lines_left; // check if the line is commented, usually from IIS logs if ( StringOps::startsWith( line, '#' ) && !StringOps::startsWith( logs_format.initial, '#' ) ) { - rich_line = QString("

      %1

      ").arg( QString::fromStdString( line ) ); + rich_line = QStringLiteral("

      %1

      ").arg( QString::fromStdString( line ) ); if ( wide_lines ) { rich_line += "
      "; } @@ -74,7 +78,7 @@ void RichText::enrichLogs( QString& rich_content, const std::string& content, co } if ( stop == std::string::npos ) { // separator not found, skip to the next one - i++; + ++i; stop = start; continue; } @@ -112,7 +116,7 @@ void RichText::enrichLogs( QString& rich_content, const std::string& content, co break; } aux_start = aux_stop + 1; - c++; + ++c; } } @@ -155,8 +159,8 @@ void RichText::enrichLogs( QString& rich_content, const std::string& content, co } rich_line += ""; class_name.clear(); - if ( color_scheme > 0 ) { - class_name += ""; + class_name += R"(">)"; } // add the class name as span rich_line += class_name; rich_line += QString::fromStdString( fld_str ); - if ( color_scheme > 0 ) { + if ( using_colors_scheme ) { rich_line += ""; } rich_line += ""; @@ -186,7 +190,7 @@ void RichText::enrichLogs( QString& rich_content, const std::string& content, co stop = aux_stop; } else { stop += sep_size; - i++; + ++i; } if ( stop > line_size ) { // this was the final separator @@ -215,8 +219,7 @@ void RichText::enrichLogs( QString& rich_content, const std::string& content, co void RichText::richLogsDefault( QString& rich_str ) { - rich_str.clear(); - rich_str += QString("








      %1

      %2

      ") + rich_str = QStringLiteral(R"(








      %1

      %2

      )") .arg( RichText::tr("Select a file from the list"), RichText::tr("to inspect its content") ); } @@ -224,7 +227,6 @@ void RichText::richLogsDefault( QString& rich_str ) void RichText::richLogsFailure( QString &rich_str ) { - rich_str.clear(); - rich_str += QString("








      %1

      ") + rich_str = QStringLiteral(R"(








      %1

      )") .arg( RichText::tr("Failed to read") ); } diff --git a/logdoctor/utilities/rtf.h b/logdoctor/utilities/rtf.h index 95bdaa95..f7e9e631 100644 --- a/logdoctor/utilities/rtf.h +++ b/logdoctor/utilities/rtf.h @@ -6,8 +6,8 @@ #include +struct LogsFormat; class TextBrowser; -class LogsFormat; class QString; @@ -15,7 +15,7 @@ class QString; /*! Utilities for the TextBrowser */ -class RichText : public QObject +class RichText final : public QObject { Q_OBJECT @@ -32,7 +32,7 @@ public: QString& rich_content, const std::string& content, const LogsFormat& logs_format, - TextBrowser& TB + const TextBrowser& TB ); //! Provides the default string diff --git a/logdoctor/utilities/strings.cpp b/logdoctor/utilities/strings.cpp index 85d3b335..1996dba9 100644 --- a/logdoctor/utilities/strings.cpp +++ b/logdoctor/utilities/strings.cpp @@ -1,213 +1,105 @@ + #include "strings.h" -#include +#include namespace StringOps { -size_t count( std::string_view str, const char flag ) -{ - return static_cast( std::count( str.cbegin(), str.cend(), flag ) ); -} - -size_t count( std::string_view str, std::string_view flag ) +size_t count( std::string_view str, std::string_view flag ) noexcept { const size_t flg_size{ flag.size() }; size_t count{ 0ul }; - for ( size_t start{0ul}; (start=str.find(flag, start)) != std::string::npos; count++ ) { + for ( size_t start{0ul}; (start=str.find(flag, start)) != std::string::npos; ++count ) { start += flg_size; } return count; } -bool isNumeric( const char& chr ) +bool isNumeric( QStringView str ) noexcept { - return chr > 47 && chr < 58; + return str.empty() + ? false + : std::all_of( str.cbegin(), str.cend(), [](const QChar c){ return c.isDigit(); } ); } -bool isNumeric( std::string_view str ) + +std::string strip( const std::string& str, const char chr ) noexcept { - if ( str.empty() ) { - return false; + if (const size_t start{ str.find_first_not_of( chr ) }; start != std::string::npos ) { + const size_t stop{ str.find_last_not_of( chr ) }; + return str.substr( start, stop-start+1ul ); } - return !std::any_of( str.cbegin(), str.cend(), - []( const char& chr ) - { return !isNumeric( chr ); }); + return std::string{}; } - -bool isAlphabetic( const char& chr ) +std::string strip( const std::string& str, const char* chars ) noexcept { - return (chr > 64 && chr < 91) - || (chr > 96 && chr < 123); -} - -bool isAlphabetic( std::string_view str ) -{ - if ( str.empty() ) { - return false; + if (const size_t start{ str.find_first_not_of( chars ) }; start != std::string::npos ) { + const size_t stop{ str.find_last_not_of( chars ) }; + return str.substr( start, stop-start+1ul ); } - return !std::any_of( str.cbegin(), str.cend(), - []( const char& chr ) - { return !isAlphabetic( chr ); }); + return std::string{}; } -bool isAlnum( const char& chr ) +std::string lstrip( const std::string& str, const char chr ) noexcept { - return isNumeric( chr ) - || isAlphabetic( chr ); -} - -bool isAlnum( std::string_view str ) -{ - if ( str.empty() ) { - return false; - } - return !std::any_of( str.cbegin(), str.cend(), - []( const char& chr ) - { return !isAlnum( chr ); }); -} - - -bool isHex( const char& chr ) -{ - return (chr > 47 && chr < 58) - || (chr > 64 && chr < 71) - || (chr > 96 && chr < 103); -} - - -bool isIP( std::string_view str ) -{ - if ( str.empty() ) { - return false; - } - for ( const char& chr : str ) { - if ( chr == '.' || chr == ':' ) { - continue; - } else if ( ! isHex( chr ) ) { - return false; - } - } - return true; -} - - -bool startsWith( std::string_view str, const char flag ) -{ - return str.front() == flag; -} - -bool startsWith( std::string_view str, std::string_view flag ) -{ - return str.rfind( flag, 0ul ) == 0ul; -} - - -bool endsWith( std::string_view str, const char flag ) -{ - return str.back() == flag; -} - -bool endsWith( std::string_view str, std::string_view flag ) -{ - return str.rfind( flag ) == str.size()-flag.size(); -} - - -bool contains( std::string_view str, std::string_view flag ) -{ - return str.find( flag ) != std::string::npos; -} - - -std::string strip( const std::string& str, const char chr ) -{ - size_t start{ str.find_first_not_of( chr ) }; - size_t stop{ str.find_last_not_of( chr ) }; - if ( start == std::string::npos ) { - start++; - } - if ( stop == std::string::npos ) { - stop = str.size(); - } - return str.substr( start, stop-start+1ul ); -} - -std::string strip( const std::string& str, std::string_view chars ) -{ - size_t start{ str.find_first_not_of( chars ) }; - size_t stop{ str.find_last_not_of( chars ) }; - if ( start == std::string::npos ) { - start++; - } - if ( stop == std::string::npos ) { - stop = str.size(); - } - return str.substr( start, stop-start+1ul ); -} - - -std::string lstrip( const std::string& str, const char chr ) -{ - const size_t start{ str.find_first_not_of( chr ) }; - if ( start != std::string::npos ) { + if (const size_t start{ str.find_first_not_of( chr ) }; start != std::string::npos ) { return str.substr( start ); } return std::string{}; } -std::string lstrip( const std::string& str, std::string_view chars ) +std::string lstrip( const std::string& str, const char* chars ) noexcept { - const size_t start{ str.find_first_not_of( chars ) }; - if ( start != std::string::npos ) { + if (const size_t start{ str.find_first_not_of( chars ) }; start != std::string::npos ) { return str.substr( start ); } return std::string{}; } -std::string rstrip( const std::string &str, const char chr ) +std::string rstrip( const std::string &str, const char chr ) noexcept { - const size_t stop{ str.find_last_not_of( chr ) }; - if ( stop != std::string::npos ) { + if (const size_t stop{ str.find_last_not_of( chr ) }; stop != std::string::npos ) { return str.substr( 0ul, stop+1ul ); } return std::string{}; } -std::string rstrip( const std::string& str, std::string_view chars ) +std::string rstrip( const std::string& str, const char* chars ) noexcept { - const size_t stop{ str.find_last_not_of( chars ) }; - if ( stop != std::string::npos ) { + if (const size_t stop{ str.find_last_not_of( chars ) }; stop != std::string::npos ) { return str.substr( 0ul, stop+1ul ); } return std::string{}; } -std::string lstripUntil( const std::string& str, const char delim, const bool inclusive, const bool consecutives ) +std::string lstripUntil( const std::string& str, const char delim, const bool inclusive, const bool consecutives ) noexcept { - size_t start{ str.find( delim ) }; - if ( start == std::string::npos ) { - return str; - } - if ( inclusive ) { - start ++; - if ( consecutives ) { - while ( str.find( delim, start ) == start ) { - start ++; + if (size_t start{ str.find( delim ) }; start != std::string::npos ) { + if ( inclusive ) { + ++ start; + if ( consecutives ) { + if (str[start] == delim) { + start = str.find_first_not_of( delim, start ); + if ( start == std::string::npos ) { + return std::string{}; + } + } } } + return str.substr( start ); } - return str.substr( start ); + return str; } -void split( std::vector& list, const std::string& target_str, const char separator ) +void split( std::vector& list, const std::string& target_str, const char separator ) noexcept { if ( target_str.empty() ) { return; @@ -225,7 +117,7 @@ void split( std::vector& list, const std::string& target_str, const } } -void split( std::vector& list, const std::string& target_str, std::string_view separator ) +void split( std::vector& list, const std::string& target_str, std::string_view separator ) noexcept { if ( target_str.empty() ) { return; @@ -246,7 +138,7 @@ void split( std::vector& list, const std::string& target_str, std:: } -void splitrip( std::vector& list, const std::string& target_str, const char separator, std::string_view strips ) +void splitrip( std::vector& list, const std::string& target_str, const char separator, const char* strips ) noexcept { split( list, strip( target_str, strips ), separator ); std::transform( list.begin(), list.end(), list.begin(), @@ -254,16 +146,16 @@ void splitrip( std::vector& list, const std::string& target_str, co { return strip( str, strips ); } ); } -void splitrip( std::vector& list, const std::string& target_str, std::string_view separator, std::string_view strips ) +void splitrip(std::vector& list, const std::string& target_str, const char* separator, const char* strips ) noexcept { split( list, strip( target_str, strips ), separator ); std::transform( list.begin(), list.end(), list.begin(), - [&strips]( const std::string& str ) + [strips]( const std::string& str ) { return strip( str, strips ); } ); } -std::string replace( std::string_view str, std::string_view target, std::string_view replace ) +std::string replace( std::string_view str, std::string_view target, std::string_view replace ) noexcept { std::string s{ str }; const size_t t_size{ target.size() }; @@ -277,21 +169,21 @@ std::string replace( std::string_view str, std::string_view target, std::string_ } -std::string toUpper( std::string_view str ) +std::string toUpper( std::string_view str ) noexcept { std::string up{ str }; std::transform( up.begin(), up.end(), up.begin(), - []( const char& c ) + []( const char c ) { return std::toupper( c ); } ); return up; } -std::string toLower( std::string_view str ) +std::string toLower( std::string_view str ) noexcept { std::string low{ str }; std::transform( low.begin(), low.end(), low.begin(), - []( const char& c ) + []( const char c ) { return std::tolower( c ); } ); return low; } diff --git a/logdoctor/utilities/strings.h b/logdoctor/utilities/strings.h index 7f5e394c..b97abc13 100644 --- a/logdoctor/utilities/strings.h +++ b/logdoctor/utilities/strings.h @@ -1,9 +1,14 @@ #ifndef LOGDOCTOR__UTILITIES__STRINGS_H #define LOGDOCTOR__UTILITIES__STRINGS_H +#include "chars.h" #include #include +#include + + +class QStringView; //! StringOps @@ -13,73 +18,67 @@ namespace StringOps { -//! Count the occurrences of the given sequence in the given string +//! Counts the occurrences of the given sequence in the given string /*! \param str The target string \param flag The character to find \return The number of occurrences */ -size_t count( std::string_view str, const char flag ); +inline size_t count( std::string_view str, const char flag ) noexcept +{ + return static_cast( std::count( str.cbegin(), str.cend(), flag ) ); +} -//! Count the occurrences of the given sequence in the given string +//! Counts the occurrences of the given sequence in the given string /*! \param str The target string \param flag The string to find \return The number of occurrences */ -size_t count( std::string_view str, std::string_view flag ); - -//! Checks whether character is numeric -/*! - \param str The target character - \return The result of the check - \see isNumeric() -*/ -bool isNumeric( const char& chr ); +size_t count( std::string_view str, std::string_view flag ) noexcept; //! Checks whether a string only contains numeric characters /*! \param str The target string \return The result of the check */ -bool isNumeric( std::string_view str ); +inline bool isNumeric( std::string_view str ) noexcept +{ + return str.empty() + ? false + : std::all_of( str.cbegin(), str.cend(), CharOps::isNumeric ); +} -//! Checks whether a character is alphabetic +//! Checks whether a string only contains numeric characters /*! - \param str The target character + \param str The target string \return The result of the check - \see isAlphabetic() */ -bool isAlphabetic( const char& chr ); +bool isNumeric( QStringView str ) noexcept; //! Checks whether a string only contains alphabetic characters /*! \param str The target string \return The result of the check */ -bool isAlphabetic( std::string_view str ); - -//! Checks whether a character is alpha-numeric -/*! - \param str The target character - \return The result of the check - \see isAlnum -*/ -bool isAlnum( const char& chr ); +inline bool isAlphabetic( std::string_view str ) noexcept +{ + return str.empty() + ? false + : std::all_of( str.cbegin(), str.cend(), CharOps::isAlphabetic ); +} //! Checks whether a string only contains alpha-numeric characters /*! \param str The target string \return The result of the check */ -bool isAlnum( std::string_view str ); - -//! Checks whether a string only contains hexadecimal characters -/*! - \param str The target character - \return The result of the check -*/ -bool isHex( const char& chr ); +inline bool isAlnum( std::string_view str ) noexcept +{ + return str.empty() + ? false + : std::all_of( str.cbegin(), str.cend(), CharOps::isAlnum ); +} //! Checks whether a string contains only IPv4/IPv6 chars /*! @@ -88,7 +87,12 @@ bool isHex( const char& chr ); \param str The target string \return The result of the check */ -bool isIP( std::string_view str ); +inline bool isIP( std::string_view str ) noexcept +{ + return str.empty() + ? false + : std::all_of( str.cbegin(), str.cend(), CharOps::isIP ); +} //! Checks if a string starts with the given sequence /*! @@ -96,7 +100,10 @@ bool isIP( std::string_view str ); \param flag The character to search for \return The result of the check */ -bool startsWith( std::string_view str, const char flag ); +inline bool startsWith( std::string_view str, const char flag ) noexcept +{ + return str.front() == flag; +} //! Checks if a string starts with the given sequence /*! @@ -105,7 +112,10 @@ bool startsWith( std::string_view str, const char flag ); \param flag The sequence to search for \return The result of the check */ -bool startsWith( std::string_view str, std::string_view flag ); +inline bool startsWith( std::string_view str, std::string_view flag ) noexcept +{ + return str.rfind( flag, 0ul ) == 0ul; +} //! Checks if a string ends with the given sequence /*! @@ -113,7 +123,10 @@ bool startsWith( std::string_view str, std::string_view flag ); \param flag The character to search for \return The result of the check */ -bool endsWith( std::string_view str, const char flag ); +inline bool endsWith( std::string_view str, const char flag ) noexcept +{ + return str.back() == flag; +} //! Checks if a string ends with the given sequence /*! @@ -122,7 +135,10 @@ bool endsWith( std::string_view str, const char flag ); \param flag The sequence to search for \return The result of the check */ -bool endsWith( std::string_view str, std::string_view flag ); +inline bool endsWith( std::string_view str, std::string_view flag ) noexcept +{ + return str.rfind( flag ) == str.size()-flag.size(); +} //! Checks if a string contains the given sequence /*! @@ -130,7 +146,10 @@ bool endsWith( std::string_view str, std::string_view flag ); \param flag The sequence to search for \return The result of the check */ -bool contains( std::string_view str, std::string_view flag ); +inline bool contains( std::string_view str, std::string_view flag ) noexcept +{ + return str.find( flag ) != std::string::npos; +} //! Strips the given character from both the left and the right side of a string /*! @@ -138,7 +157,7 @@ bool contains( std::string_view str, std::string_view flag ); \param chr The character to strip away \return The result string */ -std::string strip( const std::string& str, const char chr ); +std::string strip( const std::string& str, const char chr ) noexcept; //! Strips the given characters from both the left and the right side of a string /*! @@ -146,7 +165,7 @@ std::string strip( const std::string& str, const char chr ); \param chars The characters to strip away \return The result string */ -std::string strip( const std::string& str, std::string_view chars=" \n\t\b\r\v" ); +std::string strip( const std::string& str, const char* chars=" \n\t\b\r\v" ) noexcept; //! Strips the given character from the left side of a string /*! @@ -154,7 +173,7 @@ std::string strip( const std::string& str, std::string_view chars=" \n\t\b\r\v" \param chr The character to strip away \return The result string */ -std::string lstrip( const std::string& str, const char chr ); +std::string lstrip( const std::string& str, const char chr ) noexcept; //! Strips the given characters from the left side of a string /*! @@ -162,7 +181,7 @@ std::string lstrip( const std::string& str, const char chr ); \param chars The characters to strip away \return The result string */ -std::string lstrip( const std::string& str, std::string_view chars=" \n\t\b\r\v" ); +std::string lstrip( const std::string& str, const char* chars=" \n\t\b\r\v" ) noexcept; //! Strips the given character from the right side of a string /*! @@ -170,7 +189,7 @@ std::string lstrip( const std::string& str, std::string_view chars=" \n\t\b\r\v" \param chr The character to strip away \return The result string */ -std::string rstrip( const std::string &str, const char chr ); +std::string rstrip( const std::string &str, const char chr ) noexcept; //! Strips the given characters from the right side of a string /*! @@ -178,7 +197,7 @@ std::string rstrip( const std::string &str, const char chr ); \param chars The characters to strip away \return The result string */ -std::string rstrip( const std::string& str, std::string_view chars=" \n\t\b\r\v" ); +std::string rstrip( const std::string& str, const char* chars=" \n\t\b\r\v" ) noexcept; //! Strips everything from a string starting from the left side untill the delimiter is found (a.k.a. cut) /*! @@ -188,7 +207,7 @@ std::string rstrip( const std::string& str, std::string_view chars=" \n\t\b\r\v" \param consecutives Whether to strip all the occurrences of the delimiter if they're consecutive, only applies if inclusive \return The result string */ -std::string lstripUntil( const std::string& str, const char delim, const bool inclusive=true, const bool consecutives=true ); +std::string lstripUntil( const std::string& str, const char delim, const bool inclusive=true, const bool consecutives=true ) noexcept; //! Splits a string using a separator /*! @@ -196,7 +215,7 @@ std::string lstripUntil( const std::string& str, const char delim, const bool in \param target_str The target string \param separator The character to use as separator */ -void split( std::vector& list, const std::string& target_str, const char separator='\n' ); +void split( std::vector& list, const std::string& target_str, const char separator='\n' ) noexcept; //! Splits a string using a separator /*! @@ -204,7 +223,7 @@ void split( std::vector& list, const std::string& target_str, const \param target_str The target string \param separator The sequence to use as separator */ -void split( std::vector& list, const std::string& target_str, std::string_view separator ); +void split( std::vector& list, const std::string& target_str, std::string_view separator ) noexcept; //! Splits a string and strips all the splitted items /*! @@ -213,7 +232,7 @@ void split( std::vector& list, const std::string& target_str, std:: \param separator The sequence to use as separator \param strip The characters to strip away */ -void splitrip( std::vector& list, const std::string& target_str, const char separator='\n', std::string_view strips=" \n\t\b\r\v" ); +void splitrip( std::vector& list, const std::string& target_str, const char separator='\n', const char* strips=" \n\t\b\r\v" ) noexcept; //! Splits a string and strips all the splitted items /*! @@ -222,7 +241,7 @@ void splitrip( std::vector& list, const std::string& target_str, co \param separator The sequence to use as separator \param strip The characters to strip away */ -void splitrip( std::vector& list, const std::string& target_str, std::string_view separator, std::string_view strips=" \n\t\b\r\v" ); +void splitrip( std::vector& list, const std::string& target_str, const char* separator, const char* strips=" \n\t\b\r\v" ) noexcept; //! Replaces all the occurrences of a sequence with another /*! @@ -231,21 +250,21 @@ void splitrip( std::vector& list, const std::string& target_str, st \param replace The sequence to be used to replace the target \return The result string */ -std::string replace( std::string_view str, std::string_view target, std::string_view replace ); +std::string replace( std::string_view str, std::string_view target, std::string_view replace ) noexcept; //! Converts a string to upper case /*! \param str The target string \return The result string */ -std::string toUpper( std::string_view str ); +std::string toUpper( std::string_view str ) noexcept; //! Converts a string to lower case /*! \param str The target string \return The result string */ -std::string toLower( std::string_view str ); +std::string toLower( std::string_view str ) noexcept; } // namespace StringOps diff --git a/logdoctor/utilities/stylesheets.cpp b/logdoctor/utilities/stylesheets.cpp index 71c74539..18bd6c8c 100644 --- a/logdoctor/utilities/stylesheets.cpp +++ b/logdoctor/utilities/stylesheets.cpp @@ -6,13 +6,11 @@ #include "modules/exceptions.h" #include +#include #include -namespace /*private*/ -{ - enum StyleId : uint32_t { TEXT_PRIMARY, TEXT_DISABLED, @@ -96,7 +94,7 @@ enum StyleId : uint32_t { using StyleMap = std::unordered_map; -const StyleMap makeStyleMap() +StyleMap makeStyleMap() { switch ( GlobalConfigs::window_theme ) { case WindowTheme::Light: @@ -420,26 +418,24 @@ const StyleMap makeStyleMap() }; break; default: - throw GenericException( "Unexpected WindowTheme: "+std::to_string(static_cast(GlobalConfigs::window_theme)), true ); + throw DoNotCatchException( "Unexpected WindowTheme", std::to_string(static_cast(GlobalConfigs::window_theme)) ); break; } } -} // namespace (private) - namespace StyleSec { -void getStyleSheet( QString& stylesheet ) +QString getStyleSheet() { const QString icons_theme{ GlobalConfigs::icons_set }; const StyleMap style{ makeStyleMap() }; - stylesheet = + return //////////////// //// SHARED //// "* {" - " color: "+style.at(TEXT_PRIMARY)+";" + " color: "% style.at(TEXT_PRIMARY) %";" "}" // frames "QFrame," @@ -463,10 +459,10 @@ void getStyleSheet( QString& stylesheet ) // tooltips "QToolTip {" " padding: 2px;" - " border: 1px solid "+style.at(TOOLTIPS_BORDER)+";" + " border: 1px solid "% style.at(TOOLTIPS_BORDER) %";" " border-radius: 6px;" - " color: "+style.at(TOOLTIPS_TEXT)+";" - " background-color: "+style.at(TOOLTIPS_BASE)+";" + " color: "% style.at(TOOLTIPS_TEXT) %";" + " background-color: "% style.at(TOOLTIPS_BASE) %";" " font-size: 12px;" "}" // check boxes @@ -475,13 +471,13 @@ void getStyleSheet( QString& stylesheet ) " height: 13px;" "}" "QCheckBox::indicator:unchecked {" - " image: url(:/icons/icons/"+icons_theme+"/checkbox_unchecked.png);" + " image: url(:/icons/icons/"% icons_theme %"/checkbox_unchecked.png);" "}" "QCheckBox::indicator:indeterminate {" - " image: url(:/icons/icons/"+icons_theme+"/checkbox_semichecked.png);" + " image: url(:/icons/icons/"% icons_theme %"/checkbox_semichecked.png);" "}" "QCheckBox::indicator:checked {" - " image: url(:/icons/icons/"+icons_theme+"/checkbox_checked.png);" + " image: url(:/icons/icons/"% icons_theme %"/checkbox_checked.png);" "}" // radio buttons "QRadioButton::indicator {" @@ -489,49 +485,58 @@ void getStyleSheet( QString& stylesheet ) " height : 13px;" "}" "QRadioButton::indicator:unchecked {" - " image: url(:/icons/icons/"+icons_theme+"/radiobutton_unchecked.png);" + " image: url(:/icons/icons/"% icons_theme %"/radiobutton_unchecked.png);" "}" "QRadioButton::indicator:checked {" - " image: url(:/icons/icons/"+icons_theme+"/radiobutton_checked.png);" + " image: url(:/icons/icons/"% icons_theme %"/radiobutton_checked.png);" "}" // push buttons "QPushButton {" " border: 0px;" " border-radius: 12px;" - " background-color: "+style.at(BUTTONS_BASE)+";" + " background-color: "% style.at(BUTTONS_BASE) %";" "}" "QPushButton:hover {" - " background-color: "+style.at(BUTTONS_BASE_HOVER)+";" + " background-color: "% style.at(BUTTONS_BASE_HOVER) %";" "}" "QPushButton::flat {" - " background-color: "+style.at(BUTTONS_BASE_FLAT)+";" + " background-color: "% style.at(BUTTONS_BASE_FLAT) %";" "}" "QPushButton::disabled {" - " background-color: "+style.at(BUTTONS_BASE_DISABLED)+";" + " background-color: "% style.at(BUTTONS_BASE_DISABLED) %";" + "}" + // tool buttons + "QToolButton {" + " border: 1px solid "% style.at(BORDER_PRIMARY) %";" + " border-radius: 16px;" + " background-color: transparent;" + "}" + "QToolButton:hover {" + " border: 1px solid "% style.at(BORDER_SECONDARY) %";" "}" // line edits "QLineEdit {" " padding-left: 4px;" " padding-right: 4px;" " border-radius: 8px;" - " color: "+style.at(LINEDIT_TEXT)+";" - " selection-color: "+style.at(LINEDIT_TEXT)+";" - " background-color: "+style.at(LINEDIT_BASE)+";" - " selection-background-color: "+style.at(LINEDIT_BASE_SELECTION)+";" + " color: "% style.at(LINEDIT_TEXT) %";" + " selection-color: "% style.at(LINEDIT_TEXT) %";" + " background-color: "% style.at(LINEDIT_BASE) %";" + " selection-background-color: "% style.at(LINEDIT_BASE_SELECTION) %";" "}" "QLineEdit::focus {" - " background-color: "+style.at(LINEDIT_BASE_FOCUS)+";" + " background-color: "% style.at(LINEDIT_BASE_FOCUS) %";" "}" "QLineEdit:disabled {" - " background-color: "+style.at(LINEDIT_BASE_DISABLED)+";" + " background-color: "% style.at(LINEDIT_BASE_DISABLED) %";" "}" // combo boxes "QComboBox {" " border-radius: 8px;" - " background-color: "+style.at(BOXES_BASE_PRIMARY)+";" + " background-color: "% style.at(BOXES_BASE_PRIMARY) %";" "}" "QComboBox::disabled {" - " background-color: "+style.at(BOXES_BASE_DISABLED)+";" + " background-color: "% style.at(BOXES_BASE_DISABLED) %";" "}" "QComboBox::drop-down {" " border-top-right-radius: 8px;" @@ -539,33 +544,33 @@ void getStyleSheet( QString& stylesheet ) " border-left: 3px solid" " QLinearGradient(" " x0:0, y0:0, x1:0, y1:1," - " stop:0 "+style.at(BOXES_BASE_PRIMARY)+"," - " stop:0.1 "+style.at(BOXES_BASE_PRIMARY)+"," - " stop:0.5 "+style.at(BOXES_DECO)+"," - " stop:0.9 "+style.at(BOXES_BASE_PRIMARY)+"," - " stop:1 "+style.at(BOXES_BASE_PRIMARY)+");" - " background-color: "+style.at(BOXES_BASE_PRIMARY)+";" - " selection-background-color: "+style.at(BOXES_BASE_PRIMARY)+";" + " stop:0 "% style.at(BOXES_BASE_PRIMARY) %"," + " stop:0.1 "% style.at(BOXES_BASE_PRIMARY) %"," + " stop:0.5 "% style.at(BOXES_DECO) %"," + " stop:0.9 "% style.at(BOXES_BASE_PRIMARY) %"," + " stop:1 "% style.at(BOXES_BASE_PRIMARY) %");" + " background-color: "% style.at(BOXES_BASE_PRIMARY) %";" + " selection-background-color: "% style.at(BOXES_BASE_PRIMARY) %";" "}" "QComboBox::drop-down::disabled {" - " border-left-color: "+style.at(BOXES_BASE_DISABLED)+";" - " background-color: "+style.at(BOXES_BASE_DISABLED)+";" + " border-left-color: "% style.at(BOXES_BASE_DISABLED) %";" + " background-color: "% style.at(BOXES_BASE_DISABLED) %";" "}" "QComboBox::down-arrow {" - " image: url(:/icons/icons/"+icons_theme+"/combobox_arrow.png);" + " image: url(:/icons/icons/"% icons_theme %"/combobox_arrow.png);" "}" "QComboBox::down-arrow::disabled {" " image: url();" "}" "QComboBox:on {" " border-bottom-left-radius: 0px;" - " border-bottom: 2px solid "+style.at(BOXES_DECO)+";" - " background-color: "+style.at(BOXES_BASE_SECONDARY)+";" + " border-bottom: 2px solid "% style.at(BOXES_DECO) %";" + " background-color: "% style.at(BOXES_BASE_SECONDARY) %";" "}" "QComboBox::drop-down:on {" " border-bottom-right-radius: 0px;" " border-left-color: transparent;" - " background-color: "+style.at(BOXES_BASE_SECONDARY)+";" + " background-color: "% style.at(BOXES_BASE_SECONDARY) %";" "}" "QComboBox::down-arrow:on {" " image: url();" @@ -573,49 +578,49 @@ void getStyleSheet( QString& stylesheet ) "QComboBox QAbstractItemView {" " border-bottom-left-radius: 8px;" " border-bottom-right-radius: 8px;" - " background-color: "+style.at(BOXES_BASE_PRIMARY)+";" - " selection-background-color: "+style.at(BOXES_BASE_SELECTION)+";" + " background-color: "% style.at(BOXES_BASE_PRIMARY) %";" + " selection-background-color: "% style.at(BOXES_BASE_SELECTION) %";" "}" // spin boxes "QSpinBox {" " border-radius: 4px;" - " color: "+style.at(LINEDIT_TEXT)+";" - " background-color: "+style.at(LINEDIT_BASE)+";" - " selection-color: "+style.at(LINEDIT_TEXT)+";" - " selection-background-color: "+style.at(LINEDIT_BASE_SELECTION)+";" + " color: "% style.at(LINEDIT_TEXT) %";" + " background-color: "% style.at(LINEDIT_BASE) %";" + " selection-color: "% style.at(LINEDIT_TEXT) %";" + " selection-background-color: "% style.at(LINEDIT_BASE_SELECTION) %";" "}" "QSpinBox::focus {" - " background-color: "+style.at(LINEDIT_BASE_FOCUS)+";" + " background-color: "% style.at(LINEDIT_BASE_FOCUS) %";" "}" "QSpinBox::disabled {" - " border-color: "+style.at(BOXES_BASE_DISABLED)+";" - " color: "+style.at(TEXT_DISABLED)+";" - " background-color: "+style.at(BOXES_BASE_DISABLED)+";" + " border-color: "% style.at(BOXES_BASE_DISABLED) %";" + " color: "% style.at(TEXT_DISABLED) %";" + " background-color: "% style.at(BOXES_BASE_DISABLED) %";" "}" "QSpinBox::up-button," "QSpinBox::down-button {" " padding: 2px;" - " border-left: 2px solid "+style.at(BOXES_DECO)+";" - " background-color: "+style.at(BOXES_BASE_SECONDARY)+";" + " border-left: 2px solid "% style.at(BOXES_DECO) %";" + " background-color: "% style.at(BOXES_BASE_SECONDARY) %";" "}" "QSpinBox::up-button:hover," "QSpinBox::down-button:hover {" - " background-color: "+style.at(BOXES_BASE_SELECTION)+";" + " background-color: "% style.at(BOXES_BASE_SELECTION) %";" "}" "QSpinBox::up-button:off," "QSpinBox::down-button:off {" - " background-color: "+style.at(BOXES_BASE_DISABLED)+";" + " background-color: "% style.at(BOXES_BASE_DISABLED) %";" "}" "QSpinBox::up-button:disabled," "QSpinBox::down-button:disabled {" - " border-left-color: "+style.at(BOXES_BASE_PRIMARY)+";" - " background-color: "+style.at(BOXES_BASE_DISABLED)+";" + " border-left-color: "% style.at(BOXES_BASE_PRIMARY) %";" + " background-color: "% style.at(BOXES_BASE_DISABLED) %";" "}" "QSpinBox::up-arrow {" " width: 7px;" " height: 7px;" " padding: 2px;" - " image: url(:/icons/icons/"+icons_theme+"/spinbox_add.png);" + " image: url(:/icons/icons/"% icons_theme %"/spinbox_add.png);" "}" "QSpinBox::up-arrow:off," "QSpinBox::up-arrow:disabled {" @@ -625,7 +630,7 @@ void getStyleSheet( QString& stylesheet ) " width: 7px;" " height: 7px;" " padding: 2px;" - " image: url(:/icons/icons/"+icons_theme+"/spinbox_sub.png);" + " image: url(:/icons/icons/"% icons_theme %"/spinbox_sub.png);" "}" "QSpinBox::down-arrow:off," "QSpinBox::down-arrow:disabled {" @@ -634,12 +639,12 @@ void getStyleSheet( QString& stylesheet ) // scroll bars "QScrollBar:horizontal {" " height: 12px;" - " background-color: "+style.at(SCROLLBAR_BASE)+";" + " background-color: "% style.at(SCROLLBAR_BASE) %";" "}" "QScrollBar::handle:horizontal {" " min-width: 16px;" " margin: 5px 0px 5px 0px;" - " background-color: "+style.at(SCROLLBAR_HANDLER)+";" + " background-color: "% style.at(SCROLLBAR_HANDLER) %";" "}" "QScrollBar::handle:horizontal:hover {" " margin: 4px 0px 4px 0px;" @@ -647,12 +652,12 @@ void getStyleSheet( QString& stylesheet ) "}" "QScrollBar:vertical {" " width: 12px;" - " background-color: "+style.at(SCROLLBAR_BASE)+";" + " background-color: "% style.at(SCROLLBAR_BASE) %";" "}" "QScrollBar::handle:vertical {" " min-height: 16px;" " margin: 0px 5px 0px 5px;" - " background-color: "+style.at(SCROLLBAR_HANDLER)+";" + " background-color: "% style.at(SCROLLBAR_HANDLER) %";" "}" "QScrollBar::handle:vertical:hover {" " margin: 0px 4px 0px 4px;" @@ -666,48 +671,48 @@ void getStyleSheet( QString& stylesheet ) "QScrollBar::left-arrow," "QScrollBar::right-arrow {" " border: 0px;" - " background-color: "+style.at(SCROLLBAR_CONTROLS)+";" + " background-color: "% style.at(SCROLLBAR_CONTROLS) %";" "}" // slider "QSlider::groove:horizontal {" " height: 2px;" - " border: 1px solid "+style.at(SLIDER_BAR_ACTIVE_BORDER)+";" - " background-color: "+style.at(SLIDER_BAR_ACTIVE)+";" + " border: 1px solid "% style.at(SLIDER_BAR_ACTIVE_BORDER) %";" + " background-color: "% style.at(SLIDER_BAR_ACTIVE) %";" "}" "QSlider::add-page:horizontal {" " border: 0px;" - " background-color: "+style.at(SLIDER_BAR_INACTIVE)+";" + " background-color: "% style.at(SLIDER_BAR_INACTIVE) %";" "}" "QSlider::sub-page:horizontal {" - " border: 1px solid "+style.at(SLIDER_BAR_ACTIVE_BORDER)+";" - " background-color: "+style.at(SLIDER_BAR_ACTIVE)+";" + " border: 1px solid "% style.at(SLIDER_BAR_ACTIVE_BORDER) %";" + " background-color: "% style.at(SLIDER_BAR_ACTIVE) %";" "}" "QSlider::handle:horizontal {" " width: 12px;" " margin: -5px 0px;" - " border: 1px solid "+style.at(SLIDER_HANDLER_BORDER)+";" + " border: 1px solid "% style.at(SLIDER_HANDLER_BORDER) %";" " border-radius: 4px;" - " background-color: "+style.at(SLIDER_HANDLER)+";" + " background-color: "% style.at(SLIDER_HANDLER) %";" "}" "QSlider::handle:hover:horizontal {" - " border: 1px solid "+style.at(SLIDER_HANDLER_BORDER_HOVER)+";" + " border: 1px solid "% style.at(SLIDER_HANDLER_BORDER_HOVER) %";" "}" // charts "QGraphicsView {" " border-radius: 8px;" - " background-color: "+style.at(CHARTS_CONTOUR)+";" + " background-color: "% style.at(CHARTS_CONTOUR) %";" "}" // tables, trees and headers "QTreeView," "QListView," "QTableView {" " border-radius: 8px;" - " background-color: "+style.at(TABLES_BASE)+";" - " selection-color: "+style.at(TABLES_TEXT_SELECTION)+";" - " selection-background-color: "+style.at(TABLES_BASE_SELECTION)+";" + " background-color: "% style.at(TABLES_BASE) %";" + " selection-color: "% style.at(TABLES_TEXT_SELECTION) %";" + " selection-background-color: "% style.at(TABLES_BASE_SELECTION) %";" "}" "QTableView {" - " gridline-color: "+style.at(TABLES_GRIDLINE)+";" + " gridline-color: "% style.at(TABLES_GRIDLINE) %";" "}" "QTreeView QScrollBar::handle:vertical," "QTableView QScrollBar::handle:vertical," @@ -721,8 +726,8 @@ void getStyleSheet( QString& stylesheet ) " height: 24px;" " border: 0px;" " border-top-right-radius: 8px;" - " border-bottom: 2px solid "+style.at(TABLES_DECO)+";" - " background-color: "+style.at(TABLES_HEADER)+";" + " border-bottom: 2px solid "% style.at(TABLES_DECO) %";" + " background-color: "% style.at(TABLES_HEADER) %";" "}" "QHeaderView::section {" " height: 24px;" @@ -730,40 +735,40 @@ void getStyleSheet( QString& stylesheet ) "QHeaderView::section:first {" " padding-left: 6px;" " border-top-left-radius: 6px;" - " border-right: 1px solid "+style.at(TABLES_HEADER_SEPARATOR)+";" - " border-bottom: 2px solid "+style.at(TABLES_DECO)+";" - " background-color: "+style.at(TABLES_HEADER)+";" + " border-right: 1px solid "% style.at(TABLES_HEADER_SEPARATOR) %";" + " border-bottom: 2px solid "% style.at(TABLES_DECO) %";" + " background-color: "% style.at(TABLES_HEADER) %";" "}" "QHeaderView::section:middle {" " padding-left: 6px;" " border-radius: 0px;" // leave this here or borders won't display - " border-right: 1px solid "+style.at(TABLES_HEADER_SEPARATOR)+";" - " border-bottom: 2px solid "+style.at(TABLES_DECO)+";" - " background-color: "+style.at(TABLES_HEADER)+";" + " border-right: 1px solid "% style.at(TABLES_HEADER_SEPARATOR) %";" + " border-bottom: 2px solid "% style.at(TABLES_DECO) %";" + " background-color: "% style.at(TABLES_HEADER) %";" "}" "QHeaderView::section:last {" " padding-left: 6px;" " border-top-right-radius: 0px;" - " border-bottom: 2px solid "+style.at(TABLES_DECO)+";" - " background-color: "+style.at(TABLES_HEADER)+";" + " border-bottom: 2px solid "% style.at(TABLES_DECO) %";" + " background-color: "% style.at(TABLES_HEADER) %";" "}" "QHeaderView::section:first::hover {" - " background-color: "+style.at(TABLES_HEADER_HOVER)+";" + " background-color: "% style.at(TABLES_HEADER_HOVER) %";" "}" "QHeaderView::section:middle::hover {" - " background-color: "+style.at(TABLES_HEADER_HOVER)+";" + " background-color: "% style.at(TABLES_HEADER_HOVER) %";" "}" "QHeaderView::section:last::hover {" - " background-color: "+style.at(TABLES_HEADER_HOVER)+";" + " background-color: "% style.at(TABLES_HEADER_HOVER) %";" "}" // text browser "QTextBrowser {" - " border: 4px solid "+style.at(TEXTBROWSER_BORDER)+";" + " border: 4px solid "% style.at(TEXTBROWSER_BORDER) %";" " border-radius: 8px;" - " color: "+style.at(TEXTBROWSER_TEXT)+";" - " background-color: "+style.at(TEXTBROWSER_BASE)+";" - " selection-color: "+style.at(TEXTBROWSER_TEXT_SELECTION)+";" - " selection-background-color: "+style.at(TEXTBROWSER_BASE_SELECTION)+";" + " color: "% style.at(TEXTBROWSER_TEXT) %";" + " background-color: "% style.at(TEXTBROWSER_BASE) %";" + " selection-color: "% style.at(TEXTBROWSER_TEXT_SELECTION) %";" + " selection-background-color: "% style.at(TEXTBROWSER_BASE_SELECTION) %";" "}" "QTextBrowser QScrollBar::handle:vertical {" " padding: 12px;" @@ -771,17 +776,17 @@ void getStyleSheet( QString& stylesheet ) ////////////// //// MENU //// "QMenuBar {" - " color: "+style.at(MENU_TEXT)+";" - " background-color: "+style.at(MENU_BASE)+";" + " color: "% style.at(MENU_TEXT) %";" + " background-color: "% style.at(MENU_BASE) %";" "}" "QMenuBar::item:selected {" - " color: "+style.at(MENU_TEXT)+";" - " background-color: "+style.at(MENU_BASE_HOVER)+";" + " color: "% style.at(MENU_TEXT) %";" + " background-color: "% style.at(MENU_BASE_HOVER) %";" " border-radius: 4px;" "}" "QMenuBar::item:pressed {" - " color: "+style.at(MENU_DROPDOWN_TEXT)+";" - " background-color: "+style.at(MENU_DROPDOWN_BASE)+";" + " color: "% style.at(MENU_DROPDOWN_TEXT) %";" + " background-color: "% style.at(MENU_DROPDOWN_BASE) %";" " border-radius: 0px;" " border-top-left-radius: 4px;" " border-top-right-radius: 4px;" @@ -791,105 +796,105 @@ void getStyleSheet( QString& stylesheet ) " border-top-right-radius: 4px;" " border-bottom-right-radius: 4px;" " border-bottom-left-radius: 4px;" - " color: "+style.at(MENU_DROPDOWN_TEXT)+";" - " background-color: "+style.at(MENU_DROPDOWN_BASE)+";" + " color: "% style.at(MENU_DROPDOWN_TEXT) %";" + " background-color: "% style.at(MENU_DROPDOWN_BASE) %";" "}" "QMenu::item:selected {" - " background-color: "+style.at(MENU_DROPDOWN_BASE_SELECTION)+";" + " background-color: "% style.at(MENU_DROPDOWN_BASE_SELECTION) %";" "}" ////////////// //// MAIN //// // window "QWidget#mainwidget {" - " background-color: "+style.at(WINDOW_BASE_SECONDARY)+";" + " background-color: "% style.at(WINDOW_BASE_SECONDARY) %";" "}" // tabs buttons "QFrame#frame_Tabs_Buttons {" " border: 0px;" - " background-color: "+style.at(WINDOW_BASE_SECONDARY)+";" + " background-color: "% style.at(WINDOW_BASE_SECONDARY) %";" "}" "QPushButton#button_Tab_Log," "QPushButton#button_Tab_View," "QPushButton#button_Tab_Conf {" " border: 0px;" " border-radius: 0px;" - " background-color: "+style.at(WINDOW_BASE_PRIMARY)+";" + " background-color: "% style.at(WINDOW_BASE_PRIMARY) %";" "}" "QPushButton#button_Tab_Log::flat," "QPushButton#button_Tab_View::flat," "QPushButton#button_Tab_Conf::flat {" - " background-color: "+style.at(WINDOW_BASE_SECONDARY)+";" + " background-color: "% style.at(WINDOW_BASE_SECONDARY) %";" "}" "QPushButton#button_Tab_Log::flat:hover {" " background-color: QLinearGradient(" " x1:0, y1:0.5, x2:1, y2:0.5," - " stop:0 "+style.at(SECTIONS_LOG_HOVER)+"," - " stop:0.4 "+style.at(SECTIONS_LOG_HOVER)+"," - " stop:1 "+style.at(WINDOW_BASE_SECONDARY)+");" + " stop:0 "% style.at(SECTIONS_LOG_HOVER) %"," + " stop:0.4 "% style.at(SECTIONS_LOG_HOVER) %"," + " stop:1 "% style.at(WINDOW_BASE_SECONDARY) %");" "}" "QPushButton#button_Tab_View::flat:hover {" " background-color: QLinearGradient(" " x1:0, y1:0.5, x2:1, y2:0.5," - " stop:0 "+style.at(SECTIONS_VIEW_HOVER)+"," - " stop:0.4 "+style.at(SECTIONS_VIEW_HOVER)+"," - " stop:1 "+style.at(WINDOW_BASE_SECONDARY)+");" + " stop:0 "% style.at(SECTIONS_VIEW_HOVER) %"," + " stop:0.4 "% style.at(SECTIONS_VIEW_HOVER) %"," + " stop:1 "% style.at(WINDOW_BASE_SECONDARY) %");" "}" "QPushButton#button_Tab_Conf::flat:hover {" " background-color: QLinearGradient(" " x1:0, y1:0.5, x2:1, y2:0.5," - " stop:0 "+style.at(SECTIONS_CONF_HOVER)+"," - " stop:0.4 "+style.at(SECTIONS_CONF_HOVER)+"," - " stop:1 "+style.at(WINDOW_BASE_SECONDARY)+");" + " stop:0 "% style.at(SECTIONS_CONF_HOVER) %"," + " stop:0.4 "% style.at(SECTIONS_CONF_HOVER) %"," + " stop:1 "% style.at(WINDOW_BASE_SECONDARY) %");" "}" // tabs pages "QStackedWidget#stackedPages_Sections {" - " background-color: "+style.at(WINDOW_BASE_PRIMARY)+";" + " background-color: "% style.at(WINDOW_BASE_PRIMARY) %";" "}" ////////////// //// LOGS //// // switcher buttons "QPushButton#button_Logs_Down {" " border-radius: 16px;" - " background-color: "+style.at(WINDOW_BASE_PRIMARY)+";" + " background-color: "% style.at(WINDOW_BASE_PRIMARY) %";" "}" "QPushButton#button_Logs_Down:hover {" - " background-color: "+style.at(WINDOW_BASE_SECONDARY)+";" - " icon: url(:/icons/icons/"+icons_theme+"/down.png);" + " background-color: "% style.at(WINDOW_BASE_SECONDARY) %";" + " icon: url(:/icons/icons/"% icons_theme %"/down.png);" "}" "QPushButton#button_Logs_Up {" " border-radius: 16px;" - " background-color: "+style.at(WINDOW_BASE_PRIMARY)+";" + " background-color: "% style.at(WINDOW_BASE_PRIMARY) %";" "}" "QPushButton#button_Logs_Up::hover {" - " background-color: "+style.at(WINDOW_BASE_SECONDARY)+";" - " icon: url(:/icons/icons/"+icons_theme+"/up.png);" + " background-color: "% style.at(WINDOW_BASE_SECONDARY) %";" + " icon: url(:/icons/icons/"% icons_theme %"/up.png);" "}" // web servers buttons "QPushButton#button_LogFiles_Apache," "QPushButton#button_LogFiles_Nginx," "QPushButton#button_LogFiles_Iis {" " border-radius: 16px;" - " background-color: "+style.at(WEB_SERVERS_BUTTONS_BASE)+";" + " background-color: "% style.at(WEB_SERVERS_BUTTONS_BASE) %";" "}" "QPushButton#button_LogFiles_Apache::flat," "QPushButton#button_LogFiles_Nginx::flat," "QPushButton#button_LogFiles_Iis::flat {" - " border: 1px solid "+style.at(WEB_SERVERS_BUTTONS_BORDER_FLAT)+";" - " color: "+style.at(WEB_SERVERS_BUTTONS_TEXT_FLAT)+";" - " background-color: "+style.at(WEB_SERVERS_BUTTONS_BASE_FLAT)+";" + " border: 1px solid "% style.at(WEB_SERVERS_BUTTONS_BORDER_FLAT) %";" + " color: "% style.at(WEB_SERVERS_BUTTONS_TEXT_FLAT) %";" + " background-color: "% style.at(WEB_SERVERS_BUTTONS_BASE_FLAT) %";" "}" "QPushButton#button_LogFiles_Apache::flat:hover," "QPushButton#button_LogFiles_Nginx::flat:hover," "QPushButton#button_LogFiles_Iis::flat:hover {" - " border: 2px solid "+style.at(WEB_SERVERS_BUTTONS_BORDER_FLAT_HOVER)+";" - " color: "+style.at(WEB_SERVERS_BUTTONS_TEXT_FLAT_HOVER)+";" + " border: 2px solid "% style.at(WEB_SERVERS_BUTTONS_BORDER_FLAT_HOVER) %";" + " color: "% style.at(WEB_SERVERS_BUTTONS_TEXT_FLAT_HOVER) %";" "}" "QPushButton#button_LogFiles_Apache::disabled," "QPushButton#button_LogFiles_Nginx::disabled," "QPushButton#button_LogFiles_Iis::disabled {" " border: 0px;" - " color: "+style.at(WEB_SERVERS_BUTTONS_TEXT_DISABLED)+";" - " background-color: "+style.at(WEB_SERVERS_BUTTONS_BASE_DISABLED)+";" + " color: "% style.at(WEB_SERVERS_BUTTONS_TEXT_DISABLED) %";" + " background-color: "% style.at(WEB_SERVERS_BUTTONS_BASE_DISABLED) %";" "}" // logs list "QTreeWidget#listLogFiles::indicator {" @@ -899,10 +904,10 @@ void getStyleSheet( QString& stylesheet ) " margin-right: 4px;" "}" "QTreeWidget#listLogFiles::indicator:unchecked {" - " image: url(:/icons/icons/"+icons_theme+"/checkbox_unchecked.png);" + " image: url(:/icons/icons/"% icons_theme %"/checkbox_unchecked.png);" "}" "QTreeWidget#listLogFiles::indicator:checked {" - " image: url(:/icons/icons/"+icons_theme+"/checkbox_checked.png);" + " image: url(:/icons/icons/"% icons_theme %"/checkbox_checked.png);" "}" // view file button "QPushButton#button_LogFiles_ViewFile {" @@ -910,26 +915,26 @@ void getStyleSheet( QString& stylesheet ) "}" // refresh button "QPushButton#button_LogFiles_RefreshList {" - " border: 1px solid "+style.at(BORDER_PRIMARY)+";" + " border: 1px solid "% style.at(BORDER_PRIMARY) %";" " border-radius: 16px;" " background-color: transparent;" "}" "QPushButton#button_LogFiles_RefreshList:hover {" - " border: 1px solid "+style.at(BORDER_SECONDARY)+";" + " border: 1px solid "% style.at(BORDER_SECONDARY) %";" "}" // parse logs button "QPushButton#button_MakeStats_Start {" " border-radius: 32px;" "}" "QPushButton#button_MakeStats_Start::disabled {" - " color: "+style.at(TEXT_DISABLED)+";" + " color: "% style.at(TEXT_DISABLED) %";" "}" /////////////// //// STATS //// // statistics tabs buttons "QFrame#frame_Stats_Buttons {" " border: 0px;" - " background-color: "+style.at(WINDOW_BASE_PRIMARY)+";" + " background-color: "% style.at(WINDOW_BASE_PRIMARY) %";" "}" "QPushButton#button_Tab_StatsWarn," "QPushButton#button_Tab_StatsSpeed," @@ -938,7 +943,7 @@ void getStyleSheet( QString& stylesheet ) "QPushButton#button_Tab_StatsRelat," "QPushButton#button_Tab_StatsGlob {" " border-radius: 22px;" - " background-color: "+style.at(STATS_SWITCH_BUTTONS)+";" + " background-color: "% style.at(STATS_SWITCH_BUTTONS) %";" "}" "QPushButton#button_Tab_StatsWarn::flat," "QPushButton#button_Tab_StatsSpeed::flat," @@ -946,7 +951,7 @@ void getStyleSheet( QString& stylesheet ) "QPushButton#button_Tab_StatsDay::flat," "QPushButton#button_Tab_StatsRelat::flat," "QPushButton#button_Tab_StatsGlob::flat {" - " background-color: "+style.at(STATS_SWITCH_BUTTONS_FLAT)+";" + " background-color: "% style.at(STATS_SWITCH_BUTTONS_FLAT) %";" "}" "QPushButton#button_Tab_StatsWarn::flat:hover," "QPushButton#button_Tab_StatsSpeed::flat:hover," @@ -954,34 +959,30 @@ void getStyleSheet( QString& stylesheet ) "QPushButton#button_Tab_StatsDay::flat:hover," "QPushButton#button_Tab_StatsRelat::flat:hover," "QPushButton#button_Tab_StatsGlob::flat:hover {" - " background-color: "+style.at(STATS_SWITCH_BUTTONS_FLAT_HOVER)+";" + " background-color: "% style.at(STATS_SWITCH_BUTTONS_FLAT_HOVER) %";" "}" // stacked pages "QStackedWidget#stackedPages_Stats {" - " border-top: 2px solid "+style.at(STATS_SWITCH_BUTTONS)+";" + " border-top: 2px solid "% style.at(STATS_SWITCH_BUTTONS) %";" " border-radius: 12px;" "}" - // draw buttons - "QPushButton#button_StatsWarn_Update::disabled {" - " icon: url(:/icons/icons/midtone/save.png);" - "}" // stats warn "QTableWidget#table_StatsWarn::indicator {" " width: 13px;" " height: 13px;" "}" "QTableWidget#table_StatsWarn::indicator:unchecked {" - " image: url(:/icons/icons/"+icons_theme+"/checkbox_unchecked.png);" + " image: url(:/icons/icons/"% icons_theme %"/checkbox_unchecked.png);" "}" "QTableWidget#table_StatsWarn::indicator:checked {" - " image: url(:/icons/icons/"+icons_theme+"/checkbox_checked.png);" + " image: url(:/icons/icons/"% icons_theme %"/checkbox_checked.png);" "}" "QTableWidget#table_StatsWarn QScrollBar::handle:vertical {" " padding: 12px;" "}" // stats count "QScrollArea#scrollArea_StatsCount {" - " background-color: "+style.at(WINDOW_BASE_PRIMARY)+";" + " background-color: "% style.at(WINDOW_BASE_PRIMARY) %";" "}" "QWidget#scrollAreaContent_StatsCount {" " background-color: transparent;" @@ -996,7 +997,7 @@ void getStyleSheet( QString& stylesheet ) "QPushButton#button_StatsCount_UserAgent," "QPushButton#button_StatsCount_Client {" " border-radius: 8px;" - " background-color: "+style.at(BUTTONS_BASE_DISABLED)+";" + " background-color: "% style.at(BUTTONS_BASE_DISABLED) %";" "}" "QPushButton#button_StatsCount_Protocol::flat," "QPushButton#button_StatsCount_Method::flat," @@ -1007,7 +1008,7 @@ void getStyleSheet( QString& stylesheet ) "QPushButton#button_StatsCount_Cookie::flat," "QPushButton#button_StatsCount_UserAgent::flat," "QPushButton#button_StatsCount_Client::flat {" - " background-color: "+style.at(WINDOW_BASE_SECONDARY)+";" + " background-color: "% style.at(WINDOW_BASE_SECONDARY) %";" "}" "QPushButton#button_StatsCount_Protocol::flat:hover," "QPushButton#button_StatsCount_Method::flat:hover," @@ -1018,47 +1019,47 @@ void getStyleSheet( QString& stylesheet ) "QPushButton#button_StatsCount_Cookie::flat:hover," "QPushButton#button_StatsCount_UserAgent::flat:hover," "QPushButton#button_StatsCount_Client::flat:hover {" - " background-color: "+style.at(BUTTONS_BASE)+";" + " background-color: "% style.at(BUTTONS_BASE) %";" "}" // stats globals "QPushButton#button_StatsGlob_Apache," "QPushButton#button_StatsGlob_Nginx," "QPushButton#button_StatsGlob_Iis {" " border-radius: 16px;" - " background-color: "+style.at(WEB_SERVERS_BUTTONS_BASE)+";" + " background-color: "% style.at(WEB_SERVERS_BUTTONS_BASE) %";" "}" "QPushButton#button_StatsGlob_Apache::flat," "QPushButton#button_StatsGlob_Nginx::flat," "QPushButton#button_StatsGlob_Iis::flat {" - " border: 1px solid "+style.at(WEB_SERVERS_BUTTONS_BORDER_FLAT)+";" - " color: "+style.at(WEB_SERVERS_BUTTONS_TEXT_FLAT)+";" - " background-color: "+style.at(WEB_SERVERS_BUTTONS_BASE_FLAT)+";" + " border: 1px solid "% style.at(WEB_SERVERS_BUTTONS_BORDER_FLAT) %";" + " color: "% style.at(WEB_SERVERS_BUTTONS_TEXT_FLAT) %";" + " background-color: "% style.at(WEB_SERVERS_BUTTONS_BASE_FLAT) %";" "}" "QPushButton#button_StatsGlob_Apache::flat:hover," "QPushButton#button_StatsGlob_Nginx::flat:hover," "QPushButton#button_StatsGlob_Iis::flat:hover {" - " border: 2px solid "+style.at(WEB_SERVERS_BUTTONS_BORDER_FLAT_HOVER)+";" - " color: "+style.at(WEB_SERVERS_BUTTONS_TEXT_FLAT_HOVER)+";" + " border: 2px solid "% style.at(WEB_SERVERS_BUTTONS_BORDER_FLAT_HOVER) %";" + " color: "% style.at(WEB_SERVERS_BUTTONS_TEXT_FLAT_HOVER) %";" "}" "QPushButton#button_StatsGlob_Apache::disabled," "QPushButton#button_StatsGlob_Nginx::disabled," "QPushButton#button_StatsGlob_Iis::disabled {" " border: 0px;" - " color: "+style.at(WEB_SERVERS_BUTTONS_TEXT_DISABLED)+";" - " background-color: "+style.at(WEB_SERVERS_BUTTONS_BASE_DISABLED)+";" + " color: "% style.at(WEB_SERVERS_BUTTONS_TEXT_DISABLED) %";" + " background-color: "% style.at(WEB_SERVERS_BUTTONS_BASE_DISABLED) %";" "}" "QScrollArea#scrollArea_StatsGlob_Recur," "QScrollArea#scrollArea_StatsGlob_Perf," "QScrollArea#scrollArea_StatsGlob_Traffic," "QScrollArea#scrollArea_StatsGlob_Work {" " border-radius: 8px;" - " background-color: "+style.at(STATS_GLOBALS_FRAMES)+";" + " background-color: "% style.at(STATS_GLOBALS_FRAMES) %";" "}" // styled frames "QFrame#frame_StatsWarn_Logs," "QFrame#frame_StatsDay_Date," "QFrame#frame_StatsRelat_Field {" - " border: 1px solid "+style.at(BORDER_TERTIARY)+";" + " border: 1px solid "% style.at(BORDER_TERTIARY) %";" "}" // lines separators "QFrame#gline_StatsWarn_1," @@ -1067,14 +1068,14 @@ void getStyleSheet( QString& stylesheet ) "QFrame#gline_StatsDay_1," "QFrame#gline_StatsDay_2," "QFrame#gline_StatsRelat_1 {" - " border: 1px solid "+style.at(SEPARATORS_BORDER)+";" - " background-color: "+style.at(SEPARATORS_BASE)+";" + " border: 1px solid "% style.at(SEPARATORS_BORDER) %";" + " background-color: "% style.at(SEPARATORS_BASE) %";" "}" "QFrame#gline_StatsSpeed_1," "QFrame#gline_StatsCount_1 {" - " border: 1px solid "+style.at(SEPARATORS_BORDER)+";" + " border: 1px solid "% style.at(SEPARATORS_BORDER) %";" " margin: 2px 0px 3px 0px;" - " background-color: "+style.at(SEPARATORS_BASE)+";" + " background-color: "% style.at(SEPARATORS_BASE) %";" "}" "QFrame#gline_StatsGlob_Recur_1," "QFrame#gline_StatsGlob_Recur_2," @@ -1085,14 +1086,14 @@ void getStyleSheet( QString& stylesheet ) "QFrame#gline_StatsGlob_Traffic_2," "QFrame#gline_StatsGlob_Work_1," "QFrame#gline_StatsGlob_Work_2 {" - " border: 1px solid "+style.at(STATS_GLOBALS_FRAMES)+";" - " background-color: "+style.at(SEPARATORS_BASE)+";" + " border: 1px solid "% style.at(STATS_GLOBALS_FRAMES) %";" + " background-color: "% style.at(SEPARATORS_BASE) %";" "}" ///////////////// //// CONFIGS //// // sections "QTreeView#tree_ConfSections {" - " background-color: "+style.at(CONFIGS_TREE_BASE)+";" + " background-color: "% style.at(CONFIGS_TREE_BASE) %";" "}" "QTreeView#tree_ConfSections QScrollBar::sub-line:vertical {" " margin-top: -12px;" @@ -1106,9 +1107,9 @@ void getStyleSheet( QString& stylesheet ) "}" // line separators "QFrame#gline_ConfTextBrowser {" - " border: 2px solid "+style.at(SEPARATORS_BORDER)+";" + " border: 2px solid "% style.at(SEPARATORS_BORDER) %";" " margin: 13px 0px 14px 0px;" - " background-color: "+style.at(SEPARATORS_BASE)+";" + " background-color: "% style.at(SEPARATORS_BASE) %";" "}" // save buttons "QPushButton#button_ConfDatabases_Data_Save," @@ -1120,7 +1121,7 @@ void getStyleSheet( QString& stylesheet ) "QPushButton#button_ConfIis_Path_Save," "QPushButton#button_ConfIis_Format_Save {" " border-radius: 4px;" - " background-color: "+style.at(BUTTONS_BASE)+";" + " background-color: "% style.at(BUTTONS_BASE) %";" "}" "QPushButton#button_ConfDatabases_Data_Save:hover," "QPushButton#button_ConfDatabases_Hashes_Save:hover," @@ -1130,7 +1131,7 @@ void getStyleSheet( QString& stylesheet ) "QPushButton#button_ConfNginx_Format_Save:hover," "QPushButton#button_ConfIis_Path_Save:hover," "QPushButton#button_ConfIis_Format_Save:hover {" - " background-color: "+style.at(BUTTONS_BASE_HOVER)+";" + " background-color: "% style.at(BUTTONS_BASE_HOVER) %";" "}" "QPushButton#button_ConfDatabases_Data_Save::disabled," "QPushButton#button_ConfDatabases_Hashes_Save::disabled," @@ -1140,7 +1141,7 @@ void getStyleSheet( QString& stylesheet ) "QPushButton#button_ConfNginx_Format_Save::disabled," "QPushButton#button_ConfIis_Path_Save::disabled," "QPushButton#button_ConfIis_Format_Save::disabled {" - " background-color: "+style.at(BUTTONS_BASE_DISABLED)+";" + " background-color: "% style.at(BUTTONS_BASE_DISABLED) %";" " icon: url(:/icons/icons/midtone/save.png);" "}" // sample buttons @@ -1148,33 +1149,33 @@ void getStyleSheet( QString& stylesheet ) "QPushButton#button_ConfNginx_Format_Sample," "QPushButton#button_ConfIis_Format_Sample {" " border-radius: 8px;" - " background-color: "+style.at(BUTTONS_BASE)+";" + " background-color: "% style.at(BUTTONS_BASE) %";" "}" "QPushButton#button_ConfApache_Format_Sample:hover," "QPushButton#button_ConfNginx_Format_Sample:hover," "QPushButton#button_ConfIis_Format_Sample:hover {" - " background-color: "+style.at(BUTTONS_BASE_HOVER)+";" + " background-color: "% style.at(BUTTONS_BASE_HOVER) %";" "}" // sample previews "QScrollArea#scrollArea_ConfApache_Format_Sample," "QScrollArea#scrollArea_ConfNginx_Format_Sample," "QScrollArea#scrollArea_ConfIis_Format_Sample {" - " border: 1px solid "+style.at(BORDER_SECONDARY)+";" + " border: 1px solid "% style.at(BORDER_SECONDARY) %";" " border-top-left-radius: 4px;" " border-top-right-radius: 4px;" - " background-color: "+style.at(TEXTBROWSER_BASE)+";" + " background-color: "% style.at(TEXTBROWSER_BASE) %";" "}" // help buttons "QPushButton#button_ConfApache_Format_Help," "QPushButton#button_ConfNginx_Format_Help," "QPushButton#button_ConfIis_Format_Help {" " border-radius: 8px;" - " background-color: "+style.at(HELP_BUTTONS_BASE)+";" + " background-color: "% style.at(HELP_BUTTONS_BASE) %";" "}" "QPushButton#button_ConfApache_Format_Help:hover," "QPushButton#button_ConfNginx_Format_Help:hover," "QPushButton#button_ConfIis_Format_Help:hover {" - " background-color: "+style.at(HELP_BUTTONS_BASE_HOVER)+";" + " background-color: "% style.at(HELP_BUTTONS_BASE_HOVER) %";" "}" // warnlists / blacklists "QListWidget#list_ConfApache_Warnlist_List," @@ -1184,7 +1185,7 @@ void getStyleSheet( QString& stylesheet ) "QListWidget#list_ConfIis_Warnlist_List," "QListWidget#list_ConfIis_Blacklist_List {" " padding: 4px;" - " border: 1px solid "+style.at(BORDER_PRIMARY)+";" + " border: 1px solid "% style.at(BORDER_PRIMARY) %";" "}" "QListWidget#list_ConfApache_Warnlist_List::disabled," "QListWidget#list_ConfApache_Blacklist_List::disabled," @@ -1193,9 +1194,9 @@ void getStyleSheet( QString& stylesheet ) "QListWidget#list_ConfIis_Warnlist_List::disabled," "QListWidget#list_ConfIis_Blacklist_List::disabled {" " border: 0px;" - " color: "+style.at(TEXT_DISABLED)+";" - " background-color: "+style.at(TABLES_BASE_DISABLED)+";" - " selection-background-color: "+style.at(TABLES_BASE_DISABLED)+";" + " color: "% style.at(TEXT_DISABLED) %";" + " background-color: "% style.at(TABLES_BASE_DISABLED) %";" + " selection-background-color: "% style.at(TABLES_BASE_DISABLED) %";" "}" "QListWidget#list_ConfApache_Warnlist_List::item," "QListWidget#list_ConfApache_Blacklist_List::item," @@ -1231,7 +1232,7 @@ void getStyleSheet( QString& stylesheet ) "QPushButton#button_ConfIis_Blacklist_Up," "QPushButton#button_ConfIis_Blacklist_Down {" " border-radius: 4px;" - " background-color: "+style.at(BWLISTS_BUTTONS_BASE)+";" + " background-color: "% style.at(BWLISTS_BUTTONS_BASE) %";" "}" "QPushButton#button_ConfApache_Warnlist_Add:hover," "QPushButton#button_ConfApache_Warnlist_Remove:hover," @@ -1257,7 +1258,7 @@ void getStyleSheet( QString& stylesheet ) "QPushButton#button_ConfIis_Blacklist_Remove:hover," "QPushButton#button_ConfIis_Blacklist_Up:hover," "QPushButton#button_ConfIis_Blacklist_Down:hover {" - " background-color: "+style.at(BWLISTS_BUTTONS_BASE_HOVER)+";" + " background-color: "% style.at(BWLISTS_BUTTONS_BASE_HOVER) %";" "}" "QPushButton#button_ConfApache_Warnlist_Add::disabled," "QPushButton#button_ConfApache_Blacklist_Add::disabled," @@ -1265,8 +1266,8 @@ void getStyleSheet( QString& stylesheet ) "QPushButton#button_ConfNginx_Blacklist_Add::disabled," "QPushButton#button_ConfIis_Warnlist_Add::disabled," "QPushButton#button_ConfIis_Blacklist_Add::disabled {" - " background-color: "+style.at(BWLISTS_BUTTONS_BASE_DISABLED)+";" - " icon: url(:/icons/icons/"+icons_theme+"/list_add.png), #fff;" + " background-color: "% style.at(BWLISTS_BUTTONS_BASE_DISABLED) %";" + " icon: url(:/icons/icons/"% icons_theme %"/list_add.png), #fff;" "}" "QPushButton#button_ConfApache_Warnlist_Remove::disabled," "QPushButton#button_ConfApache_Blacklist_Remove::disabled," @@ -1274,8 +1275,8 @@ void getStyleSheet( QString& stylesheet ) "QPushButton#button_ConfNginx_Blacklist_Remove::disabled," "QPushButton#button_ConfIis_Warnlist_Remove::disabled," "QPushButton#button_ConfIis_Blacklist_Remove::disabled {" - " background-color: "+style.at(BWLISTS_BUTTONS_BASE_DISABLED)+";" - " icon: url(:/icons/icons/"+icons_theme+"/list_rem.png), #fff;" + " background-color: "% style.at(BWLISTS_BUTTONS_BASE_DISABLED) %";" + " icon: url(:/icons/icons/"% icons_theme %"/list_rem.png), #fff;" "}" "QPushButton#button_ConfApache_Warnlist_Up::disabled," "QPushButton#button_ConfApache_Blacklist_Up::disabled," @@ -1283,8 +1284,8 @@ void getStyleSheet( QString& stylesheet ) "QPushButton#button_ConfNginx_Blacklist_Up::disabled," "QPushButton#button_ConfIis_Warnlist_Up::disabled," "QPushButton#button_ConfIis_Blacklist_Up::disabled {" - " background-color: "+style.at(BWLISTS_BUTTONS_BASE_DISABLED)+";" - " icon: url(:/icons/icons/"+icons_theme+"/list_up.png), #fff;" + " background-color: "% style.at(BWLISTS_BUTTONS_BASE_DISABLED) %";" + " icon: url(:/icons/icons/"% icons_theme %"/list_up.png), #fff;" "}" "QPushButton#button_ConfApache_Warnlist_Down::disabled," "QPushButton#button_ConfApache_Blacklist_Down::disabled," @@ -1292,8 +1293,8 @@ void getStyleSheet( QString& stylesheet ) "QPushButton#button_ConfNginx_Blacklist_Down::disabled," "QPushButton#button_ConfIis_Warnlist_Down::disabled," "QPushButton#button_ConfIis_Blacklist_Down::disabled {" - " background-color: "+style.at(BWLISTS_BUTTONS_BASE_DISABLED)+";" - " icon: url(:/icons/icons/"+icons_theme+"/list_down.png), #fff;" + " background-color: "% style.at(BWLISTS_BUTTONS_BASE_DISABLED) %";" + " icon: url(:/icons/icons/"% icons_theme %"/list_down.png), #fff;" "}" "QPushButton#button_ConfApache_Warnlist_Add::flat," "QPushButton#button_ConfApache_Warnlist_Remove::flat," @@ -1319,7 +1320,7 @@ void getStyleSheet( QString& stylesheet ) "QPushButton#button_ConfIis_Blacklist_Remove::flat," "QPushButton#button_ConfIis_Blacklist_Up::flat," "QPushButton#button_ConfIis_Blacklist_Down::flat {" - " background-color: "+style.at(BWLISTS_BUTTONS_BASE_FLAT)+";" + " background-color: "% style.at(BWLISTS_BUTTONS_BASE_FLAT) %";" " icon: none;" "}"; } diff --git a/logdoctor/utilities/stylesheets.h b/logdoctor/utilities/stylesheets.h index 7cccad16..ae6e0d81 100644 --- a/logdoctor/utilities/stylesheets.h +++ b/logdoctor/utilities/stylesheets.h @@ -12,11 +12,11 @@ class QString; namespace StyleSec { -//! Provides the requested stylesheet +//! Returns the proper style sheet /*! - \param stylesheet Will hold the stylesheet + \throw DoNotCatchException */ -void getStyleSheet( QString& stylesheet ); +QString getStyleSheet(); } // namespace StyleSec diff --git a/logdoctor/utilities/vectors.h b/logdoctor/utilities/vectors.h index da37927a..be201fd2 100644 --- a/logdoctor/utilities/vectors.h +++ b/logdoctor/utilities/vectors.h @@ -20,7 +20,7 @@ namespace VecOps \return Whether the list does contain the flag or not */ template -inline bool contains( const std::vector& list, const T& flag ) +inline bool contains( const std::vector& list, const T& flag ) noexcept { return std::any_of( list.cbegin(), list.cend(), [&flag]( const T& item ) diff --git a/version.txt b/version.txt index 85d9d342..587ba81b 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -.:!¦version¦!:.3.00.:!¦version¦!:. +.:!¦version¦!:.4.00.:!¦version¦!:.