2008-07-26 15:26:19 +00:00
|
|
|
/*
|
2024-03-29 10:09:48 +01:00
|
|
|
Copyright 2006-2024 The QElectroTech Team
|
2008-07-26 15:26:19 +00:00
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#ifndef QET_ARGUMENTS_H
|
|
|
|
#define QET_ARGUMENTS_H
|
|
|
|
#include <QtCore>
|
|
|
|
/**
|
2012-11-09 21:09:24 +00:00
|
|
|
This class represents a set of arguments the application has received as
|
|
|
|
parameters. Initialized from a list of strings, an instance of this class
|
|
|
|
provides access to the differents options and files given on the command line.
|
2008-07-26 15:26:19 +00:00
|
|
|
*/
|
|
|
|
class QETArguments : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// constructors, destructor
|
2008-07-26 15:26:19 +00:00
|
|
|
public:
|
2017-08-05 02:06:59 +00:00
|
|
|
QETArguments(QObject * = nullptr);
|
|
|
|
QETArguments(const QList<QString> &, QObject * = nullptr);
|
2008-07-26 15:26:19 +00:00
|
|
|
QETArguments(const QETArguments &);
|
|
|
|
QETArguments &operator=(const QETArguments &);
|
2017-08-05 02:10:01 +00:00
|
|
|
~QETArguments() override;
|
2008-07-26 15:26:19 +00:00
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// methods
|
2008-07-26 15:26:19 +00:00
|
|
|
public:
|
|
|
|
virtual void setArguments(const QList<QString> &);
|
|
|
|
virtual QList<QString> arguments() const;
|
|
|
|
virtual QList<QString> files() const;
|
|
|
|
virtual QList<QString> projectFiles() const;
|
|
|
|
virtual QList<QString> elementFiles() const;
|
2012-04-09 15:27:15 +00:00
|
|
|
virtual QList<QString> titleBlockTemplateFiles() const;
|
2008-07-26 15:26:19 +00:00
|
|
|
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
|
|
|
|
virtual bool commonElementsDirSpecified() const;
|
|
|
|
virtual QString commonElementsDir() const;
|
|
|
|
#endif
|
2012-01-08 17:04:34 +00:00
|
|
|
#ifdef QET_ALLOW_OVERRIDE_CTBTD_OPTION
|
|
|
|
virtual bool commonTitleBlockTemplatesDirSpecified() const;
|
|
|
|
virtual QString commonTitleBlockTemplatesDir() const;
|
|
|
|
#endif
|
2008-07-26 15:26:19 +00:00
|
|
|
#ifdef QET_ALLOW_OVERRIDE_CD_OPTION
|
|
|
|
virtual bool configDirSpecified() const;
|
|
|
|
virtual QString configDir() const;
|
|
|
|
#endif
|
2008-08-17 21:08:31 +00:00
|
|
|
virtual bool langDirSpecified() const;
|
|
|
|
virtual QString langDir() const;
|
2008-07-26 15:26:19 +00:00
|
|
|
virtual bool printHelpRequested() const;
|
|
|
|
virtual bool printLicenseRequested() const;
|
|
|
|
virtual bool printVersionRequested() const;
|
|
|
|
virtual QList<QString> options() const;
|
|
|
|
virtual QList<QString> unknownOptions() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void clear();
|
|
|
|
void parseArguments(const QList<QString> &);
|
|
|
|
void handleFileArgument(const QString &);
|
|
|
|
void handleOptionArgument(const QString &);
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// attributes
|
2008-07-26 15:26:19 +00:00
|
|
|
private:
|
|
|
|
QList<QString> project_files_;
|
|
|
|
QList<QString> element_files_;
|
2012-04-09 15:27:15 +00:00
|
|
|
QList<QString> tbt_files_;
|
2008-07-26 15:26:19 +00:00
|
|
|
QList<QString> options_;
|
|
|
|
QList<QString> unknown_options_;
|
|
|
|
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
|
|
|
|
QString common_elements_dir_;
|
|
|
|
#endif
|
2012-01-08 17:04:34 +00:00
|
|
|
#ifdef QET_ALLOW_OVERRIDE_CTBTD_OPTION
|
|
|
|
QString common_tbt_dir_;
|
|
|
|
#endif
|
2008-07-26 15:26:19 +00:00
|
|
|
#ifdef QET_ALLOW_OVERRIDE_CD_OPTION
|
|
|
|
QString config_dir_;
|
|
|
|
#endif
|
2008-08-17 21:08:31 +00:00
|
|
|
QString lang_dir_;
|
2008-07-26 15:26:19 +00:00
|
|
|
bool print_help_;
|
|
|
|
bool print_license_;
|
|
|
|
bool print_version_;
|
|
|
|
};
|
|
|
|
#endif
|