forked from qt-creator/qt-creator
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -70,11 +70,8 @@ src/xml/lib/
|
||||
|
||||
# Binaries
|
||||
# --------
|
||||
bin/Aggregation.dll
|
||||
bin/CodeModel.dll
|
||||
bin/ExtensionSystem.dll
|
||||
bin/QtConcurrent.dll
|
||||
bin/Utils.dll
|
||||
bin/*.dll
|
||||
bin/qtcreator
|
||||
bin/qtcreator.exe
|
||||
doc/qtcreator.qch
|
||||
tests/manual/cplusplus/cplusplus0
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QHash>
|
||||
#include <QLinkedList>
|
||||
#include <QLocale>
|
||||
#include <QMap>
|
||||
#include <QMetaObject>
|
||||
@@ -1123,8 +1124,8 @@ static void qDumpQHash(QDumper &d)
|
||||
while (node != end) {
|
||||
d.beginHash();
|
||||
if (simpleKey) {
|
||||
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "name");
|
||||
P(d, "nameisindex", "1");
|
||||
P(d, "name", "[" << i << "]");
|
||||
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key");
|
||||
if (simpleValue)
|
||||
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
|
||||
P(d, "type", valueType);
|
||||
@@ -1265,6 +1266,48 @@ static void qDumpQList(QDumper &d)
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQLinkedList(QDumper &d)
|
||||
{
|
||||
// This uses the knowledge that QLinkedList<T> has only a single member
|
||||
// of type union { QLinkedListData *d; QLinkedListNode<T> *e; };
|
||||
const QLinkedListData *ldata =
|
||||
reinterpret_cast<const QLinkedListData*>(deref(d.data));
|
||||
int nn = ldata->size;
|
||||
if (nn < 0)
|
||||
qCheck(false);
|
||||
|
||||
int n = nn;
|
||||
P(d, "value", "<" << n << " items>");
|
||||
P(d, "valuedisabled", "true");
|
||||
P(d, "numchild", n);
|
||||
P(d, "childtype", d.innertype);
|
||||
if (d.dumpChildren) {
|
||||
unsigned innerSize = d.extraInt[0];
|
||||
bool innerTypeIsPointer = isPointerType(d.innertype);
|
||||
QByteArray strippedInnerType = stripPointerType(d.innertype);
|
||||
const char *stripped =
|
||||
isPointerType(d.innertype) ? strippedInnerType.data() : 0;
|
||||
|
||||
P(d, "childtype", d.innertype);
|
||||
if (n > 1000)
|
||||
n = 1000;
|
||||
d << ",children=[";
|
||||
const void *p = deref(ldata);
|
||||
for (int i = 0; i != n; ++i) {
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << i << "]");
|
||||
const void *addr = addOffset(p, 2 * sizeof(void*));
|
||||
qDumpInnerValueOrPointer(d, d.innertype, stripped, addr);
|
||||
p = deref(p);
|
||||
d.endHash();
|
||||
}
|
||||
if (n < nn)
|
||||
d.putEllipsis();
|
||||
d << "]";
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQLocale(QDumper &d)
|
||||
{
|
||||
const QLocale &locale = *reinterpret_cast<const QLocale *>(d.data);
|
||||
@@ -1310,6 +1353,42 @@ static void qDumpQLocale(QDumper &d)
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQMapNode(QDumper &d)
|
||||
{
|
||||
const QMapData *h = reinterpret_cast<const QMapData *>(d.data);
|
||||
const char *keyType = d.templateParameters[0];
|
||||
const char *valueType = d.templateParameters[1];
|
||||
|
||||
qCheckAccess(h->backward);
|
||||
qCheckAccess(h->forward[0]);
|
||||
|
||||
P(d, "value", "");
|
||||
P(d, "numchild", 2);
|
||||
if (d.dumpChildren) {
|
||||
//unsigned keySize = d.extraInt[0];
|
||||
//unsigned valueSize = d.extraInt[1];
|
||||
unsigned mapnodesize = d.extraInt[2];
|
||||
unsigned valueOff = d.extraInt[3];
|
||||
|
||||
unsigned keyOffset = 2 * sizeof(void*) - mapnodesize;
|
||||
unsigned valueOffset = 2 * sizeof(void*) - mapnodesize + valueOff;
|
||||
|
||||
d << ",children=[";
|
||||
d.beginHash();
|
||||
P(d, "name", "key");
|
||||
qDumpInnerValue(d, keyType, addOffset(h, keyOffset));
|
||||
|
||||
d.endHash();
|
||||
d.beginHash();
|
||||
P(d, "name", "value");
|
||||
qDumpInnerValue(d, valueType, addOffset(h, valueOffset));
|
||||
d.endHash();
|
||||
d << "]";
|
||||
}
|
||||
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQMap(QDumper &d)
|
||||
{
|
||||
QMapData *h = *reinterpret_cast<QMapData *const*>(d.data);
|
||||
@@ -1355,26 +1434,32 @@ static void qDumpQMap(QDumper &d)
|
||||
|
||||
while (node != end) {
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << i << "]");
|
||||
if (simpleKey) {
|
||||
P(d, "type", valueType);
|
||||
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "name");
|
||||
|
||||
P(d, "nameisindex", "1");
|
||||
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key");
|
||||
if (simpleValue)
|
||||
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
|
||||
|
||||
P(d, "type", valueType);
|
||||
P(d, "addr", addOffset(node, valueOffset));
|
||||
} else {
|
||||
P(d, "name", "[" << i << "]");
|
||||
P(d, "type", NS"QMapNode<" << keyType << "," << valueType << " >");
|
||||
#if QT_VERSION >= 0x040500
|
||||
// actually, any type (even 'char') will do...
|
||||
P(d, "exp", "*('"NS"QMapNode<" << keyType << "," << valueType << " >'*)" << node);
|
||||
P(d, "type", NS"QMapNode<"
|
||||
<< keyType << "," << valueType << " >");
|
||||
P(d, "exp", "*('"NS"QMapNode<"
|
||||
<< keyType << "," << valueType << " >'*)" << node);
|
||||
|
||||
//P(d, "exp", "*('"NS"QMapData'*)" << (void*)node);
|
||||
//P(d, "exp", "*(char*)" << (void*)node);
|
||||
|
||||
// P(d, "addr", node); does not work as gdb fails to parse
|
||||
// e.g. &((*('"NS"QMapNode<QString,Foo>'*)0x616658))
|
||||
#else
|
||||
P(d, "type", NS"QMapData::Node<"
|
||||
<< keyType << "," << valueType << " >");
|
||||
P(d, "exp", "*('"NS"QMapData::Node<"
|
||||
<< keyType << "," << valueType << " >'*)" << node);
|
||||
#endif
|
||||
}
|
||||
d.endHash();
|
||||
|
||||
@@ -1387,6 +1472,11 @@ static void qDumpQMap(QDumper &d)
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQMultiMap(QDumper &d)
|
||||
{
|
||||
qDumpQMap(d);
|
||||
}
|
||||
|
||||
static void qDumpQModelIndex(QDumper &d)
|
||||
{
|
||||
const QModelIndex *mi = reinterpret_cast<const QModelIndex *>(d.data);
|
||||
@@ -1431,42 +1521,6 @@ static void qDumpQModelIndex(QDumper &d)
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQMapNode(QDumper &d)
|
||||
{
|
||||
const QMapData *h = reinterpret_cast<const QMapData *>(d.data);
|
||||
const char *keyType = d.templateParameters[0];
|
||||
const char *valueType = d.templateParameters[1];
|
||||
|
||||
qCheckAccess(h->backward);
|
||||
qCheckAccess(h->forward[0]);
|
||||
|
||||
P(d, "value", "");
|
||||
P(d, "numchild", 2);
|
||||
if (d.dumpChildren) {
|
||||
//unsigned keySize = d.extraInt[0];
|
||||
//unsigned valueSize = d.extraInt[1];
|
||||
unsigned mapnodesize = d.extraInt[2];
|
||||
unsigned valueOff = d.extraInt[3];
|
||||
|
||||
unsigned keyOffset = 2 * sizeof(void*) - mapnodesize;
|
||||
unsigned valueOffset = 2 * sizeof(void*) - mapnodesize + valueOff;
|
||||
|
||||
d << ",children=[";
|
||||
d.beginHash();
|
||||
P(d, "name", "key");
|
||||
qDumpInnerValue(d, keyType, addOffset(h, keyOffset));
|
||||
|
||||
d.endHash();
|
||||
d.beginHash();
|
||||
P(d, "name", "value");
|
||||
qDumpInnerValue(d, valueType, addOffset(h, valueOffset));
|
||||
d.endHash();
|
||||
d << "]";
|
||||
}
|
||||
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQObject(QDumper &d)
|
||||
{
|
||||
const QObject *ob = reinterpret_cast<const QObject *>(d.data);
|
||||
@@ -2345,6 +2399,8 @@ static void handleProtocolVersion2and3(QDumper & d)
|
||||
case 'L':
|
||||
if (isEqual(type, "QList"))
|
||||
qDumpQList(d);
|
||||
else if (isEqual(type, "QLinkedList"))
|
||||
qDumpQLinkedList(d);
|
||||
else if (isEqual(type, "QLocale"))
|
||||
qDumpQLocale(d);
|
||||
break;
|
||||
@@ -2355,6 +2411,8 @@ static void handleProtocolVersion2and3(QDumper & d)
|
||||
qDumpQMapNode(d);
|
||||
else if (isEqual(type, "QModelIndex"))
|
||||
qDumpQModelIndex(d);
|
||||
else if (isEqual(type, "QMultiMap"))
|
||||
qDumpQMultiMap(d);
|
||||
break;
|
||||
case 'O':
|
||||
if (isEqual(type, "QObject"))
|
||||
@@ -2452,10 +2510,15 @@ void qDumpObjectData440(
|
||||
"\""NS"QHash\","
|
||||
"\""NS"QHashNode\","
|
||||
"\""NS"QImage\","
|
||||
"\""NS"QLinkedList\","
|
||||
"\""NS"QList\","
|
||||
"\""NS"QLocale\","
|
||||
"\""NS"QMap\","
|
||||
"\""NS"QMapNode\","
|
||||
"\""NS"QModelIndex\","
|
||||
#if QT_VERSION >= 0x040500
|
||||
"\""NS"QMultiMap\","
|
||||
#endif
|
||||
"\""NS"QObject\","
|
||||
"\""NS"QObjectMethodList\"," // hack to get nested properties display
|
||||
"\""NS"QObjectPropertyList\","
|
||||
@@ -2465,6 +2528,7 @@ void qDumpObjectData440(
|
||||
"\""NS"QObjectSlot\","
|
||||
"\""NS"QObjectSlotList\","
|
||||
#endif // PRIVATE_OBJECT_ALLOWED
|
||||
// << "\""NS"QRegion\","
|
||||
"\""NS"QSet\","
|
||||
"\""NS"QString\","
|
||||
"\""NS"QStringList\","
|
||||
@@ -2480,8 +2544,11 @@ void qDumpObjectData440(
|
||||
"\"std::string\","
|
||||
"\"std::vector\","
|
||||
"\"std::wstring\","
|
||||
// << "\""NS"QRegion\","
|
||||
"]";
|
||||
d << ",qtversion=["
|
||||
"\"" << ((QT_VERSION >> 16) & 255) << "\","
|
||||
"\"" << ((QT_VERSION >> 8) & 255) << "\","
|
||||
"\"" << ((QT_VERSION) & 255) << "\"]";
|
||||
d << ",namespace=\""NS"\"";
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
102
doc/api/classic.css
Normal file
102
doc/api/classic.css
Normal file
@@ -0,0 +1,102 @@
|
||||
h3.fn,span.fn
|
||||
{
|
||||
margin-left: 1cm;
|
||||
text-indent: -1cm;
|
||||
}
|
||||
|
||||
a:link
|
||||
{
|
||||
color: #004faf;
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
a:visited
|
||||
{
|
||||
color: #672967;
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
td.postheader
|
||||
{
|
||||
font-family: sans-serif
|
||||
}
|
||||
|
||||
tr.address
|
||||
{
|
||||
font-family: sans-serif
|
||||
}
|
||||
|
||||
body
|
||||
{
|
||||
background: #ffffff;
|
||||
color: black
|
||||
}
|
||||
|
||||
table tr.odd {
|
||||
background: #f0f0f0;
|
||||
color: black;
|
||||
}
|
||||
|
||||
table tr.even {
|
||||
background: #e4e4e4;
|
||||
color: black;
|
||||
}
|
||||
|
||||
table.annotated th {
|
||||
padding: 3px;
|
||||
text-align: left
|
||||
}
|
||||
|
||||
table.annotated td {
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
table tr pre
|
||||
{
|
||||
padding-top: none;
|
||||
padding-bottom: none;
|
||||
padding-left: none;
|
||||
padding-right: none;
|
||||
border: none;
|
||||
background: none
|
||||
}
|
||||
|
||||
tr.qt-style
|
||||
{
|
||||
background: #a2c511;
|
||||
color: black
|
||||
}
|
||||
|
||||
body pre
|
||||
{
|
||||
padding: 0.2em;
|
||||
border: #e7e7e7 1px solid;
|
||||
background: #f1f1f1;
|
||||
color: black
|
||||
}
|
||||
|
||||
span.preprocessor, span.preprocessor a
|
||||
{
|
||||
color: darkblue;
|
||||
}
|
||||
|
||||
span.comment
|
||||
{
|
||||
color: darkred;
|
||||
font-style: italic
|
||||
}
|
||||
|
||||
span.string,span.char
|
||||
{
|
||||
color: darkgreen;
|
||||
}
|
||||
|
||||
.subtitle
|
||||
{
|
||||
font-size: 0.8em
|
||||
}
|
||||
|
||||
.small-subtitle
|
||||
{
|
||||
font-size: 0.65em
|
||||
}
|
||||
82
doc/api/qtcreator-api.qdoc
Normal file
82
doc/api/qtcreator-api.qdoc
Normal file
@@ -0,0 +1,82 @@
|
||||
/*!
|
||||
\page index.html
|
||||
\title Qt Creator
|
||||
|
||||
Qt Creator is Qt Software's crossplatform IDE. The core of Qt Creator is
|
||||
basically only a \l{ExtensionSystem}{plugin loader}.
|
||||
|
||||
\section1 Core Libraries
|
||||
|
||||
There are a few core libraries used by many parts of Qt Creator.
|
||||
|
||||
\table
|
||||
\header
|
||||
\o Library Name
|
||||
\o Description
|
||||
|
||||
\row
|
||||
\o \l{Aggregation}{Aggregation}
|
||||
\o Adds functionality for "glueing" QObjects of different
|
||||
types together, so you can "cast" between them.
|
||||
|
||||
\row
|
||||
\o \l{ExtensionSystem}{ExtensionSystem}
|
||||
\o Implements the plugin loader framework. Provides a base class for plugins and
|
||||
basic mechanisms for plugin interaction like an object pool.
|
||||
|
||||
\endtable
|
||||
|
||||
\section1 Plugins
|
||||
|
||||
As already mentioned, Qt Creator is basically only a plugin loader framework
|
||||
which gets its IDE functionality through plugins. The most important plugin
|
||||
is the Core plugin which provides all the basic functionality needed
|
||||
later to integrate e.g. editors or mode windows.
|
||||
|
||||
\table
|
||||
\header
|
||||
\o Plugin Name
|
||||
\o Description
|
||||
|
||||
\row
|
||||
\o \l{Core} {Core}
|
||||
\o The core plugin. Provides the main window and managers for editors,
|
||||
actions, mode windows and files, just to mention the most important ones.
|
||||
|
||||
\endtable
|
||||
*/
|
||||
|
||||
/*!
|
||||
\page classes.html
|
||||
\title Qt Creator Classes
|
||||
|
||||
\generatelist classes
|
||||
*/
|
||||
|
||||
/*!
|
||||
\page namespaces.html
|
||||
\title Qt Creator Namespaces
|
||||
|
||||
\generatelist namespaces
|
||||
*/
|
||||
|
||||
/*!
|
||||
\page mainclasses.html
|
||||
\title Qt Creator Main Classes
|
||||
|
||||
\generatelist mainclasses
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
\page functions.html
|
||||
\title Qt Creator Functions
|
||||
|
||||
\generatelist functionindex
|
||||
*/
|
||||
|
||||
/*!
|
||||
\group qtc
|
||||
|
||||
\title Core Plugin
|
||||
*/
|
||||
@@ -1,17 +1,19 @@
|
||||
project = Workbench
|
||||
description = Workbench SDK Documentation
|
||||
project = Qt Creator API
|
||||
description = Qt Creator API Documentation
|
||||
|
||||
language = Cpp
|
||||
|
||||
headerdirs = . \
|
||||
../src/libs/extensionsystem \
|
||||
../src/plugins/core \
|
||||
../src/plugins/core/actionmanager
|
||||
../../src/libs/aggregation \
|
||||
../../src/libs/extensionsystem \
|
||||
../../src/plugins/core \
|
||||
../../src/plugins/core/actionmanager
|
||||
|
||||
sourcedirs = . \
|
||||
../src/libs/extensionsystem \
|
||||
../src/plugins/core \
|
||||
../src/plugins/core/actionmanager
|
||||
../../src/libs/aggregation \
|
||||
../../src/libs/extensionsystem \
|
||||
../../src/plugins/core \
|
||||
../../src/plugins/core/actionmanager
|
||||
|
||||
headers.fileextesnions = "*.h"
|
||||
sources.fileextensions = "*.cpp *.qdoc"
|
||||
@@ -22,33 +24,70 @@ indexes = $QTDIR/doc/html/qt.index
|
||||
|
||||
outputdir = ./html
|
||||
base = file:./html
|
||||
versionsym = 1.0.0
|
||||
defines = Q_QDOC \
|
||||
QT_.*_SUPPORT \
|
||||
QT_.*_LIB \
|
||||
QT_COMPAT \
|
||||
QT_KEYPAD_NAVIGATION \
|
||||
QT3_SUPPORT \
|
||||
Q_WS_.* \
|
||||
Q_OS_.* \
|
||||
Q_BYTE_ORDER \
|
||||
__cplusplus
|
||||
|
||||
versionsym = 0.9.2
|
||||
codeindent = 1
|
||||
extraimages.HTML = qt-logo \
|
||||
trolltech-logo
|
||||
|
||||
macro.br.HTML = "<br />"
|
||||
macro.QD = "\\e{Qt Designer}"
|
||||
macro.QA = "\\e{Qt Assistant}"
|
||||
macro.eacute.HTML = "é"
|
||||
## compat.qdocconf
|
||||
alias.i = e
|
||||
alias.include = input
|
||||
|
||||
macro.0 = "\\\\0"
|
||||
macro.b = "\\\\b"
|
||||
macro.n = "\\\\n"
|
||||
macro.r = "\\\\r"
|
||||
macro.i = "\\o"
|
||||
macro.i11 = "\\o{1,1}"
|
||||
macro.i12 = "\\o{1,2}"
|
||||
macro.i13 = "\\o{1,3}"
|
||||
macro.i14 = "\\o{1,4}"
|
||||
macro.i15 = "\\o{1,5}"
|
||||
macro.i16 = "\\o{1,6}"
|
||||
macro.i17 = "\\o{1,7}"
|
||||
macro.i18 = "\\o{1,8}"
|
||||
macro.i19 = "\\o{1,9}"
|
||||
macro.i21 = "\\o{2,1}"
|
||||
macro.i31 = "\\o{3,1}"
|
||||
macro.i41 = "\\o{4,1}"
|
||||
macro.i51 = "\\o{5,1}"
|
||||
macro.i61 = "\\o{6,1}"
|
||||
macro.i71 = "\\o{7,1}"
|
||||
macro.i81 = "\\o{8,1}"
|
||||
macro.i91 = "\\o{9,1}"
|
||||
macro.img = "\\image"
|
||||
macro.endquote = "\\endquotation"
|
||||
macro.relatesto = "\\relates"
|
||||
|
||||
spurious = "Missing comma in .*" \
|
||||
"Missing pattern .*"
|
||||
|
||||
## macros.qdocconf
|
||||
macro.aring.HTML = "å"
|
||||
macro.Auml.HTML = "Ä"
|
||||
macro.author = "\\bold{Author:}"
|
||||
macro.br.HTML = "<br />"
|
||||
macro.BR.HTML = "<br />"
|
||||
macro.aacute.HTML = "á"
|
||||
macro.eacute.HTML = "é"
|
||||
macro.iacute.HTML = "í"
|
||||
macro.gui = "\\bold"
|
||||
macro.hr.HTML = "<hr />"
|
||||
macro.key = "\\bold"
|
||||
macro.menu = "\\bold"
|
||||
macro.note = "\\bold{Note:}"
|
||||
macro.oslash.HTML = "ø"
|
||||
macro.ouml.HTML = "ö"
|
||||
macro.Auml.HTML = "Ä"
|
||||
macro.uuml.HTML = "ü"
|
||||
macro.QA = "\\e{Qt Assistant}"
|
||||
macro.QD = "\\e{Qt Designer}"
|
||||
macro.QL = "\\e{Qt Linguist}"
|
||||
macro.param = "\\e"
|
||||
macro.raisedaster.HTML = "<sup>*</sup>"
|
||||
macro.reg.HTML = "<sup>®</sup>"
|
||||
macro.return = "Returns"
|
||||
macro.starslash = "\\c{*/}"
|
||||
macro.uuml.HTML = "ü"
|
||||
macro.mdash.HTML = "—"
|
||||
|
||||
## qt-cpp-ignore.qdocconf
|
||||
Cpp.ignoretokens = QAXFACTORY_EXPORT \
|
||||
QDESIGNER_COMPONENTS_LIBRARY \
|
||||
QDESIGNER_EXTENSION_LIBRARY \
|
||||
@@ -68,9 +107,11 @@ Cpp.ignoretokens = QAXFACTORY_EXPORT \
|
||||
QM_EXPORT_WORKSPACE \
|
||||
QM_EXPORT_XML \
|
||||
QT_ASCII_CAST_WARN \
|
||||
QT_ASCII_CAST_WARN_CONSTRUCTOR \
|
||||
QT_BEGIN_HEADER \
|
||||
QT_DESIGNER_STATIC \
|
||||
QT_END_HEADER \
|
||||
QT_FASTCALL \
|
||||
QT_WIDGET_PLUGIN_EXPORT \
|
||||
Q_COMPAT_EXPORT \
|
||||
Q_CORE_EXPORT \
|
||||
@@ -81,6 +122,7 @@ Cpp.ignoretokens = QAXFACTORY_EXPORT \
|
||||
Q_EXPORT_CODECS_KR \
|
||||
Q_EXPORT_PLUGIN \
|
||||
Q_GFX_INLINE \
|
||||
Q_AUTOTEST_EXPORT \
|
||||
Q_GUI_EXPORT \
|
||||
Q_GUI_EXPORT_INLINE \
|
||||
Q_GUI_EXPORT_STYLE_CDE \
|
||||
@@ -93,17 +135,27 @@ Cpp.ignoretokens = QAXFACTORY_EXPORT \
|
||||
Q_GUI_EXPORT_STYLE_SGI \
|
||||
Q_GUI_EXPORT_STYLE_WINDOWS \
|
||||
Q_GUI_EXPORT_STYLE_WINDOWSXP \
|
||||
QHELP_EXPORT \
|
||||
Q_INLINE_TEMPLATE \
|
||||
Q_INTERNAL_WIN_NO_THROW \
|
||||
Q_NETWORK_EXPORT \
|
||||
Q_OPENGL_EXPORT \
|
||||
Q_OUTOFLINE_TEMPLATE \
|
||||
Q_SQL_EXPORT \
|
||||
Q_SVG_EXPORT \
|
||||
Q_SCRIPT_EXPORT \
|
||||
Q_SCRIPTTOOLS_EXPORT \
|
||||
Q_TESTLIB_EXPORT \
|
||||
Q_TYPENAME \
|
||||
Q_XML_EXPORT \
|
||||
QDBUS_EXPORT
|
||||
Q_XMLSTREAM_EXPORT \
|
||||
Q_XMLPATTERNS_EXPORT \
|
||||
QDBUS_EXPORT \
|
||||
QT_BEGIN_NAMESPACE \
|
||||
QT_BEGIN_INCLUDE_NAMESPACE \
|
||||
QT_END_NAMESPACE \
|
||||
QT_END_INCLUDE_NAMESPACE \
|
||||
PHONON_EXPORT
|
||||
Cpp.ignoredirectives = Q_DECLARE_HANDLE \
|
||||
Q_DECLARE_INTERFACE \
|
||||
Q_DECLARE_METATYPE \
|
||||
@@ -114,34 +166,66 @@ Cpp.ignoredirectives = Q_DECLARE_HANDLE \
|
||||
Q_DECLARE_TR_FUNCTIONS \
|
||||
Q_DECLARE_TYPEINFO \
|
||||
Q_DISABLE_COPY \
|
||||
QT_FORWARD_DECLARE_CLASS \
|
||||
Q_DUMMY_COMPARISON_OPERATOR \
|
||||
Q_ENUMS \
|
||||
Q_FLAGS \
|
||||
Q_INTERFACES \
|
||||
__attribute__
|
||||
__attribute__ \
|
||||
K_DECLARE_PRIVATE \
|
||||
PHONON_OBJECT \
|
||||
PHONON_HEIR
|
||||
|
||||
## qt-html-templates.qdocconf
|
||||
HTML.stylesheets = classic.css
|
||||
HTML.postheader = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n" \
|
||||
"<tr>\n" \
|
||||
"<td align=\"left\" valign=\"top\" width=\"32\">" \
|
||||
"<a href=\"http://www.trolltech.com/products/qt\"><img src=\"images/qt-logo.png\" align=\"left\" width=\"32\" height=\"32\" border=\"0\" /></a>" \
|
||||
"<a href=\"http://www.trolltech.com/products/qt\"><img src=\"images/qt-logo.png\" align=\"left\" border=\"0\" /></a>" \
|
||||
"</td>\n" \
|
||||
"<td width=\"1\"> </td>" \
|
||||
"<td class=\"postheader\" valign=\"center\">" \
|
||||
"<a href=\"index.html\">" \
|
||||
"<font color=\"#004faf\">Home</font></a> ·" \
|
||||
" <a href=\"namespaces.html\">" \
|
||||
"<font color=\"#004faf\">All Namespaces</font></a> ·" \
|
||||
" <a href=\"classes.html\">" \
|
||||
"<font color=\"#004faf\">All Classes</font></a> ·" \
|
||||
" <a href=\"interfaces.html\">" \
|
||||
"<font color=\"#004faf\">All Interfaces</font></a> ·" \
|
||||
" <a href=\"mainclasses.html\">" \
|
||||
"<font color=\"#004faf\">Main Classes</font></a> ·" \
|
||||
" <a href=\"groups.html\">" \
|
||||
"<font color=\"#004faf\">Grouped Classes</font></a> ·" \
|
||||
" <a href=\"modules.html\">" \
|
||||
"<font color=\"#004faf\">Modules</font></a> ·" \
|
||||
" <a href=\"functions.html\">" \
|
||||
"<font color=\"#004faf\">Functions</font></a>" \
|
||||
"</td>\n" \
|
||||
"<td align=\"right\" valign=\"top\" width=\"230\"><a href=\"http://www.trolltech.com\"><img src=\"images/trolltech-logo.png\" align=\"right\" width=\"203\" height=\"32\" border=\"0\" /></a></td></tr></table>"
|
||||
"<td align=\"right\" valign=\"top\" width=\"230\"></td></tr></table>"
|
||||
|
||||
HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \
|
||||
"<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \
|
||||
"<td width=\"30%\">Copyright © \$THISYEAR\$ <a href=\"trolltech.html\">Trolltech</a></td>\n" \
|
||||
"<td width=\"30%\" align=\"left\">Copyright © %THISYEAR% Nokia Corporation " \
|
||||
"and/or its subsidiary(-ies)</td>\n" \
|
||||
"<td width=\"40%\" align=\"center\"><a href=\"trademarks.html\">Trademarks</a></td>\n" \
|
||||
"<td width=\"30%\" align=\"right\"><div align=\"right\">Qt \\version</div></td>\n" \
|
||||
"</tr></table></div></address>"
|
||||
|
||||
## qt-defines.qdocconf
|
||||
defines = Q_QDOC \
|
||||
QT_.*_SUPPORT \
|
||||
QT_.*_LIB \
|
||||
QT_COMPAT \
|
||||
QT_KEYPAD_NAVIGATION \
|
||||
QT3_SUPPORT \
|
||||
Q_WS_.* \
|
||||
Q_OS_.* \
|
||||
Q_BYTE_ORDER \
|
||||
QT_DEPRECATED \
|
||||
Q_NO_USING_KEYWORD \
|
||||
__cplusplus
|
||||
|
||||
# Files not referenced in any qdoc file (last four needed by qtdemo)
|
||||
# See also qhp.Qt.extraFiles
|
||||
extraimages.HTML = qt-logo \
|
||||
trolltech-logo
|
||||
|
||||
19
doc/doc.pri
19
doc/doc.pri
@@ -1,16 +1,13 @@
|
||||
# Generate docs. Does not work for shadow builds and never will.
|
||||
# (adding a "docs" make target).
|
||||
|
||||
unix {
|
||||
QDOC = SRCDIR=$$PWD OUTDIR=$$OUT_PWD/html $$(QTDIR)/tools/qdoc3/qdoc3
|
||||
QDOC = SRCDIR=$$PWD OUTDIR=$$OUT_PWD/doc/html $$(QTDIR)/tools/qdoc3/qdoc3
|
||||
HELPGENERATOR = qhelpgenerator
|
||||
} else {
|
||||
QDOC = $$(QTDIR)\tools\qdoc3\release\qdoc3.exe
|
||||
HELPGENERATOR = qhelpgenerator
|
||||
}
|
||||
|
||||
QHP_FILE = $$OUT_PWD/html/qtcreator.qhp
|
||||
QCH_FILE = $$OUT_PWD/qtcreator.qch
|
||||
QHP_FILE = $$OUT_PWD/doc/html/qtcreator.qhp
|
||||
QCH_FILE = $$OUT_PWD/doc/qtcreator.qch
|
||||
|
||||
html_docs.commands =$$QDOC $$PWD/qtcreator.qdocconf
|
||||
html_docs.depends += $$PWD/qtcreator.qdoc $$PWD/qtcreator.qdocconf
|
||||
@@ -20,6 +17,14 @@ qch_docs.commands = $$HELPGENERATOR -o $$QCH_FILE $$QHP_FILE
|
||||
qch_docs.depends += html_docs
|
||||
qch_docs.files = $$QCH_FILE
|
||||
|
||||
macx {
|
||||
cp_docs.commands = $${QMAKE_COPY_DIR} $${OUT_PWD}/doc $${OUT_PWD}/bin/QtCreator.app/Contents/Resources
|
||||
cp_docs.depends += qch_docs
|
||||
docs.depends = cp_docs
|
||||
QMAKE_EXTRA_TARGETS += html_docs qch_docs cp_docs docs
|
||||
}
|
||||
!macx {
|
||||
docs.depends = qch_docs
|
||||
|
||||
QMAKE_EXTRA_TARGETS += html_docs qch_docs docs
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
include(doc.pri)
|
||||
Binary file not shown.
@@ -1,98 +0,0 @@
|
||||
/*!
|
||||
\page index.html
|
||||
\title Workbench
|
||||
|
||||
Workbench is Trolltech's crossplatform IDE. The core of Workbench is
|
||||
basically only a \l{Plugin Loader Framework}{plugin loader} comparable to
|
||||
Eclipse. All major functionality is then added via plugins. The plugins
|
||||
necessary for a full IDE will be provided by Trolltech, possible addons or
|
||||
replacements of existing plugins can be provided by anyone. This means that
|
||||
there will be a place where plugins can be shared.
|
||||
|
||||
The main features of Workbench are:
|
||||
|
||||
\list
|
||||
\o Fast since it's written in C++
|
||||
\o Easy and fast to use (the entire IDE can be controlled via short cuts)
|
||||
\o Highly extensible
|
||||
\o Integrated C++ language support, i.e. code completion, class browser, ...
|
||||
\o Integrated debugger framework and outstanding support for gdb
|
||||
\o Integrated Qt Designer
|
||||
\o Qtopia Integration
|
||||
\endlist
|
||||
|
||||
\section1 Plugins
|
||||
|
||||
As already mentioned, Workbench is basically only a plugin loader framework
|
||||
which gets its IDE functionality through plugins. The most important plugin
|
||||
is the QWorkbench plugin which provides all the basic functionality needed
|
||||
later to integrate e.g. editors or tool windows.
|
||||
|
||||
\table
|
||||
\header
|
||||
\o Plugin Name
|
||||
\o Description
|
||||
|
||||
\row
|
||||
\o \l{QWorkbench Plugin} {QWorkbench}
|
||||
\o The core plugin. Provides the main window and managers for editors,
|
||||
actions, tool windows and files, just to mention the most important ones.
|
||||
|
||||
\endtable
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
\page classes.html
|
||||
\title Workbench Classes and Namespaces
|
||||
|
||||
\section1 Classes
|
||||
|
||||
\generatelist classes
|
||||
|
||||
\section1 Namespaces
|
||||
|
||||
\generatelist{namespaces}
|
||||
*/
|
||||
|
||||
/*!
|
||||
\page interfaces.html
|
||||
\title Interfaces
|
||||
\generatelist mainclasses
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
\page functions.html
|
||||
\title Member Function Index
|
||||
\generatelist functionindex
|
||||
*/
|
||||
|
||||
/*!
|
||||
\group pluginloader
|
||||
|
||||
\title Plugin Loader Framework
|
||||
*/
|
||||
|
||||
/*!
|
||||
\group qwb
|
||||
|
||||
\title QWorkbench Plugin
|
||||
*/
|
||||
|
||||
/*!
|
||||
\namespace Trolltech
|
||||
*/
|
||||
|
||||
/*!
|
||||
\namespace Trolltech::QWorkbench
|
||||
*/
|
||||
|
||||
/*!
|
||||
\namespace Trolltech::QWorkbench::Internal
|
||||
\brief Classes that manage and control internal features of the workbench environment.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\namespace ExtensionSystem
|
||||
*/
|
||||
@@ -1,12 +0,0 @@
|
||||
<all>
|
||||
- installdir whitespace check done.
|
||||
- installdir exist/non-empty check
|
||||
|
||||
<linux>
|
||||
- run '/bin/xdg-desktop-install.sh' if '/usr/bin/xdg-mime exists'
|
||||
- desktop shortcut
|
||||
|
||||
<windows>
|
||||
- create dir '${env(APPDATA)}/Trolltech'
|
||||
- start menue shortcuts
|
||||
|
||||
@@ -1,433 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
// This file contains the QtCreator-specific part of the installer.
|
||||
// It lists the files and features the installer should handle.
|
||||
|
||||
#include "qinstaller.h"
|
||||
#include "qinstallergui.h"
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QObject>
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QBoxLayout>
|
||||
#include <QtGui/QGridLayout>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QMessageBox>
|
||||
|
||||
|
||||
// QInstallerGui is base of the Gui part of an installer, i.e.
|
||||
// the "main installer wizard". In the simplest case it's just
|
||||
// a sequence of "standard" wizard pages. A few commonly used
|
||||
// ones are provided already in qinstallergui.h.
|
||||
|
||||
|
||||
// A custom target directory selection based due to the no-space
|
||||
// restriction...
|
||||
|
||||
class TargetDirectoryPage : public QInstallerTargetDirectoryPage
|
||||
{
|
||||
public:
|
||||
TargetDirectoryPage(QInstaller *installer)
|
||||
: QInstallerTargetDirectoryPage(installer)
|
||||
{
|
||||
m_noSpaceLabel = new QLabel(this);
|
||||
m_noSpaceLabel->setText("The directory name should not contain any space.");
|
||||
m_noSpaceLabel->hide();
|
||||
insertWidget(m_noSpaceLabel, "MessageLabel");
|
||||
}
|
||||
|
||||
bool isComplete() const
|
||||
{
|
||||
bool invalid = targetDir().contains(' ');
|
||||
QPalette palette;
|
||||
// We show the warning only if the user types a space.
|
||||
// No need to scare him if the path is ok for us...
|
||||
if (invalid) {
|
||||
m_noSpaceLabel->show();
|
||||
palette.setColor(QPalette::WindowText, Qt::red);
|
||||
}
|
||||
m_noSpaceLabel->setPalette(palette);
|
||||
return !invalid;
|
||||
}
|
||||
|
||||
int nextId() const
|
||||
{
|
||||
QFileInfo fi(targetDir());
|
||||
|
||||
if (isVisible() && fi.isDir()) {
|
||||
QFileInfo fi2(targetDir() + '/' + installer()->uninstallerName());
|
||||
if (fi2.exists()) {
|
||||
QMessageBox::StandardButton bt = QMessageBox::warning(wizard(),
|
||||
tr("Warning"),
|
||||
tr("The directory you selected exists already and contains an installaion.\n"
|
||||
"Do you want to overwrite it?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (bt == QMessageBox::No)
|
||||
return wizard()->currentId();
|
||||
} else {
|
||||
QMessageBox::StandardButton bt = QMessageBox::warning(wizard(),
|
||||
tr("Warning"),
|
||||
tr("The directory you selected exists already.\n"
|
||||
"Do you want to remove it and continue?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (bt == QMessageBox::No)
|
||||
return wizard()->currentId();
|
||||
}
|
||||
}
|
||||
return QInstallerPage::nextId();
|
||||
}
|
||||
|
||||
private:
|
||||
QLabel *m_noSpaceLabel;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QtCreatorInstallerGui
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
// QtCreatorInstallerGui is the QtCreator specific incarnation
|
||||
// of a QInstallerGui.
|
||||
|
||||
class QtCreatorInstallerGui : public QInstallerGui
|
||||
{
|
||||
public:
|
||||
QtCreatorInstallerGui(QInstaller *installer)
|
||||
{
|
||||
// The Gui has access to the installer backend at construction
|
||||
// time. For later access it needs to store the QInstaller *
|
||||
// pointer provided. Not needed in this case here.
|
||||
|
||||
setWindowTitle(tr("%1 Setup").arg(installer->value("ProductName")));
|
||||
installer->connectGui(this);
|
||||
|
||||
// We are happy with the default set of pages.
|
||||
addPage(new QInstallerIntroductionPage(installer));
|
||||
addPage(new QInstallerLicenseAgreementPage(installer));
|
||||
//addPage(new QInstallerTargetDirectoryPage(installer));
|
||||
addPage(new TargetDirectoryPage(installer));
|
||||
if (installer->componentCount() > 1)
|
||||
addPage(new QInstallerComponentSelectionPage(installer));
|
||||
addPage(new QInstallerReadyForInstallationPage(installer));
|
||||
addPage(new QInstallerPerformInstallationPage(installer));
|
||||
addPage(new QInstallerFinishedPage(installer));
|
||||
|
||||
setStartId(installer->value("GuiStartPage").toInt());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// QInstaller is base of the "backend" part of an installer, i.e.
|
||||
// the part handling the installer tasks and keeping track of
|
||||
// related data like the directory to install to, the name of
|
||||
// the Product, version of the Product etc.
|
||||
|
||||
// QtCreatorInstaller is the QtCreator specific incarnation
|
||||
// of a QInstaller. It needs to list all tasks that a performed
|
||||
// during installation. The tasks themselves specify what to
|
||||
// do at uninstall time.
|
||||
|
||||
class QtCreatorInstaller : public QInstaller
|
||||
{
|
||||
public:
|
||||
QtCreatorInstaller()
|
||||
{
|
||||
// basic product information
|
||||
setValue("ProductName", "Qt Creator");
|
||||
setValue("ProductVersion", "alpha");
|
||||
|
||||
// registration information
|
||||
setValue("Comments", "");
|
||||
setValue("Contact", "");
|
||||
setValue("DisplayVersion", "");
|
||||
setValue("HelpLink", "");
|
||||
setValue("Publisher", "");
|
||||
setValue("UrlAboutInfo", "");
|
||||
|
||||
// information needed at installer generation time
|
||||
setValue("OutputFile", "qtcreator-installer");
|
||||
setValue("RunProgram", "@TargetDir@/bin/qtcreator");
|
||||
|
||||
// default component selection, overridable from command line
|
||||
setValue("UseQtCreator", "true");
|
||||
#ifdef Q_OS_WIN
|
||||
//setValue("UseQt", "true");
|
||||
//setValue("UseMinGW", "true");
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
// tasks related to QtCreator itself. Binary, libraries etc.
|
||||
void appendQtCreatorComponent()
|
||||
{
|
||||
QString sourceDir = value("SourceDir");
|
||||
if (sourceDir.isEmpty() && QFileInfo("../bin/qtcreator").isReadable())
|
||||
sourceDir = QLatin1String("..");
|
||||
if (sourceDir.isEmpty())
|
||||
throw QInstallerError("Missing 'SourceDir=<dir>' on command line.");
|
||||
QInstallerComponent *component = new QInstallerComponent(this);
|
||||
component->setValue("Name", "QtCreator");
|
||||
component->setValue("DisplayName", "Qt Creator");
|
||||
component->setValue("Description", "The Qt Creator IDE");
|
||||
component->setValue("SuggestedState", "AlwaysInstalled");
|
||||
#ifdef Q_OS_MAC
|
||||
component->appendDirectoryTasks(sourceDir + "/bin/QtCreator.app", "@TargetDir@");
|
||||
#else
|
||||
component->appendDirectoryTasks(sourceDir + "/bin", "@TargetDir@/bin");
|
||||
component->appendDirectoryTasks(sourceDir + "/lib", "@TargetDir@/lib");
|
||||
#endif
|
||||
|
||||
QInstallerPatchFileTask *task = new QInstallerPatchFileTask(this);
|
||||
task->setTargetPath("@TargetDir@/lib/Trolltech/" + libraryName("ProjectExplorer", "1.0.0"));
|
||||
task->setNeedle("Clear Session");
|
||||
task->setReplacement("CLEAR SESSION");
|
||||
component->appendTask(task);
|
||||
|
||||
appendComponent(component);
|
||||
}
|
||||
|
||||
void appendMinGWComponent()
|
||||
{
|
||||
QString mingwSourceDir = value("MinGWSourceDir");
|
||||
if (mingwSourceDir.isEmpty())
|
||||
throw QInstallerError("Missing 'MinGWSourceDir=<dir>' on command line.");
|
||||
QInstallerComponent *component = new QInstallerComponent(this);
|
||||
component->setValue("Name", "MinGW");
|
||||
component->setValue("DisplayName", "MinGW");
|
||||
component->setValue("Description",
|
||||
"The MinGW environment including the g++ compiler "
|
||||
"and the gdb debugger.");
|
||||
component->setValue("SuggestedState", "Installed");
|
||||
component->appendDirectoryTasks(mingwSourceDir, "@TargetDir@");
|
||||
appendComponent(component);
|
||||
}
|
||||
|
||||
void appendQtComponent()
|
||||
{
|
||||
QString qtSourceDir = value("QtSourceDir");
|
||||
if (qtSourceDir.isEmpty())
|
||||
throw QInstallerError("Missing 'QtSourceDir=<dir>' on command line.");
|
||||
|
||||
QInstallerComponent *component = new QInstallerComponent(this);
|
||||
component->setValue("Name", "Qt Development Libraries");
|
||||
component->setValue("DisplayName", "Qt");
|
||||
component->setValue("Description",
|
||||
"The Qt library files for development including "
|
||||
"documentation");
|
||||
component->setValue("SuggestedState", "Installed");
|
||||
component->appendDirectoryTasks(qtSourceDir, "@TargetDir@");
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
static const struct
|
||||
{
|
||||
const char *fileName;
|
||||
const char *sourceLocation;
|
||||
} libs[] = {
|
||||
{"/bin/Qt3Support", "/src/qt3support/"},
|
||||
{"/bin/QtCore", "/src/corelib/"},
|
||||
{"/bin/QtGui", "/src/gui/"},
|
||||
{"/bin/QtHelp", "/tools/assistant/lib/"},
|
||||
{"/bin/QtNetwork", "/src/network/"},
|
||||
{"/bin/QtOpenGL", "/src/opengl/"},
|
||||
{"/bin/QtScript", "/src/script/"},
|
||||
{"/bin/QtSql", "/src/sql/"},
|
||||
{"/bin/QtSvg", "/src/svg/"},
|
||||
{"/bin/QtTest", "/src/testlib/"},
|
||||
{"/bin/QtWebKit", "/src/3rdparty/webkit/WebCore/"},
|
||||
{"/bin/QtXml", "/src/xml/"},
|
||||
{"/bin/QtXmlPatterns", "/src/xmlpatterns/"},
|
||||
{"/plugins/accessible/qtaccessiblecompatwidgets",
|
||||
"/src/plugins/accessible/compat/"},
|
||||
{"/plugins/accessible/qtaccessiblewidgets",
|
||||
"/src/plugins/accessible/widgets/"},
|
||||
{"/plugins/codecs/qcncodecs", "/src/plugins/codecs/cn/"},
|
||||
{"/plugins/codecs/qjpcodecs", "/src/plugins/codecs/jp/"},
|
||||
{"/plugins/codecs/qkrcodecs", "/src/plugins/codecs/kr/"},
|
||||
{"/plugins/codecs/qtwcodecs", "/src/plugins/codecs/tw/"},
|
||||
{"/plugins/iconengines/qsvgicon", "/src/plugins/iconengines/svgiconengine/"},
|
||||
{"/plugins/imageformats/qgif", "/src/plugins/imageformats/gif/"},
|
||||
{"/plugins/imageformats/qjpeg", "/src/plugins/imageformats/jpeg/"},
|
||||
{"/plugins/imageformats/qmng", "/src/plugins/imageformats/mng/"},
|
||||
{"/plugins/imageformats/qsvg", "/src/plugins/imageformats/svg/"},
|
||||
{"/plugins/imageformats/qtiff", "/src/plugins/imageformats/tiff/"},
|
||||
{"/plugins/sqldrivers/qsqlite", "/src/plugins/sqldrivers/sqlite/"},
|
||||
// {"/plugins/sqldrivers/qsqlodbc", "/src/plugins/sqldrivers/odbc/"}
|
||||
};
|
||||
|
||||
QString debug = QLatin1String("d4.dll");
|
||||
|
||||
for (int i = 0; i != sizeof(libs) / sizeof(libs[0]); ++i) {
|
||||
QInstallerPatchFileTask *task = new QInstallerPatchFileTask(this);
|
||||
task->setTargetPath(QString("@TargetDir@/") + libs[i].fileName + debug);
|
||||
task->setNeedle("f:/depot/qt");
|
||||
task->setReplacement(QByteArray("@TargetDir@/") + libs[i].sourceLocation);
|
||||
component->appendTask(task);
|
||||
}
|
||||
#endif
|
||||
|
||||
appendComponent(component);
|
||||
}
|
||||
|
||||
void createTasks()
|
||||
{
|
||||
// set UseXXX=false on command line to prevent inclusion of the
|
||||
// respective component
|
||||
if (value("UseQtCreator") == "true")
|
||||
appendQtCreatorComponent();
|
||||
if (value("UseMinGW") == "true")
|
||||
appendMinGWComponent();
|
||||
if (value("UseQt") == "true")
|
||||
appendQtComponent();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QtCreatorUninstallerGui
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
class QtCreatorUninstallerGui : public QObject
|
||||
{
|
||||
public:
|
||||
QtCreatorUninstallerGui(QInstaller *installer)
|
||||
: m_installer(installer)
|
||||
{}
|
||||
|
||||
int exec()
|
||||
{
|
||||
QMessageBox::StandardButton bt = QMessageBox::question(0,
|
||||
tr("Question"),
|
||||
tr("Do you want to deinstall %1 and all of its modules?")
|
||||
.arg(m_installer->value("ProductName")),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||
if (bt == QMessageBox::No)
|
||||
return 0;
|
||||
QWizard wizard;
|
||||
wizard.addPage(new QInstallerPerformUninstallationPage(m_installer));
|
||||
wizard.show();
|
||||
return qApp->exec();
|
||||
}
|
||||
|
||||
private:
|
||||
QInstaller *m_installer;
|
||||
};
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The Main Driver Program
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
QStringList args = app.arguments();
|
||||
qDebug() << "ARGS: " << args;
|
||||
|
||||
QtCreatorInstaller installer;
|
||||
|
||||
bool helpRequested = false;
|
||||
bool guiRequested = true;
|
||||
|
||||
for (int i = 1; i < args.size(); ++i) {
|
||||
if (args.at(i).contains('=')) {
|
||||
const QString arg = args.at(i);
|
||||
const QString name = arg.section('=', 0, 0);
|
||||
const QString value = arg.section('=', 1, 1);
|
||||
installer.setValue(name, value);
|
||||
} else if (args.at(i) == "--help" || args.at(i) == "-h") {
|
||||
helpRequested = true;
|
||||
} else if (args.at(i) == "--no-gui" || args.at(i) == "NoGui") {
|
||||
qDebug() << "NOGUI";
|
||||
guiRequested = false;
|
||||
} else if (args.at(i) == "--verbose" || args.at(i) == "Verbose") {
|
||||
installer.setVerbose(true);
|
||||
} else {
|
||||
helpRequested = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (installer.isVerbose())
|
||||
installer.dump();
|
||||
|
||||
if (helpRequested) {
|
||||
QString productName = installer.value("ProductName");
|
||||
QString str;
|
||||
if (installer.isCreator())
|
||||
str = QString(" [SourceDir=<dir>]\n"
|
||||
"\n Creates the %1 installer.\n").arg(productName);
|
||||
else if (installer.isInstaller())
|
||||
str = QString(" [--no-gui] [<name>=<value>...]\n"
|
||||
"\n Runs the %1 installer\n"
|
||||
"\n If the '--no-gui' parameter is given, it runs "
|
||||
" installer without GUI\n").arg(productName);
|
||||
else if (installer.isUninstaller())
|
||||
str = QString(" [<name>=<value>...]\n"
|
||||
"\n Runs the %1 uninstaller.\n").arg(productName);
|
||||
str = "\nUsage: " + installer.installerBinaryPath() + str;
|
||||
qDebug() << qPrintable(str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (installer.isInstaller() && guiRequested) {
|
||||
QtCreatorInstallerGui gui(&installer);
|
||||
gui.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
if (installer.isUninstaller()) {
|
||||
QStringList newArgs = args;
|
||||
newArgs.removeFirst();
|
||||
installer.restartTempUninstaller(newArgs);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
if ((installer.isUninstaller() || installer.isTempUninstaller())
|
||||
&& guiRequested) {
|
||||
QtCreatorUninstallerGui gui(&installer);
|
||||
//gui.show();
|
||||
return gui.exec();
|
||||
}
|
||||
|
||||
return installer.run() ? 0 : 1;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
TEMPLATE = app
|
||||
TARGET = installercreator
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += .
|
||||
|
||||
CONFIG -= debug
|
||||
CONFIG += release
|
||||
|
||||
HEADERS += \
|
||||
qinstaller.h \
|
||||
qinstallergui.h \
|
||||
|
||||
SOURCES += \
|
||||
qinstaller.cpp \
|
||||
qinstallergui.cpp \
|
||||
installer.cpp \
|
||||
|
||||
RESOURCES += \
|
||||
installer.qrc \
|
||||
|
||||
true {
|
||||
OBJECTS_DIR = .tmp/
|
||||
MOC_DIR = .tmp/
|
||||
RCC_DIR = .tmp/
|
||||
UI_DIR = .tmp/
|
||||
}
|
||||
|
||||
win32:LIBS += ole32.lib
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>resources/logo.png</file>
|
||||
<file>resources/watermark.png</file>
|
||||
<file>resources/license.txt</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,357 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef QINSTALLER_H
|
||||
#define QINSTALLER_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QIODevice;
|
||||
class QInstallerTask;
|
||||
class QInstallerComponent;
|
||||
|
||||
class QInstaller : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QInstaller();
|
||||
~QInstaller();
|
||||
|
||||
bool run();
|
||||
|
||||
// parameter handling
|
||||
void setValue(const QString &key, const QString &value);
|
||||
QString value(const QString &key,
|
||||
const QString &defaultValue = QString()) const;
|
||||
bool containsValue(const QString &key) const;
|
||||
QString replaceVariables(const QString &str) const;
|
||||
QByteArray replaceVariables(const QByteArray &str) const;
|
||||
QString installerBinaryPath() const;
|
||||
QString uninstallerName() const;
|
||||
|
||||
// installer-specific task creation
|
||||
virtual void createTasks() {}
|
||||
|
||||
// component handling
|
||||
void appendComponent(QInstallerComponent *components);
|
||||
int componentCount() const;
|
||||
QInstallerComponent *component(int i) const;
|
||||
typedef QInstallerTask *(*TaskCreator)(QInstaller *);
|
||||
void registerTaskType(TaskCreator);
|
||||
int indexOfTaskType(TaskCreator) const;
|
||||
|
||||
// progress handling
|
||||
//void setInstallationProgress(int);
|
||||
int installationProgress() const;
|
||||
void setInstallationProgressText(const QString &);
|
||||
QString installationProgressText() const;
|
||||
|
||||
// convenience
|
||||
bool isCreator() const;
|
||||
bool isInstaller() const;
|
||||
bool isUninstaller() const;
|
||||
bool isTempUninstaller() const;
|
||||
|
||||
bool isVerbose() const;
|
||||
void setVerbose(bool on);
|
||||
void connectGui(QObject *gui);
|
||||
|
||||
QString libraryName(const QString &baseName, const QString &version);
|
||||
|
||||
bool restartTempUninstaller(const QStringList &args);
|
||||
|
||||
// status
|
||||
enum InstallerStatus {
|
||||
InstallerUnfinished,
|
||||
InstallerCanceledByUser,
|
||||
InstallerFailed,
|
||||
InstallerSucceeded,
|
||||
};
|
||||
InstallerStatus status() const;
|
||||
|
||||
// I/O helper for authors of classes deriving from QInstallerStep
|
||||
static void appendInt(QIODevice *out, qint64 n);
|
||||
static void appendString(QIODevice *out, const QString &str);
|
||||
static void appendByteArray(QIODevice *out, const QByteArray &str);
|
||||
static qint64 retrieveInt(QIODevice *in);
|
||||
static QString retrieveString(QIODevice *in);
|
||||
static QByteArray retrieveByteArray(QIODevice *in);
|
||||
|
||||
void dump() const;
|
||||
class Private;
|
||||
|
||||
public slots:
|
||||
bool runInstaller();
|
||||
bool runUninstaller();
|
||||
void interrupt();
|
||||
void showWarning(const QString &);
|
||||
|
||||
signals:
|
||||
void installationStarted();
|
||||
void installationFinished();
|
||||
void uninstallationStarted();
|
||||
void uninstallationFinished();
|
||||
void warning(QString);
|
||||
|
||||
private:
|
||||
Private *d;
|
||||
};
|
||||
|
||||
|
||||
class QInstallerComponent
|
||||
{
|
||||
public:
|
||||
explicit QInstallerComponent(QInstaller *installer);
|
||||
~QInstallerComponent();
|
||||
|
||||
void setValue(const QString &key, const QString &value);
|
||||
QString value(const QString &key,
|
||||
const QString &defaultValue = QString()) const;
|
||||
|
||||
void appendTask(QInstallerTask *step);
|
||||
void appendDirectoryTasks(const QString &sourcePath,
|
||||
const QString &targetPath);
|
||||
void appendSettingsTask(const QString &key, const QString &value);
|
||||
void appendUninstallerRegistrationTask();
|
||||
int taskCount() const;
|
||||
QInstallerTask *task(int) const;
|
||||
|
||||
friend class QInstaller;
|
||||
friend class QInstaller::Private;
|
||||
private:
|
||||
Q_DISABLE_COPY(QInstallerComponent);
|
||||
class Private;
|
||||
Private *d;
|
||||
};
|
||||
|
||||
|
||||
class QInstallerTask
|
||||
{
|
||||
public:
|
||||
QInstallerTask(QInstaller *parent);
|
||||
virtual ~QInstallerTask() {}
|
||||
|
||||
QInstaller *installer() const;
|
||||
|
||||
virtual void writeToInstaller(QIODevice *out) const = 0;
|
||||
virtual void readAndExecuteFromInstaller(QIODevice *in) = 0;
|
||||
|
||||
virtual void writeToUninstaller(QIODevice *out) const = 0;
|
||||
virtual void readAndExecuteFromUninstaller(QIODevice *in) = 0;
|
||||
|
||||
virtual void undo() = 0;
|
||||
virtual void dump(QDebug &) const {}
|
||||
|
||||
virtual QInstaller::TaskCreator creator() const = 0;
|
||||
|
||||
private:
|
||||
QInstaller *m_installer;
|
||||
};
|
||||
|
||||
|
||||
class QInstallerError
|
||||
{
|
||||
public:
|
||||
QInstallerError(const QString &m) : m_message(m) {}
|
||||
virtual ~QInstallerError() {}
|
||||
virtual QString message() const { return m_message; }
|
||||
private:
|
||||
QString m_message;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Some useful examples
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
class QInstallerCopyFileTask : public QInstallerTask
|
||||
{
|
||||
public:
|
||||
QInstallerCopyFileTask(QInstaller *parent) : QInstallerTask(parent) {}
|
||||
QInstaller::TaskCreator creator() const;
|
||||
|
||||
void setSourcePath(const QString &sourcePath) { m_sourcePath = sourcePath; }
|
||||
QString sourcePath() const { return m_sourcePath; }
|
||||
|
||||
void setTargetPath(const QString &targetPath) { m_targetPath = targetPath; }
|
||||
QString targetPath() const { return m_targetPath; }
|
||||
|
||||
void setPermissions(qint64 permissions) { m_permissions = permissions; }
|
||||
qint64 permissions() const { return m_permissions; }
|
||||
|
||||
void writeToInstaller(QIODevice *out) const;
|
||||
void readAndExecuteFromInstaller(QIODevice *in);
|
||||
|
||||
void writeToUninstaller(QIODevice *out) const;
|
||||
void readAndExecuteFromUninstaller(QIODevice *in);
|
||||
|
||||
void undo();
|
||||
void dump(QDebug &) const;
|
||||
|
||||
private:
|
||||
QString m_sourcePath;
|
||||
QString m_targetPath;
|
||||
qint64 m_permissions;
|
||||
int m_parentDirCount;
|
||||
};
|
||||
|
||||
|
||||
class QInstallerLinkFileTask : public QInstallerTask
|
||||
{
|
||||
public:
|
||||
QInstallerLinkFileTask(QInstaller *parent) : QInstallerTask(parent) {}
|
||||
QInstaller::TaskCreator creator() const;
|
||||
|
||||
void setTargetPath(const QString &path) { m_targetPath = path; }
|
||||
QString targetPath() const { return m_targetPath; }
|
||||
|
||||
void setLinkTargetPath(const QString &path) { m_linkTargetPath = path; }
|
||||
QString linkTargetPath() const { return m_linkTargetPath; }
|
||||
|
||||
void setPermissions(qint64 permissions) { m_permissions = permissions; }
|
||||
qint64 permissions() const { return m_permissions; }
|
||||
|
||||
void writeToInstaller(QIODevice *out) const;
|
||||
void readAndExecuteFromInstaller(QIODevice *in);
|
||||
|
||||
void writeToUninstaller(QIODevice *out) const;
|
||||
void readAndExecuteFromUninstaller(QIODevice *in);
|
||||
|
||||
void undo();
|
||||
void dump(QDebug &) const;
|
||||
|
||||
public:
|
||||
QString m_targetPath; // location of the link in the target system
|
||||
QString m_linkTargetPath; // linkee
|
||||
qint64 m_permissions;
|
||||
};
|
||||
|
||||
|
||||
class QInstallerWriteSettingsTask : public QInstallerTask
|
||||
{
|
||||
public:
|
||||
QInstallerWriteSettingsTask(QInstaller *parent)
|
||||
: QInstallerTask(parent) {}
|
||||
QInstaller::TaskCreator creator() const;
|
||||
|
||||
void setKey(const QString &key) { m_key = key; }
|
||||
QString key() const { return m_key; }
|
||||
|
||||
void setValue(const QString &value) { m_value = value; }
|
||||
QString value() const { return m_value; }
|
||||
|
||||
void writeToInstaller(QIODevice *out) const;
|
||||
void readAndExecuteFromInstaller(QIODevice *in);
|
||||
|
||||
void writeToUninstaller(QIODevice *out) const;
|
||||
void readAndExecuteFromUninstaller(QIODevice *in);
|
||||
|
||||
void undo();
|
||||
void dump(QDebug &) const;
|
||||
|
||||
public:
|
||||
QString m_key;
|
||||
QString m_value;
|
||||
};
|
||||
|
||||
|
||||
class QInstallerPatchFileTask : public QInstallerTask
|
||||
{
|
||||
public:
|
||||
QInstallerPatchFileTask(QInstaller *parent) : QInstallerTask(parent) {}
|
||||
QInstaller::TaskCreator creator() const;
|
||||
|
||||
void setTargetPath(const QString &path) { m_targetPath = path; }
|
||||
QString targetPath() const { return m_targetPath; }
|
||||
|
||||
void setNeedle(const QByteArray &needle) { m_needle = needle; }
|
||||
QByteArray needle() const { return m_needle; }
|
||||
|
||||
void setReplacement(const QByteArray &repl) { m_replacement = repl; }
|
||||
QByteArray replacement() const { return m_replacement; }
|
||||
|
||||
void writeToInstaller(QIODevice *out) const;
|
||||
void readAndExecuteFromInstaller(QIODevice *in);
|
||||
|
||||
void writeToUninstaller(QIODevice *) const {}
|
||||
void readAndExecuteFromUninstaller(QIODevice *) {}
|
||||
|
||||
void undo() {}
|
||||
void dump(QDebug &) const;
|
||||
|
||||
private:
|
||||
QByteArray m_needle;
|
||||
QByteArray m_replacement;
|
||||
QString m_targetPath;
|
||||
};
|
||||
|
||||
|
||||
class QInstallerMenuShortcutTask : public QInstallerTask
|
||||
{
|
||||
public:
|
||||
QInstallerMenuShortcutTask(QInstaller *parent) : QInstallerTask(parent) {}
|
||||
QInstaller::TaskCreator creator() const;
|
||||
|
||||
void setTargetPath(const QString &path) { m_targetPath = path; }
|
||||
QString targetPath() const { return m_targetPath; }
|
||||
|
||||
void setLinkTargetPath(const QString &path) { m_linkTargetPath = path; }
|
||||
QString linkTargetPath() const { return m_linkTargetPath; }
|
||||
|
||||
void writeToInstaller(QIODevice *out) const;
|
||||
void readAndExecuteFromInstaller(QIODevice *in);
|
||||
|
||||
void writeToUninstaller(QIODevice *out) const;
|
||||
void readAndExecuteFromUninstaller(QIODevice *in);
|
||||
|
||||
void undo();
|
||||
void dump(QDebug &) const;
|
||||
|
||||
public:
|
||||
QString m_targetPath;
|
||||
QString m_linkTargetPath;
|
||||
QString m_startMenuPath;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // QINSTALLER_H
|
||||
@@ -1,742 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#include "qinstallergui.h"
|
||||
|
||||
#include "qinstaller.h"
|
||||
#include "private/qobject_p.h"
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QProcess>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QCheckBox>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QGridLayout>
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QHeaderView>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QLineEdit>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QProgressBar>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QRadioButton>
|
||||
#include <QtGui/QTextEdit>
|
||||
#include <QtGui/QTreeWidget>
|
||||
#include <QtGui/QTreeView>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QInstallerGui
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
QInstallerGui::QInstallerGui(QInstaller *installer, QWidget *parent)
|
||||
: QWizard(parent)
|
||||
{
|
||||
#ifndef Q_WS_MAC
|
||||
setWizardStyle(QWizard::ModernStyle);
|
||||
#endif
|
||||
setOption(QWizard::IndependentPages);
|
||||
connect(button(QWizard::CancelButton), SIGNAL(clicked()),
|
||||
this, SLOT(cancelButtonClicked()));
|
||||
|
||||
connect(this, SIGNAL(interrupted()),
|
||||
installer, SLOT(interrupt()));
|
||||
connect(installer, SIGNAL(installationFinished()),
|
||||
this, SLOT(showFinishedPage()));
|
||||
connect(installer, SIGNAL(warning(QString)),
|
||||
this, SLOT(showWarning(QString)));
|
||||
}
|
||||
|
||||
void QInstallerGui::cancelButtonClicked()
|
||||
{
|
||||
QInstallerPage *page = qobject_cast<QInstallerPage *>(currentPage());
|
||||
qDebug() << "CANCEL CLICKED" << currentPage() << page;
|
||||
if (page && page->isInterruptible()) {
|
||||
QMessageBox::StandardButton bt = QMessageBox::warning(this,
|
||||
tr("Warning"),
|
||||
tr("Do you want to abort the installation process?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (bt == QMessageBox::Yes)
|
||||
emit interrupted();
|
||||
} else {
|
||||
QMessageBox::StandardButton bt = QMessageBox::warning(this,
|
||||
tr("Warning"),
|
||||
tr("Do you want to abort the installer application?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (bt == QMessageBox::Yes)
|
||||
QDialog::reject();
|
||||
}
|
||||
}
|
||||
|
||||
void QInstallerGui::reject()
|
||||
{}
|
||||
|
||||
void QInstallerGui::showFinishedPage()
|
||||
{
|
||||
qDebug() << "SHOW FINISHED PAGE";
|
||||
next();
|
||||
}
|
||||
|
||||
void QInstallerGui::showWarning(const QString &msg)
|
||||
{
|
||||
QMessageBox::warning(this, tr("Warning"), msg);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QInstallerPage
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
QInstallerPage::QInstallerPage(QInstaller *installer)
|
||||
: m_installer(installer), m_fresh(true)
|
||||
{
|
||||
setSubTitle(QString(" ")); // otherwise the colors will screw up
|
||||
|
||||
}
|
||||
|
||||
QInstaller *QInstallerPage::installer() const
|
||||
{
|
||||
return m_installer;
|
||||
}
|
||||
|
||||
QPixmap QInstallerPage::watermarkPixmap() const
|
||||
{
|
||||
return QPixmap(m_installer->value("WatermarkPixmap"));
|
||||
}
|
||||
|
||||
QPixmap QInstallerPage::logoPixmap() const
|
||||
{
|
||||
return QPixmap(m_installer->value("LogoPixmap"));
|
||||
}
|
||||
|
||||
QString QInstallerPage::productName() const
|
||||
{
|
||||
return m_installer->value("ProductName");
|
||||
}
|
||||
|
||||
void QInstallerPage::insertWidget(QWidget *widget, const QString &siblingName, int offset)
|
||||
{
|
||||
QWidget *sibling = findChild<QWidget *>(siblingName);
|
||||
QWidget *parent = sibling ? sibling->parentWidget() : 0;
|
||||
QLayout *layout = parent ? parent->layout() : 0;
|
||||
QBoxLayout *blayout = qobject_cast<QBoxLayout *>(layout);
|
||||
//qDebug() << "FOUND: " << sibling << parent << layout << blayout;
|
||||
if (blayout) {
|
||||
int index = blayout->indexOf(sibling) + offset;
|
||||
blayout->insertWidget(index, widget);
|
||||
}
|
||||
}
|
||||
|
||||
QWidget *QInstallerPage::findWidget(const QString &objectName) const
|
||||
{
|
||||
return findChild<QWidget *>(objectName);
|
||||
}
|
||||
|
||||
void QInstallerPage::setVisible(bool visible)
|
||||
{
|
||||
QWizardPage::setVisible(visible);
|
||||
qApp->processEvents();
|
||||
//qDebug() << "VISIBLE: " << visible << objectName() << installer();
|
||||
if (m_fresh && !visible) {
|
||||
//qDebug() << "SUPRESSED...";
|
||||
m_fresh = false;
|
||||
return;
|
||||
}
|
||||
if (visible)
|
||||
entering();
|
||||
else
|
||||
leaving();
|
||||
}
|
||||
|
||||
int QInstallerPage::nextId() const
|
||||
{
|
||||
//qDebug() << "NEXTID";
|
||||
return QWizardPage::nextId();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QInstallerIntroductionPage
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
QInstallerIntroductionPage::QInstallerIntroductionPage(QInstaller *installer)
|
||||
: QInstallerPage(installer)
|
||||
{
|
||||
setObjectName("IntroductionPage");
|
||||
setTitle(tr("Setup - %1").arg(productName()));
|
||||
setPixmap(QWizard::WatermarkPixmap, watermarkPixmap());
|
||||
setSubTitle(QString());
|
||||
|
||||
QLabel *msgLabel = new QLabel(this);
|
||||
msgLabel->setObjectName("MessageLabel");
|
||||
msgLabel->setWordWrap(true);
|
||||
msgLabel->setText(QInstaller::tr("Welcome to the %1 Setup Wizard.")
|
||||
.arg(productName()));
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
layout->addWidget(msgLabel);
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QInstallerLicenseAgreementPage
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
QInstallerLicenseAgreementPage::QInstallerLicenseAgreementPage(QInstaller *installer)
|
||||
: QInstallerPage(installer)
|
||||
{
|
||||
setObjectName("LicenseAgreementPage");
|
||||
setTitle(tr("License Agreement"));
|
||||
QString msg = tr("Please read the following License Agreement. "
|
||||
"You must accept the terms of this agreement "
|
||||
"before continuing with the installation.");
|
||||
setPixmap(QWizard::LogoPixmap, logoPixmap());
|
||||
setPixmap(QWizard::WatermarkPixmap, QPixmap());
|
||||
|
||||
QTextEdit *textEdit = new QTextEdit(this);
|
||||
textEdit->setObjectName("LicenseText");
|
||||
QFile file(":/resources/license.txt");
|
||||
file.open(QIODevice::ReadOnly);
|
||||
textEdit->setText(file.readAll());
|
||||
|
||||
m_acceptRadioButton = new QRadioButton(tr("I accept the agreement"), this);
|
||||
m_rejectRadioButton = new QRadioButton(tr("I do not accept the agreement"), this);
|
||||
|
||||
QLabel *msgLabel = new QLabel(msg, this);
|
||||
msgLabel->setObjectName("MessageLabel");
|
||||
msgLabel->setWordWrap(true);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
layout->addWidget(msgLabel);
|
||||
layout->addWidget(textEdit);
|
||||
QHBoxLayout *hlayout = new QHBoxLayout;
|
||||
hlayout->addWidget(new QLabel(tr("Do you accept this License?")));
|
||||
QVBoxLayout *vlayout = new QVBoxLayout;
|
||||
vlayout->addWidget(m_acceptRadioButton);
|
||||
vlayout->addWidget(m_rejectRadioButton);
|
||||
hlayout->addLayout(vlayout);
|
||||
layout->addLayout(hlayout);
|
||||
setLayout(layout);
|
||||
connect(m_acceptRadioButton, SIGNAL(toggled(bool)),
|
||||
this, SIGNAL(completeChanged()));
|
||||
connect(m_rejectRadioButton, SIGNAL(toggled(bool)),
|
||||
this, SIGNAL(completeChanged()));
|
||||
}
|
||||
|
||||
bool QInstallerLicenseAgreementPage::isComplete() const
|
||||
{
|
||||
return m_acceptRadioButton->isChecked();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QInstallerComponentSelectionPage
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
static QString niceSizeText(const QString &str)
|
||||
{
|
||||
qint64 size = str.toInt();
|
||||
QString msg = QInstallerComponentSelectionPage::tr(
|
||||
"This component will occupy approximately %1 %2 on your harddisk.");
|
||||
if (size < 10000)
|
||||
return msg.arg(size).arg("Bytes");
|
||||
if (size < 1024 * 10000)
|
||||
return msg.arg(size / 1024).arg("kBytes");
|
||||
return msg.arg(size / 1024 / 1024).arg("MBytes");
|
||||
}
|
||||
|
||||
class QInstallerComponentSelectionPage::Private : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Private(QInstallerComponentSelectionPage *q_, QInstaller *installer)
|
||||
: q(q_), m_installer(installer)
|
||||
{
|
||||
m_treeView = new QTreeWidget(q);
|
||||
m_treeView->setObjectName("TreeView");
|
||||
m_treeView->setMouseTracking(true);
|
||||
m_treeView->header()->hide();
|
||||
|
||||
for (int i = 0; i != installer->componentCount(); ++i) {
|
||||
QInstallerComponent *component = installer->component(i);
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem(m_treeView);
|
||||
item->setText(0, component->value("Name"));
|
||||
item->setToolTip(0, component->value("Description"));
|
||||
item->setToolTip(1, niceSizeText(component->value("UncompressedSize")));
|
||||
//QString current = component->value("CurrentState");
|
||||
QString suggested = component->value("SuggestedState");
|
||||
if (suggested == "Uninstalled") {
|
||||
item->setCheckState(0, Qt::Unchecked);
|
||||
} else if (suggested == "AlwaysInstalled") {
|
||||
item->setCheckState(0, Qt::PartiallyChecked);
|
||||
item->setFlags(item->flags() & ~Qt::ItemIsUserCheckable);
|
||||
} else { //if (suggested == "Installed")
|
||||
item->setCheckState(0, Qt::Checked);
|
||||
}
|
||||
}
|
||||
|
||||
m_descriptionLabel = new QLabel(q);
|
||||
m_descriptionLabel->setWordWrap(true);
|
||||
|
||||
m_sizeLabel = new QLabel(q);
|
||||
m_sizeLabel->setWordWrap(true);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(q);
|
||||
//layout->addWidget(msgLabel);
|
||||
QHBoxLayout *hlayout = new QHBoxLayout;
|
||||
hlayout->addWidget(m_treeView, 3);
|
||||
QVBoxLayout *vlayout = new QVBoxLayout;
|
||||
vlayout->addWidget(m_descriptionLabel);
|
||||
vlayout->addWidget(m_sizeLabel);
|
||||
vlayout->addSpacerItem(new QSpacerItem(1, 1,
|
||||
QSizePolicy::MinimumExpanding,
|
||||
QSizePolicy::MinimumExpanding));
|
||||
hlayout->addLayout(vlayout, 2);
|
||||
layout->addLayout(hlayout);
|
||||
q->setLayout(layout);
|
||||
|
||||
connect(m_treeView,
|
||||
SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
|
||||
this, SLOT(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
|
||||
}
|
||||
|
||||
public slots:
|
||||
void currentItemChanged(QTreeWidgetItem *item, QTreeWidgetItem *)
|
||||
{
|
||||
m_descriptionLabel->setText(item->toolTip(0));
|
||||
m_sizeLabel->setText(item->toolTip(1));
|
||||
}
|
||||
|
||||
public:
|
||||
QInstallerComponentSelectionPage *q;
|
||||
QInstaller *m_installer;
|
||||
QTreeWidget *m_treeView;
|
||||
QLabel *m_descriptionLabel;
|
||||
QLabel *m_sizeLabel;
|
||||
};
|
||||
|
||||
|
||||
QInstallerComponentSelectionPage::QInstallerComponentSelectionPage
|
||||
(QInstaller *installer)
|
||||
: QInstallerPage(installer), d(new Private(this, installer))
|
||||
{
|
||||
setObjectName("ComponentSelectionPage");
|
||||
setTitle(tr("Select Components"));
|
||||
QString msg = tr("Please select the components you want to install.");
|
||||
setSubTitle(msg);
|
||||
setPixmap(QWizard::LogoPixmap, logoPixmap());
|
||||
setPixmap(QWizard::WatermarkPixmap, QPixmap());
|
||||
}
|
||||
|
||||
QInstallerComponentSelectionPage::~QInstallerComponentSelectionPage()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void QInstallerComponentSelectionPage::leaving()
|
||||
{
|
||||
int n = d->m_treeView->topLevelItemCount();
|
||||
for (int i = 0; i != n; ++i) {
|
||||
QTreeWidgetItem *item = d->m_treeView->topLevelItem(i);
|
||||
QInstallerComponent *component = installer()->component(i);
|
||||
if (item->checkState(0) == Qt::Unchecked)
|
||||
component->setValue("WantedState", "Uninstalled");
|
||||
else
|
||||
component->setValue("WantedState", "Installed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QInstallerTargetDirectoryPage
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
QInstallerTargetDirectoryPage::QInstallerTargetDirectoryPage(QInstaller *installer)
|
||||
: QInstallerPage(installer)
|
||||
{
|
||||
setObjectName("TargetDirectoryPage");
|
||||
setTitle(tr("Installation Directory"));
|
||||
setPixmap(QWizard::LogoPixmap, logoPixmap());
|
||||
setPixmap(QWizard::WatermarkPixmap, QPixmap());
|
||||
|
||||
QLabel *msgLabel = new QLabel(this);
|
||||
msgLabel->setText(QInstaller::tr("Please specify the directory where %1 "
|
||||
"will be installed.").arg(productName()));
|
||||
msgLabel->setWordWrap(true);
|
||||
msgLabel->setObjectName("MessageLabel");
|
||||
|
||||
m_lineEdit = new QLineEdit(this);
|
||||
m_lineEdit->setObjectName("LineEdit");
|
||||
|
||||
QPushButton *browseButton = new QPushButton(this);
|
||||
browseButton->setObjectName("BrowseButton");
|
||||
browseButton->setText("Browse...");
|
||||
browseButton->setIcon(QIcon(logoPixmap()));
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
layout->addWidget(msgLabel);
|
||||
QHBoxLayout *hlayout = new QHBoxLayout;
|
||||
hlayout->addWidget(m_lineEdit);
|
||||
hlayout->addWidget(browseButton);
|
||||
layout->addLayout(hlayout);
|
||||
setLayout(layout);
|
||||
|
||||
QString targetDir = installer->value("TargetDir");
|
||||
//targetDir = QDir::currentPath();
|
||||
if (targetDir.isEmpty())
|
||||
targetDir = QDir::homePath() + QDir::separator() + productName();
|
||||
m_lineEdit->setText(targetDir);
|
||||
|
||||
connect(browseButton, SIGNAL(clicked()),
|
||||
this, SLOT(dirRequested()));
|
||||
connect(m_lineEdit, SIGNAL(textChanged(QString)),
|
||||
this, SIGNAL(completeChanged()));
|
||||
}
|
||||
|
||||
QString QInstallerTargetDirectoryPage::targetDir() const
|
||||
{
|
||||
return m_lineEdit->text();
|
||||
}
|
||||
|
||||
void QInstallerTargetDirectoryPage::setTargetDir(const QString &dirName)
|
||||
{
|
||||
m_lineEdit->setText(dirName);
|
||||
}
|
||||
|
||||
void QInstallerTargetDirectoryPage::entering()
|
||||
{
|
||||
connect(wizard(), SIGNAL(customButtonClicked(int)),
|
||||
this, SLOT(targetDirSelected()));
|
||||
}
|
||||
|
||||
void QInstallerTargetDirectoryPage::leaving()
|
||||
{
|
||||
installer()->setValue("TargetDir", targetDir());
|
||||
disconnect(wizard(), SIGNAL(customButtonClicked(int)),
|
||||
this, SLOT(targetDirSelected()));
|
||||
}
|
||||
|
||||
void QInstallerTargetDirectoryPage::targetDirSelected()
|
||||
{
|
||||
//qDebug() << "TARGET DIRECTORY";
|
||||
QDir dir(targetDir());
|
||||
if (dir.exists() && dir.isReadable()) {
|
||||
QMessageBox::StandardButton bt = QMessageBox::warning(this,
|
||||
tr("Warning"),
|
||||
tr("The directory you slected exists already.\n"
|
||||
"Do you want to continue?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (bt == QMessageBox::Yes)
|
||||
wizard()->next();
|
||||
return;
|
||||
}
|
||||
dir.cdUp();
|
||||
if (dir.exists() && dir.isReadable()) {
|
||||
wizard()->next();
|
||||
return;
|
||||
}
|
||||
wizard()->next();
|
||||
}
|
||||
|
||||
void QInstallerTargetDirectoryPage::dirRequested()
|
||||
{
|
||||
//qDebug() << "DIR REQUESTED";
|
||||
QString newDirName = QFileDialog::getExistingDirectory(this,
|
||||
tr("Select Installation Directory"), targetDir()
|
||||
/*, Options options = ShowDirsOnly*/);
|
||||
if (newDirName.isEmpty() || newDirName == targetDir())
|
||||
return;
|
||||
m_lineEdit->setText(newDirName);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QInstallerReadyForInstallationPage
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
QInstallerReadyForInstallationPage::
|
||||
QInstallerReadyForInstallationPage(QInstaller *installer)
|
||||
: QInstallerPage(installer)
|
||||
{
|
||||
setObjectName("ReadyForInstallationPage");
|
||||
setTitle(tr("Ready to Install"));
|
||||
setCommitPage(true);
|
||||
setButtonText(QWizard::CommitButton, tr("Install"));
|
||||
|
||||
QLabel *msgLabel = new QLabel(this);
|
||||
msgLabel->setObjectName("MessageLabel");
|
||||
msgLabel->setText(QInstaller::tr("Setup is now ready to begin installing %1 "
|
||||
"on your computer.").arg(productName()));
|
||||
|
||||
QLayout *layout = new QVBoxLayout(this);
|
||||
layout->addWidget(msgLabel);
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QInstallerPerformInstallationPage
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
QInstallerPerformInstallationPage::QInstallerPerformInstallationPage(QInstaller *gui)
|
||||
: QInstallerPage(gui)
|
||||
{
|
||||
setObjectName("InstallationPage");
|
||||
setTitle(tr("Installing %1").arg(installer()->value("ProductName")));
|
||||
setCommitPage(true);
|
||||
|
||||
m_progressBar = new QProgressBar(this);
|
||||
m_progressBar->setObjectName("ProgressBar");
|
||||
m_progressBar->setRange(1, 100);
|
||||
|
||||
m_progressLabel = new QLabel(this);
|
||||
m_progressLabel->setObjectName("ProgressLabel");
|
||||
|
||||
m_updateTimer = new QTimer(this);
|
||||
connect(m_updateTimer, SIGNAL(timeout()),
|
||||
this, SLOT(updateProgress()));
|
||||
m_updateTimer->setInterval(50);
|
||||
|
||||
QLayout *layout = new QVBoxLayout(this);
|
||||
layout->addWidget(m_progressBar);
|
||||
layout->addWidget(m_progressLabel);
|
||||
setLayout(layout);
|
||||
|
||||
connect(installer(), SIGNAL(installationStarted()),
|
||||
this, SLOT(installationStarted()));
|
||||
connect(installer(), SIGNAL(installationFinished()),
|
||||
this, SLOT(installationFinished()));
|
||||
}
|
||||
|
||||
void QInstallerPerformInstallationPage::initializePage()
|
||||
{
|
||||
QWizardPage::initializePage();
|
||||
QTimer::singleShot(30, installer(), SLOT(runInstaller()));
|
||||
}
|
||||
|
||||
// FIXME: remove function
|
||||
bool QInstallerPerformInstallationPage::isComplete() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void QInstallerPerformInstallationPage::installationStarted()
|
||||
{
|
||||
qDebug() << "INSTALLATION STARTED";
|
||||
m_updateTimer->start();
|
||||
updateProgress();
|
||||
}
|
||||
|
||||
void QInstallerPerformInstallationPage::installationFinished()
|
||||
{
|
||||
qDebug() << "INSTALLATION FINISHED";
|
||||
m_updateTimer->stop();
|
||||
updateProgress();
|
||||
}
|
||||
|
||||
void QInstallerPerformInstallationPage::updateProgress()
|
||||
{
|
||||
int progress = installer()->installationProgress();
|
||||
if (progress != m_progressBar->value())
|
||||
m_progressBar->setValue(progress);
|
||||
QString progressText = installer()->installationProgressText();
|
||||
if (progressText != m_progressLabel->text())
|
||||
m_progressLabel->setText(progressText);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QInstallerPerformUninstallationPage
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
QInstallerPerformUninstallationPage::QInstallerPerformUninstallationPage
|
||||
(QInstaller *gui)
|
||||
: QInstallerPage(gui)
|
||||
{
|
||||
setObjectName("UninstallationPage");
|
||||
setTitle(tr("Uninstalling %1").arg(installer()->value("ProductName")));
|
||||
setCommitPage(true);
|
||||
|
||||
m_progressBar = new QProgressBar(this);
|
||||
m_progressBar->setObjectName("ProgressBar");
|
||||
m_progressBar->setRange(1, 100);
|
||||
|
||||
m_progressLabel = new QLabel(this);
|
||||
m_progressLabel->setObjectName("ProgressLabel");
|
||||
|
||||
m_updateTimer = new QTimer(this);
|
||||
connect(m_updateTimer, SIGNAL(timeout()),
|
||||
this, SLOT(updateProgress()));
|
||||
m_updateTimer->setInterval(50);
|
||||
|
||||
QLayout *layout = new QVBoxLayout(this);
|
||||
layout->addWidget(m_progressBar);
|
||||
layout->addWidget(m_progressLabel);
|
||||
setLayout(layout);
|
||||
|
||||
connect(installer(), SIGNAL(uninstallationStarted()),
|
||||
this, SLOT(uninstallationStarted()));
|
||||
connect(installer(), SIGNAL(uninstallationFinished()),
|
||||
this, SLOT(uninstallationFinished()));
|
||||
}
|
||||
|
||||
void QInstallerPerformUninstallationPage::initializePage()
|
||||
{
|
||||
QWizardPage::initializePage();
|
||||
QTimer::singleShot(30, installer(), SLOT(runUninstaller()));
|
||||
}
|
||||
|
||||
// FIXME: remove function
|
||||
bool QInstallerPerformUninstallationPage::isComplete() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void QInstallerPerformUninstallationPage::uninstallationStarted()
|
||||
{
|
||||
m_updateTimer->start();
|
||||
updateProgress();
|
||||
}
|
||||
|
||||
void QInstallerPerformUninstallationPage::uninstallationFinished()
|
||||
{
|
||||
m_updateTimer->stop();
|
||||
updateProgress();
|
||||
}
|
||||
|
||||
void QInstallerPerformUninstallationPage::updateProgress()
|
||||
{
|
||||
int progress = installer()->installationProgress();
|
||||
if (progress != m_progressBar->value())
|
||||
m_progressBar->setValue(progress);
|
||||
QString progressText = installer()->installationProgressText();
|
||||
if (progressText != m_progressLabel->text())
|
||||
m_progressLabel->setText(progressText);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QInstallerFinishedPage
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
QInstallerFinishedPage::QInstallerFinishedPage(QInstaller *installer)
|
||||
: QInstallerPage(installer)
|
||||
{
|
||||
setObjectName("FinishedPage");
|
||||
setTitle(tr("Completing the %1 Setup Wizard").arg(productName()));
|
||||
setPixmap(QWizard::WatermarkPixmap, watermarkPixmap());
|
||||
setSubTitle(QString());
|
||||
|
||||
QLabel *msgLabel = new QLabel(this);
|
||||
msgLabel->setObjectName("MessageLabel");
|
||||
msgLabel->setWordWrap(true);
|
||||
msgLabel->setText(tr("Click Finish to exit the Setup Wizard"));
|
||||
|
||||
m_runItCheckBox = new QCheckBox(this);
|
||||
m_runItCheckBox->setObjectName("RunItCheckBox");
|
||||
m_runItCheckBox->setChecked(true);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
layout->addWidget(msgLabel);
|
||||
if (m_runItCheckBox)
|
||||
layout->addWidget(m_runItCheckBox);
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
void QInstallerFinishedPage::entering()
|
||||
{
|
||||
qDebug() << "FINISHED ENTERING: ";
|
||||
connect(wizard()->button(QWizard::FinishButton), SIGNAL(clicked()),
|
||||
this, SLOT(handleFinishClicked()));
|
||||
if (installer()->status() == QInstaller::InstallerSucceeded) {
|
||||
m_runItCheckBox->show();
|
||||
m_runItCheckBox->setText(tr("Run %1 now.").arg(productName()));
|
||||
} else {
|
||||
setTitle(tr("The %1 Setup Wizard failed").arg(productName()));
|
||||
m_runItCheckBox->hide();
|
||||
m_runItCheckBox->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
void QInstallerFinishedPage::leaving()
|
||||
{
|
||||
disconnect(wizard(), SIGNAL(customButtonClicked(int)),
|
||||
this, SLOT(handleFinishClicked()));
|
||||
}
|
||||
|
||||
void QInstallerFinishedPage::handleFinishClicked()
|
||||
{
|
||||
if (!m_runItCheckBox->isChecked())
|
||||
return;
|
||||
QString program = installer()->value("RunProgram");
|
||||
if (program.isEmpty())
|
||||
return;
|
||||
program = installer()->replaceVariables(program);
|
||||
qDebug() << "STARTING " << program;
|
||||
QProcess *process = new QProcess;
|
||||
process->start(program);
|
||||
process->waitForFinished();
|
||||
}
|
||||
|
||||
#include "qinstallergui.moc"
|
||||
|
||||
QT_END_NAMESPACE
|
||||
@@ -1,256 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef QINSTALLERGUI_H
|
||||
#define QINSTALLERGUI_H
|
||||
|
||||
#include <QtGui/QWizard>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QInstaller;
|
||||
|
||||
// FIXME: move to private classes
|
||||
class QCheckBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QProgressBar;
|
||||
class QRadioButton;
|
||||
class QTreeView;
|
||||
class QTreeWidget;
|
||||
|
||||
class QInstallerGui : public QWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QInstallerGui(QInstaller *installer, QWidget *parent = 0);
|
||||
|
||||
signals:
|
||||
void interrupted();
|
||||
|
||||
public slots:
|
||||
void cancelButtonClicked();
|
||||
void reject();
|
||||
void showFinishedPage();
|
||||
void showWarning(const QString &msg);
|
||||
};
|
||||
|
||||
|
||||
class QInstallerPage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QInstallerPage(QInstaller *installer);
|
||||
|
||||
virtual bool isInterruptible() const { return false; }
|
||||
virtual QPixmap watermarkPixmap() const;
|
||||
virtual QPixmap logoPixmap() const;
|
||||
virtual QString productName() const;
|
||||
|
||||
protected:
|
||||
QInstaller *installer() const;
|
||||
|
||||
// Inserts widget into the same layout like a sibling identified
|
||||
// by its name. Default position is just behind the sibling.
|
||||
virtual void insertWidget(QWidget *widget, const QString &siblingName,
|
||||
int offset = 1);
|
||||
virtual QWidget *findWidget(const QString &objectName) const;
|
||||
|
||||
virtual void setVisible(bool visible); // reimp
|
||||
virtual int nextId() const; // reimp
|
||||
|
||||
virtual void entering() {} // called on entering
|
||||
virtual void leaving() {} // called on leaving
|
||||
|
||||
virtual void forward() const {} // called when going forwards
|
||||
//virtual void backward() const {} // called when going back
|
||||
bool isConstructing() const { return m_fresh; }
|
||||
|
||||
private:
|
||||
QInstaller *m_installer;
|
||||
bool m_fresh;
|
||||
};
|
||||
|
||||
|
||||
class QInstallerIntroductionPage : public QInstallerPage
|
||||
{
|
||||
public:
|
||||
explicit QInstallerIntroductionPage(QInstaller *installer);
|
||||
};
|
||||
|
||||
|
||||
class QInstallerLicenseAgreementPage : public QInstallerPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QInstallerLicenseAgreementPage(QInstaller *installer);
|
||||
bool isComplete() const;
|
||||
|
||||
private:
|
||||
QRadioButton *m_acceptRadioButton;
|
||||
QRadioButton *m_rejectRadioButton;
|
||||
};
|
||||
|
||||
|
||||
class QInstallerComponentSelectionPage : public QInstallerPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QInstallerComponentSelectionPage(QInstaller *installer);
|
||||
~QInstallerComponentSelectionPage();
|
||||
|
||||
protected:
|
||||
//void entering();
|
||||
void leaving();
|
||||
|
||||
private:
|
||||
class Private;
|
||||
Private *d;
|
||||
};
|
||||
|
||||
|
||||
class QInstallerTargetDirectoryPage : public QInstallerPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QInstallerTargetDirectoryPage(QInstaller *installer);
|
||||
QString targetDir() const;
|
||||
void setTargetDir(const QString &dirName);
|
||||
|
||||
protected:
|
||||
void entering();
|
||||
void leaving();
|
||||
|
||||
private slots:
|
||||
void targetDirSelected();
|
||||
void dirRequested();
|
||||
|
||||
private:
|
||||
QLineEdit *m_lineEdit;
|
||||
};
|
||||
|
||||
|
||||
class QInstallerReadyForInstallationPage : public QInstallerPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QInstallerReadyForInstallationPage(QInstaller *installer);
|
||||
};
|
||||
|
||||
|
||||
class QInstallerPerformInstallationPage : public QInstallerPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QInstallerPerformInstallationPage(QInstaller *installer);
|
||||
|
||||
protected:
|
||||
void initializePage();
|
||||
bool isComplete() const;
|
||||
bool isInterruptible() const { return true; }
|
||||
|
||||
signals:
|
||||
void installationRequested();
|
||||
|
||||
private slots:
|
||||
void installationStarted();
|
||||
void installationFinished();
|
||||
void updateProgress();
|
||||
|
||||
private:
|
||||
QProgressBar *m_progressBar;
|
||||
QLabel *m_progressLabel;
|
||||
QTimer *m_updateTimer;
|
||||
};
|
||||
|
||||
|
||||
class QInstallerPerformUninstallationPage : public QInstallerPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QInstallerPerformUninstallationPage(QInstaller *installer);
|
||||
|
||||
protected:
|
||||
void initializePage();
|
||||
bool isComplete() const;
|
||||
bool isInterruptible() const { return true; }
|
||||
|
||||
signals:
|
||||
void uninstallationRequested();
|
||||
|
||||
private slots:
|
||||
void uninstallationStarted();
|
||||
void uninstallationFinished();
|
||||
void updateProgress();
|
||||
|
||||
private:
|
||||
QProgressBar *m_progressBar;
|
||||
QLabel *m_progressLabel;
|
||||
QTimer *m_updateTimer;
|
||||
};
|
||||
|
||||
|
||||
class QInstallerFinishedPage : public QInstallerPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QInstallerFinishedPage(QInstaller *installer);
|
||||
|
||||
public slots:
|
||||
void handleFinishClicked();
|
||||
|
||||
protected:
|
||||
void entering();
|
||||
void leaving();
|
||||
|
||||
private:
|
||||
QCheckBox *m_runItCheckBox;
|
||||
};
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // QINSTALLERGUI_H
|
||||
@@ -1,84 +0,0 @@
|
||||
For individuals and/or legal entities resident in the American Continent (including those resident in Canada, South America, and the United States of America), the applicable licensing terms are specified under the heading "Trolltech Technology Preview License
|
||||
Agreement: American Continent".
|
||||
|
||||
For individuals and/or legal entities not resident in the American Continent, the applicable licensing terms are specified under the heading "Trolltech Technology Preview License Agreement: Norway".
|
||||
|
||||
TROLLTECH TECHNOLOGY PREVIEW LICENSE AGREEMENT: AMERICAN CONTINENT Agreement version 2.0
|
||||
IMPORTANT-READ CAREFULLY:
|
||||
|
||||
1. This Trolltech Technology Preview License Agreement ("Agreement") is a legal agreement between you (either an individual or a legal entity) and Trolltech, Inc. ("Trolltech"), and pertains to the Trolltech software product(s) accompanying this Agreement, which include(s) computer software and may include "online" or electronic documentation, associated media, and printed materials, including the source code, example programs and the documentation ("Licensed Software").
|
||||
|
||||
2. The Licensed Software is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. Trolltech retains all rights not expressly granted. No title, property rights or copyright in the Licensed Software or in any modifications to the Licensed Software shall pass to the Licensee under any circumstances. The Licensed Software is licensed, not sold.
|
||||
|
||||
3. By installing, copying, or otherwise using the Licensed Software, Licensee agrees to be bound by the terms of this Agreement. If Licensee does not agree to the terms of this Agreement, Licensee should not install, copy, or otherwise use the Licensed Software.
|
||||
|
||||
4. Upon Licensee's acceptance of the terms and conditions of this Agreement, Trolltech grants Licensee the right to use the Licensed Software in the manner provided below.
|
||||
|
||||
5. Trolltech grants to Licensee as an individual a personal, non-exclusive, non-transferable license to make and use copies of the Licensed Software for the sole purpose of evaluating and testing the Licensed Software and/or providing feedback to Trolltech. Licensee may install copies of the Licensed Software on an unlimited number of computers provided that Licensee is the only individual using the Licensed Software. If Licensee is an entity, Trolltech grants Licensee the right to designate one, and only one, individual within Licensee's organization who shall have the sole right to use the Licensed Software in the manner provided in this Agreement. Licensee may, at any time, but not more frequently than once every six (6) months, designate another individual to replace the current designated user by notifying Trolltech, so long as there is no more than one (1) designated user at any given time
|
||||
|
||||
6. Licensee may not loan, rent, lease, or license the Licensed Software or any copy of it. Licensee may not alter or remove any details of ownership, copyright, trademark or other property right connected with the Licensed Software. Licensee may not modify or distribute the Licensed Software. Licensee may not distribute any software statically or dynamically linked with the Licensed Software.
|
||||
|
||||
7. This Licensed Software is time-limited. All rights granted to Licensee in this Agreement will be void three (3) months after Licensee received the Licensed Software.
|
||||
|
||||
8. The Licensed Software may provide links to third party libraries or code (collectively "Third Party Libraries") to implement various functions. Third Party Libraries do not comprise part of the Licensed Software. In some cases, access to Third Party Libraries may be included along with the Licensed Software delivery as a convenience for development and testing only. Such source code and libraries as are or may be listed in the ".../src/3rdparty" source tree delivered with the Licensed Software, as may be amended from time to time, do not comprise the Licensed Software. Licensee acknowledges (1) that some Third Party Libraries may require additional licensing of copyright and patents from the owners of such, and (2) that distribution of any of the Licensed Software referencing any portion of a Third Party Library may require appropriate licensing from such third parties.
|
||||
|
||||
9. Pre-Release Code, Non-Commercial Use: The Licensed Software contains Pre-release Code that is not at the level of performance and compatibility of a final, generally available, product offering. The Licensed Software may not operate correctly and may be substantially modified prior to the first commercial shipment, if any. Trolltech is not obligated to make this or any later version of the Licensed Software commercially available. The License Software is "Not for Commercial Use" and may only be used for the purposes described in Section 5. You may not use the Licensed Software in a live operating environment where it may be relied upon to perform in the same manner as a commercially released product or with data that has not been sufficiently backed up.
|
||||
|
||||
10. WARRANTY DISCLAIMER: THE LICENSED SOFTWARE IS LICENSED TO LICENSEE "AS IS". TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, TROLLTECH ON BEHALF OF ITSELF AND ITS SUPPLIERS, DISCLAIMS ALL WARRANTIES AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT WITH REGARD TO THE LICENSED SOFTWARE.
|
||||
|
||||
11. LIMITATION OF LIABILITY: IF, TROLLTECH'S WARRANTY DISCLAIMER NOTWITHSTANDING, TROLLTECH IS HELD LIABLE TO LICENSEE, WHETHER IN CONTRACT, TORT OR ANY OTHER LEGAL THEORY, BASED ON THE LICENSED SOFTWARE, TROLLTECH'S ENTIRE LIABILITY TO LICENSEE AND LICENSEE'S EXCLUSIVE REMEDY SHALL BE, AT TROLLTECH'S OPTION, EITHER (A) RETURN OF THE PRICE LICENSEE PAID FOR THE LICENSED SOFTWARE, OR (B) REPAIR OR REPLACEMENT OF THE LICENSED SOFTWARE, PROVIDED LICENSEE RETURNS TO TROLLTECH ALL COPIES OF THE LICENSED SOFTWARE AS ORIGINALLY DELIVERED TO LICENSEE. TROLLTECH SHALL NOT UNDER ANY CIRCUMSTANCES BE LIABLE TO LICENSEE BASED ON FAILURE OF THE LICENSED SOFTWARE IF THE FAILURE RESULTED FROM ACCIDENT, ABUSE OR MISAPPLICATION, NOR SHALL TROLLTECH UNDER ANY CIRCUMSTANCES BE LIABLE FOR SPECIAL DAMAGES, PUNITIVE OR EXEMPLARY DAMAGES, DAMAGES FOR LOSS OF PROFITS OR INTERRUPTION OF BUSINESS OR FOR LOSS OR CORRUPTION OF DATA. ANY AWARD OF DAMAGES FROM TROLLTECH TO LICENSEE SHALL NOT EXCEED THE TOTAL AMOUNT LICENSEE HAS PAID TO TROLLTECH IN CONNECTION WITH THIS AGREEMENT.
|
||||
|
||||
12. Termination: Without prejudice to any other rights, Trolltech may terminate this Agreement if Licensee fails to comply with the terms and conditions of this Agreement. In such event, Licensee must destroy all copies of the Licensed Software and all of its components.
|
||||
|
||||
13. Export Restrictions: Licensee agrees not to export or re-export the Licensed Software, any part thereof, or any process or service that is the direct product of the Licensed Software. Licensee may not sell, resell, or otherwise transfer for value, the Licensed Software (the foregoing collectively referred to as the "Restricted Components"), to any country, person, entity or end user subject to U.S. export restrictions. Licensee specifically agrees not to export or re-export any of the Restricted Components (i) to any country to which the U.S. has embargoed or restricted the export of goods or services, which currently include, but are not necessarily limited to Cuba, Iran, Iraq, Libya, North Korea, Sudan and Syria, or to any national of any such country, wherever located, who intends to transmit or transport the Restricted Components back to such country; (ii) to any end-user who Licensee knows or has reason to know will utilize the Restricted Components in the design, development or production of nuclear, chemical or biological weapons; or (iii) to any end-user who has been prohibited from participating in U.S. export transactions by any federal agency of the U.S. government. Licensee warrants and represents that neither the U.S. Commerce Department, Bureau of Export Administration nor any other U.S. federal agency has suspended, revoked or denied Licensee's export privileges.
|
||||
|
||||
14. Government End Users: A "U.S. Government End User" shall mean any agency or entity of the government of the United States. The following shall apply if Licensee is a U.S. Government End User. The Licensed Software is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire the Licensed Software with only those rights set forth herein. The Licensed Software (including related documentation) is provided to U.S. Government End Users: (a) only as a commercial end item; and (b) only pursuant to this Agreement.
|
||||
|
||||
15. Compliance with local laws: Licensee shall comply with all applicable laws and regulations relating to the Licensed Software in the United States and in other countries in which Licensee uses or modifies the Licensed Software. Without limiting the generality of the foregoing, Licensee shall not export, re-export, disclose or distribute any of the Licensed Software in violation of any applicable laws or regulations, including the export laws and regulations of the United States, and shall comply with all such laws and regulations.
|
||||
|
||||
16. Entire Agreement: This Agreement constitutes the complete agreement between the parties and supersedes all prior or contemporaneous discussions, representations, and proposals, written or oral, with respect to the subject matters discussed herein. No modification of this Agreement will be effective unless contained in a writing executed by an authorized representative of each party. No term or condition contained in Licensee's purchase order will apply unless expressly accepted by Trolltech in writing. If any provision of the Agreement is found void or unenforceable, the remainder will remain valid and enforceable according to its terms. If any remedy provided is determined to have failed for its essential purpose, all limitations of liability and exclusions of damages set forth in this Agreement shall remain in effect.
|
||||
|
||||
17. Governing law, legal venue: This Agreement shall be construed, interpreted and governed by the laws of the State of California, USA. Any action or proceeding arising from or relating to this Agreement shall be brought in a federal court in the Northern District of California or in the State Court in Santa Clara County, California, and each party irrevocably submits to the personal jurisdiction of any such court in any such action or proceeding. The Agreement gives Licensee specific legal rights; Licensee may have others, which vary from state to state and from country to country. Trolltech reserves all rights not specifically granted in this Agreement.
|
||||
|
||||
|
||||
|
||||
|
||||
For legal entities and/or individuals residing in any country other than Canada, the United States of America or South America:
|
||||
TROLLTECH TECHNOLOGY PREVIEW LICENSE AGREEMENT: NORWAY
|
||||
|
||||
Agreement version 2.0
|
||||
IMPORTANT-READ CAREFULLY:
|
||||
|
||||
1. This Trolltech Technology Preview License Agreement ("Agreement") is a legal agreement between you (either an individual or a legal entity) and Trolltech ASA ("Trolltech"), and pertains to the Trolltech software product(s) accompanying this Agreement, which include(s) computer software and may include "online" or electronic documentation, associated media, and printed materials, including the source code, example programs and the documentation ("Licensed Software").
|
||||
|
||||
2. The Licensed Software is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. Trolltech retains all rights not expressly granted. No title, property rights or copyright in the Licensed Software or in any modifications to the Licensed Software shall pass to the Licensee under any circumstances. The Licensed Software is licensed, not sold.
|
||||
|
||||
3. By installing, copying, or otherwise using the Licensed Software, Licensee agrees to be bound by the terms of this Agreement. If Licensee does not agree to the terms of this Agreement, Licensee should not install, copy, or otherwise use the Licensed Software.
|
||||
|
||||
4. Upon Licensee's acceptance of the terms and conditions of this Agreement, Trolltech grants Licensee the right to use the Licensed Software in the manner provided below.
|
||||
|
||||
5. Trolltech grants to Licensee as an individual a personal, non-exclusive, non-transferable license to make and use copies of the Licensed Software for the sole purpose of evaluating and testing the Licensed Software and/or providing feedback to Trolltech. Licensee may install copies of the Licensed Software on an unlimited number of computers provided that Licensee is the only individual using the Licensed Software. If Licensee is an entity, Trolltech grants Licensee the right to designate one, and only one, individual within Licensee's organization who shall have the sole right to use the Licensed Software in the manner provided in this Agreement. Licensee may, at any time, but not more frequently than once every six (6) months, designate another individual to replace the current designated user by notifying Trolltech, so long as there is no more than one (1) designated user at any given time
|
||||
|
||||
6. Licensee may not loan, rent, lease, or license the Licensed Software or any copy of it. Licensee may not alter or remove any details of ownership, copyright, trademark or other property right connected with the Licensed Software. Licensee may not modify or distribute the Licensed Software. Licensee may not distribute any software statically or dynamically linked with the Licensed Software.
|
||||
|
||||
7. This Licensed Software is time-limited. All rights granted to Licensee in this Agreement will be void three (3) months after Licensee received the Licensed Software.
|
||||
|
||||
8. The Licensed Software may provide links to third party libraries or code (collectively "Third Party Libraries") to implement various functions. Third Party Libraries do not comprise part of the Licensed Software. In some cases, access to Third Party Libraries may be included along with the Licensed Software delivery as a convenience for development and testing only. Such source code and libraries as are or may be listed in the ".../src/3rdparty" source tree delivered with the Licensed Software, as may be amended from time to time, do not comprise the Licensed Software. Licensee acknowledges (1) that some Third Party Libraries may require additional licensing of copyright and patents from the owners of such, and (2) that distribution of any of the Licensed Software referencing any portion of a Third Party Library may require appropriate licensing from such third parties.
|
||||
|
||||
9. Pre-Release Code, Non-Commercial Use: The Licensed Software contains Pre-release Code that is not at the level of performance and compatibility of a final, generally available, product offering. The Licensed Software may not operate correctly and may be substantially modified prior to the first commercial shipment, if any. Trolltech is not obligated to make this or any later version of the Licensed Software commercially available. The License Software is "Not for Commercial Use" and may only be used for the purposes described in Section 5. You may not use the Licensed Software in a live operating environment where it may be relied upon to perform in the same manner as a commercially released product or with data that has not been sufficiently backed up.
|
||||
|
||||
10. WARRANTY DISCLAIMER: THE LICENSED SOFTWARE IS LICENSED TO LICENSEE "AS IS". TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, TROLLTECH ON BEHALF OF ITSELF AND ITS SUPPLIERS, DISCLAIMS ALL WARRANTIES AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT WITH REGARD TO THE LICENSED SOFTWARE.
|
||||
|
||||
11. LIMITATION OF LIABILITY: IF, TROLLTECH'S WARRANTY DISCLAIMER NOTWITHSTANDING, TROLLTECH IS HELD LIABLE TO LICENSEE, WHETHER IN CONTRACT, TORT OR ANY OTHER LEGAL THEORY, BASED ON THE LICENSED SOFTWARE, TROLLTECH'S ENTIRE LIABILITY TO LICENSEE AND LICENSEE'S EXCLUSIVE REMEDY SHALL BE, AT TROLLTECH'S OPTION, EITHER (A) RETURN OF THE PRICE LICENSEE PAID FOR THE LICENSED SOFTWARE, OR (B) REPAIR OR REPLACEMENT OF THE LICENSED SOFTWARE, PROVIDED LICENSEE RETURNS TO TROLLTECH ALL COPIES OF THE LICENSED SOFTWARE AS ORIGINALLY DELIVERED TO LICENSEE. TROLLTECH SHALL NOT UNDER ANY CIRCUMSTANCES BE LIABLE TO LICENSEE BASED ON FAILURE OF THE LICENSED SOFTWARE IF THE FAILURE RESULTED FROM ACCIDENT, ABUSE OR MISAPPLICATION, NOR SHALL TROLLTECH UNDER ANY CIRCUMSTANCES BE LIABLE FOR SPECIAL DAMAGES, PUNITIVE OR EXEMPLARY DAMAGES, DAMAGES FOR LOSS OF PROFITS OR INTERRUPTION OF BUSINESS OR FOR LOSS OR CORRUPTION OF DATA. ANY AWARD OF DAMAGES FROM TROLLTECH TO LICENSEE SHALL NOT EXCEED THE TOTAL AMOUNT LICENSEE HAS PAID TO TROLLTECH IN CONNECTION WITH THIS AGREEMENT.
|
||||
|
||||
12. Termination: Without prejudice to any other rights, Trolltech may terminate this Agreement if Licensee fails to comply with the terms and conditions of this Agreement. In such event, Licensee must destroy all copies of the Licensed Software and all of its components.
|
||||
|
||||
13. Export Restrictions: Licensee agrees not to export or re-export the Licensed Software, any part thereof, or any process or service that is the direct product of the Licensed Software. Licensee may not sell, resell, or otherwise transfer for value, the Licensed Software (the foregoing collectively referred to as the "Restricted Components"), to any country, person, entity or end user subject to U.S. export restrictions. Licensee specifically agrees not to export or re-export any of the Restricted Components (i) to any country to which the U.S. has embargoed or restricted the export of goods or services, which currently include, but are not necessarily limited to Cuba, Iran, Iraq, Libya, North Korea, Sudan and Syria, or to any national of any such country, wherever located, who intends to transmit or transport the Restricted Components back to such country; (ii) to any end-user who Licensee knows or has reason to know will utilize the Restricted Components in the design, development or production of nuclear, chemical or biological weapons; or (iii) to any end-user who has been prohibited from participating in U.S. export transactions by any federal agency of the U.S. government. Licensee warrants and represents that neither the U.S. Commerce Department, Bureau of Export Administration nor any other U.S. federal agency has suspended, revoked or denied Licensee's export privileges.
|
||||
|
||||
14. Government End Users: A "U.S. Government End User" shall mean any agency or entity of the government of the United States. The following shall apply if Licensee is a U.S. Government End User. The Licensed Software is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire the Licensed Software with only those rights set forth herein. The Licensed Software (including related documentation) is provided to U.S. Government End Users: (a) only as a commercial end item; and (b) only pursuant to this Agreement.
|
||||
|
||||
15. Compliance with local laws: Licensee shall comply with all applicable laws and regulations relating to the Licensed Software in the United States and in other countries in which Licensee uses or modifies the Licensed Software. Without limiting the generality of the foregoing, Licensee shall not export, re-export, disclose or distribute any of the Licensed Software in violation of any applicable laws or regulations, including the export laws and regulations of the United States, and shall comply with all such laws and regulations.
|
||||
|
||||
16. Entire Agreement: This Agreement constitutes the complete agreement between the parties and supersedes all prior or contemporaneous discussions, representations, and proposals, written or oral, with respect to the subject matters discussed herein. No modification of this Agreement will be effective unless contained in a writing executed by an authorized representative of each party. No term or condition contained in Licensee's purchase order will apply unless expressly accepted by Trolltech in writing. If any provision of the Agreement is found void or unenforceable, the remainder will remain valid and enforceable according to its terms. If any remedy provided is determined to have failed for its essential purpose, all limitations of liability and exclusions of damages set forth in this Agreement shall remain in effect.
|
||||
|
||||
17. Governing law, legal venue: This Agreement shall be construed, interpreted and governed by the laws of Norway, the legal venue to be Oslo City Court. Trolltech reserves all rights not specifically granted in this Agreement.
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB |
@@ -10,3 +10,5 @@ TEMPLATE = subdirs
|
||||
CONFIG += ordered
|
||||
|
||||
SUBDIRS = src
|
||||
|
||||
include(doc/doc.pri)
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
## Open script-dir-homed subshell
|
||||
(
|
||||
ABS_SCRIPT_DIR=`pwd`/`dirname "$0"`
|
||||
cd "${ABS_SCRIPT_DIR}"
|
||||
ABS_SCRIPT_DIR=$(cd $(dirname $(which "$0")) && pwd)
|
||||
cd "${ABS_SCRIPT_DIR}" || exit 1
|
||||
|
||||
|
||||
## Internal config
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -55,12 +55,12 @@
|
||||
|
||||
#include "CPlusPlusForwardDeclarations.h"
|
||||
#include "ASTfwd.h"
|
||||
#include <new>
|
||||
#include "MemoryPool.h"
|
||||
|
||||
CPLUSPLUS_BEGIN_HEADER
|
||||
CPLUSPLUS_BEGIN_NAMESPACE
|
||||
|
||||
class CPLUSPLUS_EXPORT AST
|
||||
class CPLUSPLUS_EXPORT AST: public Managed
|
||||
{
|
||||
AST(const AST &other);
|
||||
void operator =(const AST &other);
|
||||
@@ -74,10 +74,6 @@ public:
|
||||
static void accept(AST *ast, ASTVisitor *visitor)
|
||||
{ if (ast) ast->accept(visitor); }
|
||||
|
||||
void *operator new(size_t size, MemoryPool *pool);
|
||||
void operator delete(void *);
|
||||
void operator delete(void *, MemoryPool *);
|
||||
|
||||
virtual unsigned firstToken() const = 0;
|
||||
virtual unsigned lastToken() const = 0;
|
||||
|
||||
@@ -187,6 +183,8 @@ public:
|
||||
UsingDirectiveAST *asUsingDirective();
|
||||
WhileStatementAST *asWhileStatement();
|
||||
|
||||
virtual AST *clone(MemoryPool *pool) const = 0;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor) = 0;
|
||||
};
|
||||
@@ -195,6 +193,9 @@ class CPLUSPLUS_EXPORT SpecifierAST: public AST
|
||||
{
|
||||
public:
|
||||
SpecifierAST *next;
|
||||
|
||||
public:
|
||||
virtual SpecifierAST *clone(MemoryPool *pool) const = 0;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT SimpleSpecifierAST: public SpecifierAST
|
||||
@@ -206,6 +207,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual SimpleSpecifierAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -224,6 +227,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual AttributeSpecifierAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -242,6 +247,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual AttributeAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -256,6 +263,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual TypeofSpecifierAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -264,28 +273,39 @@ class CPLUSPLUS_EXPORT StatementAST: public AST
|
||||
{
|
||||
public:
|
||||
StatementAST *next;
|
||||
|
||||
public:
|
||||
virtual StatementAST *clone(MemoryPool *pool) const = 0;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ExpressionAST: public AST
|
||||
{
|
||||
public:
|
||||
virtual ExpressionAST *clone(MemoryPool *pool) const = 0;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT DeclarationAST: public AST
|
||||
{
|
||||
public:
|
||||
DeclarationAST *next;
|
||||
|
||||
public:
|
||||
virtual DeclarationAST *clone(MemoryPool *pool) const = 0;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT CoreDeclaratorAST: public AST
|
||||
{
|
||||
public:
|
||||
virtual CoreDeclaratorAST *clone(MemoryPool *pool) const = 0;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT PostfixDeclaratorAST: public AST
|
||||
{
|
||||
public:
|
||||
PostfixDeclaratorAST *next;
|
||||
|
||||
public:
|
||||
virtual PostfixDeclaratorAST *clone(MemoryPool *pool) const = 0;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT DeclaratorAST: public AST
|
||||
@@ -301,6 +321,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual DeclaratorAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -315,6 +337,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ExpressionListAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -330,6 +354,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual SimpleDeclarationAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -343,6 +369,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual EmptyDeclarationAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -358,6 +386,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual AccessDeclarationAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -375,6 +405,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual AsmDefinitionAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -391,6 +423,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual BaseSpecifierAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -407,6 +441,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual QtMethodAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -414,14 +450,16 @@ protected:
|
||||
class CPLUSPLUS_EXPORT BinaryExpressionAST: public ExpressionAST
|
||||
{
|
||||
public:
|
||||
unsigned binary_op_token;
|
||||
ExpressionAST *left_expression;
|
||||
unsigned binary_op_token;
|
||||
ExpressionAST *right_expression;
|
||||
|
||||
public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual BinaryExpressionAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -438,6 +476,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual CastExpressionAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -448,6 +488,7 @@ public:
|
||||
unsigned classkey_token;
|
||||
SpecifierAST *attributes;
|
||||
NameAST *name;
|
||||
unsigned colon_token;
|
||||
BaseSpecifierAST *base_clause;
|
||||
unsigned lbrace_token;
|
||||
DeclarationAST *member_specifiers;
|
||||
@@ -457,6 +498,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ClassSpecifierAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -473,6 +516,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual CaseStatementAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -488,6 +533,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual CompoundStatementAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -502,6 +549,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ConditionAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -519,6 +568,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ConditionalExpressionAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -538,6 +589,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual CppCastExpressionAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -552,6 +605,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual CtorInitializerAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -565,6 +620,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual DeclarationStatementAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -578,6 +635,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual DeclaratorIdAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -593,6 +652,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual NestedDeclaratorAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -610,6 +671,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual FunctionDeclaratorAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -625,6 +688,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ArrayDeclaratorAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -639,6 +704,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual DeclaratorListAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -656,6 +723,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual DeleteExpressionAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -675,6 +744,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual DoStatementAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -688,6 +759,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual NamedTypeSpecifierAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -702,6 +775,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ElaboratedTypeSpecifierAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -719,6 +794,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual EnumSpecifierAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -735,6 +812,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual EnumeratorAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -750,6 +829,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ExceptionDeclarationAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -767,6 +848,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ExceptionSpecificationAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -781,6 +864,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ExpressionOrDeclarationStatementAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -795,6 +880,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ExpressionStatementAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -811,6 +898,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual FunctionDefinitionAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -831,6 +920,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ForStatementAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -850,6 +941,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual IfStatementAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -865,6 +958,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ArrayInitializerAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -880,6 +975,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual LabeledStatementAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -895,6 +992,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual LinkageBodyAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -910,6 +1009,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual LinkageSpecificationAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -927,6 +1028,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual MemInitializerAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -934,6 +1037,7 @@ protected:
|
||||
class CPLUSPLUS_EXPORT NameAST: public ExpressionAST
|
||||
{
|
||||
public:
|
||||
virtual NameAST *clone(MemoryPool *pool) const = 0;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT NestedNameSpecifierAST: public AST
|
||||
@@ -947,6 +1051,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual NestedNameSpecifierAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -962,6 +1068,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual QualifiedNameAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -976,6 +1084,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual OperatorFunctionIdAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -991,6 +1101,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ConversionFunctionIdAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1004,6 +1116,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual SimpleNameAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1018,6 +1132,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual DestructorNameAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1034,6 +1150,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual TemplateIdAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1050,6 +1168,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual NamespaceAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1067,6 +1187,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual NamespaceAliasDefinitionAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1081,6 +1203,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual NewDeclaratorAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1099,6 +1223,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual NewExpressionAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1114,6 +1240,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual NewInitializerAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1129,6 +1257,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual NewTypeIdAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1144,6 +1274,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual OperatorAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1160,6 +1292,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ParameterDeclarationAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1174,6 +1308,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ParameterDeclarationClauseAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1182,6 +1318,9 @@ class CPLUSPLUS_EXPORT PostfixAST: public AST
|
||||
{
|
||||
public:
|
||||
PostfixAST *next;
|
||||
|
||||
public:
|
||||
virtual PostfixAST *clone(MemoryPool *pool) const = 0;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT CallAST: public PostfixAST
|
||||
@@ -1195,6 +1334,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual CallAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1210,6 +1351,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ArrayAccessAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1223,6 +1366,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual PostIncrDecrAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1238,6 +1383,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual MemberAccessAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1254,6 +1401,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual TypeidExpressionAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1271,6 +1420,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual TypenameCallExpressionAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1287,6 +1438,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual TypeConstructorCallAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1301,6 +1454,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual PostfixExpressionAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1309,6 +1464,9 @@ class CPLUSPLUS_EXPORT PtrOperatorAST: public AST
|
||||
{
|
||||
public:
|
||||
PtrOperatorAST *next;
|
||||
|
||||
public:
|
||||
virtual PtrOperatorAST *clone(MemoryPool *pool) const = 0;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT PointerToMemberAST: public PtrOperatorAST
|
||||
@@ -1323,6 +1481,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual PointerToMemberAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1337,6 +1497,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual PointerAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1350,6 +1512,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ReferenceAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1364,6 +1528,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual BreakStatementAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1378,6 +1544,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ContinueStatementAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1393,6 +1561,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual GotoStatementAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1408,6 +1578,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ReturnStatementAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1422,6 +1594,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual SizeofExpressionAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1435,6 +1609,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual NumericLiteralAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1448,6 +1624,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual BoolLiteralAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1461,6 +1639,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ThisExpressionAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1476,6 +1656,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual NestedExpressionAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1490,6 +1672,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual StringLiteralAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1507,6 +1691,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual SwitchStatementAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1521,6 +1707,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual TemplateArgumentListAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1539,6 +1727,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual TemplateDeclarationAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1553,6 +1743,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ThrowExpressionAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1566,6 +1758,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual TranslationUnitAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1581,6 +1775,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual TryBlockStatementAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1599,6 +1795,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual CatchClauseAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1613,6 +1811,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual TypeIdAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1629,6 +1829,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual TypenameTypeParameterAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1649,6 +1851,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual TemplateTypeParameterAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1663,6 +1867,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual UnaryExpressionAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1679,6 +1885,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual UsingAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1695,6 +1903,8 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual UsingDirectiveAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
@@ -1712,6 +1922,43 @@ public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual WhileStatementAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
|
||||
|
||||
// ObjC++
|
||||
class CPLUSPLUS_EXPORT IdentifierListAST: public AST
|
||||
{
|
||||
public:
|
||||
unsigned identifier_token;
|
||||
IdentifierListAST *next;
|
||||
|
||||
public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual IdentifierListAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCClassDeclarationAST: public DeclarationAST
|
||||
{
|
||||
public:
|
||||
unsigned class_token;
|
||||
IdentifierListAST *identifier_list;
|
||||
unsigned semicolon_token;
|
||||
|
||||
public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual ObjCClassDeclarationAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
|
||||
@@ -185,6 +185,10 @@ public:
|
||||
virtual bool visit(WhileStatementAST *) { return true; }
|
||||
virtual bool visit(QtMethodAST *) { return true; }
|
||||
|
||||
// ObjC++
|
||||
virtual bool visit(IdentifierListAST *) { return true; }
|
||||
virtual bool visit(ObjCClassDeclarationAST *) { return true; }
|
||||
|
||||
private:
|
||||
Control *_control;
|
||||
};
|
||||
|
||||
@@ -167,6 +167,10 @@ class UsingDirectiveAST;
|
||||
class WhileStatementAST;
|
||||
class QtMethodAST;
|
||||
|
||||
// ObjC++
|
||||
class IdentifierListAST;
|
||||
class ObjCClassDeclarationAST;
|
||||
|
||||
CPLUSPLUS_END_NAMESPACE
|
||||
CPLUSPLUS_END_HEADER
|
||||
|
||||
|
||||
@@ -122,6 +122,12 @@ bool Lexer::qtMocRunEnabled() const
|
||||
void Lexer::setQtMocRunEnabled(bool onoff)
|
||||
{ _qtMocRunEnabled = onoff; }
|
||||
|
||||
bool Lexer::objcEnabled() const
|
||||
{ return _objcEnabled; }
|
||||
|
||||
void Lexer::setObjcEnabled(bool onoff)
|
||||
{ _objcEnabled = onoff; }
|
||||
|
||||
bool Lexer::isIncremental() const
|
||||
{ return _isIncremental; }
|
||||
|
||||
@@ -548,8 +554,53 @@ void Lexer::scan_helper(Token *tok)
|
||||
break;
|
||||
|
||||
default: {
|
||||
if (_objcEnabled) {
|
||||
if (ch == '@' && _yychar >= 'a' && _yychar <= 'z') {
|
||||
const char *yytext = _currentChar;
|
||||
|
||||
do {
|
||||
yyinp();
|
||||
if (! isalnum(_yychar))
|
||||
break;
|
||||
} while (_yychar);
|
||||
|
||||
const int yylen = _currentChar - yytext;
|
||||
tok->kind = classifyObjCAtKeyword(yytext, yylen);
|
||||
break;
|
||||
} else if (ch == '@' && _yychar == '"') {
|
||||
// objc @string literals
|
||||
ch = _yychar;
|
||||
yyinp();
|
||||
tok->kind = T_AT_STRING_LITERAL;
|
||||
|
||||
const char *yytext = _currentChar;
|
||||
|
||||
while (_yychar && _yychar != '"') {
|
||||
if (_yychar != '\\')
|
||||
yyinp();
|
||||
else {
|
||||
yyinp(); // skip `\\'
|
||||
|
||||
if (_yychar)
|
||||
yyinp();
|
||||
}
|
||||
}
|
||||
// assert(_yychar == '"');
|
||||
|
||||
int yylen = _currentChar - yytext;
|
||||
|
||||
if (_yychar == '"')
|
||||
yyinp();
|
||||
|
||||
if (control())
|
||||
tok->string = control()->findOrInsertStringLiteral(yytext, yylen);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ch == 'L' && (_yychar == '"' || _yychar == '\'')) {
|
||||
// wide char literals
|
||||
// wide char/string literals
|
||||
ch = _yychar;
|
||||
yyinp();
|
||||
|
||||
|
||||
@@ -80,6 +80,9 @@ public:
|
||||
bool qtMocRunEnabled() const;
|
||||
void setQtMocRunEnabled(bool onoff);
|
||||
|
||||
bool objcEnabled() const;
|
||||
void setObjcEnabled(bool onoff);
|
||||
|
||||
void scan(Token *tok);
|
||||
|
||||
inline void operator()(Token *tok)
|
||||
@@ -112,6 +115,7 @@ private:
|
||||
void scan_helper(Token *tok);
|
||||
void setSource(const char *firstChar, const char *lastChar);
|
||||
static int classify(const char *string, int length, bool q);
|
||||
static int classifyObjCAtKeyword(const char *s, int n);
|
||||
static int classifyOperator(const char *string, int length);
|
||||
|
||||
inline void yyinp()
|
||||
@@ -143,6 +147,7 @@ private:
|
||||
unsigned _scanKeywords: 1;
|
||||
unsigned _scanAngleStringLiteralTokens: 1;
|
||||
unsigned _qtMocRunEnabled: 1;
|
||||
unsigned _objcEnabled: 1;
|
||||
};
|
||||
};
|
||||
unsigned _currentLine;
|
||||
|
||||
@@ -112,4 +112,19 @@ void *MemoryPool::allocate_helper(size_t size)
|
||||
return addr;
|
||||
}
|
||||
|
||||
Managed::Managed()
|
||||
{ }
|
||||
|
||||
Managed::~Managed()
|
||||
{ }
|
||||
|
||||
void *Managed::operator new(size_t size, MemoryPool *pool)
|
||||
{ return pool->allocate(size); }
|
||||
|
||||
void Managed::operator delete(void *)
|
||||
{ }
|
||||
|
||||
void Managed::operator delete(void *, MemoryPool *)
|
||||
{ }
|
||||
|
||||
CPLUSPLUS_END_NAMESPACE
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
|
||||
#include "CPlusPlusForwardDeclarations.h"
|
||||
#include <cstddef>
|
||||
#include <new>
|
||||
|
||||
CPLUSPLUS_BEGIN_HEADER
|
||||
CPLUSPLUS_BEGIN_NAMESPACE
|
||||
@@ -99,6 +100,20 @@ private:
|
||||
};
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT Managed
|
||||
{
|
||||
Managed(const Managed &other);
|
||||
void operator = (const Managed &other);
|
||||
|
||||
public:
|
||||
Managed();
|
||||
virtual ~Managed();
|
||||
|
||||
void *operator new(size_t size, MemoryPool *pool);
|
||||
void operator delete(void *);
|
||||
void operator delete(void *, MemoryPool *);
|
||||
};
|
||||
|
||||
CPLUSPLUS_END_NAMESPACE
|
||||
CPLUSPLUS_END_HEADER
|
||||
|
||||
|
||||
464
shared/cplusplus/ObjectiveCAtKeywords.cpp
Normal file
464
shared/cplusplus/ObjectiveCAtKeywords.cpp
Normal file
@@ -0,0 +1,464 @@
|
||||
#include "Lexer.h"
|
||||
#include "Token.h"
|
||||
|
||||
CPLUSPLUS_BEGIN_NAMESPACE
|
||||
|
||||
static inline int classify3(const char *s) {
|
||||
if (s[0] == 'e') {
|
||||
if (s[1] == 'n') {
|
||||
if (s[2] == 'd') {
|
||||
return T_AT_END;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s[0] == 't') {
|
||||
if (s[1] == 'r') {
|
||||
if (s[2] == 'y') {
|
||||
return T_AT_TRY;
|
||||
}
|
||||
}
|
||||
}
|
||||
return T_ERROR;
|
||||
}
|
||||
|
||||
static inline int classify4(const char *s) {
|
||||
if (s[0] == 'd') {
|
||||
if (s[1] == 'e') {
|
||||
if (s[2] == 'f') {
|
||||
if (s[3] == 's') {
|
||||
return T_AT_DEFS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return T_ERROR;
|
||||
}
|
||||
|
||||
static inline int classify5(const char *s) {
|
||||
if (s[0] == 'c') {
|
||||
if (s[1] == 'a') {
|
||||
if (s[2] == 't') {
|
||||
if (s[3] == 'c') {
|
||||
if (s[4] == 'h') {
|
||||
return T_AT_CATCH;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s[1] == 'l') {
|
||||
if (s[2] == 'a') {
|
||||
if (s[3] == 's') {
|
||||
if (s[4] == 's') {
|
||||
return T_AT_CLASS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s[0] == 't') {
|
||||
if (s[1] == 'h') {
|
||||
if (s[2] == 'r') {
|
||||
if (s[3] == 'o') {
|
||||
if (s[4] == 'w') {
|
||||
return T_AT_THROW;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return T_ERROR;
|
||||
}
|
||||
|
||||
static inline int classify6(const char *s) {
|
||||
if (s[0] == 'e') {
|
||||
if (s[1] == 'n') {
|
||||
if (s[2] == 'c') {
|
||||
if (s[3] == 'o') {
|
||||
if (s[4] == 'd') {
|
||||
if (s[5] == 'e') {
|
||||
return T_AT_ENCODE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s[0] == 'p') {
|
||||
if (s[1] == 'u') {
|
||||
if (s[2] == 'b') {
|
||||
if (s[3] == 'l') {
|
||||
if (s[4] == 'i') {
|
||||
if (s[5] == 'c') {
|
||||
return T_AT_PUBLIC;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return T_ERROR;
|
||||
}
|
||||
|
||||
static inline int classify7(const char *s) {
|
||||
if (s[0] == 'd') {
|
||||
if (s[1] == 'y') {
|
||||
if (s[2] == 'n') {
|
||||
if (s[3] == 'a') {
|
||||
if (s[4] == 'm') {
|
||||
if (s[5] == 'i') {
|
||||
if (s[6] == 'c') {
|
||||
return T_AT_DYNAMIC;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s[0] == 'f') {
|
||||
if (s[1] == 'i') {
|
||||
if (s[2] == 'n') {
|
||||
if (s[3] == 'a') {
|
||||
if (s[4] == 'l') {
|
||||
if (s[5] == 'l') {
|
||||
if (s[6] == 'y') {
|
||||
return T_AT_FINALLY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s[0] == 'p') {
|
||||
if (s[1] == 'a') {
|
||||
if (s[2] == 'c') {
|
||||
if (s[3] == 'k') {
|
||||
if (s[4] == 'a') {
|
||||
if (s[5] == 'g') {
|
||||
if (s[6] == 'e') {
|
||||
return T_AT_PACKAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s[1] == 'r') {
|
||||
if (s[2] == 'i') {
|
||||
if (s[3] == 'v') {
|
||||
if (s[4] == 'a') {
|
||||
if (s[5] == 't') {
|
||||
if (s[6] == 'e') {
|
||||
return T_AT_PRIVATE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return T_ERROR;
|
||||
}
|
||||
|
||||
static inline int classify8(const char *s) {
|
||||
if (s[0] == 'o') {
|
||||
if (s[1] == 'p') {
|
||||
if (s[2] == 't') {
|
||||
if (s[3] == 'i') {
|
||||
if (s[4] == 'o') {
|
||||
if (s[5] == 'n') {
|
||||
if (s[6] == 'a') {
|
||||
if (s[7] == 'l') {
|
||||
return T_AT_OPTIONAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s[0] == 'p') {
|
||||
if (s[1] == 'r') {
|
||||
if (s[2] == 'o') {
|
||||
if (s[3] == 'p') {
|
||||
if (s[4] == 'e') {
|
||||
if (s[5] == 'r') {
|
||||
if (s[6] == 't') {
|
||||
if (s[7] == 'y') {
|
||||
return T_AT_PROPERTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s[3] == 't') {
|
||||
if (s[4] == 'o') {
|
||||
if (s[5] == 'c') {
|
||||
if (s[6] == 'o') {
|
||||
if (s[7] == 'l') {
|
||||
return T_AT_PROTOCOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s[0] == 'r') {
|
||||
if (s[1] == 'e') {
|
||||
if (s[2] == 'q') {
|
||||
if (s[3] == 'u') {
|
||||
if (s[4] == 'i') {
|
||||
if (s[5] == 'r') {
|
||||
if (s[6] == 'e') {
|
||||
if (s[7] == 'd') {
|
||||
return T_AT_REQUIRED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s[0] == 's') {
|
||||
if (s[1] == 'e') {
|
||||
if (s[2] == 'l') {
|
||||
if (s[3] == 'e') {
|
||||
if (s[4] == 'c') {
|
||||
if (s[5] == 't') {
|
||||
if (s[6] == 'o') {
|
||||
if (s[7] == 'r') {
|
||||
return T_AT_SELECTOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return T_ERROR;
|
||||
}
|
||||
|
||||
static inline int classify9(const char *s) {
|
||||
if (s[0] == 'i') {
|
||||
if (s[1] == 'n') {
|
||||
if (s[2] == 't') {
|
||||
if (s[3] == 'e') {
|
||||
if (s[4] == 'r') {
|
||||
if (s[5] == 'f') {
|
||||
if (s[6] == 'a') {
|
||||
if (s[7] == 'c') {
|
||||
if (s[8] == 'e') {
|
||||
return T_AT_INTERFACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s[0] == 'p') {
|
||||
if (s[1] == 'r') {
|
||||
if (s[2] == 'o') {
|
||||
if (s[3] == 't') {
|
||||
if (s[4] == 'e') {
|
||||
if (s[5] == 'c') {
|
||||
if (s[6] == 't') {
|
||||
if (s[7] == 'e') {
|
||||
if (s[8] == 'd') {
|
||||
return T_AT_PROTECTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return T_ERROR;
|
||||
}
|
||||
|
||||
static inline int classify10(const char *s) {
|
||||
if (s[0] == 's') {
|
||||
if (s[1] == 'y') {
|
||||
if (s[2] == 'n') {
|
||||
if (s[3] == 't') {
|
||||
if (s[4] == 'h') {
|
||||
if (s[5] == 'e') {
|
||||
if (s[6] == 's') {
|
||||
if (s[7] == 'i') {
|
||||
if (s[8] == 'z') {
|
||||
if (s[9] == 'e') {
|
||||
return T_AT_SYNTHESIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return T_ERROR;
|
||||
}
|
||||
|
||||
static inline int classify11(const char *s) {
|
||||
if (s[0] == 'n') {
|
||||
if (s[1] == 'o') {
|
||||
if (s[2] == 't') {
|
||||
if (s[3] == '_') {
|
||||
if (s[4] == 'k') {
|
||||
if (s[5] == 'e') {
|
||||
if (s[6] == 'y') {
|
||||
if (s[7] == 'w') {
|
||||
if (s[8] == 'o') {
|
||||
if (s[9] == 'r') {
|
||||
if (s[10] == 'd') {
|
||||
return T_AT_NOT_KEYWORD;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return T_ERROR;
|
||||
}
|
||||
|
||||
static inline int classify12(const char *s) {
|
||||
if (s[0] == 's') {
|
||||
if (s[1] == 'y') {
|
||||
if (s[2] == 'n') {
|
||||
if (s[3] == 'c') {
|
||||
if (s[4] == 'h') {
|
||||
if (s[5] == 'r') {
|
||||
if (s[6] == 'o') {
|
||||
if (s[7] == 'n') {
|
||||
if (s[8] == 'i') {
|
||||
if (s[9] == 'z') {
|
||||
if (s[10] == 'e') {
|
||||
if (s[11] == 'd') {
|
||||
return T_AT_SYNCHRONIZED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return T_ERROR;
|
||||
}
|
||||
|
||||
static inline int classify14(const char *s) {
|
||||
if (s[0] == 'i') {
|
||||
if (s[1] == 'm') {
|
||||
if (s[2] == 'p') {
|
||||
if (s[3] == 'l') {
|
||||
if (s[4] == 'e') {
|
||||
if (s[5] == 'm') {
|
||||
if (s[6] == 'e') {
|
||||
if (s[7] == 'n') {
|
||||
if (s[8] == 't') {
|
||||
if (s[9] == 'a') {
|
||||
if (s[10] == 't') {
|
||||
if (s[11] == 'i') {
|
||||
if (s[12] == 'o') {
|
||||
if (s[13] == 'n') {
|
||||
return T_AT_IMPLEMENTATION;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return T_ERROR;
|
||||
}
|
||||
|
||||
static inline int classify19(const char *s) {
|
||||
if (s[0] == 'c') {
|
||||
if (s[1] == 'o') {
|
||||
if (s[2] == 'm') {
|
||||
if (s[3] == 'p') {
|
||||
if (s[4] == 'a') {
|
||||
if (s[5] == 't') {
|
||||
if (s[6] == 'i') {
|
||||
if (s[7] == 'b') {
|
||||
if (s[8] == 'i') {
|
||||
if (s[9] == 'l') {
|
||||
if (s[10] == 'i') {
|
||||
if (s[11] == 't') {
|
||||
if (s[12] == 'y') {
|
||||
if (s[13] == '_') {
|
||||
if (s[14] == 'a') {
|
||||
if (s[15] == 'l') {
|
||||
if (s[16] == 'i') {
|
||||
if (s[17] == 'a') {
|
||||
if (s[18] == 's') {
|
||||
return T_AT_COMPATIBILITY_ALIAS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return T_ERROR;
|
||||
}
|
||||
|
||||
int Lexer::classifyObjCAtKeyword(const char *s, int n) {
|
||||
switch (n) {
|
||||
case 3: return classify3(s);
|
||||
case 4: return classify4(s);
|
||||
case 5: return classify5(s);
|
||||
case 6: return classify6(s);
|
||||
case 7: return classify7(s);
|
||||
case 8: return classify8(s);
|
||||
case 9: return classify9(s);
|
||||
case 10: return classify10(s);
|
||||
case 11: return classify11(s);
|
||||
case 12: return classify12(s);
|
||||
case 14: return classify14(s);
|
||||
case 19: return classify19(s);
|
||||
default: return T_ERROR;
|
||||
} // switch
|
||||
}
|
||||
|
||||
CPLUSPLUS_END_NAMESPACE
|
||||
@@ -395,6 +395,28 @@ bool Parser::parseDeclaration(DeclarationAST *&node)
|
||||
case T_EXPORT:
|
||||
return parseTemplateDeclaration(node);
|
||||
|
||||
// objc++
|
||||
case T_AT_CLASS:
|
||||
return parseObjCClassDeclaration(node);
|
||||
|
||||
case T_AT_INTERFACE:
|
||||
return parseObjCInterfaceDeclaration(node);
|
||||
|
||||
case T_AT_PROTOCOL:
|
||||
return parseObjCProtocolDeclaration(node);
|
||||
|
||||
// case T_AT_END:
|
||||
// return parseObjCEndDeclaration(node);
|
||||
|
||||
case T_AT_COMPATIBILITY_ALIAS:
|
||||
return parseObjCAliasDeclaration(node);
|
||||
|
||||
case T_AT_SYNTHESIZE:
|
||||
return parseObjCPropertySynthesize(node);
|
||||
|
||||
case T_AT_DYNAMIC:
|
||||
return parseObjCPropertyDynamic(node);
|
||||
|
||||
default:
|
||||
if (LA() == T_EXTERN && LA(2) == T_TEMPLATE)
|
||||
return parseTemplateDeclaration(node);
|
||||
@@ -1196,9 +1218,12 @@ bool Parser::parseClassSpecifier(SpecifierAST *&node)
|
||||
const bool previousInFunctionBody = _inFunctionBody;
|
||||
_inFunctionBody = false;
|
||||
|
||||
unsigned colon_token = 0;
|
||||
|
||||
if (LA() == T_COLON || LA() == T_LBRACE) {
|
||||
BaseSpecifierAST *base_clause = 0;
|
||||
if (LA() == T_COLON) {
|
||||
colon_token = cursor();
|
||||
parseBaseClause(base_clause);
|
||||
if (LA() != T_LBRACE) {
|
||||
_translationUnit->error(cursor(), "expected `{' before `%s'", tok().spell());
|
||||
@@ -1216,6 +1241,7 @@ bool Parser::parseClassSpecifier(SpecifierAST *&node)
|
||||
ast->classkey_token = classkey_token;
|
||||
ast->attributes = attributes;
|
||||
ast->name = name;
|
||||
ast->colon_token = colon_token;
|
||||
ast->base_clause = base_clause;
|
||||
|
||||
if (LA() == T_LBRACE)
|
||||
@@ -3257,4 +3283,170 @@ bool Parser::parseThrowExpression(ExpressionAST *&node)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Parser::parseObjCClassDeclaration(DeclarationAST *&node)
|
||||
{
|
||||
if (LA() != T_AT_CLASS)
|
||||
return false;
|
||||
|
||||
ObjCClassDeclarationAST *ast = new (_pool) ObjCClassDeclarationAST;
|
||||
ast->class_token = consumeToken();
|
||||
parseObjCIdentifierList(ast->identifier_list);
|
||||
match(T_SEMICOLON, &ast->semicolon_token);
|
||||
node = ast;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Parser::parseObjCInterfaceDeclaration(DeclarationAST *&node)
|
||||
{
|
||||
if (LA() != T_AT_INTERFACE)
|
||||
return false;
|
||||
|
||||
unsigned interface_token = consumeToken();
|
||||
unsigned interface_name_token = 0;
|
||||
match(T_IDENTIFIER, &interface_name_token);
|
||||
if (LA() == T_LPAREN) {
|
||||
// category interface
|
||||
unsigned lparen_token = consumeToken();
|
||||
unsigned catagory_name_token = 0;
|
||||
if (LA() == T_IDENTIFIER)
|
||||
catagory_name_token = consumeToken();
|
||||
unsigned rparen_token = 0;
|
||||
match(T_RPAREN, &rparen_token);
|
||||
parseObjCProtocolRefs();
|
||||
parseObjCClassInstanceVariables();
|
||||
parseObjCInterfaceDeclList();
|
||||
unsigned end_token = 0;
|
||||
match(T_AT_END, &end_token);
|
||||
return true;
|
||||
} else {
|
||||
// class interface
|
||||
unsigned colon_token = 0;
|
||||
unsigned super_class_token = 0;
|
||||
if (LA() == T_COLON) {
|
||||
colon_token = consumeToken();
|
||||
match(T_IDENTIFIER, &super_class_token);
|
||||
}
|
||||
parseObjCProtocolRefs();
|
||||
parseObjCInterfaceDeclList();
|
||||
unsigned end_token = 0;
|
||||
match(T_AT_END, &end_token);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Parser::parseObjCProtocolDeclaration(DeclarationAST *&node)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Parser::parseObjCEndDeclaration(DeclarationAST *&node)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Parser::parseObjCAliasDeclaration(DeclarationAST *&node)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Parser::parseObjCPropertySynthesize(DeclarationAST *&node)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Parser::parseObjCPropertyDynamic(DeclarationAST *&node)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Parser::parseObjCIdentifierList(IdentifierListAST *&node)
|
||||
{
|
||||
if (LA() == T_IDENTIFIER) {
|
||||
IdentifierListAST **it = &node;
|
||||
IdentifierListAST *id = new (_pool) IdentifierListAST;
|
||||
id->identifier_token = consumeToken();
|
||||
*it = id;
|
||||
while (LA() == T_COMMA) {
|
||||
consumeToken();
|
||||
if (LA() == T_IDENTIFIER) {
|
||||
it = &(*it)->next;
|
||||
IdentifierListAST *id = new (_pool) IdentifierListAST;
|
||||
id->identifier_token = consumeToken();
|
||||
*it = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Parser::parseObjCProtocolRefs()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Parser::parseObjCClassInstanceVariables()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Parser::parseObjCInterfaceDeclList()
|
||||
{
|
||||
unsigned saved = cursor();
|
||||
while (LA() != T_AT_END && parseObjCInterfaceMemberDeclaration()) {
|
||||
if (saved == cursor())
|
||||
consumeToken(); // skip a token
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Parser::parseObjCInterfaceMemberDeclaration()
|
||||
{
|
||||
switch (LA()) {
|
||||
case T_SEMICOLON:
|
||||
consumeToken();
|
||||
return true;
|
||||
|
||||
case T_AT_REQUIRED:
|
||||
case T_AT_OPTIONAL:
|
||||
consumeToken();
|
||||
return true;
|
||||
|
||||
case T_PLUS:
|
||||
case T_MINUS:
|
||||
return parseObjCMethodPrototype();
|
||||
|
||||
default: {
|
||||
DeclarationAST *declaration = 0;
|
||||
parseDeclaration(declaration);
|
||||
} // default
|
||||
|
||||
} // switch
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Parser::parseObjCPropertyDeclaration(DeclarationAST *&ast)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Parser::parseObjCMethodPrototype()
|
||||
{
|
||||
if (LA() != T_PLUS && LA() != T_MINUS)
|
||||
return false;
|
||||
|
||||
// instance or class method?
|
||||
unsigned method_type_token = consumeToken();
|
||||
|
||||
|
||||
SpecifierAST *attributes = 0, **attr = &attributes;
|
||||
while (parseAttributeSpecifier(*attr))
|
||||
attr = &(*attr)->next;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
CPLUSPLUS_END_NAMESPACE
|
||||
|
||||
@@ -203,6 +203,24 @@ public:
|
||||
bool parseUsingDirective(DeclarationAST *&node);
|
||||
bool parseWhileStatement(StatementAST *&node);
|
||||
|
||||
// ObjC++
|
||||
bool parseObjCClassDeclaration(DeclarationAST *&node);
|
||||
bool parseObjCInterfaceDeclaration(DeclarationAST *&node);
|
||||
bool parseObjCProtocolDeclaration(DeclarationAST *&node);
|
||||
bool parseObjCEndDeclaration(DeclarationAST *&node);
|
||||
bool parseObjCAliasDeclaration(DeclarationAST *&node);
|
||||
bool parseObjCPropertySynthesize(DeclarationAST *&node);
|
||||
bool parseObjCPropertyDynamic(DeclarationAST *&node);
|
||||
|
||||
bool parseObjCIdentifierList(IdentifierListAST *&node);
|
||||
|
||||
bool parseObjCPropertyDeclaration(DeclarationAST *&ast);
|
||||
bool parseObjCProtocolRefs();
|
||||
bool parseObjCClassInstanceVariables();
|
||||
bool parseObjCInterfaceMemberDeclaration();
|
||||
bool parseObjCInterfaceDeclList();
|
||||
bool parseObjCMethodPrototype();
|
||||
|
||||
// Qt MOC run
|
||||
bool parseQtMethod(ExpressionAST *&node);
|
||||
|
||||
|
||||
1283
shared/cplusplus/PrettyPrinter.cpp
Normal file
1283
shared/cplusplus/PrettyPrinter.cpp
Normal file
File diff suppressed because it is too large
Load Diff
162
shared/cplusplus/PrettyPrinter.h
Normal file
162
shared/cplusplus/PrettyPrinter.h
Normal file
@@ -0,0 +1,162 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef CPLUSPLUS_PRETTYPRINTER_H
|
||||
#define CPLUSPLUS_PRETTYPRINTER_H
|
||||
|
||||
#include "CPlusPlusForwardDeclarations.h"
|
||||
#include "ASTVisitor.h"
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
CPLUSPLUS_BEGIN_HEADER
|
||||
CPLUSPLUS_BEGIN_NAMESPACE
|
||||
|
||||
class PrettyPrinter: protected ASTVisitor
|
||||
{
|
||||
public:
|
||||
PrettyPrinter(Control *control, std::ostream &out);
|
||||
|
||||
void operator()(AST *ast);
|
||||
|
||||
protected:
|
||||
virtual bool visit(AccessDeclarationAST *ast);
|
||||
virtual bool visit(ArrayAccessAST *ast);
|
||||
virtual bool visit(ArrayDeclaratorAST *ast);
|
||||
virtual bool visit(ArrayInitializerAST *ast);
|
||||
virtual bool visit(AsmDefinitionAST *ast);
|
||||
virtual bool visit(AttributeSpecifierAST *ast);
|
||||
virtual bool visit(AttributeAST *ast);
|
||||
virtual bool visit(BaseSpecifierAST *ast);
|
||||
virtual bool visit(BinaryExpressionAST *ast);
|
||||
virtual bool visit(BoolLiteralAST *ast);
|
||||
virtual bool visit(BreakStatementAST *ast);
|
||||
virtual bool visit(CallAST *ast);
|
||||
virtual bool visit(CaseStatementAST *ast);
|
||||
virtual bool visit(CastExpressionAST *ast);
|
||||
virtual bool visit(CatchClauseAST *ast);
|
||||
virtual bool visit(ClassSpecifierAST *ast);
|
||||
virtual bool visit(CompoundStatementAST *ast);
|
||||
virtual bool visit(ConditionAST *ast);
|
||||
virtual bool visit(ConditionalExpressionAST *ast);
|
||||
virtual bool visit(ContinueStatementAST *ast);
|
||||
virtual bool visit(ConversionFunctionIdAST *ast);
|
||||
virtual bool visit(CppCastExpressionAST *ast);
|
||||
virtual bool visit(CtorInitializerAST *ast);
|
||||
virtual bool visit(DeclaratorAST *ast);
|
||||
virtual bool visit(DeclarationStatementAST *ast);
|
||||
virtual bool visit(DeclaratorIdAST *ast);
|
||||
virtual bool visit(DeclaratorListAST *ast);
|
||||
virtual bool visit(DeleteExpressionAST *ast);
|
||||
virtual bool visit(DestructorNameAST *ast);
|
||||
virtual bool visit(DoStatementAST *ast);
|
||||
virtual bool visit(ElaboratedTypeSpecifierAST *ast);
|
||||
virtual bool visit(EmptyDeclarationAST *ast);
|
||||
virtual bool visit(EnumSpecifierAST *ast);
|
||||
virtual bool visit(EnumeratorAST *ast);
|
||||
virtual bool visit(ExceptionDeclarationAST *ast);
|
||||
virtual bool visit(ExceptionSpecificationAST *ast);
|
||||
virtual bool visit(ExpressionListAST *ast);
|
||||
virtual bool visit(ExpressionOrDeclarationStatementAST *ast);
|
||||
virtual bool visit(ExpressionStatementAST *ast);
|
||||
virtual bool visit(ForStatementAST *ast);
|
||||
virtual bool visit(FunctionDeclaratorAST *ast);
|
||||
virtual bool visit(FunctionDefinitionAST *ast);
|
||||
virtual bool visit(GotoStatementAST *ast);
|
||||
virtual bool visit(IfStatementAST *ast);
|
||||
virtual bool visit(LabeledStatementAST *ast);
|
||||
virtual bool visit(LinkageBodyAST *ast);
|
||||
virtual bool visit(LinkageSpecificationAST *ast);
|
||||
virtual bool visit(MemInitializerAST *ast);
|
||||
virtual bool visit(MemberAccessAST *ast);
|
||||
virtual bool visit(NamedTypeSpecifierAST *ast);
|
||||
virtual bool visit(NamespaceAST *ast);
|
||||
virtual bool visit(NamespaceAliasDefinitionAST *ast);
|
||||
virtual bool visit(NestedDeclaratorAST *ast);
|
||||
virtual bool visit(NestedExpressionAST *ast);
|
||||
virtual bool visit(NestedNameSpecifierAST *ast);
|
||||
virtual bool visit(NewDeclaratorAST *ast);
|
||||
virtual bool visit(NewExpressionAST *ast);
|
||||
virtual bool visit(NewInitializerAST *ast);
|
||||
virtual bool visit(NewTypeIdAST *ast);
|
||||
virtual bool visit(NumericLiteralAST *ast);
|
||||
virtual bool visit(OperatorAST *ast);
|
||||
virtual bool visit(OperatorFunctionIdAST *ast);
|
||||
virtual bool visit(ParameterDeclarationAST *ast);
|
||||
virtual bool visit(ParameterDeclarationClauseAST *ast);
|
||||
virtual bool visit(PointerAST *ast);
|
||||
virtual bool visit(PointerToMemberAST *ast);
|
||||
virtual bool visit(PostIncrDecrAST *ast);
|
||||
virtual bool visit(PostfixExpressionAST *ast);
|
||||
virtual bool visit(QualifiedNameAST *ast);
|
||||
virtual bool visit(ReferenceAST *ast);
|
||||
virtual bool visit(ReturnStatementAST *ast);
|
||||
virtual bool visit(SimpleDeclarationAST *ast);
|
||||
virtual bool visit(SimpleNameAST *ast);
|
||||
virtual bool visit(SimpleSpecifierAST *ast);
|
||||
virtual bool visit(SizeofExpressionAST *ast);
|
||||
virtual bool visit(StringLiteralAST *ast);
|
||||
virtual bool visit(SwitchStatementAST *ast);
|
||||
virtual bool visit(TemplateArgumentListAST *ast);
|
||||
virtual bool visit(TemplateDeclarationAST *ast);
|
||||
virtual bool visit(TemplateIdAST *ast);
|
||||
virtual bool visit(TemplateTypeParameterAST *ast);
|
||||
virtual bool visit(ThisExpressionAST *ast);
|
||||
virtual bool visit(ThrowExpressionAST *ast);
|
||||
virtual bool visit(TranslationUnitAST *ast);
|
||||
virtual bool visit(TryBlockStatementAST *ast);
|
||||
virtual bool visit(TypeConstructorCallAST *ast);
|
||||
virtual bool visit(TypeIdAST *ast);
|
||||
virtual bool visit(TypeidExpressionAST *ast);
|
||||
virtual bool visit(TypeofSpecifierAST *ast);
|
||||
virtual bool visit(TypenameCallExpressionAST *ast);
|
||||
virtual bool visit(TypenameTypeParameterAST *ast);
|
||||
virtual bool visit(UnaryExpressionAST *ast);
|
||||
virtual bool visit(UsingAST *ast);
|
||||
virtual bool visit(UsingDirectiveAST *ast);
|
||||
virtual bool visit(WhileStatementAST *ast);
|
||||
virtual bool visit(QtMethodAST *ast);
|
||||
|
||||
void indent();
|
||||
void deindent();
|
||||
void newline();
|
||||
|
||||
private:
|
||||
std::ostream &out;
|
||||
unsigned depth;
|
||||
};
|
||||
|
||||
CPLUSPLUS_END_NAMESPACE
|
||||
CPLUSPLUS_END_HEADER
|
||||
|
||||
#endif // CPLUSPLUS_PRETTYPRINTER_H
|
||||
@@ -62,7 +62,7 @@ static const char *token_names[] = {
|
||||
|
||||
("<identifier>"), ("<int literal>"), ("<float literal>"), ("<char literal>"),
|
||||
("<wide char literal>"), ("<string literal>"), ("<wide char literal>"),
|
||||
("<angle string literal>"),
|
||||
("<@string literal>"), ("<angle string literal>"),
|
||||
|
||||
("&"), ("&&"), ("&="), ("->"), ("->*"), ("^"), ("^="), (":"), ("::"),
|
||||
(","), ("/"), ("/="), ("."), ("..."), (".*"), ("="), ("=="), ("!"),
|
||||
@@ -84,8 +84,16 @@ static const char *token_names[] = {
|
||||
("union"), ("unsigned"), ("using"), ("virtual"), ("void"),
|
||||
("volatile"), ("wchar_t"), ("while"),
|
||||
|
||||
// gnu
|
||||
("__attribute__"), ("__typeof__"),
|
||||
|
||||
// objc @keywords
|
||||
("@catch"), ("@class"), ("@compatibility_alias"), ("@defs"), ("@dynamic"),
|
||||
("@encode"), ("@end"), ("@finally"), ("@implementation"), ("@interface"),
|
||||
("@not_keyword"), ("@optional"), ("@package"), ("@private"), ("@property"),
|
||||
("@protected"), ("@protocol"), ("@public"), ("@required"), ("@selector"),
|
||||
("@synchronized"), ("@synthesize"), ("@throw"), ("@try"),
|
||||
|
||||
("SIGNAL"), ("SLOT"), ("Q_SIGNALS"), ("Q_SLOTS")
|
||||
};
|
||||
|
||||
@@ -118,6 +126,7 @@ const char *Token::spell() const
|
||||
case T_FLOAT_LITERAL:
|
||||
case T_CHAR_LITERAL:
|
||||
case T_STRING_LITERAL:
|
||||
case T_AT_STRING_LITERAL:
|
||||
case T_ANGLE_STRING_LITERAL:
|
||||
case T_WIDE_CHAR_LITERAL:
|
||||
case T_WIDE_STRING_LITERAL:
|
||||
|
||||
@@ -73,6 +73,7 @@ enum Kind {
|
||||
T_WIDE_CHAR_LITERAL,
|
||||
T_STRING_LITERAL,
|
||||
T_WIDE_STRING_LITERAL,
|
||||
T_AT_STRING_LITERAL,
|
||||
T_ANGLE_STRING_LITERAL,
|
||||
T_LAST_LITERAL = T_ANGLE_STRING_LITERAL,
|
||||
|
||||
@@ -199,6 +200,34 @@ enum Kind {
|
||||
T___ATTRIBUTE__,
|
||||
T___TYPEOF__,
|
||||
|
||||
// obj c++ @ keywords
|
||||
T_FIRST_OBJC_KEYWORD,
|
||||
|
||||
T_AT_CATCH = T_FIRST_OBJC_KEYWORD,
|
||||
T_AT_CLASS,
|
||||
T_AT_COMPATIBILITY_ALIAS,
|
||||
T_AT_DEFS,
|
||||
T_AT_DYNAMIC,
|
||||
T_AT_ENCODE,
|
||||
T_AT_END,
|
||||
T_AT_FINALLY,
|
||||
T_AT_IMPLEMENTATION,
|
||||
T_AT_INTERFACE,
|
||||
T_AT_NOT_KEYWORD,
|
||||
T_AT_OPTIONAL,
|
||||
T_AT_PACKAGE,
|
||||
T_AT_PRIVATE,
|
||||
T_AT_PROPERTY,
|
||||
T_AT_PROTECTED,
|
||||
T_AT_PROTOCOL,
|
||||
T_AT_PUBLIC,
|
||||
T_AT_REQUIRED,
|
||||
T_AT_SELECTOR,
|
||||
T_AT_SYNCHRONIZED,
|
||||
T_AT_SYNTHESIZE,
|
||||
T_AT_THROW,
|
||||
T_AT_TRY,
|
||||
|
||||
T_FIRST_QT_KEYWORD,
|
||||
|
||||
// Qt keywords
|
||||
|
||||
@@ -35,7 +35,9 @@ HEADERS += \
|
||||
$$PWD/Token.h \
|
||||
$$PWD/TranslationUnit.h \
|
||||
$$PWD/Type.h \
|
||||
$$PWD/TypeVisitor.h
|
||||
$$PWD/TypeVisitor.h \
|
||||
$$PWD/PrettyPrinter.h
|
||||
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/AST.cpp \
|
||||
@@ -52,6 +54,7 @@ SOURCES += \
|
||||
$$PWD/DiagnosticClient.cpp \
|
||||
$$PWD/FullySpecifiedType.cpp \
|
||||
$$PWD/Keywords.cpp \
|
||||
$$PWD/ObjectiveCAtKeywords.cpp \
|
||||
$$PWD/Lexer.cpp \
|
||||
$$PWD/LiteralTable.cpp \
|
||||
$$PWD/Literals.cpp \
|
||||
@@ -69,5 +72,6 @@ SOURCES += \
|
||||
$$PWD/Token.cpp \
|
||||
$$PWD/TranslationUnit.cpp \
|
||||
$$PWD/Type.cpp \
|
||||
$$PWD/TypeVisitor.cpp
|
||||
$$PWD/TypeVisitor.cpp \
|
||||
$$PWD/PrettyPrinter.cpp
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "sizehandlerect.h"
|
||||
#include "widgethostconstants.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include <QtDesigner/QDesignerFormWindowInterface>
|
||||
|
||||
@@ -143,7 +143,7 @@ void FormResizer::setFormWindow(QDesignerFormWindowInterface *fw)
|
||||
if (debugFormResizer)
|
||||
qDebug() << "FormResizer::setFormWindow " << fw;
|
||||
QVBoxLayout *layout = qobject_cast<QVBoxLayout *>(m_frame->layout());
|
||||
QTC_ASSERT(layout, return);
|
||||
Q_ASSERT(layout);
|
||||
if (layout->count())
|
||||
delete layout->takeAt(0);
|
||||
m_formWindow = fw;
|
||||
|
||||
@@ -33,8 +33,6 @@
|
||||
|
||||
#include "indenter.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace SharedTools::IndenterInternal;
|
||||
|
||||
// --- Constants
|
||||
@@ -59,10 +57,10 @@ Constants::Constants() :
|
||||
{
|
||||
m_literal.setMinimal(true);
|
||||
m_inlineCComment.setMinimal(true);
|
||||
QTC_ASSERT(m_literal.isValid(), return);
|
||||
QTC_ASSERT(m_label.isValid(), return);
|
||||
QTC_ASSERT(m_inlineCComment.isValid(), return);
|
||||
QTC_ASSERT(m_braceX.isValid(), return);
|
||||
QTC_ASSERT(m_iflikeKeyword.isValid(), return);
|
||||
QTC_ASSERT(m_caseLabel.isValid(), return);
|
||||
Q_ASSERT(m_literal.isValid());
|
||||
Q_ASSERT(m_label.isValid());
|
||||
Q_ASSERT(m_inlineCComment.isValid());
|
||||
Q_ASSERT(m_braceX.isValid());
|
||||
Q_ASSERT(m_iflikeKeyword.isValid());
|
||||
Q_ASSERT(m_caseLabel.isValid());
|
||||
}
|
||||
|
||||
@@ -33,8 +33,6 @@
|
||||
|
||||
#include "procommandmanager.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
|
||||
ProCommandGroup::ProCommandGroup(const QString &name)
|
||||
@@ -78,7 +76,7 @@ ProCommandManager::~ProCommandManager()
|
||||
|
||||
void ProCommandManager::beginGroup(const QString &name)
|
||||
{
|
||||
QTC_ASSERT(!m_group, return);
|
||||
Q_ASSERT(!m_group);
|
||||
|
||||
if (m_pos != m_groups.count()) {
|
||||
int removecount = m_groups.count() - m_pos;
|
||||
@@ -97,7 +95,7 @@ bool ProCommandManager::hasGroup() const
|
||||
|
||||
void ProCommandManager::endGroup()
|
||||
{
|
||||
QTC_ASSERT(m_group, return);
|
||||
Q_ASSERT(m_group);
|
||||
|
||||
m_groups.append(m_group);
|
||||
m_pos = m_groups.count();
|
||||
@@ -108,7 +106,7 @@ void ProCommandManager::endGroup()
|
||||
|
||||
bool ProCommandManager::command(ProCommand *cmd)
|
||||
{
|
||||
QTC_ASSERT(m_group, return false);
|
||||
Q_ASSERT(m_group);
|
||||
|
||||
if (cmd->redo()) {
|
||||
m_group->appendCommand(cmd);
|
||||
|
||||
@@ -35,8 +35,6 @@
|
||||
#include "proparserutils.h"
|
||||
#include "proitems.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QDebug>
|
||||
@@ -188,7 +186,7 @@ public:
|
||||
QString format(const char *format) const;
|
||||
|
||||
QString currentFileName() const;
|
||||
QString getcwd() const;
|
||||
QString currentDirectory() const;
|
||||
ProFile *currentProFile() const;
|
||||
|
||||
bool evaluateConditionalFunction(const QString &function, const QString &arguments, bool *result);
|
||||
@@ -530,11 +528,15 @@ bool ProFileEvaluator::Private::visitBeginProBlock(ProBlock *block)
|
||||
if (!m_skipLevel) {
|
||||
m_prevCondition = m_condition;
|
||||
m_condition = ConditionFalse;
|
||||
} else {
|
||||
Q_ASSERT(m_condition != ConditionTrue);
|
||||
}
|
||||
} else if (block->blockKind() & ProBlock::ScopeContentsKind) {
|
||||
m_updateCondition = false;
|
||||
if (m_condition != ConditionTrue)
|
||||
++m_skipLevel;
|
||||
else
|
||||
Q_ASSERT(!m_skipLevel);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -542,8 +544,14 @@ bool ProFileEvaluator::Private::visitBeginProBlock(ProBlock *block)
|
||||
bool ProFileEvaluator::Private::visitEndProBlock(ProBlock *block)
|
||||
{
|
||||
if (block->blockKind() & ProBlock::ScopeContentsKind) {
|
||||
if (m_skipLevel)
|
||||
if (m_skipLevel) {
|
||||
Q_ASSERT(m_condition != ConditionTrue);
|
||||
--m_skipLevel;
|
||||
} else {
|
||||
// Conditionals contained inside this block may have changed the state.
|
||||
// So we reset it here to make an else following us do the right thing.
|
||||
m_condition = ConditionTrue;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -572,8 +580,12 @@ bool ProFileEvaluator::Private::visitProCondition(ProCondition *cond)
|
||||
{
|
||||
if (!m_skipLevel) {
|
||||
if (cond->text().toLower() == QLatin1String("else")) {
|
||||
// The state ConditionElse makes sure that subsequential elses are ignored.
|
||||
// That's braindead, but qmake is like that.
|
||||
if (m_prevCondition == ConditionTrue)
|
||||
m_condition = ConditionElse;
|
||||
else if (m_prevCondition == ConditionFalse)
|
||||
m_condition = ConditionTrue;
|
||||
} else if (m_condition == ConditionFalse) {
|
||||
if (isActiveConfig(cond->text(), true) ^ m_invertNext)
|
||||
m_condition = ConditionTrue;
|
||||
@@ -611,8 +623,7 @@ bool ProFileEvaluator::Private::visitBeginProFile(ProFile * pro)
|
||||
m_cumulative = cumulative;
|
||||
}
|
||||
|
||||
QString fn = pro->fileName();
|
||||
ok = QDir::setCurrent(QFileInfo(fn).absolutePath());
|
||||
ok = QDir::setCurrent(pro->directoryName());
|
||||
}
|
||||
|
||||
return ok;
|
||||
@@ -759,6 +770,11 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value)
|
||||
removeEach(&m_valuemap, varName, v);
|
||||
removeEach(&m_filevaluemap[currentProFile()], varName, v);
|
||||
}
|
||||
} else if (!m_skipLevel) {
|
||||
// this is a hack for the moment to fix the
|
||||
// CONFIG -= app_bundle problem on Mac (add it to a variable -CONFIG as was done before)
|
||||
insertUnique(&m_valuemap, QString("-%1").arg(varName), v);
|
||||
insertUnique(&m_filevaluemap[currentProFile()], QString("-%1").arg(varName), v);
|
||||
} else {
|
||||
// We are stingy with our values, too.
|
||||
}
|
||||
@@ -807,18 +823,20 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value)
|
||||
|
||||
bool ProFileEvaluator::Private::visitProFunction(ProFunction *func)
|
||||
{
|
||||
if (!m_skipLevel && (!m_updateCondition || m_condition == ConditionFalse)) {
|
||||
if (!m_updateCondition || m_condition == ConditionFalse) {
|
||||
QString text = func->text();
|
||||
int lparen = text.indexOf(QLatin1Char('('));
|
||||
int rparen = text.lastIndexOf(QLatin1Char(')'));
|
||||
QTC_ASSERT(lparen < rparen, return false);
|
||||
Q_ASSERT(lparen < rparen);
|
||||
QString arguments = text.mid(lparen + 1, rparen - lparen - 1);
|
||||
QString funcName = text.left(lparen);
|
||||
m_lineNo = func->lineNumber();
|
||||
bool result = false;
|
||||
if (!evaluateConditionalFunction(funcName.trimmed(), arguments, &result))
|
||||
bool result;
|
||||
if (!evaluateConditionalFunction(funcName.trimmed(), arguments, &result)) {
|
||||
m_invertNext = false;
|
||||
return false;
|
||||
if (result ^ m_invertNext)
|
||||
}
|
||||
if (!m_skipLevel && (result ^ m_invertNext))
|
||||
m_condition = ConditionTrue;
|
||||
}
|
||||
m_invertNext = false;
|
||||
@@ -942,11 +960,10 @@ QString ProFileEvaluator::Private::currentFileName() const
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString ProFileEvaluator::Private::getcwd() const
|
||||
QString ProFileEvaluator::Private::currentDirectory() const
|
||||
{
|
||||
ProFile *cur = m_profileStack.top();
|
||||
QFileInfo fi(cur->fileName());
|
||||
return fi.absolutePath();
|
||||
return cur->directoryName();
|
||||
}
|
||||
|
||||
QStringList ProFileEvaluator::Private::expandVariableReferences(const QString &str)
|
||||
@@ -1556,7 +1573,7 @@ QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &fun
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
q->logMessage(format("'%1' is not a function").arg(func));
|
||||
q->logMessage(format("'%1' is not a recognized replace function").arg(func));
|
||||
break;
|
||||
default:
|
||||
q->logMessage(format("Function '%1' is not implemented").arg(func));
|
||||
@@ -1577,26 +1594,67 @@ bool ProFileEvaluator::Private::evaluateConditionalFunction(const QString &funct
|
||||
for (int i = 0; i < argumentsList.count(); ++i)
|
||||
args += expandVariableReferences(argumentsList[i]).join(sep);
|
||||
|
||||
enum ConditionFunc { CF_CONFIG = 1, CF_CONTAINS, CF_COUNT, CF_EXISTS, CF_INCLUDE,
|
||||
CF_LOAD, CF_ISEMPTY, CF_SYSTEM, CF_MESSAGE};
|
||||
enum TestFunc { T_REQUIRES=1, T_GREATERTHAN, T_LESSTHAN, T_EQUALS,
|
||||
T_EXISTS, T_EXPORT, T_CLEAR, T_UNSET, T_EVAL, T_CONFIG, T_SYSTEM,
|
||||
T_RETURN, T_BREAK, T_NEXT, T_DEFINED, T_CONTAINS, T_INFILE,
|
||||
T_COUNT, T_ISEMPTY, T_INCLUDE, T_LOAD, T_DEBUG, T_MESSAGE, T_IF };
|
||||
|
||||
static QHash<QString, int> *functions = 0;
|
||||
if (!functions) {
|
||||
functions = new QHash<QString, int>;
|
||||
functions->insert(QLatin1String("load"), CF_LOAD); //v
|
||||
functions->insert(QLatin1String("include"), CF_INCLUDE); //v
|
||||
functions->insert(QLatin1String("message"), CF_MESSAGE); //v
|
||||
functions->insert(QLatin1String("warning"), CF_MESSAGE); //v
|
||||
functions->insert(QLatin1String("error"), CF_MESSAGE); //v
|
||||
functions->insert(QLatin1String("requires"), T_REQUIRES);
|
||||
functions->insert(QLatin1String("greaterThan"), T_GREATERTHAN);
|
||||
functions->insert(QLatin1String("lessThan"), T_LESSTHAN);
|
||||
functions->insert(QLatin1String("equals"), T_EQUALS);
|
||||
functions->insert(QLatin1String("isEqual"), T_EQUALS);
|
||||
functions->insert(QLatin1String("exists"), T_EXISTS);
|
||||
functions->insert(QLatin1String("export"), T_EXPORT);
|
||||
functions->insert(QLatin1String("clear"), T_CLEAR);
|
||||
functions->insert(QLatin1String("unset"), T_UNSET);
|
||||
functions->insert(QLatin1String("eval"), T_EVAL);
|
||||
functions->insert(QLatin1String("CONFIG"), T_CONFIG);
|
||||
functions->insert(QLatin1String("if"), T_IF);
|
||||
functions->insert(QLatin1String("isActiveConfig"), T_CONFIG);
|
||||
functions->insert(QLatin1String("system"), T_SYSTEM);
|
||||
functions->insert(QLatin1String("return"), T_RETURN);
|
||||
functions->insert(QLatin1String("break"), T_BREAK);
|
||||
functions->insert(QLatin1String("next"), T_NEXT);
|
||||
functions->insert(QLatin1String("defined"), T_DEFINED);
|
||||
functions->insert(QLatin1String("contains"), T_CONTAINS);
|
||||
functions->insert(QLatin1String("infile"), T_INFILE);
|
||||
functions->insert(QLatin1String("count"), T_COUNT);
|
||||
functions->insert(QLatin1String("isEmpty"), T_ISEMPTY);
|
||||
functions->insert(QLatin1String("load"), T_LOAD); //v
|
||||
functions->insert(QLatin1String("include"), T_INCLUDE); //v
|
||||
functions->insert(QLatin1String("debug"), T_DEBUG);
|
||||
functions->insert(QLatin1String("message"), T_MESSAGE); //v
|
||||
functions->insert(QLatin1String("warning"), T_MESSAGE); //v
|
||||
functions->insert(QLatin1String("error"), T_MESSAGE); //v
|
||||
}
|
||||
|
||||
bool cond = false;
|
||||
bool ok = true;
|
||||
|
||||
ConditionFunc func_t = (ConditionFunc)functions->value(function);
|
||||
TestFunc func_t = (TestFunc)functions->value(function);
|
||||
|
||||
switch (func_t) {
|
||||
case CF_CONFIG: {
|
||||
#if 0
|
||||
case T_INFILE:
|
||||
case T_REQUIRES:
|
||||
case T_GREATERTHAN:
|
||||
case T_LESSTHAN:
|
||||
case T_EQUALS:
|
||||
case T_EXPORT:
|
||||
case T_CLEAR:
|
||||
case T_UNSET:
|
||||
case T_EVAL:
|
||||
case T_IF:
|
||||
case T_RETURN:
|
||||
case T_BREAK:
|
||||
case T_NEXT:
|
||||
case T_DEFINED:
|
||||
#endif
|
||||
case T_CONFIG: {
|
||||
if (args.count() < 1 || args.count() > 2) {
|
||||
q->logMessage(format("CONFIG(config) requires one or two arguments."));
|
||||
ok = false;
|
||||
@@ -1618,7 +1676,7 @@ bool ProFileEvaluator::Private::evaluateConditionalFunction(const QString &funct
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CF_CONTAINS: {
|
||||
case T_CONTAINS: {
|
||||
if (args.count() < 2 || args.count() > 3) {
|
||||
q->logMessage(format("contains(var, val) requires two or three arguments."));
|
||||
ok = false;
|
||||
@@ -1650,9 +1708,9 @@ bool ProFileEvaluator::Private::evaluateConditionalFunction(const QString &funct
|
||||
|
||||
break;
|
||||
}
|
||||
case CF_COUNT: {
|
||||
case T_COUNT: {
|
||||
if (args.count() != 2 && args.count() != 3) {
|
||||
q->logMessage(format("count(var, count) requires two or three arguments."));
|
||||
q->logMessage(format("count(var, count, op=\"equals\") requires two or three arguments."));
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
@@ -1677,7 +1735,9 @@ bool ProFileEvaluator::Private::evaluateConditionalFunction(const QString &funct
|
||||
cond = values(args.first()).count() == args[1].toInt();
|
||||
break;
|
||||
}
|
||||
case CF_INCLUDE: {
|
||||
case T_INCLUDE: {
|
||||
if (m_skipLevel && !m_cumulative)
|
||||
break;
|
||||
QString parseInto;
|
||||
if (args.count() == 2) {
|
||||
parseInto = args[1];
|
||||
@@ -1688,12 +1748,14 @@ bool ProFileEvaluator::Private::evaluateConditionalFunction(const QString &funct
|
||||
}
|
||||
QString fileName = args.first();
|
||||
// ### this breaks if we have include(c:/reallystupid.pri) but IMHO that's really bad style.
|
||||
QDir currentProPath(getcwd());
|
||||
QDir currentProPath(currentDirectory());
|
||||
fileName = QDir::cleanPath(currentProPath.absoluteFilePath(fileName));
|
||||
ok = evaluateFile(fileName, &ok);
|
||||
break;
|
||||
}
|
||||
case CF_LOAD: {
|
||||
case T_LOAD: {
|
||||
if (m_skipLevel && !m_cumulative)
|
||||
break;
|
||||
QString parseInto;
|
||||
bool ignore_error = false;
|
||||
if (args.count() == 2) {
|
||||
@@ -1707,13 +1769,16 @@ bool ProFileEvaluator::Private::evaluateConditionalFunction(const QString &funct
|
||||
ok = evaluateFeatureFile( args.first(), &cond);
|
||||
break;
|
||||
}
|
||||
case CF_MESSAGE: {
|
||||
case T_DEBUG:
|
||||
// Yup - do nothing. Nothing is going to enable debug output anyway.
|
||||
break;
|
||||
case T_MESSAGE: {
|
||||
if (args.count() != 1) {
|
||||
q->logMessage(format("%1(message) requires one argument.").arg(function));
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
QString msg = args.first();
|
||||
QString msg = fixEnvVariables(args.first());
|
||||
if (function == QLatin1String("error")) {
|
||||
QStringList parents;
|
||||
foreach (ProFile *proFile, m_profileStack)
|
||||
@@ -1730,7 +1795,8 @@ bool ProFileEvaluator::Private::evaluateConditionalFunction(const QString &funct
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CF_SYSTEM: {
|
||||
#if 0 // Way too dangerous to enable.
|
||||
case T_SYSTEM: {
|
||||
if (args.count() != 1) {
|
||||
q->logMessage(format("system(exec) requires one argument."));
|
||||
ok = false;
|
||||
@@ -1739,7 +1805,8 @@ bool ProFileEvaluator::Private::evaluateConditionalFunction(const QString &funct
|
||||
ok = system(args.first().toLatin1().constData()) == 0;
|
||||
break;
|
||||
}
|
||||
case CF_ISEMPTY: {
|
||||
#endif
|
||||
case T_ISEMPTY: {
|
||||
if (args.count() != 1) {
|
||||
q->logMessage(format("isEmpty(var) requires one argument."));
|
||||
ok = false;
|
||||
@@ -1754,7 +1821,7 @@ bool ProFileEvaluator::Private::evaluateConditionalFunction(const QString &funct
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CF_EXISTS: {
|
||||
case T_EXISTS: {
|
||||
if (args.count() != 1) {
|
||||
q->logMessage(format("exists(file) requires one argument."));
|
||||
ok = false;
|
||||
@@ -1768,7 +1835,7 @@ bool ProFileEvaluator::Private::evaluateConditionalFunction(const QString &funct
|
||||
break;
|
||||
}
|
||||
//regular expression I guess
|
||||
QString dirstr = getcwd();
|
||||
QString dirstr = currentDirectory();
|
||||
int slsh = file.lastIndexOf(Option::dir_sep);
|
||||
if (slsh != -1) {
|
||||
dirstr = file.left(slsh+1);
|
||||
@@ -1778,6 +1845,13 @@ bool ProFileEvaluator::Private::evaluateConditionalFunction(const QString &funct
|
||||
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
// This is too chatty currently (missing defineTest and defineReplace)
|
||||
//q->logMessage(format("'%1' is not a recognized test function").arg(function));
|
||||
break;
|
||||
default:
|
||||
q->logMessage(format("Function '%1' is not implemented").arg(function));
|
||||
break;
|
||||
}
|
||||
|
||||
if (result)
|
||||
@@ -1800,7 +1874,7 @@ QStringList ProFileEvaluator::Private::values(const QString &variableName,
|
||||
return QStringList(m_outputDir);
|
||||
if (variableName == QLatin1String("PWD") || //current working dir (of _FILE_)
|
||||
variableName == QLatin1String("IN_PWD"))
|
||||
return QStringList(getcwd());
|
||||
return QStringList(currentDirectory());
|
||||
if (variableName == QLatin1String("DIR_SEPARATOR"))
|
||||
return QStringList(Option::dir_sep);
|
||||
if (variableName == QLatin1String("DIRLIST_SEPARATOR"))
|
||||
@@ -1975,7 +2049,13 @@ bool ProFileEvaluator::Private::evaluateFeatureFile(const QString &fileName, boo
|
||||
break;
|
||||
}
|
||||
}
|
||||
return fn.isEmpty() ? false : evaluateFile(fn, result);
|
||||
if (fn.isEmpty())
|
||||
return false;
|
||||
bool cumulative = m_cumulative;
|
||||
m_cumulative = false;
|
||||
bool ok = evaluateFile(fn, result);
|
||||
m_cumulative = cumulative;
|
||||
return ok;
|
||||
}
|
||||
|
||||
void ProFileEvaluator::Private::expandPatternHelper(const QString &relName, const QString &absName,
|
||||
@@ -2085,14 +2165,23 @@ bool ProFileEvaluator::contains(const QString &variableName) const
|
||||
return d->m_valuemap.contains(variableName);
|
||||
}
|
||||
|
||||
inline QStringList fixEnvVariables(const QStringList &x)
|
||||
{
|
||||
QStringList ret;
|
||||
foreach (const QString &str, x)
|
||||
ret << Option::fixString(str, Option::FixEnvVars);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
QStringList ProFileEvaluator::values(const QString &variableName) const
|
||||
{
|
||||
return d->values(variableName);
|
||||
return fixEnvVariables(d->values(variableName));
|
||||
}
|
||||
|
||||
QStringList ProFileEvaluator::values(const QString &variableName, const ProFile *pro) const
|
||||
{
|
||||
return d->values(variableName, pro);
|
||||
return fixEnvVariables(d->values(variableName, pro));
|
||||
}
|
||||
|
||||
ProFileEvaluator::TemplateType ProFileEvaluator::templateType()
|
||||
@@ -2166,20 +2255,6 @@ void ProFileEvaluator::errorMessage(const QString &message)
|
||||
qWarning("%s", qPrintable(message));
|
||||
}
|
||||
|
||||
// This function is unneeded and still retained. See log message for reason.
|
||||
QStringList ProFileEvaluator::absFileNames(const QString &variableName)
|
||||
{
|
||||
QStringList sources_out;
|
||||
QFileInfo fi(d->m_origfile);
|
||||
QDir dir(fi.absoluteDir());
|
||||
foreach (const QString &fn, values(variableName)) {
|
||||
const QString absName = QDir::cleanPath(dir.absoluteFilePath(fn));
|
||||
d->expandPatternHelper(fn, absName, sources_out);
|
||||
}
|
||||
|
||||
return sources_out;
|
||||
}
|
||||
|
||||
void ProFileEvaluator::setVerbose(bool on)
|
||||
{
|
||||
d->m_verbose = on;
|
||||
|
||||
@@ -66,8 +66,6 @@ public:
|
||||
|
||||
ProFileEvaluator::TemplateType templateType();
|
||||
virtual bool contains(const QString &variableName) const;
|
||||
QStringList absFileNames(const QString &variableName);
|
||||
QStringList absFileName(const QString &name);
|
||||
void setVerbose(bool on); // Default is false
|
||||
void setCumulative(bool on); // Default is true!
|
||||
void setOutputDir(const QString &dir); // Default is empty
|
||||
|
||||
@@ -275,6 +275,7 @@ ProFile::ProFile(const QString &fileName)
|
||||
|
||||
QFileInfo fi(fileName);
|
||||
m_displayFileName = fi.fileName();
|
||||
m_directoryName = fi.absolutePath();
|
||||
}
|
||||
|
||||
ProFile::~ProFile()
|
||||
@@ -291,6 +292,11 @@ QString ProFile::fileName() const
|
||||
return m_fileName;
|
||||
}
|
||||
|
||||
QString ProFile::directoryName() const
|
||||
{
|
||||
return m_directoryName;
|
||||
}
|
||||
|
||||
void ProFile::setModified(bool modified)
|
||||
{
|
||||
m_modified = modified;
|
||||
|
||||
@@ -209,6 +209,7 @@ public:
|
||||
|
||||
QString displayFileName() const;
|
||||
QString fileName() const;
|
||||
QString directoryName() const;
|
||||
|
||||
void setModified(bool modified);
|
||||
bool isModified() const;
|
||||
@@ -218,6 +219,7 @@ public:
|
||||
private:
|
||||
QString m_fileName;
|
||||
QString m_displayFileName;
|
||||
QString m_directoryName;
|
||||
bool m_modified;
|
||||
};
|
||||
|
||||
|
||||
@@ -173,7 +173,12 @@ static QStringList replaceInList(const QStringList &varList, const QRegExp ®e
|
||||
}
|
||||
*/
|
||||
|
||||
inline QStringList splitPathList(const QString paths)
|
||||
inline QString fixEnvVariables(const QString &x)
|
||||
{
|
||||
return Option::fixString(x, Option::FixEnvVars);
|
||||
}
|
||||
|
||||
inline QStringList splitPathList(const QString &paths)
|
||||
{
|
||||
return paths.split(Option::dirlist_sep);
|
||||
}
|
||||
|
||||
@@ -33,8 +33,6 @@
|
||||
|
||||
#include "resourcefile_p.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
@@ -119,7 +117,7 @@ bool ResourceFile::load()
|
||||
} else {
|
||||
p = m_prefix_list[idx];
|
||||
}
|
||||
QTC_ASSERT(p, return false);
|
||||
Q_ASSERT(p);
|
||||
|
||||
QDomElement felt = relt.firstChildElement(QLatin1String("file"));
|
||||
for (; !felt.isNull(); felt = felt.nextSiblingElement(QLatin1String("file"))) {
|
||||
@@ -251,7 +249,7 @@ bool ResourceFile::isEmpty() const
|
||||
QStringList ResourceFile::fileList(int pref_idx) const
|
||||
{
|
||||
QStringList result;
|
||||
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return result);
|
||||
Q_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count());
|
||||
const FileList &abs_file_list = m_prefix_list.at(pref_idx)->file_list;
|
||||
foreach (const File *abs_file, abs_file_list)
|
||||
result.append(relativePath(abs_file->name));
|
||||
@@ -261,9 +259,9 @@ QStringList ResourceFile::fileList(int pref_idx) const
|
||||
void ResourceFile::addFile(int prefix_idx, const QString &file, int file_idx)
|
||||
{
|
||||
Prefix * const p = m_prefix_list[prefix_idx];
|
||||
QTC_ASSERT(p, return);
|
||||
Q_ASSERT(p);
|
||||
FileList &files = p->file_list;
|
||||
QTC_ASSERT(file_idx >= -1 && file_idx <= files.size(), return);
|
||||
Q_ASSERT(file_idx >= -1 && file_idx <= files.size());
|
||||
if (file_idx == -1)
|
||||
file_idx = files.size();
|
||||
files.insert(file_idx, new File(p, absolutePath(file)));
|
||||
@@ -275,7 +273,7 @@ void ResourceFile::addPrefix(const QString &prefix, int prefix_idx)
|
||||
if (indexOfPrefix(fixed_prefix) != -1)
|
||||
return;
|
||||
|
||||
QTC_ASSERT(prefix_idx >= -1 && prefix_idx <= m_prefix_list.size(), return);
|
||||
Q_ASSERT(prefix_idx >= -1 && prefix_idx <= m_prefix_list.size());
|
||||
if (prefix_idx == -1)
|
||||
prefix_idx = m_prefix_list.size();
|
||||
m_prefix_list.insert(prefix_idx, new Prefix(fixed_prefix));
|
||||
@@ -283,7 +281,7 @@ void ResourceFile::addPrefix(const QString &prefix, int prefix_idx)
|
||||
|
||||
void ResourceFile::removePrefix(int prefix_idx)
|
||||
{
|
||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
||||
Q_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count());
|
||||
Prefix * const p = m_prefix_list.at(prefix_idx);
|
||||
delete p;
|
||||
m_prefix_list.removeAt(prefix_idx);
|
||||
@@ -291,39 +289,39 @@ void ResourceFile::removePrefix(int prefix_idx)
|
||||
|
||||
void ResourceFile::removeFile(int prefix_idx, int file_idx)
|
||||
{
|
||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
||||
Q_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count());
|
||||
FileList &fileList = m_prefix_list[prefix_idx]->file_list;
|
||||
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return);
|
||||
Q_ASSERT(file_idx >= 0 && file_idx < fileList.count());
|
||||
delete fileList.at(file_idx);
|
||||
fileList.removeAt(file_idx);
|
||||
}
|
||||
|
||||
void ResourceFile::replacePrefix(int prefix_idx, const QString &prefix)
|
||||
{
|
||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
||||
Q_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count());
|
||||
m_prefix_list[prefix_idx]->name = fixPrefix(prefix);
|
||||
}
|
||||
|
||||
void ResourceFile::replaceLang(int prefix_idx, const QString &lang)
|
||||
{
|
||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
||||
Q_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count());
|
||||
m_prefix_list[prefix_idx]->lang = lang;
|
||||
}
|
||||
|
||||
void ResourceFile::replaceAlias(int prefix_idx, int file_idx, const QString &alias)
|
||||
{
|
||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
||||
Q_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count());
|
||||
FileList &fileList = m_prefix_list.at(prefix_idx)->file_list;
|
||||
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return);
|
||||
Q_ASSERT(file_idx >= 0 && file_idx < fileList.count());
|
||||
fileList[file_idx]->alias = alias;
|
||||
}
|
||||
|
||||
|
||||
void ResourceFile::replaceFile(int pref_idx, int file_idx, const QString &file)
|
||||
{
|
||||
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return);
|
||||
Q_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count());
|
||||
FileList &fileList = m_prefix_list.at(pref_idx)->file_list;
|
||||
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return);
|
||||
Q_ASSERT(file_idx >= 0 && file_idx < fileList.count());
|
||||
fileList[file_idx]->name = file;
|
||||
}
|
||||
|
||||
@@ -339,7 +337,7 @@ int ResourceFile::indexOfPrefix(const QString &prefix) const
|
||||
|
||||
int ResourceFile::indexOfFile(int pref_idx, const QString &file) const
|
||||
{
|
||||
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return -1);
|
||||
Q_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count());
|
||||
Prefix * const p = m_prefix_list.at(pref_idx);
|
||||
File equalFile(p, absolutePath(file));
|
||||
return p->file_list.indexOf(&equalFile);
|
||||
@@ -373,16 +371,16 @@ bool ResourceFile::contains(const QString &prefix, const QString &file) const
|
||||
return false;
|
||||
if (file.isEmpty())
|
||||
return true;
|
||||
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return false);
|
||||
Q_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count());
|
||||
Prefix * const p = m_prefix_list.at(pref_idx);
|
||||
QTC_ASSERT(p, return false);
|
||||
Q_ASSERT(p);
|
||||
File equalFile(p, absolutePath(file));
|
||||
return p->file_list.contains(&equalFile);
|
||||
}
|
||||
|
||||
bool ResourceFile::contains(int pref_idx, const QString &file) const
|
||||
{
|
||||
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return false);
|
||||
Q_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count());
|
||||
Prefix * const p = m_prefix_list.at(pref_idx);
|
||||
File equalFile(p, absolutePath(file));
|
||||
return p->file_list.contains(&equalFile);
|
||||
@@ -412,49 +410,49 @@ int ResourceFile::prefixCount() const
|
||||
|
||||
QString ResourceFile::prefix(int idx) const
|
||||
{
|
||||
QTC_ASSERT((idx >= 0) && (idx < m_prefix_list.count()), return QString());
|
||||
Q_ASSERT((idx >= 0) && (idx < m_prefix_list.count()));
|
||||
return m_prefix_list.at(idx)->name;
|
||||
}
|
||||
|
||||
QString ResourceFile::lang(int idx) const
|
||||
{
|
||||
QTC_ASSERT(idx >= 0 && idx < m_prefix_list.count(), return QString());
|
||||
Q_ASSERT(idx >= 0 && idx < m_prefix_list.count());
|
||||
return m_prefix_list.at(idx)->lang;
|
||||
}
|
||||
|
||||
int ResourceFile::fileCount(int prefix_idx) const
|
||||
{
|
||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return 0);
|
||||
Q_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count());
|
||||
return m_prefix_list.at(prefix_idx)->file_list.size();
|
||||
}
|
||||
|
||||
QString ResourceFile::file(int prefix_idx, int file_idx) const
|
||||
{
|
||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return QString());
|
||||
Q_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count());
|
||||
FileList &fileList = m_prefix_list.at(prefix_idx)->file_list;
|
||||
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return QString());
|
||||
Q_ASSERT(file_idx >= 0 && file_idx < fileList.count());
|
||||
return fileList.at(file_idx)->name;
|
||||
}
|
||||
|
||||
QString ResourceFile::alias(int prefix_idx, int file_idx) const
|
||||
{
|
||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return QString());
|
||||
Q_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count());
|
||||
FileList &fileList = m_prefix_list.at(prefix_idx)->file_list;
|
||||
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return QString());
|
||||
Q_ASSERT(file_idx >= 0 && file_idx < fileList.count());
|
||||
return fileList.at(file_idx)->alias;
|
||||
}
|
||||
|
||||
void * ResourceFile::prefixPointer(int prefixIndex) const
|
||||
{
|
||||
QTC_ASSERT(prefixIndex >= 0 && prefixIndex < m_prefix_list.count(), return 0);
|
||||
Q_ASSERT(prefixIndex >= 0 && prefixIndex < m_prefix_list.count());
|
||||
return m_prefix_list.at(prefixIndex);
|
||||
}
|
||||
|
||||
void * ResourceFile::filePointer(int prefixIndex, int fileIndex) const
|
||||
{
|
||||
QTC_ASSERT(prefixIndex >= 0 && prefixIndex < m_prefix_list.count(), return 0);
|
||||
Q_ASSERT(prefixIndex >= 0 && prefixIndex < m_prefix_list.count());
|
||||
FileList &fileList = m_prefix_list.at(prefixIndex)->file_list;
|
||||
QTC_ASSERT(fileIndex >= 0 && fileIndex < fileList.count(), return 0);
|
||||
Q_ASSERT(fileIndex >= 0 && fileIndex < fileList.count());
|
||||
return fileList.at(fileIndex);
|
||||
}
|
||||
|
||||
@@ -509,7 +507,7 @@ QModelIndex ResourceModel::index(int row, int column, const QModelIndex &parent)
|
||||
// File node
|
||||
Node * const node = reinterpret_cast<Node *>(pip);
|
||||
Prefix * const prefix = node->prefix();
|
||||
QTC_ASSERT(prefix, return QModelIndex());
|
||||
Q_ASSERT(prefix);
|
||||
if (row < 0 || row >= prefix->file_list.count())
|
||||
return QModelIndex();
|
||||
const int prefixIndex = m_resource_file.prefixPointerIndex(prefix);
|
||||
@@ -521,7 +519,7 @@ QModelIndex ResourceModel::index(int row, int column, const QModelIndex &parent)
|
||||
return QModelIndex();
|
||||
internalPointer = m_resource_file.prefixPointer(row);
|
||||
}
|
||||
QTC_ASSERT(internalPointer, return QModelIndex());
|
||||
Q_ASSERT(internalPointer);
|
||||
return createIndex(row, 0, internalPointer);
|
||||
}
|
||||
|
||||
@@ -535,12 +533,12 @@ QModelIndex ResourceModel::parent(const QModelIndex &index) const
|
||||
return QModelIndex();
|
||||
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
||||
Prefix * const prefix = node->prefix();
|
||||
QTC_ASSERT(prefix, return QModelIndex());
|
||||
Q_ASSERT(prefix);
|
||||
bool const isFileNode = (prefix != node);
|
||||
|
||||
if (isFileNode) {
|
||||
const int row = m_resource_file.prefixPointerIndex(prefix);
|
||||
QTC_ASSERT(row >= 0, return QModelIndex());
|
||||
Q_ASSERT(row >= 0);
|
||||
return createIndex(row, 0, prefix);
|
||||
} else {
|
||||
return QModelIndex();
|
||||
@@ -553,7 +551,7 @@ int ResourceModel::rowCount(const QModelIndex &parent) const
|
||||
void * const internalPointer = parent.internalPointer();
|
||||
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
||||
Prefix * const prefix = node->prefix();
|
||||
QTC_ASSERT(prefix, return 0);
|
||||
Q_ASSERT(prefix);
|
||||
bool const isFileNode = (prefix != node);
|
||||
|
||||
if (isFileNode) {
|
||||
@@ -612,7 +610,7 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
|
||||
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
||||
Prefix const * const prefix = node->prefix();
|
||||
File const * const file = node->file();
|
||||
QTC_ASSERT(prefix, return QVariant());
|
||||
Q_ASSERT(prefix);
|
||||
bool const isFileNode = (prefix != node);
|
||||
|
||||
QVariant result;
|
||||
@@ -629,7 +627,7 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
|
||||
appendParenthesized(lang, stringRes);
|
||||
} else {
|
||||
// File node
|
||||
QTC_ASSERT(file, return result);
|
||||
Q_ASSERT(file);
|
||||
stringRes = QFileInfo(file->name).fileName();
|
||||
const QString alias = file->alias;
|
||||
if (!alias.isEmpty())
|
||||
@@ -641,7 +639,7 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
|
||||
case Qt::DecorationRole:
|
||||
if (isFileNode) {
|
||||
// File node
|
||||
QTC_ASSERT(file, return result);
|
||||
Q_ASSERT(file);
|
||||
const QString path = m_resource_file.absolutePath(file->name);
|
||||
if (iconFileExtension(path)) {
|
||||
const QIcon icon(path);
|
||||
@@ -653,7 +651,7 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
|
||||
case Qt::ToolTipRole:
|
||||
if (isFileNode) {
|
||||
// File node
|
||||
QTC_ASSERT(file, return result);
|
||||
Q_ASSERT(file);
|
||||
QString conv_file = m_resource_file.relativePath(file->name);
|
||||
QString stringRes = conv_file.replace(QDir::separator(), QLatin1Char('/'));
|
||||
const QString &alias_file = file->alias;
|
||||
@@ -682,12 +680,12 @@ void ResourceModel::getItem(const QModelIndex &index, QString &prefix, QString &
|
||||
void * const internalPointer = index.internalPointer();
|
||||
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
||||
Prefix * const p = node->prefix();
|
||||
QTC_ASSERT(p, return);
|
||||
Q_ASSERT(p);
|
||||
bool const isFileNode = (p != node);
|
||||
|
||||
if (isFileNode) {
|
||||
File *const f = node->file();
|
||||
QTC_ASSERT(f, return);
|
||||
Q_ASSERT(f);
|
||||
if (!f->alias.isEmpty())
|
||||
file = f->alias;
|
||||
else
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
|
||||
#include "namespace_global.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QAbstractItemModel>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QString>
|
||||
@@ -68,7 +66,7 @@ class Node
|
||||
protected:
|
||||
Node(File *file, Prefix *prefix) : m_file(file), m_prefix(prefix)
|
||||
{
|
||||
QTC_ASSERT(m_prefix, return);
|
||||
Q_ASSERT(m_prefix);
|
||||
}
|
||||
public:
|
||||
File *file() { return m_file; }
|
||||
|
||||
@@ -35,8 +35,6 @@
|
||||
|
||||
#include "undocommands_p.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include <QtGui/QAction>
|
||||
@@ -312,14 +310,14 @@ void ResourceView::findSamePlacePostDeletionModelIndex(int &row, QModelIndex &pa
|
||||
|
||||
EntryBackup * ResourceView::removeEntry(const QModelIndex &index)
|
||||
{
|
||||
QTC_ASSERT(m_qrcModel, return 0);
|
||||
Q_ASSERT(m_qrcModel);
|
||||
return m_qrcModel->removeEntry(index);
|
||||
}
|
||||
|
||||
void ResourceView::addFiles(int prefixIndex, const QStringList &fileNames, int cursorFile,
|
||||
int &firstFile, int &lastFile)
|
||||
{
|
||||
QTC_ASSERT(m_qrcModel, return);
|
||||
Q_ASSERT(m_qrcModel);
|
||||
m_qrcModel->addFiles(prefixIndex, fileNames, cursorFile, firstFile, lastFile);
|
||||
|
||||
// Expand prefix node
|
||||
@@ -331,11 +329,11 @@ void ResourceView::addFiles(int prefixIndex, const QStringList &fileNames, int c
|
||||
|
||||
void ResourceView::removeFiles(int prefixIndex, int firstFileIndex, int lastFileIndex)
|
||||
{
|
||||
QTC_ASSERT(prefixIndex >= 0 && prefixIndex < m_qrcModel->rowCount(QModelIndex()), return);
|
||||
Q_ASSERT(prefixIndex >= 0 && prefixIndex < m_qrcModel->rowCount(QModelIndex()));
|
||||
const QModelIndex prefixModelIndex = m_qrcModel->index(prefixIndex, 0, QModelIndex());
|
||||
QTC_ASSERT(prefixModelIndex != QModelIndex(), return);
|
||||
QTC_ASSERT(firstFileIndex >= 0 && firstFileIndex < m_qrcModel->rowCount(prefixModelIndex), return);
|
||||
QTC_ASSERT(lastFileIndex >= 0 && lastFileIndex < m_qrcModel->rowCount(prefixModelIndex), return);
|
||||
Q_ASSERT(prefixModelIndex != QModelIndex());
|
||||
Q_ASSERT(firstFileIndex >= 0 && firstFileIndex < m_qrcModel->rowCount(prefixModelIndex));
|
||||
Q_ASSERT(lastFileIndex >= 0 && lastFileIndex < m_qrcModel->rowCount(prefixModelIndex));
|
||||
|
||||
for (int i = lastFileIndex; i >= firstFileIndex; i--) {
|
||||
const QModelIndex index = m_qrcModel->index(i, 0, prefixModelIndex);
|
||||
@@ -572,7 +570,7 @@ QString ResourceView::getCurrentValue(NodeProperty property) const
|
||||
case AliasProperty: return currentAlias();
|
||||
case PrefixProperty: return currentPrefix();
|
||||
case LanguageProperty: return currentLanguage();
|
||||
default: QTC_ASSERT(false, /**/); return QString(); // Kill warning
|
||||
default: Q_ASSERT(false); return QString(); // Kill warning
|
||||
}
|
||||
}
|
||||
|
||||
@@ -583,7 +581,7 @@ void ResourceView::changeValue(const QModelIndex &nodeIndex, NodeProperty proper
|
||||
case AliasProperty: m_qrcModel->changeAlias(nodeIndex, value); return;
|
||||
case PrefixProperty: m_qrcModel->changePrefix(nodeIndex, value); return;
|
||||
case LanguageProperty: m_qrcModel->changeLang(nodeIndex, value); return;
|
||||
default: QTC_ASSERT(false, /**/);
|
||||
default: Q_ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ bool ModifyPropertyCommand::mergeWith(const QUndoCommand * command)
|
||||
|
||||
void ModifyPropertyCommand::undo()
|
||||
{
|
||||
QTC_ASSERT(m_view, return);
|
||||
Q_ASSERT(m_view);
|
||||
|
||||
// Save current text in m_after for redo()
|
||||
m_after = m_view->getCurrentValue(m_property);
|
||||
@@ -117,7 +117,7 @@ void ModifyPropertyCommand::redo()
|
||||
return;
|
||||
|
||||
// Bring back text before undo
|
||||
QTC_ASSERT(m_view, return);
|
||||
Q_ASSERT(m_view);
|
||||
m_view->changeValue(makeIndex(), m_property, m_after);
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ void RemoveEntryCommand::undo()
|
||||
{
|
||||
if (m_entry == 0) {
|
||||
m_entry->restore();
|
||||
QTC_ASSERT(m_view != 0, return);
|
||||
Q_ASSERT(m_view != 0);
|
||||
const QModelIndex index = makeIndex();
|
||||
m_view->setExpanded(index, m_isExpanded);
|
||||
m_view->setCurrentIndex(index);
|
||||
|
||||
@@ -34,8 +34,6 @@
|
||||
#ifndef WRAP_HELPERS_H
|
||||
#define WRAP_HELPERS_H
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtScript/QScriptEngine>
|
||||
#include <QtScript/QScriptContext>
|
||||
#include <QtScript/QScriptValue>
|
||||
@@ -89,7 +87,7 @@ template <class Wrapper, class Wrapped>
|
||||
Wrapped * (Wrapper::*wrappedAccessor) () const)
|
||||
{
|
||||
Wrapped *wrapped = wrappedFromScriptValue(context->thisObject(), wrappedAccessor);
|
||||
QTC_ASSERT(wrapped, return 0);
|
||||
Q_ASSERT(wrapped);
|
||||
return wrapped;
|
||||
}
|
||||
|
||||
@@ -316,7 +314,7 @@ static void scriptValueToQObject(const QScriptValue &sv, SomeQObject * &p)
|
||||
{
|
||||
QObject *qObject = sv.toQObject();
|
||||
p = qobject_cast<SomeQObject*>(qObject);
|
||||
QTC_ASSERT(p, return);
|
||||
Q_ASSERT(p);
|
||||
}
|
||||
|
||||
// Register a QObject-derived class which has Q_DECLARE_METATYPE(Ptr*)
|
||||
|
||||
@@ -182,8 +182,8 @@
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.nokia.qtcreator</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.9.1</string>
|
||||
<string>0.9.2</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.9.1</string>
|
||||
<string>0.9.2</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -36,13 +36,11 @@ macx {
|
||||
SCHEMES.files = $$IDE_SOURCE_TREE/bin/schemes
|
||||
GDBDEBUGGER.path = Contents/Resources
|
||||
GDBDEBUGGER.files = $$IDE_SOURCE_TREE/bin/gdbmacros
|
||||
DOC.path = Contents/Resources/doc
|
||||
DOC.files = $$IDE_SOURCE_TREE/doc/qtcreator.qch
|
||||
LICENSE.path = Contents/Resources
|
||||
LICENSE.files = $$IDE_SOURCE_TREE/bin/license.txt
|
||||
RUNINTERMINAL.path = Contents/Resources
|
||||
RUNINTERMINAL.files = $$IDE_SOURCE_TREE/bin/runInTerminal.command
|
||||
QMAKE_BUNDLE_DATA += SNIPPETS TEMPLATES DESIGNER SCHEMES GDBDEBUGGER DOC LICENSE RUNINTERMINAL
|
||||
QMAKE_BUNDLE_DATA += SNIPPETS TEMPLATES DESIGNER SCHEMES GDBDEBUGGER LICENSE RUNINTERMINAL
|
||||
QMAKE_INFO_PLIST = $$PWD/Info.plist
|
||||
}
|
||||
!macx {
|
||||
|
||||
@@ -98,12 +98,12 @@ static void displayError(const QString &t) // No console on Windows.
|
||||
|
||||
static void displayHelpText(const QString &t)
|
||||
{
|
||||
qWarning(t.toUtf8().constData());
|
||||
qWarning("%s", qPrintable(t));
|
||||
}
|
||||
|
||||
static void displayError(const QString &t)
|
||||
{
|
||||
qCritical(t.toUtf8().constData());
|
||||
qCritical("%s", qPrintable(t));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,12 +37,12 @@
|
||||
|
||||
/*!
|
||||
\namespace Aggregation
|
||||
\brief Contains support for bundling related components, such that
|
||||
each component exposes the properties and behavior of the
|
||||
\brief The Aggregation namespace contains support for bundling related components,
|
||||
such that each component exposes the properties and behavior of the
|
||||
other components to the outside.
|
||||
|
||||
Components that are bundled to an Aggregate can be "cast" to each other
|
||||
and have a coupled life cycle. See the documentation of Aggregate for
|
||||
and have a coupled life cycle. See the documentation of Aggregation::Aggregate for
|
||||
details and examples.
|
||||
*/
|
||||
|
||||
|
||||
@@ -35,8 +35,7 @@
|
||||
#define CPPDOCUMENT_H
|
||||
|
||||
#include <CPlusPlusForwardDeclarations.h>
|
||||
|
||||
#include "pp-macro.h"
|
||||
#include "Macro.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QList>
|
||||
|
||||
@@ -32,23 +32,21 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "LookupContext.h"
|
||||
#include "ResolveExpression.h"
|
||||
#include "Overview.h"
|
||||
|
||||
#include <CoreTypes.h>
|
||||
#include <Symbols.h>
|
||||
#include <Literals.h>
|
||||
#include <Names.h>
|
||||
#include <Scope.h>
|
||||
#include <Control.h>
|
||||
#include <cplusplus/Overview.h>
|
||||
|
||||
#include <QFile>
|
||||
#include <QtDebug>
|
||||
|
||||
using namespace CPlusPlus;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// LookupUtils
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
bool LookupUtils::isNameCompatibleWithIdentifier(Name *name, Identifier *id)
|
||||
bool LookupContext::isNameCompatibleWithIdentifier(Name *name, Identifier *id)
|
||||
{
|
||||
if (! name) {
|
||||
return false;
|
||||
@@ -274,33 +272,23 @@ void LookupContext::expand(const QList<Scope *> &scopes, QList<Scope *> *expande
|
||||
}
|
||||
}
|
||||
|
||||
void LookupContext::expand(Scope *scope,
|
||||
void LookupContext::expandNamespace(Scope *scope,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
QList<Scope *> *expandedScopes) const
|
||||
{
|
||||
Overview overview;
|
||||
|
||||
if (expandedScopes->contains(scope)) {
|
||||
//qDebug() << "skipped:" << overview.prettyName(scope->owner()->name());
|
||||
return;
|
||||
}
|
||||
|
||||
expandedScopes->append(scope);
|
||||
|
||||
if (scope->isNamespaceScope()) {
|
||||
Namespace *ns = scope->owner()->asNamespace();
|
||||
Name *nsName = ns->name();
|
||||
if (nsName) {
|
||||
QList<Symbol *> namespaceList = resolveNamespace(nsName, visibleScopes);
|
||||
if (! ns)
|
||||
return;
|
||||
|
||||
if (Name *nsName = ns->name()) {
|
||||
const QList<Symbol *> namespaceList = resolveNamespace(nsName, visibleScopes);
|
||||
foreach (Symbol *otherNs, namespaceList) {
|
||||
if (otherNs == ns)
|
||||
continue;
|
||||
expand(otherNs->asNamespace()->members(), visibleScopes, expandedScopes);
|
||||
}
|
||||
//qDebug() << "*** found:" << namespaceList.count() << "namespace aliases";
|
||||
}
|
||||
//qDebug() << "namespace scope" << overview.prettyName(ns->name())
|
||||
//<< ns->fileName() << ns->line();
|
||||
|
||||
for (unsigned i = 0; i < scope->symbolCount(); ++i) { // ### make me fast
|
||||
Symbol *symbol = scope->symbolAt(i);
|
||||
if (Namespace *ns = symbol->asNamespace()) {
|
||||
@@ -308,9 +296,7 @@ void LookupContext::expand(Scope *scope,
|
||||
expand(ns->members(), visibleScopes, expandedScopes);
|
||||
}
|
||||
} else if (UsingNamespaceDirective *u = symbol->asUsingNamespaceDirective()) {
|
||||
QList<Symbol *> candidates = resolveNamespace(u->name(), visibleScopes);
|
||||
//qDebug() << "found:" << candidates.count() << "namespaces to import for:"
|
||||
//<< overview.prettyName(u->name());
|
||||
const QList<Symbol *> candidates = resolveNamespace(u->name(), visibleScopes);
|
||||
for (int j = 0; j < candidates.size(); ++j) {
|
||||
expand(candidates.at(j)->asNamespace()->members(),
|
||||
visibleScopes, expandedScopes);
|
||||
@@ -319,8 +305,16 @@ void LookupContext::expand(Scope *scope,
|
||||
expand(e->members(), visibleScopes, expandedScopes);
|
||||
}
|
||||
}
|
||||
} else if (scope->isClassScope()) {
|
||||
}
|
||||
|
||||
void LookupContext::expandClass(Scope *scope,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
QList<Scope *> *expandedScopes) const
|
||||
{
|
||||
Class *klass = scope->owner()->asClass();
|
||||
if (! klass)
|
||||
return;
|
||||
|
||||
for (unsigned i = 0; i < scope->symbolCount(); ++i) {
|
||||
Symbol *symbol = scope->symbolAt(i);
|
||||
if (Class *nestedClass = symbol->asClass()) {
|
||||
@@ -338,10 +332,11 @@ void LookupContext::expand(Scope *scope,
|
||||
if (scope->isNamespaceScope()) {
|
||||
Namespace *enclosingNamespace = scope->owner()->asNamespace();
|
||||
if (enclosingNamespace->name()) {
|
||||
QList<Symbol *> nsList = resolveNamespace(enclosingNamespace->name(),
|
||||
const QList<Symbol *> nsList = resolveNamespace(enclosingNamespace->name(),
|
||||
visibleScopes);
|
||||
foreach (Symbol *ns, nsList) {
|
||||
expand(ns->asNamespace()->members(), classVisibleScopes, &classVisibleScopes);
|
||||
expand(ns->asNamespace()->members(), classVisibleScopes,
|
||||
&classVisibleScopes);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -350,25 +345,30 @@ void LookupContext::expand(Scope *scope,
|
||||
for (unsigned i = 0; i < klass->baseClassCount(); ++i) {
|
||||
BaseClass *baseClass = klass->baseClassAt(i);
|
||||
Name *baseClassName = baseClass->name();
|
||||
QList<Symbol *> baseClassCandidates = resolveClass(baseClassName, classVisibleScopes);
|
||||
const QList<Symbol *> baseClassCandidates = resolveClass(baseClassName,
|
||||
classVisibleScopes);
|
||||
if (baseClassCandidates.isEmpty()) {
|
||||
Overview overview;
|
||||
qDebug() << "unresolved base class:" << overview.prettyName(baseClassName);
|
||||
}
|
||||
|
||||
for (int j = 0; j < baseClassCandidates.size(); ++j) {
|
||||
Class *baseClassSymbol = baseClassCandidates.at(j)->asClass();
|
||||
expand(baseClassSymbol->members(), visibleScopes, expandedScopes);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (scope->isBlockScope()) {
|
||||
//qDebug() << "block scope" << overview.prettyName(scope->owner()->name());
|
||||
}
|
||||
|
||||
void LookupContext::expandBlock(Scope *scope,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
QList<Scope *> *expandedScopes) const
|
||||
{
|
||||
for (unsigned i = 0; i < scope->symbolCount(); ++i) {
|
||||
Symbol *symbol = scope->symbolAt(i);
|
||||
if (UsingNamespaceDirective *u = symbol->asUsingNamespaceDirective()) {
|
||||
QList<Symbol *> candidates = resolveNamespace(u->name(), visibleScopes);
|
||||
//qDebug() << "found:" << candidates.count() << "namespaces to import for:"
|
||||
//<< overview.prettyName(u->name());
|
||||
const QList<Symbol *> candidates = resolveNamespace(u->name(),
|
||||
visibleScopes);
|
||||
for (int j = 0; j < candidates.size(); ++j) {
|
||||
expand(candidates.at(j)->asNamespace()->members(),
|
||||
visibleScopes, expandedScopes);
|
||||
@@ -376,27 +376,47 @@ void LookupContext::expand(Scope *scope,
|
||||
}
|
||||
|
||||
}
|
||||
} else if (scope->isFunctionScope()) {
|
||||
}
|
||||
|
||||
void LookupContext::expandFunction(Scope *scope,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
QList<Scope *> *expandedScopes) const
|
||||
{
|
||||
Function *function = scope->owner()->asFunction();
|
||||
//qDebug() << "function scope" << overview.prettyName(function->name());
|
||||
if (! expandedScopes->contains(function->arguments()))
|
||||
expandedScopes->append(function->arguments());
|
||||
if (QualifiedNameId *q = function->name()->asQualifiedNameId()) {
|
||||
//qDebug() << "**** here:" << overview.prettyName(function->name());
|
||||
Name *nestedNameSpec = 0;
|
||||
if (q->nameCount() == 1 && q->isGlobal())
|
||||
nestedNameSpec = q->nameAt(0);
|
||||
else
|
||||
nestedNameSpec = control()->qualifiedNameId(q->names(), q->nameCount() - 1,
|
||||
q->isGlobal());
|
||||
QList<Symbol *> candidates = resolveClassOrNamespace(nestedNameSpec, visibleScopes);
|
||||
//qDebug() << "**** found:" << candidates.count() << "class or namespace for:"
|
||||
//<< overview.prettyName(nestedNameSpec);
|
||||
const QList<Symbol *> candidates = resolveClassOrNamespace(nestedNameSpec, visibleScopes);
|
||||
for (int j = 0; j < candidates.size(); ++j) {
|
||||
expand(candidates.at(j)->asScopedSymbol()->members(),
|
||||
visibleScopes, expandedScopes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LookupContext::expand(Scope *scope,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
QList<Scope *> *expandedScopes) const
|
||||
{
|
||||
if (expandedScopes->contains(scope))
|
||||
return;
|
||||
|
||||
expandedScopes->append(scope);
|
||||
|
||||
if (scope->isNamespaceScope()) {
|
||||
expandNamespace(scope, visibleScopes, expandedScopes);
|
||||
} else if (scope->isClassScope()) {
|
||||
expandClass(scope, visibleScopes, expandedScopes);
|
||||
} else if (scope->isBlockScope()) {
|
||||
expandBlock(scope, visibleScopes, expandedScopes);
|
||||
} else if (scope->isFunctionScope()) {
|
||||
expandFunction(scope, visibleScopes, expandedScopes);
|
||||
} else if (scope->isPrototypeScope()) {
|
||||
//qDebug() << "prototype scope" << overview.prettyName(scope->owner()->name());
|
||||
}
|
||||
|
||||
@@ -34,22 +34,12 @@
|
||||
#ifndef CPLUSPLUS_LOOKUPCONTEXT_H
|
||||
#define CPLUSPLUS_LOOKUPCONTEXT_H
|
||||
|
||||
#include <SymbolVisitor.h>
|
||||
#include <cplusplus/CppDocument.h>
|
||||
|
||||
#include <QList>
|
||||
#include <QSet>
|
||||
#include <QMap>
|
||||
#include <QPair>
|
||||
|
||||
namespace CPlusPlus {
|
||||
|
||||
class CPLUSPLUS_EXPORT LookupUtils
|
||||
{
|
||||
public:
|
||||
static bool isNameCompatibleWithIdentifier(Name *name, Identifier *id);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT LookupContext: LookupUtils
|
||||
class CPLUSPLUS_EXPORT LookupContext
|
||||
{
|
||||
public:
|
||||
LookupContext(Control *control = 0);
|
||||
@@ -124,8 +114,25 @@ public:
|
||||
void expand(Scope *scope, const QList<Scope *> &visibleScopes,
|
||||
QList<Scope *> *expandedScopes) const;
|
||||
|
||||
void expandNamespace(Scope *scope,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
QList<Scope *> *expandedScopes) const;
|
||||
|
||||
void expandClass(Scope *scope,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
QList<Scope *> *expandedScopes) const;
|
||||
|
||||
void expandBlock(Scope *scope,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
QList<Scope *> *expandedScopes) const;
|
||||
|
||||
void expandFunction(Scope *scope,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
QList<Scope *> *expandedScopes) const;
|
||||
|
||||
private:
|
||||
QList<Scope *> buildVisibleScopes();
|
||||
static bool isNameCompatibleWithIdentifier(Name *name, Identifier *id);
|
||||
|
||||
private:
|
||||
Control *_control;
|
||||
|
||||
@@ -50,29 +50,40 @@
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef PP_INTERNAL_H
|
||||
#define PP_INTERNAL_H
|
||||
#include "Macro.h"
|
||||
|
||||
#include <QByteArray>
|
||||
using namespace CPlusPlus;
|
||||
|
||||
namespace CPlusPlus {
|
||||
namespace _PP_internal {
|
||||
Macro::Macro()
|
||||
: _next(0),
|
||||
_hashcode(0),
|
||||
_line(0),
|
||||
_state(0)
|
||||
{ }
|
||||
|
||||
inline bool comment_p (const char *__first, const char *__last)
|
||||
QString Macro::toString() const
|
||||
{
|
||||
if (__first == __last)
|
||||
return false;
|
||||
|
||||
if (*__first != '/')
|
||||
return false;
|
||||
|
||||
if (++__first == __last)
|
||||
return false;
|
||||
|
||||
return (*__first == '/' || *__first == '*');
|
||||
QString text;
|
||||
if (_hidden)
|
||||
text += QLatin1String("#undef ");
|
||||
else
|
||||
text += QLatin1String("#define ");
|
||||
text += QString::fromUtf8(_name.constData(), _name.size());
|
||||
if (_functionLike) {
|
||||
text += QLatin1Char('(');
|
||||
bool first = true;
|
||||
foreach (const QByteArray formal, _formals) {
|
||||
if (! first)
|
||||
text += QLatin1String(", ");
|
||||
else
|
||||
first = false;
|
||||
text += QString::fromUtf8(formal.constData(), formal.size());
|
||||
}
|
||||
if (_variadic)
|
||||
text += QLatin1String("...");
|
||||
text += QLatin1Char(')');
|
||||
}
|
||||
text += QLatin1Char(' ');
|
||||
text += QString::fromUtf8(_definition.constData(), _definition.size());
|
||||
return text;
|
||||
}
|
||||
|
||||
} // _PP_internal
|
||||
} // namespace CPlusPlus
|
||||
|
||||
#endif // PP_INTERNAL_H
|
||||
@@ -64,59 +64,80 @@ namespace CPlusPlus {
|
||||
class CPLUSPLUS_EXPORT Macro
|
||||
{
|
||||
public:
|
||||
QByteArray name;
|
||||
QByteArray definition;
|
||||
QVector<QByteArray> formals;
|
||||
QByteArray fileName;
|
||||
int line;
|
||||
Macro *next;
|
||||
unsigned hashcode;
|
||||
Macro();
|
||||
|
||||
QByteArray name() const
|
||||
{ return _name; }
|
||||
|
||||
void setName(const QByteArray &name)
|
||||
{ _name = name; }
|
||||
|
||||
QByteArray definition() const
|
||||
{ return _definition; }
|
||||
|
||||
void setDefinition(const QByteArray &definition)
|
||||
{ _definition = definition; }
|
||||
|
||||
QVector<QByteArray> formals() const
|
||||
{ return _formals; }
|
||||
|
||||
void addFormal(const QByteArray &formal)
|
||||
{ _formals.append(formal); }
|
||||
|
||||
QByteArray fileName() const
|
||||
{ return _fileName; }
|
||||
|
||||
void setFileName(const QByteArray &fileName)
|
||||
{ _fileName = fileName; }
|
||||
|
||||
unsigned line() const
|
||||
{ return _line; }
|
||||
|
||||
void setLine(unsigned line)
|
||||
{ _line = line; }
|
||||
|
||||
bool isHidden() const
|
||||
{ return _hidden; }
|
||||
|
||||
void setHidden(bool isHidden)
|
||||
{ _hidden = isHidden; }
|
||||
|
||||
bool isFunctionLike() const
|
||||
{ return _functionLike; }
|
||||
|
||||
void setFunctionLike(bool isFunctionLike)
|
||||
{ _functionLike = isFunctionLike; }
|
||||
|
||||
bool isVariadic() const
|
||||
{ return _variadic; }
|
||||
|
||||
void setVariadic(bool isVariadic)
|
||||
{ _variadic = isVariadic; }
|
||||
|
||||
QString toString() const;
|
||||
|
||||
// ### private
|
||||
Macro *_next;
|
||||
unsigned _hashcode;
|
||||
|
||||
private:
|
||||
QByteArray _name;
|
||||
QByteArray _definition;
|
||||
QVector<QByteArray> _formals;
|
||||
QByteArray _fileName;
|
||||
unsigned _line;
|
||||
|
||||
union
|
||||
{
|
||||
unsigned state;
|
||||
unsigned _state;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned hidden: 1;
|
||||
unsigned function_like: 1;
|
||||
unsigned variadics: 1;
|
||||
unsigned _hidden: 1;
|
||||
unsigned _functionLike: 1;
|
||||
unsigned _variadic: 1;
|
||||
};
|
||||
};
|
||||
|
||||
inline Macro():
|
||||
line(0),
|
||||
next(0),
|
||||
hashcode(0),
|
||||
state(0)
|
||||
{ }
|
||||
|
||||
QString toString() const
|
||||
{
|
||||
QString text;
|
||||
if (hidden)
|
||||
text += QLatin1String("#undef ");
|
||||
else
|
||||
text += QLatin1String("#define ");
|
||||
text += QString::fromUtf8(name.constData(), name.size());
|
||||
if (function_like) {
|
||||
text += QLatin1Char('(');
|
||||
bool first = true;
|
||||
foreach (const QByteArray formal, formals) {
|
||||
if (! first)
|
||||
text += QLatin1String(", ");
|
||||
else
|
||||
first = false;
|
||||
text += QString::fromUtf8(formal.constData(), formal.size());
|
||||
}
|
||||
if (variadics)
|
||||
text += QLatin1String("...");
|
||||
text += QLatin1Char(')');
|
||||
}
|
||||
text += QLatin1Char(' ');
|
||||
text += QString::fromUtf8(definition.constData(), definition.size());
|
||||
return text;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace CPlusPlus
|
||||
42
src/libs/cplusplus/PreprocessorClient.cpp
Normal file
42
src/libs/cplusplus/PreprocessorClient.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#include "PreprocessorClient.h"
|
||||
|
||||
using namespace CPlusPlus;
|
||||
|
||||
Client::Client()
|
||||
{ }
|
||||
|
||||
Client::~Client()
|
||||
{ }
|
||||
@@ -31,14 +31,16 @@
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef PP_CLIENT_H
|
||||
#define PP_CLIENT_H
|
||||
#ifndef CPLUSPLUS_PP_CLIENT_H
|
||||
#define CPLUSPLUS_PP_CLIENT_H
|
||||
|
||||
#include <CPlusPlusForwardDeclarations.h>
|
||||
#include <QtGlobal>
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
#include <QFile>
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QByteArray;
|
||||
class QString;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace CPlusPlus {
|
||||
|
||||
@@ -56,11 +58,8 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
Client()
|
||||
{ }
|
||||
|
||||
virtual ~Client()
|
||||
{ }
|
||||
Client();
|
||||
virtual ~Client();
|
||||
|
||||
virtual void macroAdded(const Macro ¯o) = 0;
|
||||
virtual void sourceNeeded(QString &fileName, IncludeType mode,
|
||||
@@ -79,4 +78,4 @@ public:
|
||||
|
||||
} // namespace CPlusPlus
|
||||
|
||||
#endif // PP_CLIENT_H
|
||||
#endif // CPLUSPLUS_PP_CLIENT_H
|
||||
@@ -50,16 +50,15 @@
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "pp-environment.h"
|
||||
#include "pp.h"
|
||||
|
||||
#include "PreprocessorEnvironment.h"
|
||||
#include "Macro.h"
|
||||
#include <cstring>
|
||||
|
||||
using namespace CPlusPlus;
|
||||
|
||||
Environment::Environment()
|
||||
: currentLine(0),
|
||||
hide_next(false),
|
||||
hideNext(false),
|
||||
_macros(0),
|
||||
_allocated_macros(0),
|
||||
_macro_count(-1),
|
||||
@@ -91,10 +90,10 @@ Macro *Environment::macroAt(unsigned index) const
|
||||
|
||||
Macro *Environment::bind(const Macro &__macro)
|
||||
{
|
||||
Q_ASSERT(! __macro.name.isEmpty());
|
||||
Q_ASSERT(! __macro.name().isEmpty());
|
||||
|
||||
Macro *m = new Macro (__macro);
|
||||
m->hashcode = hash_code(m->name);
|
||||
m->_hashcode = hashCode(m->name());
|
||||
|
||||
if (++_macro_count == _allocated_macros) {
|
||||
if (! _allocated_macros)
|
||||
@@ -110,8 +109,8 @@ Macro *Environment::bind(const Macro &__macro)
|
||||
if (! _hash || _macro_count > (_hash_count >> 1)) {
|
||||
rehash();
|
||||
} else {
|
||||
const unsigned h = m->hashcode % _hash_count;
|
||||
m->next = _hash[h];
|
||||
const unsigned h = m->_hashcode % _hash_count;
|
||||
m->_next = _hash[h];
|
||||
_hash[h] = m;
|
||||
}
|
||||
|
||||
@@ -121,10 +120,10 @@ Macro *Environment::bind(const Macro &__macro)
|
||||
Macro *Environment::remove(const QByteArray &name)
|
||||
{
|
||||
Macro macro;
|
||||
macro.name = name;
|
||||
macro.hidden = true;
|
||||
macro.fileName = currentFile;
|
||||
macro.line = currentLine;
|
||||
macro.setName(name);
|
||||
macro.setHidden(true);
|
||||
macro.setFileName(currentFile);
|
||||
macro.setLine(currentLine);
|
||||
return bind(macro);
|
||||
}
|
||||
|
||||
@@ -197,18 +196,18 @@ Macro *Environment::resolve (const QByteArray &name) const
|
||||
if (! _macros)
|
||||
return 0;
|
||||
|
||||
Macro *it = _hash[hash_code (name) % _hash_count];
|
||||
for (; it; it = it->next) {
|
||||
if (it->name != name)
|
||||
Macro *it = _hash[hashCode(name) % _hash_count];
|
||||
for (; it; it = it->_next) {
|
||||
if (it->name() != name)
|
||||
continue;
|
||||
else if (it->hidden)
|
||||
else if (it->isHidden())
|
||||
return 0;
|
||||
else break;
|
||||
}
|
||||
return it;
|
||||
}
|
||||
|
||||
unsigned Environment::hash_code (const QByteArray &s)
|
||||
unsigned Environment::hashCode(const QByteArray &s)
|
||||
{
|
||||
unsigned hash_value = 0;
|
||||
|
||||
@@ -229,8 +228,8 @@ void Environment::rehash()
|
||||
|
||||
for (Macro **it = firstMacro(); it != lastMacro(); ++it) {
|
||||
Macro *m= *it;
|
||||
const unsigned h = m->hashcode % _hash_count;
|
||||
m->next = _hash[h];
|
||||
const unsigned h = m->_hashcode % _hash_count;
|
||||
m->_next = _hash[h];
|
||||
_hash[h] = m;
|
||||
}
|
||||
}
|
||||
@@ -50,8 +50,8 @@
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef PP_ENVIRONMENT_H
|
||||
#define PP_ENVIRONMENT_H
|
||||
#ifndef CPLUSPLUS_PP_ENVIRONMENT_H
|
||||
#define CPLUSPLUS_PP_ENVIRONMENT_H
|
||||
|
||||
#include "CPlusPlusForwardDeclarations.h"
|
||||
|
||||
@@ -90,13 +90,13 @@ public:
|
||||
{ return _macros + _macro_count + 1; }
|
||||
|
||||
private:
|
||||
static unsigned hash_code (const QByteArray &s);
|
||||
static unsigned hashCode(const QByteArray &s);
|
||||
void rehash();
|
||||
|
||||
public:
|
||||
QByteArray currentFile;
|
||||
unsigned currentLine;
|
||||
bool hide_next;
|
||||
bool hideNext;
|
||||
|
||||
private:
|
||||
Macro **_macros;
|
||||
@@ -108,4 +108,4 @@ private:
|
||||
|
||||
} // namespace CPlusPlus
|
||||
|
||||
#endif // PP_ENVIRONMENT_H
|
||||
#endif // CPLUSPLUS_PP_ENVIRONMENT_H
|
||||
@@ -427,6 +427,7 @@ bool ResolveExpression::visit(UnaryExpressionAST *ast)
|
||||
|
||||
bool ResolveExpression::visit(QualifiedNameAST *ast)
|
||||
{
|
||||
ResolveClass resolveClass;
|
||||
Scope dummy;
|
||||
Name *name = sem.check(ast, &dummy);
|
||||
|
||||
@@ -435,7 +436,9 @@ bool ResolveExpression::visit(QualifiedNameAST *ast)
|
||||
if (symbol->isTypedef()) {
|
||||
if (NamedType *namedTy = symbol->type()->asNamedType()) {
|
||||
LookupContext symbolContext(symbol, _context);
|
||||
QList<Symbol *> resolvedClasses = symbolContext.resolveClass(namedTy->name());
|
||||
const Result r(namedTy, symbol);
|
||||
const QList<Symbol *> resolvedClasses =
|
||||
resolveClass(r, _context);
|
||||
if (resolvedClasses.count()) {
|
||||
foreach (Symbol *s, resolvedClasses) {
|
||||
addResult(s->type(), s);
|
||||
@@ -535,6 +538,7 @@ bool ResolveExpression::visit(ArrayAccessAST *ast)
|
||||
_results.clear();
|
||||
|
||||
const QList<Result> indexResults = operator()(ast->expression);
|
||||
ResolveClass symbolsForDotAcccess;
|
||||
|
||||
foreach (Result p, baseResults) {
|
||||
FullySpecifiedType ty = p.first;
|
||||
@@ -548,13 +552,12 @@ bool ResolveExpression::visit(ArrayAccessAST *ast)
|
||||
} else if (ArrayType *arrTy = ty->asArrayType()) {
|
||||
addResult(arrTy->elementType(), contextSymbol);
|
||||
} else if (NamedType *namedTy = ty->asNamedType()) {
|
||||
Name *className = namedTy->name();
|
||||
const QList<Scope *> scopes = visibleScopes(p);
|
||||
const QList<Symbol *> classObjectCandidates = _context.resolveClass(className, scopes);
|
||||
const QList<Symbol *> classObjectCandidates =
|
||||
symbolsForDotAcccess(p, _context);
|
||||
|
||||
foreach (Symbol *classObject, classObjectCandidates) {
|
||||
const QList<Result> overloads = resolveArrayOperator(p, namedTy,
|
||||
classObject->asClass());
|
||||
const QList<Result> overloads =
|
||||
resolveArrayOperator(p, namedTy, classObject->asClass());
|
||||
foreach (Result r, overloads) {
|
||||
FullySpecifiedType ty = r.first;
|
||||
Function *funTy = ty->asFunction();
|
||||
@@ -593,6 +596,7 @@ ResolveExpression::resolveMemberExpression(const QList<Result> &baseResults,
|
||||
unsigned accessOp,
|
||||
Name *memberName) const
|
||||
{
|
||||
ResolveClass resolveClass;
|
||||
QList<Result> results;
|
||||
|
||||
if (accessOp == T_ARROW) {
|
||||
@@ -603,9 +607,8 @@ ResolveExpression::resolveMemberExpression(const QList<Result> &baseResults,
|
||||
ty = refTy->elementType();
|
||||
|
||||
if (NamedType *namedTy = ty->asNamedType()) {
|
||||
Name *className = namedTy->name();
|
||||
const QList<Scope *> scopes = visibleScopes(p);
|
||||
const QList<Symbol *> classObjectCandidates = _context.resolveClass(className, scopes);
|
||||
const QList<Symbol *> classObjectCandidates =
|
||||
resolveClass(namedTy, p, _context);
|
||||
|
||||
foreach (Symbol *classObject, classObjectCandidates) {
|
||||
const QList<Result> overloads = resolveArrowOperator(p, namedTy,
|
||||
@@ -665,12 +668,15 @@ ResolveExpression::resolveMember(const Result &p,
|
||||
Name *memberName,
|
||||
NamedType *namedTy) const
|
||||
{
|
||||
ResolveClass resolveClass;
|
||||
|
||||
const QList<Symbol *> classObjectCandidates =
|
||||
resolveClass(namedTy, p, _context);
|
||||
|
||||
QList<Result> results;
|
||||
Name *className = namedTy->name();
|
||||
const QList<Scope *> scopes = visibleScopes(p);
|
||||
const QList<Symbol *> classObjectCandidates = _context.resolveClass(className, scopes);
|
||||
foreach (Symbol *classObject, classObjectCandidates) {
|
||||
results += resolveMember(p, memberName, namedTy, classObject->asClass());
|
||||
results += resolveMember(p, memberName, namedTy,
|
||||
classObject->asClass());
|
||||
}
|
||||
return results;
|
||||
}
|
||||
@@ -792,3 +798,91 @@ bool ResolveExpression::visit(PostIncrDecrAST *)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ResolveClass::ResolveClass()
|
||||
{ }
|
||||
|
||||
QList<Symbol *> ResolveClass::operator()(NamedType *namedTy,
|
||||
ResolveExpression::Result p,
|
||||
const LookupContext &context)
|
||||
{
|
||||
const QList<ResolveExpression::Result> previousBlackList = _blackList;
|
||||
const QList<Symbol *> symbols = resolveClass(namedTy, p, context);
|
||||
_blackList = previousBlackList;
|
||||
return symbols;
|
||||
}
|
||||
|
||||
QList<Symbol *> ResolveClass::operator()(ResolveExpression::Result p,
|
||||
const LookupContext &context)
|
||||
{
|
||||
const QList<ResolveExpression::Result> previousBlackList = _blackList;
|
||||
const QList<Symbol *> symbols = resolveClass(p, context);
|
||||
_blackList = previousBlackList;
|
||||
return symbols;
|
||||
}
|
||||
|
||||
QList<Symbol *> ResolveClass::resolveClass(NamedType *namedTy,
|
||||
ResolveExpression::Result p,
|
||||
const LookupContext &context)
|
||||
{
|
||||
QList<Symbol *> resolvedSymbols;
|
||||
|
||||
if (_blackList.contains(p))
|
||||
return resolvedSymbols;
|
||||
|
||||
_blackList.append(p);
|
||||
|
||||
const QList<Symbol *> candidates =
|
||||
context.resolve(namedTy->name(), context.visibleScopes(p));
|
||||
|
||||
foreach (Symbol *candidate, candidates) {
|
||||
if (Class *klass = candidate->asClass()) {
|
||||
if (resolvedSymbols.contains(klass))
|
||||
continue; // we already know about `klass'
|
||||
resolvedSymbols.append(klass);
|
||||
} else if (candidate->isTypedef()) {
|
||||
if (Declaration *decl = candidate->asDeclaration()) {
|
||||
if (Class *asClass = decl->type()->asClass()) {
|
||||
// typedef struct { } Point;
|
||||
// Point pt;
|
||||
// pt.
|
||||
resolvedSymbols.append(asClass);
|
||||
} else {
|
||||
// typedef Point Boh;
|
||||
// Boh b;
|
||||
// b.
|
||||
const ResolveExpression::Result r(decl->type(), decl);
|
||||
resolvedSymbols += resolveClass(r, context);
|
||||
}
|
||||
}
|
||||
} else if (Declaration *decl = candidate->asDeclaration()) {
|
||||
if (Function *funTy = decl->type()->asFunction()) {
|
||||
// QString foo("ciao");
|
||||
// foo.
|
||||
if (funTy->scope()->isBlockScope() || funTy->scope()->isNamespaceScope()) {
|
||||
const ResolveExpression::Result r(funTy->returnType(), decl);
|
||||
resolvedSymbols += resolveClass(r, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return resolvedSymbols;
|
||||
}
|
||||
|
||||
QList<Symbol *> ResolveClass::resolveClass(ResolveExpression::Result p,
|
||||
const LookupContext &context)
|
||||
{
|
||||
FullySpecifiedType ty = p.first;
|
||||
|
||||
if (NamedType *namedTy = ty->asNamedType()) {
|
||||
return resolveClass(namedTy, p, context);
|
||||
} else if (ReferenceType *refTy = ty->asReferenceType()) {
|
||||
const ResolveExpression::Result e(refTy->elementType(), p.second);
|
||||
return resolveClass(e, context);
|
||||
}
|
||||
|
||||
return QList<Symbol *>();
|
||||
}
|
||||
|
||||
|
||||
@@ -128,6 +128,31 @@ private:
|
||||
QList<Result> _results;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ResolveClass
|
||||
{
|
||||
public:
|
||||
ResolveClass();
|
||||
|
||||
QList<Symbol *> operator()(NamedType *namedTy,
|
||||
ResolveExpression::Result p,
|
||||
const LookupContext &context);
|
||||
|
||||
QList<Symbol *> operator()(ResolveExpression::Result p,
|
||||
const LookupContext &context);
|
||||
|
||||
private:
|
||||
QList<Symbol *> resolveClass(NamedType *namedTy,
|
||||
ResolveExpression::Result p,
|
||||
const LookupContext &context);
|
||||
|
||||
QList<Symbol *> resolveClass(ResolveExpression::Result p,
|
||||
const LookupContext &context);
|
||||
|
||||
private:
|
||||
QList<ResolveExpression::Result> _blackList;
|
||||
};
|
||||
|
||||
|
||||
} // end of namespace CPlusPlus
|
||||
|
||||
#endif // CPLUSPLUS_RESOLVEEXPRESSION_H
|
||||
|
||||
@@ -57,7 +57,8 @@ bool SimpleToken::isKeyword() const
|
||||
SimpleLexer::SimpleLexer()
|
||||
: _lastState(0),
|
||||
_skipComments(false),
|
||||
_qtMocRunEnabled(true)
|
||||
_qtMocRunEnabled(true),
|
||||
_objcEnabled(false)
|
||||
{ }
|
||||
|
||||
SimpleLexer::~SimpleLexer()
|
||||
@@ -73,6 +74,17 @@ void SimpleLexer::setQtMocRunEnabled(bool enabled)
|
||||
_qtMocRunEnabled = enabled;
|
||||
}
|
||||
|
||||
|
||||
bool SimpleLexer::objcEnabled() const
|
||||
{
|
||||
return _objcEnabled;
|
||||
}
|
||||
|
||||
void SimpleLexer::setObjcEnabled(bool onoff)
|
||||
{
|
||||
_objcEnabled = onoff;
|
||||
}
|
||||
|
||||
bool SimpleLexer::skipComments() const
|
||||
{
|
||||
return _skipComments;
|
||||
@@ -93,6 +105,7 @@ QList<SimpleToken> SimpleLexer::operator()(const QString &text, int state)
|
||||
|
||||
Lexer lex(firstChar, lastChar);
|
||||
lex.setQtMocRunEnabled(_qtMocRunEnabled);
|
||||
lex.setObjcEnabled(_objcEnabled);
|
||||
|
||||
if (! _skipComments)
|
||||
lex.setScanCommentTokens(true);
|
||||
|
||||
@@ -91,6 +91,9 @@ public:
|
||||
bool qtMocRunEnabled() const;
|
||||
void setQtMocRunEnabled(bool enabled);
|
||||
|
||||
bool objcEnabled() const;
|
||||
void setObjcEnabled(bool onoff);
|
||||
|
||||
QList<SimpleToken> operator()(const QString &text, int state = 0);
|
||||
|
||||
int state() const
|
||||
@@ -100,6 +103,7 @@ private:
|
||||
int _lastState;
|
||||
bool _skipComments: 1;
|
||||
bool _qtMocRunEnabled: 1;
|
||||
bool _objcEnabled: 1;
|
||||
};
|
||||
|
||||
} // end of namespace CPlusPlus
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <cplusplus/LookupContext.h>
|
||||
#include <cplusplus/ResolveExpression.h>
|
||||
#include <cplusplus/pp.h>
|
||||
#include <QSet>
|
||||
|
||||
using namespace CPlusPlus;
|
||||
|
||||
@@ -136,7 +137,7 @@ QString TypeOfExpression::preprocessedExpression(const QString &expression,
|
||||
processEnvironment(documents, thisDocument,
|
||||
&env, &processed);
|
||||
const QByteArray code = expression.toUtf8();
|
||||
pp preproc(0, env);
|
||||
Preprocessor preproc(0, env);
|
||||
QByteArray preprocessedCode;
|
||||
preproc("<expression>", code, &preprocessedCode);
|
||||
return QString::fromUtf8(preprocessedCode);
|
||||
|
||||
@@ -22,14 +22,14 @@ HEADERS += \
|
||||
TypePrettyPrinter.h \
|
||||
ResolveExpression.h \
|
||||
LookupContext.h \
|
||||
PreprocessorClient.h \
|
||||
PreprocessorEnvironment.h \
|
||||
Macro.h \
|
||||
pp.h \
|
||||
pp-cctype.h \
|
||||
pp-engine.h \
|
||||
pp-macro-expander.h \
|
||||
pp-scanner.h \
|
||||
pp-client.h \
|
||||
pp-environment.h \
|
||||
pp-internal.h \
|
||||
pp-macro.h
|
||||
pp-scanner.h
|
||||
|
||||
SOURCES += \
|
||||
SimpleLexer.cpp \
|
||||
@@ -44,8 +44,11 @@ SOURCES += \
|
||||
TypePrettyPrinter.cpp \
|
||||
ResolveExpression.cpp \
|
||||
LookupContext.cpp \
|
||||
PreprocessorClient.cpp \
|
||||
PreprocessorEnvironment.cpp \
|
||||
Macro.cpp \
|
||||
pp-engine.cpp \
|
||||
pp-environment.cpp \
|
||||
pp-macro-expander.cpp
|
||||
pp-macro-expander.cpp \
|
||||
pp-scanner.cpp
|
||||
|
||||
RESOURCES += cplusplus.qrc
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef PP_CCTYPE_H
|
||||
#define PP_CCTYPE_H
|
||||
#ifndef CPLUSPLUS_PP_CCTYPE_H
|
||||
#define CPLUSPLUS_PP_CCTYPE_H
|
||||
|
||||
#include <CPlusPlusForwardDeclarations.h>
|
||||
|
||||
@@ -73,4 +73,4 @@ inline bool CPLUSPLUS_EXPORT pp_isspace (int __ch)
|
||||
|
||||
} // namespace CPlusPlus
|
||||
|
||||
#endif // PP_CCTYPE_H
|
||||
#endif // CPLUSPLUS_PP_CCTYPE_H
|
||||
|
||||
@@ -451,7 +451,7 @@ private:
|
||||
} // end of anonymous namespace
|
||||
|
||||
|
||||
pp::pp (Client *client, Environment &env)
|
||||
Preprocessor::Preprocessor(Client *client, Environment &env)
|
||||
: client(client),
|
||||
env(env),
|
||||
expand(env)
|
||||
@@ -459,7 +459,7 @@ pp::pp (Client *client, Environment &env)
|
||||
resetIfLevel ();
|
||||
}
|
||||
|
||||
void pp::pushState(const State &s)
|
||||
void Preprocessor::pushState(const State &s)
|
||||
{
|
||||
_savedStates.append(state());
|
||||
_source = s.source;
|
||||
@@ -467,7 +467,7 @@ void pp::pushState(const State &s)
|
||||
_dot = s.dot;
|
||||
}
|
||||
|
||||
pp::State pp::state() const
|
||||
Preprocessor::State Preprocessor::state() const
|
||||
{
|
||||
State state;
|
||||
state.source = _source;
|
||||
@@ -476,7 +476,7 @@ pp::State pp::state() const
|
||||
return state;
|
||||
}
|
||||
|
||||
void pp::popState()
|
||||
void Preprocessor::popState()
|
||||
{
|
||||
const State &state = _savedStates.last();
|
||||
_source = state.source;
|
||||
@@ -485,7 +485,7 @@ void pp::popState()
|
||||
_savedStates.removeLast();
|
||||
}
|
||||
|
||||
void pp::operator () (const QByteArray &filename,
|
||||
void Preprocessor::operator () (const QByteArray &filename,
|
||||
const QByteArray &source,
|
||||
QByteArray *result)
|
||||
{
|
||||
@@ -497,7 +497,7 @@ void pp::operator () (const QByteArray &filename,
|
||||
env.currentFile = previousFile;
|
||||
}
|
||||
|
||||
pp::State pp::createStateFromSource(const QByteArray &source) const
|
||||
Preprocessor::State Preprocessor::createStateFromSource(const QByteArray &source) const
|
||||
{
|
||||
State state;
|
||||
state.source = source;
|
||||
@@ -512,7 +512,7 @@ pp::State pp::createStateFromSource(const QByteArray &source) const
|
||||
return state;
|
||||
}
|
||||
|
||||
void pp::operator()(const QByteArray &source, QByteArray *result)
|
||||
void Preprocessor::operator()(const QByteArray &source, QByteArray *result)
|
||||
{
|
||||
pushState(createStateFromSource(source));
|
||||
|
||||
@@ -600,19 +600,15 @@ void pp::operator()(const QByteArray &source, QByteArray *result)
|
||||
if (! m) {
|
||||
result->append(spell);
|
||||
} else {
|
||||
if (! m->function_like) {
|
||||
if (! m->isFunctionLike()) {
|
||||
if (_dot->isNot(T_LPAREN)) {
|
||||
if (client)
|
||||
client->startExpandingMacro(identifierToken->offset,
|
||||
*m, spell);
|
||||
|
||||
m->hidden = true;
|
||||
|
||||
expand(m->definition.constBegin(),
|
||||
m->definition.constEnd(),
|
||||
result);
|
||||
|
||||
m->hidden = false;
|
||||
m->setHidden(true);
|
||||
expand(m->definition(), result);
|
||||
m->setHidden(false);
|
||||
|
||||
if (client)
|
||||
client->stopExpandingMacro(_dot->offset, *m);
|
||||
@@ -624,13 +620,9 @@ void pp::operator()(const QByteArray &source, QByteArray *result)
|
||||
if (client)
|
||||
client->startExpandingMacro(identifierToken->offset,
|
||||
*m, spell);
|
||||
m->hidden = true;
|
||||
|
||||
expand(m->definition.constBegin(),
|
||||
m->definition.constEnd(),
|
||||
&tmp);
|
||||
|
||||
m->hidden = false;
|
||||
m->setHidden(true);
|
||||
expand(m->definition(), &tmp);
|
||||
m->setHidden(false);
|
||||
|
||||
if (client)
|
||||
client->stopExpandingMacro(_dot->offset, *m);
|
||||
@@ -641,7 +633,7 @@ void pp::operator()(const QByteArray &source, QByteArray *result)
|
||||
if (_dot->is(T_IDENTIFIER)) {
|
||||
const QByteArray id = tokenSpell(*_dot);
|
||||
Macro *macro = env.resolve(id);
|
||||
if (macro && macro->function_like)
|
||||
if (macro && macro->isFunctionLike())
|
||||
m = macro;
|
||||
}
|
||||
popState();
|
||||
@@ -656,7 +648,7 @@ void pp::operator()(const QByteArray &source, QByteArray *result)
|
||||
// collect the actual arguments
|
||||
if (_dot->isNot(T_LPAREN)) {
|
||||
// ### warnng expected T_LPAREN
|
||||
result->append(m->name);
|
||||
result->append(m->name());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -700,27 +692,27 @@ void pp::operator()(const QByteArray &source, QByteArray *result)
|
||||
env.currentLine = previousCurrentLine;
|
||||
}
|
||||
|
||||
const char *pp::startOfToken(const Token &token) const
|
||||
const char *Preprocessor::startOfToken(const Token &token) const
|
||||
{ return _source.constBegin() + token.begin(); }
|
||||
|
||||
const char *pp::endOfToken(const Token &token) const
|
||||
const char *Preprocessor::endOfToken(const Token &token) const
|
||||
{ return _source.constBegin() + token.end(); }
|
||||
|
||||
QByteArray pp::tokenSpell(const Token &token) const
|
||||
QByteArray Preprocessor::tokenSpell(const Token &token) const
|
||||
{
|
||||
const QByteArray text = QByteArray::fromRawData(_source.constBegin() + token.offset,
|
||||
token.length);
|
||||
return text;
|
||||
}
|
||||
|
||||
QByteArray pp::tokenText(const Token &token) const
|
||||
QByteArray Preprocessor::tokenText(const Token &token) const
|
||||
{
|
||||
const QByteArray text(_source.constBegin() + token.offset,
|
||||
token.length);
|
||||
return text;
|
||||
}
|
||||
|
||||
void pp::processDirective(TokenIterator firstToken, TokenIterator lastToken)
|
||||
void Preprocessor::processDirective(TokenIterator firstToken, TokenIterator lastToken)
|
||||
{
|
||||
RangeLexer tk(firstToken, lastToken);
|
||||
++tk; // skip T_POUND
|
||||
@@ -771,7 +763,7 @@ void pp::processDirective(TokenIterator firstToken, TokenIterator lastToken)
|
||||
}
|
||||
}
|
||||
|
||||
QVector<Token> pp::tokenize(const QByteArray &text) const
|
||||
QVector<Token> Preprocessor::tokenize(const QByteArray &text) const
|
||||
{
|
||||
QVector<Token> tokens;
|
||||
Lexer lex(text.constBegin(), text.constEnd());
|
||||
@@ -784,7 +776,7 @@ QVector<Token> pp::tokenize(const QByteArray &text) const
|
||||
return tokens;
|
||||
}
|
||||
|
||||
void pp::processInclude(bool skipCurentPath,
|
||||
void Preprocessor::processInclude(bool skipCurentPath,
|
||||
TokenIterator firstToken, TokenIterator lastToken,
|
||||
bool acceptMacros)
|
||||
{
|
||||
@@ -836,7 +828,7 @@ void pp::processInclude(bool skipCurentPath,
|
||||
}
|
||||
}
|
||||
|
||||
void pp::processDefine(TokenIterator firstToken, TokenIterator lastToken)
|
||||
void Preprocessor::processDefine(TokenIterator firstToken, TokenIterator lastToken)
|
||||
{
|
||||
RangeLexer tk(firstToken, lastToken);
|
||||
|
||||
@@ -852,30 +844,30 @@ void pp::processDefine(TokenIterator firstToken, TokenIterator lastToken)
|
||||
}
|
||||
|
||||
Macro macro;
|
||||
macro.fileName = env.currentFile;
|
||||
macro.line = env.currentLine;
|
||||
macro.name = tokenText(*tk);
|
||||
macro.setFileName(env.currentFile);
|
||||
macro.setLine(env.currentLine);
|
||||
macro.setName(tokenText(*tk));
|
||||
++tk; // skip T_IDENTIFIER
|
||||
|
||||
if (tk->is(T_LPAREN) && ! tk->whitespace) {
|
||||
// a function-like macro definition
|
||||
macro.function_like = true;
|
||||
macro.setFunctionLike(true);
|
||||
|
||||
++tk; // skip T_LPAREN
|
||||
if (tk->is(T_IDENTIFIER)) {
|
||||
macro.formals.append(tokenText(*tk));
|
||||
macro.addFormal(tokenText(*tk));
|
||||
++tk; // skip T_IDENTIFIER
|
||||
while (tk->is(T_COMMA)) {
|
||||
++tk;// skip T_COMMA
|
||||
if (tk->isNot(T_IDENTIFIER))
|
||||
break;
|
||||
macro.formals.append(tokenText(*tk));
|
||||
macro.addFormal(tokenText(*tk));
|
||||
++tk; // skip T_IDENTIFIER
|
||||
}
|
||||
}
|
||||
|
||||
if (tk->is(T_DOT_DOT_DOT)) {
|
||||
macro.variadics = true;
|
||||
macro.setVariadic(true);
|
||||
++tk; // skip T_DOT_DOT_DOT
|
||||
}
|
||||
|
||||
@@ -887,32 +879,31 @@ void pp::processDefine(TokenIterator firstToken, TokenIterator lastToken)
|
||||
++tk; // skip T_RPAREN
|
||||
}
|
||||
|
||||
QByteArray macroId = macro.name;
|
||||
const bool isQtWord = isQtReservedWord(macroId);
|
||||
if (isQtReservedWord(macro.name())) {
|
||||
QByteArray macroId = macro.name();
|
||||
|
||||
if (macro.function_like) {
|
||||
if (macro.isFunctionLike()) {
|
||||
macroId += '(';
|
||||
for (int i = 0; i < macro.formals.size(); ++i) {
|
||||
if (i != 0)
|
||||
bool fst = true;
|
||||
foreach (const QByteArray formal, macro.formals()) {
|
||||
if (! fst)
|
||||
macroId += ", ";
|
||||
|
||||
const QByteArray formal = macro.formals.at(i);
|
||||
fst = false;
|
||||
macroId += formal;
|
||||
}
|
||||
macroId += ')';
|
||||
}
|
||||
|
||||
if (isQtWord)
|
||||
macro.definition = macroId;
|
||||
else {
|
||||
macro.setDefinition(macroId);
|
||||
} else {
|
||||
// ### make me fast!
|
||||
const char *startOfDefinition = startOfToken(*tk);
|
||||
const char *endOfDefinition = startOfToken(*lastToken);
|
||||
macro.definition.append(startOfDefinition,
|
||||
QByteArray definition(startOfDefinition,
|
||||
endOfDefinition - startOfDefinition);
|
||||
macro.definition.replace("\\\n", " ");
|
||||
macro.definition.replace('\n', ' ');
|
||||
macro.definition = macro.definition.trimmed();
|
||||
definition.replace("\\\n", " ");
|
||||
definition.replace('\n', ' ');
|
||||
macro.setDefinition(definition.trimmed());
|
||||
}
|
||||
|
||||
env.bind(macro);
|
||||
@@ -921,7 +912,7 @@ void pp::processDefine(TokenIterator firstToken, TokenIterator lastToken)
|
||||
client->macroAdded(macro);
|
||||
}
|
||||
|
||||
void pp::processIf(TokenIterator firstToken, TokenIterator lastToken)
|
||||
void Preprocessor::processIf(TokenIterator firstToken, TokenIterator lastToken)
|
||||
{
|
||||
RangeLexer tk(firstToken, lastToken);
|
||||
|
||||
@@ -948,7 +939,7 @@ void pp::processIf(TokenIterator firstToken, TokenIterator lastToken)
|
||||
}
|
||||
}
|
||||
|
||||
void pp::processElse(TokenIterator firstToken, TokenIterator lastToken)
|
||||
void Preprocessor::processElse(TokenIterator firstToken, TokenIterator lastToken)
|
||||
{
|
||||
RangeLexer tk(firstToken, lastToken);
|
||||
|
||||
@@ -961,7 +952,7 @@ void pp::processElse(TokenIterator firstToken, TokenIterator lastToken)
|
||||
}
|
||||
}
|
||||
|
||||
void pp::processElif(TokenIterator firstToken, TokenIterator lastToken)
|
||||
void Preprocessor::processElif(TokenIterator firstToken, TokenIterator lastToken)
|
||||
{
|
||||
RangeLexer tk(firstToken, lastToken);
|
||||
++tk; // skip T_POUND
|
||||
@@ -980,7 +971,7 @@ void pp::processElif(TokenIterator firstToken, TokenIterator lastToken)
|
||||
}
|
||||
}
|
||||
|
||||
void pp::processEndif(TokenIterator, TokenIterator)
|
||||
void Preprocessor::processEndif(TokenIterator, TokenIterator)
|
||||
{
|
||||
if (iflevel == 0 && !skipping()) {
|
||||
// std::cerr << "*** WARNING #endif without #if" << std::endl;
|
||||
@@ -992,7 +983,7 @@ void pp::processEndif(TokenIterator, TokenIterator)
|
||||
}
|
||||
}
|
||||
|
||||
void pp::processIfdef(bool checkUndefined,
|
||||
void Preprocessor::processIfdef(bool checkUndefined,
|
||||
TokenIterator firstToken, TokenIterator lastToken)
|
||||
{
|
||||
RangeLexer tk(firstToken, lastToken);
|
||||
@@ -1013,7 +1004,7 @@ void pp::processIfdef(bool checkUndefined,
|
||||
}
|
||||
}
|
||||
|
||||
void pp::processUndef(TokenIterator firstToken, TokenIterator lastToken)
|
||||
void Preprocessor::processUndef(TokenIterator firstToken, TokenIterator lastToken)
|
||||
{
|
||||
RangeLexer tk(firstToken, lastToken);
|
||||
|
||||
@@ -1029,14 +1020,14 @@ void pp::processUndef(TokenIterator firstToken, TokenIterator lastToken)
|
||||
}
|
||||
}
|
||||
|
||||
void pp::resetIfLevel ()
|
||||
void Preprocessor::resetIfLevel ()
|
||||
{
|
||||
iflevel = 0;
|
||||
_skipping[iflevel] = false;
|
||||
_true_test[iflevel] = false;
|
||||
}
|
||||
|
||||
pp::PP_DIRECTIVE_TYPE pp::classifyDirective (const QByteArray &__directive) const
|
||||
Preprocessor::PP_DIRECTIVE_TYPE Preprocessor::classifyDirective (const QByteArray &__directive) const
|
||||
{
|
||||
switch (__directive.size())
|
||||
{
|
||||
@@ -1085,7 +1076,7 @@ pp::PP_DIRECTIVE_TYPE pp::classifyDirective (const QByteArray &__directive) cons
|
||||
return PP_UNKNOWN_DIRECTIVE;
|
||||
}
|
||||
|
||||
bool pp::testIfLevel()
|
||||
bool Preprocessor::testIfLevel()
|
||||
{
|
||||
const bool result = !_skipping[iflevel++];
|
||||
_skipping[iflevel] = _skipping[iflevel - 1];
|
||||
@@ -1093,10 +1084,10 @@ bool pp::testIfLevel()
|
||||
return result;
|
||||
}
|
||||
|
||||
int pp::skipping() const
|
||||
int Preprocessor::skipping() const
|
||||
{ return _skipping[iflevel]; }
|
||||
|
||||
Value pp::evalExpression(TokenIterator firstToken, TokenIterator lastToken,
|
||||
Value Preprocessor::evalExpression(TokenIterator firstToken, TokenIterator lastToken,
|
||||
const QByteArray &source) const
|
||||
{
|
||||
ExpressionEvaluator eval(&env);
|
||||
@@ -1104,7 +1095,7 @@ Value pp::evalExpression(TokenIterator firstToken, TokenIterator lastToken,
|
||||
return result;
|
||||
}
|
||||
|
||||
bool pp::isQtReservedWord (const QByteArray ¯oId) const
|
||||
bool Preprocessor::isQtReservedWord (const QByteArray ¯oId) const
|
||||
{
|
||||
const int size = macroId.size();
|
||||
if (size == 9 && macroId.at(0) == 'Q' && macroId == "Q_SIGNALS")
|
||||
|
||||
@@ -50,10 +50,10 @@
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef PP_ENGINE_H
|
||||
#define PP_ENGINE_H
|
||||
#ifndef CPLUSPLUS_PP_ENGINE_H
|
||||
#define CPLUSPLUS_PP_ENGINE_H
|
||||
|
||||
#include "pp-client.h"
|
||||
#include "PreprocessorClient.h"
|
||||
|
||||
#include <Token.h>
|
||||
#include <QVector>
|
||||
@@ -134,7 +134,7 @@ namespace CPlusPlus {
|
||||
#undef PP_DEFINE_BIN_OP
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT pp
|
||||
class CPLUSPLUS_EXPORT Preprocessor
|
||||
{
|
||||
Client *client;
|
||||
Environment &env;
|
||||
@@ -182,7 +182,7 @@ namespace CPlusPlus {
|
||||
State createStateFromSource(const QByteArray &source) const;
|
||||
|
||||
public:
|
||||
pp(Client *client, Environment &env);
|
||||
Preprocessor(Client *client, Environment &env);
|
||||
|
||||
void operator()(const QByteArray &filename,
|
||||
const QByteArray &source,
|
||||
@@ -228,4 +228,4 @@ namespace CPlusPlus {
|
||||
|
||||
} // namespace CPlusPlus
|
||||
|
||||
#endif // PP_ENGINE_H
|
||||
#endif // CPLUSPLUS_PP_ENGINE_H
|
||||
|
||||
@@ -32,11 +32,26 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "pp.h"
|
||||
#include "pp-cctype.h"
|
||||
#include "pp-macro-expander.h"
|
||||
#include <QDateTime>
|
||||
|
||||
using namespace CPlusPlus;
|
||||
|
||||
inline static bool comment_p (const char *__first, const char *__last)
|
||||
{
|
||||
if (__first == __last)
|
||||
return false;
|
||||
|
||||
if (*__first != '/')
|
||||
return false;
|
||||
|
||||
if (++__first == __last)
|
||||
return false;
|
||||
|
||||
return (*__first == '/' || *__first == '*');
|
||||
}
|
||||
|
||||
MacroExpander::MacroExpander (Environment &env, pp_frame *frame)
|
||||
: env(env), frame(frame),
|
||||
lines(0), generated_lines(0)
|
||||
@@ -47,7 +62,7 @@ const QByteArray *MacroExpander::resolve_formal(const QByteArray &__name)
|
||||
if (! (frame && frame->expanding_macro))
|
||||
return 0;
|
||||
|
||||
const QVector<QByteArray> &formals = frame->expanding_macro->formals;
|
||||
const QVector<QByteArray> formals = frame->expanding_macro->formals();
|
||||
for (int index = 0; index < formals.size(); ++index) {
|
||||
const QByteArray formal = formals.at(index);
|
||||
|
||||
@@ -137,7 +152,7 @@ const char *MacroExpander::operator () (const char *__first, const char *__last,
|
||||
__result->append(__first, next_pos - __first);
|
||||
__first = next_pos;
|
||||
}
|
||||
else if (_PP_internal::comment_p (__first, __last))
|
||||
else if (comment_p (__first, __last))
|
||||
{
|
||||
__first = skip_comment_or_divop (__first, __last);
|
||||
int n = skip_comment_or_divop.lines;
|
||||
@@ -198,12 +213,12 @@ const char *MacroExpander::operator () (const char *__first, const char *__last,
|
||||
}
|
||||
|
||||
Macro *macro = env.resolve (fast_name);
|
||||
if (! macro || macro->hidden || env.hide_next)
|
||||
if (! macro || macro->isHidden() || env.hideNext)
|
||||
{
|
||||
if (fast_name.size () == 7 && fast_name [0] == 'd' && fast_name == "defined")
|
||||
env.hide_next = true;
|
||||
env.hideNext = true;
|
||||
else
|
||||
env.hide_next = false;
|
||||
env.hideNext = false;
|
||||
|
||||
if (fast_name.size () == 8 && fast_name [0] == '_' && fast_name [1] == '_')
|
||||
{
|
||||
@@ -245,19 +260,19 @@ const char *MacroExpander::operator () (const char *__first, const char *__last,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! macro->function_like)
|
||||
if (! macro->isFunctionLike())
|
||||
{
|
||||
Macro *m = 0;
|
||||
|
||||
if (! macro->definition.isEmpty())
|
||||
if (! macro->definition().isEmpty())
|
||||
{
|
||||
macro->hidden = true;
|
||||
macro->setHidden(true);
|
||||
|
||||
QByteArray __tmp;
|
||||
__tmp.reserve (256);
|
||||
|
||||
MacroExpander expand_macro (env);
|
||||
expand_macro (macro->definition.constBegin (), macro->definition.constEnd (), &__tmp);
|
||||
expand_macro (macro->definition(), &__tmp);
|
||||
generated_lines += expand_macro.lines;
|
||||
|
||||
if (! __tmp.isEmpty ())
|
||||
@@ -277,7 +292,7 @@ const char *MacroExpander::operator () (const char *__first, const char *__last,
|
||||
*__result += __tmp;
|
||||
}
|
||||
|
||||
macro->hidden = false;
|
||||
macro->setHidden(false);
|
||||
}
|
||||
|
||||
if (! m)
|
||||
@@ -333,9 +348,9 @@ const char *MacroExpander::operator () (const char *__first, const char *__last,
|
||||
|
||||
pp_frame frame (macro, actuals);
|
||||
MacroExpander expand_macro (env, &frame);
|
||||
macro->hidden = true;
|
||||
expand_macro (macro->definition.constBegin (), macro->definition.constEnd (), __result);
|
||||
macro->hidden = false;
|
||||
macro->setHidden(true);
|
||||
expand_macro (macro->definition(), __result);
|
||||
macro->setHidden(false);
|
||||
generated_lines += expand_macro.lines;
|
||||
}
|
||||
else
|
||||
@@ -351,8 +366,8 @@ const char *MacroExpander::skip_argument_variadics (QVector<QByteArray> const &_
|
||||
{
|
||||
const char *arg_end = skip_argument (__first, __last);
|
||||
|
||||
while (__macro->variadics && __first != arg_end && arg_end != __last && *arg_end == ','
|
||||
&& (__actuals.size () + 1) == __macro->formals.size ())
|
||||
while (__macro->isVariadic() && __first != arg_end && arg_end != __last && *arg_end == ','
|
||||
&& (__actuals.size () + 1) == __macro->formals().size ())
|
||||
{
|
||||
arg_end = skip_argument (++arg_end, __last);
|
||||
}
|
||||
|
||||
@@ -88,6 +88,10 @@ namespace CPlusPlus {
|
||||
const char *operator () (const char *first, const char *last,
|
||||
QByteArray *result);
|
||||
|
||||
const char *operator () (const QByteArray &source,
|
||||
QByteArray *result)
|
||||
{ return operator()(source.constBegin(), source.constEnd(), result); }
|
||||
|
||||
const char *skip_argument_variadics (const QVector<QByteArray> &actuals,
|
||||
Macro *macro,
|
||||
const char *first, const char *last);
|
||||
|
||||
296
src/libs/cplusplus/pp-scanner.cpp
Normal file
296
src/libs/cplusplus/pp-scanner.cpp
Normal file
@@ -0,0 +1,296 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
/*
|
||||
Copyright 2005 Roberto Raggi <roberto@kdevelop.org>
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
KDEVELOP TEAM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "pp-scanner.h"
|
||||
#include "pp-cctype.h"
|
||||
|
||||
using namespace CPlusPlus;
|
||||
|
||||
const char *pp_skip_blanks::operator () (const char *__first, const char *__last)
|
||||
{
|
||||
lines = 0;
|
||||
|
||||
for (; __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first) {
|
||||
if (*__first == '\\') {
|
||||
const char *__begin = __first;
|
||||
++__begin;
|
||||
|
||||
if (__begin != __last && *__begin == '\n')
|
||||
++__first;
|
||||
else
|
||||
break;
|
||||
} else if (*__first == '\n' || !pp_isspace (*__first))
|
||||
break;
|
||||
}
|
||||
|
||||
return __first;
|
||||
}
|
||||
|
||||
const char *pp_skip_whitespaces::operator () (const char *__first, const char *__last)
|
||||
{
|
||||
lines = 0;
|
||||
|
||||
for (; __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first) {
|
||||
if (! pp_isspace (*__first))
|
||||
break;
|
||||
}
|
||||
|
||||
return __first;
|
||||
}
|
||||
|
||||
const char *pp_skip_comment_or_divop::operator () (const char *__first, const char *__last)
|
||||
{
|
||||
enum {
|
||||
MAYBE_BEGIN,
|
||||
BEGIN,
|
||||
MAYBE_END,
|
||||
END,
|
||||
IN_COMMENT,
|
||||
IN_CXX_COMMENT
|
||||
} state (MAYBE_BEGIN);
|
||||
|
||||
lines = 0;
|
||||
|
||||
for (; __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first) {
|
||||
switch (state) {
|
||||
default:
|
||||
break;
|
||||
|
||||
case MAYBE_BEGIN:
|
||||
if (*__first != '/')
|
||||
return __first;
|
||||
|
||||
state = BEGIN;
|
||||
break;
|
||||
|
||||
case BEGIN:
|
||||
if (*__first == '*')
|
||||
state = IN_COMMENT;
|
||||
else if (*__first == '/')
|
||||
state = IN_CXX_COMMENT;
|
||||
else
|
||||
return __first;
|
||||
break;
|
||||
|
||||
case IN_COMMENT:
|
||||
if (*__first == '*')
|
||||
state = MAYBE_END;
|
||||
break;
|
||||
|
||||
case IN_CXX_COMMENT:
|
||||
if (*__first == '\n')
|
||||
return __first;
|
||||
break;
|
||||
|
||||
case MAYBE_END:
|
||||
if (*__first == '/')
|
||||
state = END;
|
||||
else if (*__first != '*')
|
||||
state = IN_COMMENT;
|
||||
break;
|
||||
|
||||
case END:
|
||||
return __first;
|
||||
}
|
||||
}
|
||||
|
||||
return __first;
|
||||
}
|
||||
|
||||
const char *pp_skip_identifier::operator () (const char *__first, const char *__last)
|
||||
{
|
||||
lines = 0;
|
||||
|
||||
for (; __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first) {
|
||||
if (! pp_isalnum (*__first) && *__first != '_')
|
||||
break;
|
||||
}
|
||||
|
||||
return __first;
|
||||
}
|
||||
|
||||
const char *pp_skip_number::operator () (const char *__first, const char *__last)
|
||||
{
|
||||
lines = 0;
|
||||
|
||||
for (; __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first) {
|
||||
if (! pp_isalnum (*__first) && *__first != '.')
|
||||
break;
|
||||
}
|
||||
|
||||
return __first;
|
||||
}
|
||||
|
||||
const char *pp_skip_string_literal::operator () (const char *__first, const char *__last)
|
||||
{
|
||||
enum {
|
||||
BEGIN,
|
||||
IN_STRING,
|
||||
QUOTE,
|
||||
END
|
||||
} state (BEGIN);
|
||||
|
||||
lines = 0;
|
||||
|
||||
for (; __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first) {
|
||||
switch (state)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
|
||||
case BEGIN:
|
||||
if (*__first != '\"')
|
||||
return __first;
|
||||
state = IN_STRING;
|
||||
break;
|
||||
|
||||
case IN_STRING:
|
||||
if (! (*__first != '\n'))
|
||||
return __last;
|
||||
|
||||
if (*__first == '\"')
|
||||
state = END;
|
||||
else if (*__first == '\\')
|
||||
state = QUOTE;
|
||||
break;
|
||||
|
||||
case QUOTE:
|
||||
state = IN_STRING;
|
||||
break;
|
||||
|
||||
case END:
|
||||
return __first;
|
||||
}
|
||||
}
|
||||
|
||||
return __first;
|
||||
}
|
||||
|
||||
const char *pp_skip_char_literal::operator () (const char *__first, const char *__last)
|
||||
{
|
||||
enum {
|
||||
BEGIN,
|
||||
IN_STRING,
|
||||
QUOTE,
|
||||
END
|
||||
} state (BEGIN);
|
||||
|
||||
lines = 0;
|
||||
|
||||
for (; state != END && __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first) {
|
||||
switch (state)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
|
||||
case BEGIN:
|
||||
if (*__first != '\'')
|
||||
return __first;
|
||||
state = IN_STRING;
|
||||
break;
|
||||
|
||||
case IN_STRING:
|
||||
if (! (*__first != '\n'))
|
||||
return __last;
|
||||
|
||||
if (*__first == '\'')
|
||||
state = END;
|
||||
else if (*__first == '\\')
|
||||
state = QUOTE;
|
||||
break;
|
||||
|
||||
case QUOTE:
|
||||
state = IN_STRING;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return __first;
|
||||
}
|
||||
|
||||
const char *pp_skip_argument::operator () (const char *__first, const char *__last)
|
||||
{
|
||||
int depth = 0;
|
||||
lines = 0;
|
||||
|
||||
while (__first != __last) {
|
||||
if (!depth && (*__first == ')' || *__first == ','))
|
||||
break;
|
||||
else if (*__first == '(')
|
||||
++depth, ++__first;
|
||||
else if (*__first == ')')
|
||||
--depth, ++__first;
|
||||
else if (*__first == '\"') {
|
||||
__first = skip_string_literal (__first, __last);
|
||||
lines += skip_string_literal.lines;
|
||||
} else if (*__first == '\'') {
|
||||
__first = skip_char_literal (__first, __last);
|
||||
lines += skip_char_literal.lines;
|
||||
} else if (*__first == '/') {
|
||||
__first = skip_comment_or_divop (__first, __last);
|
||||
lines += skip_comment_or_divop.lines;
|
||||
} else if (pp_isalpha (*__first) || *__first == '_') {
|
||||
__first = skip_identifier (__first, __last);
|
||||
lines += skip_identifier.lines;
|
||||
} else if (pp_isdigit (*__first)) {
|
||||
__first = skip_number (__first, __last);
|
||||
lines += skip_number.lines;
|
||||
} else if (*__first == '\n') {
|
||||
++__first;
|
||||
++lines;
|
||||
} else
|
||||
++__first;
|
||||
}
|
||||
|
||||
return __first;
|
||||
}
|
||||
|
||||
@@ -50,266 +50,57 @@
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef PP_SCANNER_H
|
||||
#define PP_SCANNER_H
|
||||
#ifndef CPLUSPLUS_PP_SCANNER_H
|
||||
#define CPLUSPLUS_PP_SCANNER_H
|
||||
|
||||
namespace CPlusPlus {
|
||||
|
||||
struct pp_skip_blanks
|
||||
{
|
||||
int lines;
|
||||
|
||||
|
||||
const char *operator () (const char *__first, const char *__last)
|
||||
{
|
||||
lines = 0;
|
||||
|
||||
for (; __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first)
|
||||
{
|
||||
if (*__first == '\\')
|
||||
{
|
||||
const char *__begin = __first;
|
||||
++__begin;
|
||||
|
||||
if (__begin != __last && *__begin == '\n')
|
||||
++__first;
|
||||
else
|
||||
break;
|
||||
}
|
||||
else if (*__first == '\n' || !pp_isspace (*__first))
|
||||
break;
|
||||
}
|
||||
|
||||
return __first;
|
||||
}
|
||||
const char *operator () (const char *first, const char *last);
|
||||
};
|
||||
|
||||
struct pp_skip_whitespaces
|
||||
{
|
||||
int lines;
|
||||
|
||||
|
||||
const char *operator () (const char *__first, const char *__last)
|
||||
{
|
||||
lines = 0;
|
||||
|
||||
for (; __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first)
|
||||
{
|
||||
if (! pp_isspace (*__first))
|
||||
break;
|
||||
}
|
||||
|
||||
return __first;
|
||||
}
|
||||
const char *operator () (const char *first, const char *last);
|
||||
};
|
||||
|
||||
struct pp_skip_comment_or_divop
|
||||
{
|
||||
int lines;
|
||||
|
||||
|
||||
const char *operator () (const char *__first, const char *__last)
|
||||
{
|
||||
enum {
|
||||
MAYBE_BEGIN,
|
||||
BEGIN,
|
||||
MAYBE_END,
|
||||
END,
|
||||
IN_COMMENT,
|
||||
IN_CXX_COMMENT
|
||||
} state (MAYBE_BEGIN);
|
||||
|
||||
lines = 0;
|
||||
|
||||
for (; __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
default:
|
||||
assert (0);
|
||||
break;
|
||||
|
||||
case MAYBE_BEGIN:
|
||||
if (*__first != '/')
|
||||
return __first;
|
||||
|
||||
state = BEGIN;
|
||||
break;
|
||||
|
||||
case BEGIN:
|
||||
if (*__first == '*')
|
||||
state = IN_COMMENT;
|
||||
else if (*__first == '/')
|
||||
state = IN_CXX_COMMENT;
|
||||
else
|
||||
return __first;
|
||||
break;
|
||||
|
||||
case IN_COMMENT:
|
||||
if (*__first == '*')
|
||||
state = MAYBE_END;
|
||||
break;
|
||||
|
||||
case IN_CXX_COMMENT:
|
||||
if (*__first == '\n')
|
||||
return __first;
|
||||
break;
|
||||
|
||||
case MAYBE_END:
|
||||
if (*__first == '/')
|
||||
state = END;
|
||||
else if (*__first != '*')
|
||||
state = IN_COMMENT;
|
||||
break;
|
||||
|
||||
case END:
|
||||
return __first;
|
||||
}
|
||||
}
|
||||
|
||||
return __first;
|
||||
}
|
||||
const char *operator () (const char *first, const char *last);
|
||||
};
|
||||
|
||||
struct pp_skip_identifier
|
||||
{
|
||||
int lines;
|
||||
|
||||
|
||||
const char *operator () (const char *__first, const char *__last)
|
||||
{
|
||||
lines = 0;
|
||||
|
||||
for (; __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first)
|
||||
{
|
||||
if (! pp_isalnum (*__first) && *__first != '_')
|
||||
break;
|
||||
}
|
||||
|
||||
return __first;
|
||||
}
|
||||
const char *operator () (const char *first, const char *last);
|
||||
};
|
||||
|
||||
struct pp_skip_number
|
||||
{
|
||||
int lines;
|
||||
|
||||
|
||||
const char *operator () (const char *__first, const char *__last)
|
||||
{
|
||||
lines = 0;
|
||||
|
||||
for (; __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first)
|
||||
{
|
||||
if (! pp_isalnum (*__first) && *__first != '.')
|
||||
break;
|
||||
}
|
||||
|
||||
return __first;
|
||||
}
|
||||
const char *operator () (const char *first, const char *last);
|
||||
};
|
||||
|
||||
struct pp_skip_string_literal
|
||||
{
|
||||
int lines;
|
||||
|
||||
|
||||
const char *operator () (const char *__first, const char *__last)
|
||||
{
|
||||
enum {
|
||||
BEGIN,
|
||||
IN_STRING,
|
||||
QUOTE,
|
||||
END
|
||||
} state (BEGIN);
|
||||
|
||||
lines = 0;
|
||||
|
||||
for (; __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
default:
|
||||
assert (0);
|
||||
break;
|
||||
|
||||
case BEGIN:
|
||||
if (*__first != '\"')
|
||||
return __first;
|
||||
state = IN_STRING;
|
||||
break;
|
||||
|
||||
case IN_STRING:
|
||||
if (! (*__first != '\n'))
|
||||
return __last;
|
||||
|
||||
if (*__first == '\"')
|
||||
state = END;
|
||||
else if (*__first == '\\')
|
||||
state = QUOTE;
|
||||
break;
|
||||
|
||||
case QUOTE:
|
||||
state = IN_STRING;
|
||||
break;
|
||||
|
||||
case END:
|
||||
return __first;
|
||||
}
|
||||
}
|
||||
|
||||
return __first;
|
||||
}
|
||||
const char *operator () (const char *first, const char *last);
|
||||
};
|
||||
|
||||
struct pp_skip_char_literal
|
||||
{
|
||||
int lines;
|
||||
|
||||
|
||||
const char *operator () (const char *__first, const char *__last)
|
||||
{
|
||||
enum {
|
||||
BEGIN,
|
||||
IN_STRING,
|
||||
QUOTE,
|
||||
END
|
||||
} state (BEGIN);
|
||||
|
||||
lines = 0;
|
||||
|
||||
for (; state != END && __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
default:
|
||||
assert (0);
|
||||
break;
|
||||
|
||||
case BEGIN:
|
||||
if (*__first != '\'')
|
||||
return __first;
|
||||
state = IN_STRING;
|
||||
break;
|
||||
|
||||
case IN_STRING:
|
||||
if (! (*__first != '\n'))
|
||||
return __last;
|
||||
|
||||
if (*__first == '\'')
|
||||
state = END;
|
||||
else if (*__first == '\\')
|
||||
state = QUOTE;
|
||||
break;
|
||||
|
||||
case QUOTE:
|
||||
state = IN_STRING;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return __first;
|
||||
}
|
||||
const char *operator () (const char *first, const char *last);
|
||||
};
|
||||
|
||||
struct pp_skip_argument
|
||||
@@ -321,60 +112,9 @@ struct pp_skip_argument
|
||||
pp_skip_comment_or_divop skip_comment_or_divop;
|
||||
int lines;
|
||||
|
||||
|
||||
const char *operator () (const char *__first, const char *__last)
|
||||
{
|
||||
int depth = 0;
|
||||
lines = 0;
|
||||
|
||||
while (__first != __last)
|
||||
{
|
||||
if (!depth && (*__first == ')' || *__first == ','))
|
||||
break;
|
||||
else if (*__first == '(')
|
||||
++depth, ++__first;
|
||||
else if (*__first == ')')
|
||||
--depth, ++__first;
|
||||
else if (*__first == '\"')
|
||||
{
|
||||
__first = skip_string_literal (__first, __last);
|
||||
lines += skip_string_literal.lines;
|
||||
}
|
||||
else if (*__first == '\'')
|
||||
{
|
||||
__first = skip_char_literal (__first, __last);
|
||||
lines += skip_char_literal.lines;
|
||||
}
|
||||
else if (*__first == '/')
|
||||
{
|
||||
__first = skip_comment_or_divop (__first, __last);
|
||||
lines += skip_comment_or_divop.lines;
|
||||
}
|
||||
else if (pp_isalpha (*__first) || *__first == '_')
|
||||
{
|
||||
__first = skip_identifier (__first, __last);
|
||||
lines += skip_identifier.lines;
|
||||
}
|
||||
else if (pp_isdigit (*__first))
|
||||
{
|
||||
__first = skip_number (__first, __last);
|
||||
lines += skip_number.lines;
|
||||
}
|
||||
else if (*__first == '\n')
|
||||
{
|
||||
++__first;
|
||||
++lines;
|
||||
}
|
||||
else
|
||||
++__first;
|
||||
}
|
||||
|
||||
return __first;
|
||||
}
|
||||
const char *operator () (const char *first, const char *last);
|
||||
};
|
||||
|
||||
} // namespace CPlusPlus
|
||||
|
||||
#endif // PP_SCANNER_H
|
||||
|
||||
// kate: space-indent on; indent-width 2; replace-tabs on;
|
||||
#endif // CPLUSPLUS_PP_SCANNER_H
|
||||
|
||||
@@ -50,20 +50,14 @@
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef PP_H
|
||||
#define PP_H
|
||||
#ifndef CPLUSPLUS_PREPROCESSOR_H
|
||||
#define CPLUSPLUS_PREPROCESSOR_H
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <cctype>
|
||||
|
||||
#include "pp-cctype.h"
|
||||
#include "pp-internal.h"
|
||||
#include "pp-macro.h"
|
||||
#include "pp-environment.h"
|
||||
#include "Macro.h"
|
||||
#include "PreprocessorClient.h"
|
||||
#include "PreprocessorEnvironment.h"
|
||||
#include "pp-scanner.h"
|
||||
#include "pp-macro-expander.h"
|
||||
#include "pp-engine.h"
|
||||
#include "pp-client.h"
|
||||
|
||||
#endif // PP_H
|
||||
#endif // CPLUSPLUS_PREPROCESSOR_H
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
/*!
|
||||
\class ExtensionSystem::IPlugin
|
||||
\mainclass
|
||||
\brief Base class for all plugins.
|
||||
|
||||
The IPlugin class is an abstract class that must be implemented
|
||||
@@ -304,7 +305,7 @@ void IPlugin::addObject(QObject *obj)
|
||||
plugin pool. Usually, registered objects must be removed from
|
||||
the object pool and deleted by hand.
|
||||
Objects added to the pool via addAutoReleasedObject are automatically
|
||||
removed and deleted in \i reverse order of registration when
|
||||
removed and deleted in reverse order of registration when
|
||||
the IPlugin instance is destroyed.
|
||||
\sa PluginManager::addObject()
|
||||
*/
|
||||
|
||||
@@ -54,7 +54,8 @@ enum { debugLeaks = 0 };
|
||||
|
||||
/*!
|
||||
\namespace ExtensionSystem
|
||||
\brief Classes that belong to the core plugin system.
|
||||
\brief The ExtensionSystem namespace provides
|
||||
classes that belong to the core plugin system.
|
||||
|
||||
The basic extension system contains of the plugin manager and its supporting classes,
|
||||
and the IPlugin interface that must be implemented by plugin providers.
|
||||
@@ -444,11 +445,19 @@ void PluginManager::startTests()
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
* \fn bool PluginManager::runningTests() const
|
||||
* \internal
|
||||
*/
|
||||
bool PluginManager::runningTests() const
|
||||
{
|
||||
return !d->testSpecs.isEmpty();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \fn QString PluginManager::testDataDirectory() const
|
||||
* \internal
|
||||
*/
|
||||
QString PluginManager::testDataDirectory() const
|
||||
{
|
||||
QString s = QString::fromLocal8Bit(qgetenv("IDETESTDIR"));
|
||||
|
||||
@@ -221,7 +221,7 @@ QList<PluginDependency> PluginSpec::dependencies() const
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn PluginOptionDescriptions optionDescriptions() const
|
||||
\fn PluginSpec::PluginArgumentDescriptions PluginSpec::argumentDescriptions() const
|
||||
Returns a list of descriptions of command line arguments the plugin processes.
|
||||
*/
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ struct PathChooserPrivate
|
||||
PathValidatingLineEdit *m_lineEdit;
|
||||
PathChooser::Kind m_acceptingKind;
|
||||
QString m_dialogTitleOverride;
|
||||
QString m_initialBrowsePathOverride;
|
||||
};
|
||||
|
||||
PathChooserPrivate::PathChooserPrivate(PathChooser *chooser) :
|
||||
@@ -138,15 +139,20 @@ QString PathChooser::path() const
|
||||
|
||||
void PathChooser::setPath(const QString &path)
|
||||
{
|
||||
const QString defaultPath = path.isEmpty() ? homePath() : path;
|
||||
m_d->m_lineEdit->setText(QDir::toNativeSeparators(defaultPath));
|
||||
m_d->m_lineEdit->setText(QDir::toNativeSeparators(path));
|
||||
}
|
||||
|
||||
void PathChooser::slotBrowse()
|
||||
{
|
||||
emit beforeBrowsing();
|
||||
|
||||
QString predefined = path();
|
||||
if (!predefined.isEmpty() && !QFileInfo(predefined).isDir())
|
||||
if ((predefined.isEmpty() || !QFileInfo(predefined).isDir())
|
||||
&& !m_d->m_initialBrowsePathOverride.isNull()) {
|
||||
predefined = m_d->m_initialBrowsePathOverride;
|
||||
if (!QFileInfo(predefined).isDir())
|
||||
predefined.clear();
|
||||
}
|
||||
|
||||
// Prompt for a file/dir
|
||||
QString dialogTitle;
|
||||
@@ -167,13 +173,15 @@ void PathChooser::slotBrowse()
|
||||
;
|
||||
}
|
||||
|
||||
// TODO make cross-platform
|
||||
// Delete trailing slashes unless it is "/", only
|
||||
// Delete trailing slashes unless it is "/"|"\\", only
|
||||
if (!newPath.isEmpty()) {
|
||||
newPath = QDir::toNativeSeparators(newPath);
|
||||
if (newPath.size() > 1 && newPath.endsWith(QDir::separator()))
|
||||
newPath.truncate(newPath.size() - 1);
|
||||
setPath(newPath);
|
||||
}
|
||||
|
||||
emit browsingFinished();
|
||||
}
|
||||
|
||||
bool PathChooser::isValid() const
|
||||
@@ -270,6 +278,11 @@ void PathChooser::setPromptDialogTitle(const QString &title)
|
||||
m_d->m_dialogTitleOverride = title;
|
||||
}
|
||||
|
||||
void PathChooser::setInitialBrowsePathBackup(const QString &path)
|
||||
{
|
||||
m_d->m_initialBrowsePathOverride = path;
|
||||
}
|
||||
|
||||
QString PathChooser::makeDialogTitle(const QString &title)
|
||||
{
|
||||
if (m_d->m_dialogTitleOverride.isNull())
|
||||
|
||||
@@ -71,6 +71,8 @@ public:
|
||||
|
||||
void setPromptDialogTitle(const QString &title);
|
||||
|
||||
void setInitialBrowsePathBackup(const QString &path);
|
||||
|
||||
bool isValid() const;
|
||||
QString errorMessage() const;
|
||||
|
||||
@@ -91,6 +93,8 @@ private:
|
||||
signals:
|
||||
void validChanged();
|
||||
void changed();
|
||||
void beforeBrowsing();
|
||||
void browsingFinished();
|
||||
void returnPressed();
|
||||
|
||||
public slots:
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<plugin name="BinEditor" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="BinEditor" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Binary editor component.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="TextEditor" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
<dependency name="TextEditor" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<plugin name="Bookmarks" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="Bookmarks" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Bookmarks in text editors.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="TextEditor" version="0.9.1"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="TextEditor" version="0.9.2"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.2"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<plugin name="CMakeProjectManager" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="CMakeProjectManager" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>### TODO</license>
|
||||
<description>CMake support</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="TextEditor" version="0.9.1"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.1"/>
|
||||
<dependency name="CppTools" version="0.9.1"/>
|
||||
<dependency name="CppEditor" version="0.9.1"/>
|
||||
<dependency name="Help" version="0.9.1"/>
|
||||
<dependency name="TextEditor" version="0.9.2"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.2"/>
|
||||
<dependency name="CppTools" version="0.9.2"/>
|
||||
<dependency name="CppEditor" version="0.9.2"/>
|
||||
<dependency name="Help" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -99,7 +99,7 @@ QString CMakeBuildStepConfigWidget::displayName() const
|
||||
return "CMake";
|
||||
}
|
||||
|
||||
void CMakeBuildStepConfigWidget::init(const QString &buildConfiguration)
|
||||
void CMakeBuildStepConfigWidget::init(const QString & /*buildConfiguration */)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
@@ -121,12 +121,12 @@ ProjectExplorer::BuildStep *CMakeBuildStepFactory::create(ProjectExplorer::Proje
|
||||
return new CMakeStep(pro);
|
||||
}
|
||||
|
||||
QStringList CMakeBuildStepFactory::canCreateForProject(ProjectExplorer::Project *pro) const
|
||||
QStringList CMakeBuildStepFactory::canCreateForProject(ProjectExplorer::Project * /* pro */) const
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
QString CMakeBuildStepFactory::displayNameForName(const QString &name) const
|
||||
QString CMakeBuildStepFactory::displayNameForName(const QString & /* name */) const
|
||||
{
|
||||
return "CMake";
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ QString MakeBuildStepConfigWidget::displayName() const
|
||||
return "Make";
|
||||
}
|
||||
|
||||
void MakeBuildStepConfigWidget::init(const QString &buildConfiguration)
|
||||
void MakeBuildStepConfigWidget::init(const QString & /* buildConfiguration */)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
@@ -115,12 +115,12 @@ ProjectExplorer::BuildStep *MakeBuildStepFactory::create(ProjectExplorer::Projec
|
||||
return new MakeStep(pro);
|
||||
}
|
||||
|
||||
QStringList MakeBuildStepFactory::canCreateForProject(ProjectExplorer::Project *pro) const
|
||||
QStringList MakeBuildStepFactory::canCreateForProject(ProjectExplorer::Project * /* pro */) const
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
QString MakeBuildStepFactory::displayNameForName(const QString &name) const
|
||||
QString MakeBuildStepFactory::displayNameForName(const QString & /* name */) const
|
||||
{
|
||||
return "Make";
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<plugin name="Core" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="Core" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Constants {
|
||||
|
||||
#define IDE_VERSION_MAJOR 0
|
||||
#define IDE_VERSION_MINOR 9
|
||||
#define IDE_VERSION_RELEASE 1
|
||||
#define IDE_VERSION_RELEASE 2
|
||||
|
||||
#define STRINGIFY_INTERNAL(x) #x
|
||||
#define STRINGIFY(x) STRINGIFY_INTERNAL(x)
|
||||
@@ -52,7 +52,7 @@ namespace Constants {
|
||||
|
||||
const char * const IDE_VERSION_LONG = IDE_VERSION;
|
||||
const char * const IDE_AUTHOR = "Nokia Corporation";
|
||||
const char * const IDE_YEAR = "2008";
|
||||
const char * const IDE_YEAR = "2009";
|
||||
|
||||
#ifdef IDE_REVISION
|
||||
const char * const IDE_REVISION_STR = STRINGIFY(IDE_REVISION);
|
||||
|
||||
@@ -47,6 +47,8 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &initialCategory,
|
||||
setupUi(this);
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||
|
||||
connect(buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply()));
|
||||
|
||||
splitter->setCollapsible(1, false);
|
||||
pageTree->header()->setVisible(false);
|
||||
|
||||
@@ -135,3 +137,9 @@ void SettingsDialog::reject()
|
||||
page->finished(false);
|
||||
done(QDialog::Rejected);
|
||||
}
|
||||
|
||||
void SettingsDialog::apply()
|
||||
{
|
||||
foreach (IOptionsPage *page, m_pages)
|
||||
page->finished(true);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ private slots:
|
||||
void pageSelected(QTreeWidgetItem *cat);
|
||||
void accept();
|
||||
void reject();
|
||||
void apply();
|
||||
|
||||
private:
|
||||
QList<Core::IOptionsPage*> m_pages;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SettingsDialog</class>
|
||||
<widget class="QDialog" name="SettingsDialog">
|
||||
@@ -13,12 +14,12 @@
|
||||
<string>Options</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
@@ -26,9 +27,7 @@
|
||||
</property>
|
||||
<widget class="QTreeWidget" name="pageTree">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>7</vsizetype>
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -44,12 +43,12 @@
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedPages">
|
||||
<property name="minimumSize">
|
||||
@@ -77,7 +76,7 @@
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -319,6 +319,7 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) :
|
||||
IActionContainer *advancedMenu = am->createMenu(Constants::M_EDIT_ADVANCED);
|
||||
medit->addMenu(advancedMenu, Constants::G_EDIT_FORMAT);
|
||||
advancedMenu->menu()->setTitle(tr("&Advanced"));
|
||||
|
||||
cmd = am->registerAction(m_d->m_openInExternalEditorAction, Constants::OPEN_IN_EXTERNAL_EDITOR, editManagerContext);
|
||||
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+V,Alt+I")));
|
||||
advancedMenu->addAction(cmd);
|
||||
|
||||
@@ -65,6 +65,7 @@ enum MakeWritableResult {
|
||||
};
|
||||
|
||||
struct EditorManagerPrivate;
|
||||
|
||||
namespace Internal {
|
||||
class OpenEditorsWindow;
|
||||
class EditorSplitter;
|
||||
@@ -224,7 +225,8 @@ private:
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class EditorClosingCoreListener : public ICoreListener {
|
||||
class EditorClosingCoreListener : public ICoreListener
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
@@ -323,6 +323,7 @@ void FancyTabWidget::paintEvent(QPaintEvent *event)
|
||||
QPainter p(this);
|
||||
|
||||
QRect rect = m_selectionWidget->rect().adjusted(0, 0, 1, 0);
|
||||
rect = style()->visualRect(layoutDirection(), geometry(), rect);
|
||||
StyleHelper::verticalGradient(&p, rect, rect);
|
||||
p.setPen(StyleHelper::borderColor());
|
||||
p.drawLine(rect.topRight(), rect.bottomRight());
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
<string>Reset to default</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
<string>R</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="core.qrc">
|
||||
@@ -114,7 +114,7 @@
|
||||
<string>Reset to default</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
<string>R</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="core.qrc">
|
||||
|
||||
@@ -49,12 +49,12 @@ QKeySequence INavigationWidgetFactory::activationSequence()
|
||||
}
|
||||
|
||||
|
||||
void INavigationWidgetFactory::saveSettings(int position, QWidget *widget)
|
||||
void INavigationWidgetFactory::saveSettings(int /* position */, QWidget * /* widget */)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void INavigationWidgetFactory::restoreSettings(int position, QWidget *widget)
|
||||
void INavigationWidgetFactory::restoreSettings(int /* position */, QWidget * /* widget */)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -625,6 +625,7 @@ void MainWindow::registerDefaultActions()
|
||||
// Toggle Sidebar Action
|
||||
m_toggleSideBarAction = new QAction(QIcon(Constants::ICON_TOGGLE_SIDEBAR),
|
||||
tr("Toggle Sidebar"), this);
|
||||
m_toggleSideBarAction->setCheckable(true);
|
||||
cmd = am->registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, m_globalContext);
|
||||
#ifdef Q_OS_MAC
|
||||
cmd->setDefaultKeySequence(QKeySequence("Ctrl+0"));
|
||||
|
||||
@@ -822,10 +822,12 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti
|
||||
}
|
||||
|
||||
State mflags = bflags;
|
||||
if (toolbutton->state & State_Sunken) {
|
||||
if (toolbutton->activeSubControls & SC_ToolButton)
|
||||
bflags |= State_Sunken;
|
||||
if (toolbutton->activeSubControls & SC_ToolButtonMenu)
|
||||
mflags |= State_Sunken;
|
||||
}
|
||||
|
||||
QStyleOption tool(0);
|
||||
tool.palette = toolbutton->palette;
|
||||
@@ -894,11 +896,12 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti
|
||||
tool.rect = tool.rect.adjusted(2, 2, -2, -2);
|
||||
drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget);
|
||||
} else if (toolbutton->features & QStyleOptionToolButton::HasMenu) {
|
||||
int mbi = pixelMetric(PM_MenuButtonIndicator, toolbutton, widget);
|
||||
int arrowSize = 6;
|
||||
QRect ir = toolbutton->rect.adjusted(1, 1, -1, -1);
|
||||
QStyleOptionToolButton newBtn = *toolbutton;
|
||||
newBtn.palette = panelPalette(option->palette);
|
||||
newBtn.rect = QRect(ir.right() + 5 - mbi, ir.height() - mbi + 4, mbi - 6, mbi - 6);
|
||||
newBtn.rect = QRect(ir.right() - arrowSize - 1,
|
||||
ir.height() - arrowSize - 2, arrowSize, arrowSize);
|
||||
QWindowsStyle::drawPrimitive(PE_IndicatorArrowDown, &newBtn, painter, widget);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user