From 30182c1bb7112b61b8bc29801c9ced6078e715a2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 31 Aug 2018 13:51:40 +0200 Subject: 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 --- sources/shiboken2/generator/main.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'sources/shiboken2/generator/main.cpp') 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& 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_SPLITTER "" PATH_SPLITTER "...]"); + QString pathSyntax; + QTextStream(&pathSyntax) << "[" << pathSplitter << "" + << 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); } -- cgit v1.2.3