Refactoring. Fixing Clang-Tidy warnings.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-12-27 20:22:42 +02:00
parent e108a1378f
commit 349863b033
2 changed files with 489 additions and 480 deletions

File diff suppressed because it is too large Load diff

View file

@ -39,16 +39,30 @@
#include "../vmisc/vsysexits.h" #include "../vmisc/vsysexits.h"
class VCommandLine; class VCommandLine;
typedef std::shared_ptr<VCommandLine> VCommandLinePtr; using VCommandLinePtr = std::shared_ptr<VCommandLine>;
typedef QList<QCommandLineOption *> VCommandLineOptions; using VLayoutGeneratorPtr = std::shared_ptr<VLayoutGenerator>;
typedef std::shared_ptr<VLayoutGenerator> VLayoutGeneratorPtr;
class VCommandLineOption : public QCommandLineOption
{
public:
VCommandLineOption()
: QCommandLineOption(QStringLiteral("fakeOption")) {}
VCommandLineOption(const QString &name, const QString &description, const QString &valueName = QString(),
const QString &defaultValue = QString())
: QCommandLineOption(name, description, valueName, defaultValue) {}
VCommandLineOption(const QStringList &names, const QString &description, const QString &valueName = QString(),
const QString &defaultValue = QString())
: QCommandLineOption(names, description, valueName, defaultValue) {}
};
//@brief: class used to install export command line options and parse their values //@brief: class used to install export command line options and parse their values
//QCommandLineParser* object must exists until this object alive //QCommandLineParser* object must exists until this object alive
class VCommandLine class VCommandLine
{ {
public: public:
virtual ~VCommandLine(); virtual ~VCommandLine() = default;
//@brief creates object and applies export related options to parser //@brief creates object and applies export related options to parser
@ -83,10 +97,10 @@ public:
//@brief returns export type set, defaults 0 - svg //@brief returns export type set, defaults 0 - svg
int OptExportType() const; int OptExportType() const;
int IsBinaryDXF() const; bool IsBinaryDXF() const;
int IsTextAsPaths() const; bool IsTextAsPaths() const;
int IsExportOnlyDetails() const; bool IsExportOnlyDetails() const;
int IsCSVWithHeader() const; bool IsCSVWithHeader() const;
//@brief returns the piece name regex or empty string if not set //@brief returns the piece name regex or empty string if not set
QString OptExportSuchDetails() const; QString OptExportSuchDetails() const;
@ -143,17 +157,16 @@ private:
Q_DISABLE_COPY(VCommandLine) Q_DISABLE_COPY(VCommandLine)
static VCommandLinePtr instance; static VCommandLinePtr instance;
QCommandLineParser parser; QCommandLineParser parser;
VCommandLineOptions optionsUsed; QMap<QString, VCommandLineOption> optionsUsed;
QMap<QString, int> optionsIndex;
bool isGuiEnabled; bool isGuiEnabled;
friend class VApplication; friend class VApplication;
static qreal Lo2Px(const QString& src, const DialogLayoutSettings& converter);
static qreal Pg2Px(const QString& src, const DialogLayoutSettings& converter);
static void InitOptions(VCommandLineOptions &options, QMap<QString, int> &optionsIndex);
VAbstractLayoutDialog::PaperSizeTemplate FormatSize(const QString &key) const; VAbstractLayoutDialog::PaperSizeTemplate FormatSize(const QString &key) const;
void InitCommandLineOptions();
bool IsOptionSet(const QString &option) const;
QString OptionValue(const QString &option) const;
QStringList OptionValues(const QString &option) const;
}; };
#endif // VCMDEXPORT_H #endif // VCMDEXPORT_H