summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/moc/moc.cpp22
-rw-r--r--src/tools/moc/mwerks_mac.cpp227
-rw-r--r--src/tools/moc/mwerks_mac.h54
-rw-r--r--src/tools/moc/preprocessor.cpp16
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp2
-rw-r--r--src/tools/uic/uic.pro2
6 files changed, 32 insertions, 291 deletions
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index e2987f1be4..36d84a61d8 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -549,12 +549,20 @@ void Moc::parse()
case NAMESPACE: {
int rewind = index;
if (test(IDENTIFIER)) {
+ QByteArray nsName = lexem();
+ QByteArrayList nested;
+ while (test(SCOPE)) {
+ next(IDENTIFIER);
+ nested.append(nsName);
+ nsName = lexem();
+ }
if (test(EQ)) {
// namespace Foo = Bar::Baz;
until(SEMIC);
} else if (!test(SEMIC)) {
NamespaceDef def;
- def.classname = lexem();
+ def.classname = nsName;
+
next(LBRACE);
def.begin = index - 1;
until(RBRACE);
@@ -568,11 +576,23 @@ void Moc::parse()
def.qualified.prepend(namespaceList.at(i).classname + "::");
}
}
+ for (const QByteArray &ns : nested) {
+ NamespaceDef parentNs;
+ parentNs.classname = ns;
+ parentNs.qualified = def.qualified;
+ def.qualified += ns + "::";
+ parentNs.begin = def.begin;
+ parentNs.end = def.end;
+ namespaceList += parentNs;
+ }
}
+
while (parseNamespace && inNamespace(&def) && hasNext()) {
switch (next()) {
case NAMESPACE:
if (test(IDENTIFIER)) {
+ while (test(SCOPE))
+ next(IDENTIFIER);
if (test(EQ)) {
// namespace Foo = Bar::Baz;
until(SEMIC);
diff --git a/src/tools/moc/mwerks_mac.cpp b/src/tools/moc/mwerks_mac.cpp
deleted file mode 100644
index fe8bf680fb..0000000000
--- a/src/tools/moc/mwerks_mac.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifdef MOC_MWERKS_PLUGIN
-
-#include "mwerks_mac.h"
-#include "qt_mac.h"
-
-/* compiler headers */
-#include "DropInCompilerLinker.h"
-#include "CompilerMapping.h"
-#include "CWPluginErrors.h"
-
-/* standard headers */
-#include <stdio.h>
-#include <string.h>
-
-QT_BEGIN_NAMESPACE
-
-//qglobal.cpp
-const unsigned char * p_str(const char * c);
-QCString pstring2qstring(const unsigned char *c);
-
-#if CW_USE_PRAGMA_EXPORT
-#pragma export on
-#endif
-
-CWPLUGIN_ENTRY(CWPlugin_GetDropInFlags)(const DropInFlags** flags, long* flagsSize)
-{
- static const DropInFlags sFlags = {
- kCurrentDropInFlagsVersion,
- CWDROPINCOMPILERTYPE,
- DROPINCOMPILERLINKERAPIVERSION_7,
- kCompAlwaysReload|kCompRequiresProjectBuildStartedMsg,
- Lang_C_CPP,
- DROPINCOMPILERLINKERAPIVERSION
- };
- *flags = &sFlags;
- *flagsSize = sizeof(sFlags);
- return cwNoErr;
-}
-
-
-
-CWPLUGIN_ENTRY(CWPlugin_GetDropInName)(const char** dropinName)
-{
- static const char sDropInName[] = "McMoc";
- *dropinName = sDropInName;
- return cwNoErr;
-}
-
-CWPLUGIN_ENTRY(CWPlugin_GetDisplayName)(const char** displayName)
-{
- static const char sDisplayName[] = "McMoc";
- *displayName = sDisplayName;
- return cwNoErr;
-}
-
-CWPLUGIN_ENTRY(CWPlugin_GetTargetList)(const CWTargetList** targetList)
-{
- static CWDataType sCPU = targetCPUAny;
- static CWDataType sOS = targetOSMacintosh;
- static CWTargetList sTargetList = {kCurrentCWTargetListVersion, 1, &sCPU, 1, &sOS};
- *targetList = &sTargetList;
- return cwNoErr;
-}
-
-CWPLUGIN_ENTRY(CWPlugin_GetDefaultMappingList)(const CWExtMapList** defaultMappingList)
-{
- static CWExtensionMapping sExtension[] = { {'TEXT', ".mocs", kPrecompile } };
- static CWExtMapList sExtensionMapList = {kCurrentCWExtMapListVersion, 3, sExtension};
- *defaultMappingList = &sExtensionMapList;
- return cwNoErr;
-}
-
-#if CW_USE_PRAGMA_EXPORT
-#pragma export off
-#endif
-typedef short CWFileRef;
-
-static int line_count = 0;
-moc_status do_moc(CWPluginContext, const QCString &, const QCString &, CWFileSpec *, bool);
-
-static CWResult mocify(CWPluginContext context, const QCString &source)
-{
- CWDisplayLines(context, line_count++);
-
- source.stripWhiteSpace();
-
- CWResult err;
- bool dotmoc=false;
- QCString stem = source, ext;
- int dotpos = stem.findRev('.');
- if(dotpos != -1) {
- ext = stem.right(stem.length() - (dotpos+1));
- stem = stem.left(dotpos);
- if(ext == "cpp")
- dotmoc = true;
- } else {
- //whoa!
- }
- QCString dest;
- if(dotmoc)
- dest = stem + ".moc";
- else
- dest = "moc_" + stem + ".cpp";
-
- //moc it
- CWFileSpec destSpec;
- moc_status mocd = do_moc(context, source, dest, &destSpec, dotmoc);
-
-#if 0
- QCString derr = "Weird";
- switch(mocd) {
- case moc_success: derr = "Success"; break;
- case moc_parse_error: derr = "Parser Error"; break;
- case moc_no_qobject:derr = "No QOBJECT"; break;
- case moc_not_time: derr = "Not Time"; break;
- case moc_no_source: derr = "No Source"; break;
- case moc_general_error: derr = "General Error"; break;
- }
- char dmsg[200];
- sprintf(dmsg, "\"%s\" %s", source.data(), derr.data());
- CWReportMessage(context, NULL, dmsg, NULL, messagetypeError, 0);
-#endif
-
- //handle project
- if(mocd == moc_no_qobject) {
- char msg[400];
- sprintf(msg, "\"%s\" No relevant classes found. No output generated.", source.data());
- CWReportMessage(context, NULL, msg, NULL, messagetypeWarning, 0);
- } else if ((mocd == moc_success || mocd == moc_not_time) && !dotmoc)
- {
- long whichFile;
- CWNewProjectEntryInfo ei;
- memset(&ei, '\0', sizeof(ei));
- ei.groupPath = "QtGenerated";
- err = CWAddProjectEntry(context, &destSpec, true, &ei, &whichFile);
- if (!CWSUCCESS(err))
- {
- char msg[200];
- sprintf(msg, "\"%s\" not added", dest.data());
- CWReportMessage(context, NULL, msg, NULL, messagetypeWarning, 0);
- }
- if(mocd == moc_success)
- CWSetModDate(context, &destSpec, NULL, true);
- }
- return cwNoErr;
-}
-
-pascal short main(CWPluginContext context)
-{
- short result;
- long request;
-
- if (CWGetPluginRequest(context, &request) != cwNoErr)
- return cwErrRequestFailed;
- result = cwErrInvalidParameter;
-
- /* dispatch on compiler request */
- switch (request)
- {
- case reqInitCompiler:
- case reqTermCompiler:
- result = cwNoErr;
- break;
-
- case reqCompile:
- {
- line_count = 0;
- const char *files = NULL;
- long filelen;
- CWGetMainFileText(context, &files, &filelen);
- const char *beg = files;
- for(int x = 0; x < filelen; x++) {
- if(*(files++) == '\r') {
- char file[1024];
- memcpy(file, beg, files - beg);
- file[(files-beg)-1] = '\0';
- mocify(context, file);
- beg = files;
- }
- }
- if(beg != files) {
- char file[1024];
- memcpy(file, beg, files - beg);
- file[(files-beg)] = '\0';
- mocify(context, file);
- }
-
- result = cwNoErr;
- break;
- }
- }
-
- /* return result code */
- return result;
-}
-
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/tools/moc/mwerks_mac.h b/src/tools/moc/mwerks_mac.h
deleted file mode 100644
index 9f6f074036..0000000000
--- a/src/tools/moc/mwerks_mac.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MWERKS_MAC_H
-#define MWERKS_MAC_H
-
-#include <qglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifdef Q_OS_MAC
-
-#define macintosh
-
-/*make moc a plugin*/
-enum moc_status {
- moc_success = 1,
- moc_parse_error = 2,
- moc_no_qobject = 3,
- moc_not_time = 4,
- moc_no_source = 5,
- moc_general_error = 6
-};
-
-#endif
-
-QT_END_NAMESPACE
-
-#endif // MWERKS_MAC_H
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index f5639ffe31..32c94639ab 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -236,7 +236,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
data -= 2;
break;
case DIGIT:
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
if (!*data || *data != '.') {
token = INTEGER_LITERAL;
@@ -244,7 +244,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
(*data == 'x' || *data == 'X')
&& *lexem == '0') {
++data;
- while (is_hex_char(*data))
+ while (is_hex_char(*data) || *data == '\'')
++data;
}
break;
@@ -253,13 +253,13 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
++data;
Q_FALLTHROUGH();
case FLOATING_LITERAL:
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
if (*data == '+' || *data == '-')
++data;
if (*data == 'e' || *data == 'E') {
++data;
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
}
if (*data == 'f' || *data == 'F'
@@ -413,7 +413,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
token = PP_CHARACTER_LITERAL;
break;
case PP_DIGIT:
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
if (!*data || *data != '.') {
token = PP_INTEGER_LITERAL;
@@ -421,7 +421,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
(*data == 'x' || *data == 'X')
&& *lexem == '0') {
++data;
- while (is_hex_char(*data))
+ while (is_hex_char(*data) || *data == '\'')
++data;
}
break;
@@ -430,13 +430,13 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
++data;
Q_FALLTHROUGH();
case PP_FLOATING_LITERAL:
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
if (*data == '+' || *data == '-')
++data;
if (*data == 'e' || *data == 'E') {
++data;
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
}
if (*data == 'f' || *data == 'F'
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index 2b0d70eac6..301d6fdabb 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -1484,6 +1484,8 @@ void WriteInitialization::writeProperties(const QString &varName,
defineC = whatsThisDefineC;
else if (propertyName == QLatin1String("statusTip"))
defineC = statusTipDefineC;
+ else if (propertyName == QLatin1String("shortcut"))
+ defineC = shortcutDefineC;
else if (propertyName == QLatin1String("accessibleName") || propertyName == QLatin1String("accessibleDescription"))
defineC = accessibilityDefineC;
diff --git a/src/tools/uic/uic.pro b/src/tools/uic/uic.pro
index 9afb2d847f..02469cdd1b 100644
--- a/src/tools/uic/uic.pro
+++ b/src/tools/uic/uic.pro
@@ -1,5 +1,5 @@
option(host_build)
-!force_bootstrap:if(!qtConfig(commandlineparser)|!qtConfig(textcodec)): \
+!force_bootstrap:if(!qtConfig(commandlineparser)|!qtConfig(textcodec)|!qtConfig(xmlstreamreader)|!qtConfig(xmlstreamwriter)): \
CONFIG += force_bootstrap
DEFINES += QT_UIC QT_NO_CAST_FROM_ASCII QT_NO_FOREACH