aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator/main.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-08-31 13:51:40 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-09-04 18:35:47 +0000
commit30182c1bb7112b61b8bc29801c9ced6078e715a2 (patch)
tree1a78d386a212c4c1ba1427f2c281f048a65d4cb7 /sources/shiboken2/generator/main.cpp
parent5872256892c4a26169af30ddfffcd1544b31fe82 (diff)
shiboken: Replace some character #defines by char constants
Change defines to variables where possible (not used in string literal concatenations). Remove constants only used in one file from the header. Change regular expressions to raw string literals for clarity. Replace static instance of the CONVERTTOCPP regular expressions by an accessor of ShibokenGenerator. Change PATH_SPLITTER in main.cpp define to a QChar constant. Change-Id: If6766e0467ca2c635788240414c984d60feef875 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2/generator/main.cpp')
-rw-r--r--sources/shiboken2/generator/main.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/sources/shiboken2/generator/main.cpp b/sources/shiboken2/generator/main.cpp
index 9c3d7275b..701ede7b7 100644
--- a/sources/shiboken2/generator/main.cpp
+++ b/sources/shiboken2/generator/main.cpp
@@ -43,9 +43,9 @@
#include "qtdocgenerator.h"
#ifdef _WINDOWS
- #define PATH_SPLITTER ";"
+static const QChar pathSplitter = QLatin1Char(';');
#else
- #define PATH_SPLITTER ":"
+static const QChar pathSplitter = QLatin1Char(':');
#endif
static inline QString languageLevelOption() { return QStringLiteral("language-level"); }
@@ -147,18 +147,18 @@ static bool processProjectFile(QFile& projectFile, QMap<QString, QString>& args)
}
if (!includePaths.isEmpty())
- args.insert(includePathOption(), includePaths.join(QLatin1String(PATH_SPLITTER)));
+ args.insert(includePathOption(), includePaths.join(pathSplitter));
if (!frameworkIncludePaths.isEmpty())
args.insert(frameworkIncludePathOption(),
- frameworkIncludePaths.join(QLatin1String(PATH_SPLITTER)));
+ frameworkIncludePaths.join(pathSplitter));
if (!systemIncludePaths.isEmpty()) {
args.insert(systemIncludePathOption(),
- systemIncludePaths.join(QLatin1String(PATH_SPLITTER)));
+ systemIncludePaths.join(pathSplitter));
}
if (!typesystemPaths.isEmpty())
- args.insert(typesystemPathOption(), typesystemPaths.join(QLatin1String(PATH_SPLITTER)));
+ args.insert(typesystemPathOption(), typesystemPaths.join(pathSplitter));
if (!apiVersions.isEmpty())
args.insert(QLatin1String("api-version"), apiVersions.join(QLatin1Char('|')));
if (!languageLevel.isEmpty())
@@ -214,7 +214,7 @@ static void addPathOptionValue(const QString &option, const QString &value,
{
const CommandArgumentMap::iterator it = args.find(option);
if (it != args.end())
- it.value().append(QLatin1String(PATH_SPLITTER) + value);
+ it.value().append(pathSplitter + value);
else
args.insert(option, value);
}
@@ -302,7 +302,9 @@ void printUsage()
s << "Usage:\n "
<< "shiboken [options] header-file typesystem-file\n\n"
<< "General options:\n";
- const QString pathSyntax = QLatin1String("<path>[" PATH_SPLITTER "<path>" PATH_SPLITTER "...]");
+ QString pathSyntax;
+ QTextStream(&pathSyntax) << "<path>[" << pathSplitter << "<path>"
+ << pathSplitter << "...]";
OptionDescriptions generalOptions = OptionDescriptions()
<< qMakePair(QLatin1String("api-version=<\"package mask\">,<\"version\">"),
QLatin1String("Specify the supported api version used to generate the bindings"))
@@ -388,7 +390,7 @@ static void parseIncludePathOption(const QString &option, HeaderType headerType,
const CommandArgumentMap::iterator it = args.find(option);
if (it != args.end()) {
const QStringList includePathListList =
- it.value().split(QLatin1String(PATH_SPLITTER), QString::SkipEmptyParts);
+ it.value().split(pathSplitter, QString::SkipEmptyParts);
args.erase(it);
for (const QString &s : includePathListList)
extractor.addIncludePath(HeaderPath{QFile::encodeName(s), headerType});
@@ -540,7 +542,7 @@ int main(int argc, char *argv[])
ait = args.find(QLatin1String("typesystem-paths"));
if (ait != args.end()) {
- extractor.addTypesystemSearchPath(ait.value().split(QLatin1String(PATH_SPLITTER)));
+ extractor.addTypesystemSearchPath(ait.value().split(pathSplitter));
args.erase(ait);
}