QuasarAppLib
1.0.530.c9fba11
Toggle main menu visibility
params.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2018-2026 QuasarApp.
3
* Distributed under the lgplv3 software license, see the accompanying
4
* Everyone is permitted to copy and distribute verbatim copies
5
* of this license document, but changing it is not allowed.
6
*/
7
8
#ifndef PARAMS_H
9
#define PARAMS_H
10
11
#include <QMap>
12
#include <QVariant>
13
#include "
quasarapp_global.h
"
14
#include "
helpdata.h
"
15
#include "
optiondata.h
"
16
17
namespace
QuasarAppUtils
{
18
19
23
enum
VerboseLvl
{
25
Error
= 0x0,
27
Warning
= 0x1,
29
Info
= 0x2,
31
Debug
= 0x3,
32
33
};
34
#ifdef QA_DISABLE_LOG
35
#define DEFAULT_VERBOSE_LVL "0"
36
#else
37
#ifdef QT_DEBUG
38
#define DEFAULT_VERBOSE_LVL "3"
39
#else
40
#define DEFAULT_VERBOSE_LVL "2"
41
#endif
42
#endif
43
64
class
QUASARAPPSHARED_EXPORT
Params
65
{
66
public
:
67
Params
() =
delete
;
68
77
static
bool
parseParams
(
const
int
argc,
const
char
*argv[],
const
OptionsDataList
& options = {});
78
87
static
bool
parseParams(
int
argc,
char
*argv[],
const
OptionsDataList
& options = {});
88
96
static
bool
parseParams(
const
QStringList& paramsArray,
const
OptionsDataList& options = {});
97
105
static
QString getArg(
const
QString& key,
const
QString &def = {});
106
112
static
void
setArg(
const
QString& key,
const
QString& val);
113
120
static
void
setEnable(
const
QString& key,
bool
enable);
121
127
static
bool
isEndable(
const
QString& key);
128
136
[[deprecated(
"Use QALogger and qt debug functions(qDebug, qInfo, qError...)"
)]]
137
static
void
log(
const
QString& log, VerboseLvl vLvl = VerboseLvl::Debug);
138
143
static
VerboseLvl
getVerboseLvl();
144
149
static
bool
isDebug();
150
155
[[deprecated(
"Use Qt MACROSSSES"
)]]
156
static
bool
isDebugBuild();
157
162
static
int
size();
163
167
static
void
showHelp();
168
179
static
void
showHelpForInputOptions();
180
185
static
Help::Section getHelpOfInputOptions();
186
192
static
const
Help::Section& getHelp();
193
198
static
const
QMap<QString, QString> &getUserParamsMap();
199
203
static
void
clearParsedData();
204
209
static
QString getCurrentExecutable();
210
215
static
QString getCurrentExecutableDir();
216
221
static
OptionsDataList
availableArguments();
222
223
private
:
224
235
static
bool
optionsForEach(
const
QStringList& paramsArray,
236
const
OptionsDataList &availableOptions);
237
243
static
void
printWorkingOptions();
244
250
static
bool
checkOption(
const
OptionData &option,
const
QString &rawOptionName);
251
258
static
void
parseAvailableOptions(
const
OptionsDataList& availableOptionsListIn,
259
OptionsDataList* availableOptionsListOut,
260
Help::Section* helpOut);
261
262
264
static
QMap<QString, QString> params;
265
267
static
OptionsDataList
inputOptions;
268
270
static
Help::Section userHelp;
271
273
static
QString appPath;
274
276
static
QString appName;
277
278
};
279
}
280
281
#endif
// PARAMS_H
QuasarAppUtils::Params::Params
Params()=delete
QuasarAppUtils::Params::parseParams
static bool parseParams(const int argc, const char *argv[], const OptionsDataList &options={})
parseParams Parse input data of started application.
Definition
params.cpp:193
helpdata.h
QuasarAppUtils
The QuasarAppUtils namespace contains the base functions for all applications of the QuasarApp group....
Definition
crc32constexper.h:16
QuasarAppUtils::OptionsDataList
QMultiHash< QString, OptionData > OptionsDataList
OptionsList is Hash map of the OptionData items. Where the key it is group name and value it is optio...
Definition
optiondata.h:150
QuasarAppUtils::VerboseLvl
VerboseLvl
The VerboseLvl enum uses for sets log level.
Definition
params.h:23
QuasarAppUtils::Error
@ Error
Error message. This logs will marked as a Error and printing if the verbose lvl >= 0.
Definition
params.h:25
QuasarAppUtils::Warning
@ Warning
Warning message. This logs will marked as a Warning and printing if the verbose lvl >= 1.
Definition
params.h:27
QuasarAppUtils::Info
@ Info
General information. This logs will marked as a Info and and printing if the verbose lvl >= 2.
Definition
params.h:29
QuasarAppUtils::Debug
@ Debug
Debug message. This logs will marked as a Debug and printing if the verbose lvl >= 3.
Definition
params.h:31
optiondata.h
quasarapp_global.h
QUASARAPPSHARED_EXPORT
#define QUASARAPPSHARED_EXPORT
Definition
quasarapp_global.h:11
params.h
Generated by
1.18.0