QuasarAppLib
optiondata.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021-2025 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
9#include "optiondata.h"
10
11namespace QuasarAppUtils{
12
13OptionData::OptionData(const QStringList& name,
14 const QString& arguments,
15 const QString& description,
16 const QString& example,
17 const QString& depricatedMsg,
18 bool removed) {
19
20 setNames(name);
25 _removed = removed;
26}
27
28const QStringList &OptionData::names() const {
29 return _name;
30}
31
32void OptionData::setNames(const QStringList &newName) {
33 _name = newName;
34}
35
36const QString &OptionData::description() const {
37 return _description;
38}
39
40void OptionData::setDescription(const QString &newDescription) {
41 _description = newDescription;
42}
43
44const QString &OptionData::example() const {
45 return _example;
46}
47
48void OptionData::setExample(const QString &newExample) {
49 _example = newExample;
50}
51
52const QString &OptionData::arguments() const {
53 return _arguments;
54}
55
56void OptionData::setArguments(const QString &newArguments) {
57 _arguments = newArguments;
58}
59
60const QString &OptionData::depricatedMsg() const {
61 return _depricatedMsg;
62}
63
64void OptionData::setDepricatedMsg(const QString &newDepricatedMsg) {
65 _depricatedMsg = newDepricatedMsg;
66}
67
69 return _removed;
70}
71
73 return depricatedMsg().size();
74}
75
77 QString left = names().join(" / ") + " " + arguments();
78
79 QString right = description();
80 if (example().size()) {
81 right += " Example: " + example();
82 }
83
84 return {{left, {right}}};
85}
86
87bool OptionData::isValid() const {
88 return names().size();
89}
90}
void setExample(const QString &newExample)
setExample This method sets a new example value of this option
bool isDepricated() const
isDepricated This method return true if this option is depricated.
const QString & example() const
example This is example of use string.
void setDepricatedMsg(const QString &newDepricatedMsg)
setDepricatedMsg This method sets new value of the depricated warnning message of this option.
void setNames(const QStringList &newNames)
setNames This method sets new value of the option name.
void setDescription(const QString &newDescription)
setDescription This method sets new description of this options.
Help::Options toHelp() const
toHelp This method convert this option into help line. The help line have next structure :
bool isValid() const
isValid This method return true if the option is valid. If option do not contain a name then it is in...
void setArguments(const QString &newArguments)
setArguments This method sets new value of the options arguments
const QString & depricatedMsg() const
depricatedWarning This is a message that will be printed as a warning if user will use this option....
const QString & description() const
description This is description message of this option.
OptionData(const QStringList &names, const QString &arguments="", const QString &description="", const QString &example="", const QString &depricatedMsg="", bool removed=false)
OptionData This is main constructor.
bool isRemoved() const
isRemoved This method return true if the option is removed.
const QString & arguments() const
arguments This is input arguments of this option or help meesage about arguments.
const QStringList & names() const
name This is name of the option. It is a required argument and cannot be empty.
QMultiMap< QString, QString > Options
Options this is list of key-descriptions pairs of help. The key is name of the available argument and...
Definition helpdata.h:32
The QuasaraAppUtils class This lib include base functions for the all applications of QuasarApp group...
Definition helpdata.cpp:18