summaryrefslogtreecommitdiffstats
path: root/src/tools/moc/moc.cpp
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2010-03-17 00:29:17 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2010-03-19 05:01:45 (GMT)
commit78e1a866ba5d594233db80f7aab88331db237d3a (patch)
tree8e9a05b5fa6db273a7de2528e7c1b611a4372cda /src/tools/moc/moc.cpp
parent4537b52520e0829ba89666c114d8da14d74b768e (diff)
downloadQt-78e1a866ba5d594233db80f7aab88331db237d3a.zip
Qt-78e1a866ba5d594233db80f7aab88331db237d3a.tar.gz
Qt-78e1a866ba5d594233db80f7aab88331db237d3a.tar.bz2
Implement Q_PRIVATE_PROPERTY that allows you to declare properties
where the read/write are in the d pointer. Works like Q_PRIVATE_SLOT. Reviewed-by:olivier Reviewed-by:akennedy Reviewed-by:warwick allison
Diffstat (limited to 'src/tools/moc/moc.cpp')
-rw-r--r--src/tools/moc/moc.cpp44
1 files changed, 39 insertions, 5 deletions
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index 94ad56f..680b8a5 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -658,6 +658,9 @@ void Moc::parse()
case Q_PRIVATE_SLOT_TOKEN:
parseSlotInPrivate(&def, access);
break;
+ case Q_PRIVATE_PROPERTY_TOKEN:
+ parsePrivateProperty(&def);
+ break;
case ENUM: {
EnumDef enumDef;
if (parseEnum(&enumDef))
@@ -872,11 +875,8 @@ void Moc::parseSignals(ClassDef *def)
}
}
-
-void Moc::parseProperty(ClassDef *def)
+void Moc::createPropertyDef(PropertyDef &propDef)
{
- next(LPAREN);
- PropertyDef propDef;
QByteArray type = parseType().name;
if (type.isEmpty())
error();
@@ -964,7 +964,6 @@ void Moc::parseProperty(ClassDef *def)
error(2);
}
}
- next(RPAREN);
if (propDef.read.isNull()) {
QByteArray msg;
msg += "Property declaration ";
@@ -988,6 +987,41 @@ void Moc::parseProperty(ClassDef *def)
propDef.constant = false;
warning(msg.constData());
}
+}
+
+void Moc::parseProperty(ClassDef *def)
+{
+ next(LPAREN);
+ PropertyDef propDef;
+ createPropertyDef(propDef);
+ next(RPAREN);
+
+
+ if(!propDef.notify.isEmpty())
+ def->notifyableProperties++;
+ def->propertyList += propDef;
+}
+
+void Moc::parsePrivateProperty(ClassDef *def)
+{
+ next(LPAREN);
+ PropertyDef propDef;
+ next(IDENTIFIER);
+ propDef.inPrivateClass = lexem();
+ while (test(SCOPE)) {
+ propDef.inPrivateClass += lexem();
+ next(IDENTIFIER);
+ propDef.inPrivateClass += lexem();
+ }
+ // also allow void functions
+ if (test(LPAREN)) {
+ next(RPAREN);
+ propDef.inPrivateClass += "()";
+ }
+
+ next(COMMA);
+
+ createPropertyDef(propDef);
if(!propDef.notify.isEmpty())
def->notifyableProperties++;