aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator/shiboken2
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-06-07 15:56:37 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-06-09 13:49:18 +0000
commita3e4e367cf462e2dd9d7b08fe8d3f0007c33e1fa (patch)
treea2c8d3fc3719656a18aaf2b3734fc73466efca06 /sources/shiboken2/generator/shiboken2
parent798d3edb8ff260e7a6cf56640121146bc6e62593 (diff)
shiboken: Further refactor command line arguments and help
Replace the QMap of options returned by the generators by a vector of pairs to allow for specifying the order. This allows for better formatting -I/-F/-T in multiple lines. Add -h for help. Move the missing typelib file handling into main and print a help hint there. Change-Id: I5a95bd8d193be012aaa7ce3934945b25e21d3f79 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/shiboken2/generator/shiboken2')
-rw-r--r--sources/shiboken2/generator/shiboken2/headergenerator.h2
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.cpp31
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.h2
3 files changed, 17 insertions, 18 deletions
diff --git a/sources/shiboken2/generator/shiboken2/headergenerator.h b/sources/shiboken2/generator/shiboken2/headergenerator.h
index 5c1ffec35..d9dc8ffe8 100644
--- a/sources/shiboken2/generator/shiboken2/headergenerator.h
+++ b/sources/shiboken2/generator/shiboken2/headergenerator.h
@@ -41,7 +41,7 @@ class AbstractMetaFunction;
class HeaderGenerator : public ShibokenGenerator
{
public:
- QMap<QString, QString> options() const override { return QMap<QString, QString>(); }
+ OptionDescriptions options() const override { return OptionDescriptions(); }
protected:
QString fileNamePrefix() const override;
QString fileNameForContext(GeneratorContext &context) const override;
diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
index fb9946be1..2693ecf40 100644
--- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
@@ -2446,22 +2446,21 @@ QPair< int, int > ShibokenGenerator::getMinMaxArguments(const AbstractMetaFuncti
return qMakePair(minArgs, maxArgs);
}
-QMap<QString, QString> ShibokenGenerator::options() const
-{
- QMap<QString, QString> opts(Generator::options());
- opts.insert(QLatin1String(AVOID_PROTECTED_HACK),
- QLatin1String("Avoid the use of the '#define protected public' hack."));
- opts.insert(QLatin1String(PARENT_CTOR_HEURISTIC),
- QLatin1String("Enable heuristics to detect parent relationship on constructors."));
- opts.insert(QLatin1String(RETURN_VALUE_HEURISTIC),
- QLatin1String("Enable heuristics to detect parent relationship on return values (USE WITH CAUTION!)"));
- opts.insert(QLatin1String(ENABLE_PYSIDE_EXTENSIONS),
- QLatin1String("Enable PySide extensions, such as support for signal/slots, use this if you are creating a binding for a Qt-based library."));
- opts.insert(QLatin1String(DISABLE_VERBOSE_ERROR_MESSAGES),
- QLatin1String("Disable verbose error messages. Turn the python code hard to debug but safe few kB on the generated bindings."));
- opts.insert(QLatin1String(USE_ISNULL_AS_NB_NONZERO),
- QLatin1String("If a class have an isNull()const method, it will be used to compute the value of boolean casts"));
- return opts;
+Generator::OptionDescriptions ShibokenGenerator::options() const
+{
+ return OptionDescriptions()
+ << qMakePair(QLatin1String(AVOID_PROTECTED_HACK),
+ QLatin1String("Avoid the use of the '#define protected public' hack."))
+ << qMakePair(QLatin1String(DISABLE_VERBOSE_ERROR_MESSAGES),
+ QLatin1String("Disable verbose error messages. Turn the python code hard to debug but safe few kB on the generated bindings."))
+ << qMakePair(QLatin1String(PARENT_CTOR_HEURISTIC),
+ QLatin1String("Enable heuristics to detect parent relationship on constructors."))
+ << qMakePair(QLatin1String(ENABLE_PYSIDE_EXTENSIONS),
+ QLatin1String("Enable PySide extensions, such as support for signal/slots, use this if you are creating a binding for a Qt-based library."))
+ << qMakePair(QLatin1String(RETURN_VALUE_HEURISTIC),
+ QLatin1String("Enable heuristics to detect parent relationship on return values (USE WITH CAUTION!)"))
+ << qMakePair(QLatin1String(USE_ISNULL_AS_NB_NONZERO),
+ QLatin1String("If a class have an isNull()const method, it will be used to compute the value of boolean casts"));
}
static void getCode(QStringList& code, const CodeSnipList& codeSnips)
diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.h b/sources/shiboken2/generator/shiboken2/shibokengenerator.h
index 1be56edc8..497ff4e34 100644
--- a/sources/shiboken2/generator/shiboken2/shibokengenerator.h
+++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.h
@@ -429,7 +429,7 @@ public:
QString extendedIsConvertibleFunctionName(const TypeEntry* targetType) const;
QString extendedToCppFunctionName(const TypeEntry* targetType) const;
- QMap< QString, QString > options() const override;
+ OptionDescriptions options() const override;
/// Returns true if the user enabled the so called "parent constructor heuristic".
bool useCtorHeuristic() const;