Add helper functions -> QCommandLineParser reported some warnings
This commit is contained in:
		
							
								
								
									
										81
									
								
								common/include/commandline_parser.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								common/include/commandline_parser.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,81 @@
 | 
			
		||||
#ifndef COMMAND_LINE_PARSER_H_INCLUDED
 | 
			
		||||
#define COMMAND_LINE_PARSER_H_INCLUDED
 | 
			
		||||
 | 
			
		||||
#include <QCoreApplication>
 | 
			
		||||
#include <QCommandLineParser>
 | 
			
		||||
#include <QCommandLineOption>
 | 
			
		||||
#include <QString>
 | 
			
		||||
 | 
			
		||||
class CommandLineParser : public QCommandLineParser {
 | 
			
		||||
    QString m_repositoryUrl;
 | 
			
		||||
    QString m_plugInDir;
 | 
			
		||||
    QString m_plugInName;
 | 
			
		||||
    QString m_workingDir;
 | 
			
		||||
    QString m_psaConfigDir{"etc/psa_config"};
 | 
			
		||||
    QString m_psaTariffDir{"etc/psa_tariff"};
 | 
			
		||||
    QString m_dryRun;
 | 
			
		||||
    QString m_noUpdatePsaHardware;
 | 
			
		||||
    QString m_showYoctoVersion;
 | 
			
		||||
    QString m_showYoctoInstallStatus;
 | 
			
		||||
    QString m_showExtendedVersion;
 | 
			
		||||
    QString m_iniFileName;
 | 
			
		||||
    QString m_alwaysDownloadConfig;
 | 
			
		||||
    QString m_alwaysDownloadDC;
 | 
			
		||||
    QString m_readDCVersion{"false"};
 | 
			
		||||
    QString m_dcDir{"etc/dc/"};
 | 
			
		||||
    qint64 m_ppid;
 | 
			
		||||
 | 
			
		||||
    QCommandLineOption m_repositoryUrlOption;
 | 
			
		||||
    QCommandLineOption m_iniFileDirectoryOption;
 | 
			
		||||
    QCommandLineOption m_iniFileNameOption;
 | 
			
		||||
    QCommandLineOption m_pluginDirectoryOption;
 | 
			
		||||
    QCommandLineOption m_pluginNameOption;
 | 
			
		||||
    QCommandLineOption m_noDownloadOption;
 | 
			
		||||
    QCommandLineOption m_alwaysDownloadConfigOption;
 | 
			
		||||
    QCommandLineOption m_alwaysDownloadDCOption;
 | 
			
		||||
    QCommandLineOption m_workingDirectoryOption;
 | 
			
		||||
    QCommandLineOption m_psaConfigDirectoryOption;
 | 
			
		||||
    QCommandLineOption m_psaTariffDirectoryOption;
 | 
			
		||||
    QCommandLineOption m_dryRunOption;
 | 
			
		||||
    QCommandLineOption m_extendedVersionOption;
 | 
			
		||||
    QCommandLineOption m_yoctoVersionOption;
 | 
			
		||||
    QCommandLineOption m_yoctoInstallStatusOption;
 | 
			
		||||
    QCommandLineOption m_dcDirectoryOption;
 | 
			
		||||
    QCommandLineOption m_readDCVersionOption;
 | 
			
		||||
    QCommandLineOption m_setPPid;
 | 
			
		||||
 | 
			
		||||
    QCommandLineParser m_parser;
 | 
			
		||||
 | 
			
		||||
    void configure();
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
    explicit CommandLineParser();
 | 
			
		||||
    ~CommandLineParser() = default;
 | 
			
		||||
 | 
			
		||||
    QCommandLineParser &parser() { return m_parser; }
 | 
			
		||||
    QCommandLineParser const &parser() const { return m_parser; }
 | 
			
		||||
    void process(const QCoreApplication &app) { m_parser.process(app); }
 | 
			
		||||
    bool isSet(QCommandLineOption const &o) { return m_parser.isSet(o); }
 | 
			
		||||
    bool isSet(QString const& s) {return m_parser.isSet(s); }
 | 
			
		||||
    bool addOption(QCommandLineOption const &o) { return m_parser.addOption(o); }
 | 
			
		||||
    QString const &iniFileName() const { return m_iniFileName; }
 | 
			
		||||
    void readSettings();
 | 
			
		||||
    QString repositoryUrl();
 | 
			
		||||
    QString plugInDir();
 | 
			
		||||
    QString plugInName();
 | 
			
		||||
    QString workingDir();
 | 
			
		||||
    QString psaConfigDir();
 | 
			
		||||
    QString psaTariffDir();
 | 
			
		||||
    bool dryRun();
 | 
			
		||||
    qint64 ppid();
 | 
			
		||||
    bool noUpdatePsaHardware();
 | 
			
		||||
    bool yoctoVersion();
 | 
			
		||||
    bool yoctoInstallStatus();
 | 
			
		||||
    bool extendedVersion();
 | 
			
		||||
    bool alwaysDownloadConfig();
 | 
			
		||||
    bool alwaysDownloadDC();
 | 
			
		||||
    bool readDCVersion();
 | 
			
		||||
    QString dcDir();
 | 
			
		||||
};
 | 
			
		||||
#endif // COMMAND_LINE_PARSER_H_INCLUDED
 | 
			
		||||
		Reference in New Issue
	
	Block a user