-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathoptiondata.h
152 lines (127 loc) · 5.35 KB
/
optiondata.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
* Copyright (C) 2021-2025 QuasarApp.
* Distributed under the lgplv3 software license, see the accompanying
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
*/
#ifndef OPTIONDATA_H
#define OPTIONDATA_H
#include "quasarapp_global.h"
#include "helpdata.h"
namespace QuasarAppUtils{
/**
* @brief The OptionData class contains information about one option.
*/
class QUASARAPPSHARED_EXPORT OptionData
{
public:
/**
* @brief OptionData This is main constructor
* @param names This is names list of the option. It is a required argument and cannot be empty.
* @param arguments This is input arguments of this option or help meesage about arguments.
* @param description This is description message of this option.
* @param example This is example of use string.
* @param depricatedMsg This is a message that will be printed as a warning if user will use this option. If you set this argument to empty value then warning message will be ignored and option not be marked asa a depricated. An option will be marked as a depricated when this arguments will not equal empty string.
* @param removed This option show depricatedMsg as a error and force the parseParams method return false. This option will be ignored if the depricatedMsg will be empty.
*/
OptionData(const QStringList& names,
const QString& arguments = "",
const QString& description = "",
const QString& example = "",
const QString& depricatedMsg = "",
bool removed = false);
/**
* @brief name This is name of the option. It is a required argument and cannot be empty.
* @return return name of this option.
*/
const QStringList &names() const;
/**
* @brief description This is description message of this option.
* @return return description of this option.
*/
const QString &description() const;
/**
* @brief example This is example of use string.
* @return return example if use of this option.
*/
const QString &example() const;
/**
* @brief arguments This is input arguments of this option or help meesage about arguments.
* @return return arguments of this option.
*/
const QString &arguments() const;
/**
* @brief depricatedWarning This is a message that will be printed as a warning if user will use this option. If you set this argument to empty value then warning message will be ignored and option not be marked asa a depricated. An option will be marked as a depricated when this arguments will not equal empty string.
* @note if this value is empty the option are not depricated.
* @return warning meessage of the depricated options.
*/
const QString &depricatedMsg() const;
/**
* @brief toHelp This method convert this option into help line.
* The help line have next structure :
*
* Key: {name [arguments]}
* Value: {description examples}
* @return The Help::Options set with one line.
*/
Help::Options toHelp() const;
/**
* @brief isValid This method return true if the option is valid. If option do not contain a name then it is invalid.
* @return true if the option valid else false.
*/
bool isValid() const;
/**
* @brief isRemoved This method return true if the option is removed.
* @return true if option is removed else false.
*/
bool isRemoved() const;
/**
* @brief isDepricated This method return true if this option is depricated.
* @return true if options is depricated else false
*/
bool isDepricated() const;
protected:
/**
* @brief setNames This method sets new value of the option name.
* @param newNames This is a new value of the options name.
* @note see the OptionData::name method.
*/
void setNames(const QStringList &newNames);
/**
* @brief setDescription This method sets new description of this options.
* @param newDescription This is new value of optons description
* @note See the OptionData::description method.
*/
void setDescription(const QString &newDescription);
/**
* @brief setExample This method sets a new example value of this option
* @param newExample This is a new value of the options example.
* @note See the OptionData::example method.
*/
void setExample(const QString &newExample);
/**
* @brief setArguments This method sets new value of the options arguments
* @param newArguments new value of the options arguments
* @note See the OptionData::arguments method.
*/
void setArguments(const QString &newArguments);
/**
* @brief setDepricatedMsg This method sets new value of the depricated warnning message of this option.
* @param newDepricatedMsg This is new value of the depricated message.
* @note See the OptionData::depricatedMsg method.
*/
void setDepricatedMsg(const QString &newDepricatedMsg);
private:
QStringList _name;
QString _description;
QString _example;
QString _arguments;
QString _depricatedMsg;
bool _removed;
};
/**
* @brief OptionsList is Hash map of the OptionData items. Where the key it is group name and value it is option data.
*/
typedef QMultiHash<QString, OptionData> OptionsDataList;
}
#endif // OPTIONDATA_H