Changeset 846 for trunk/src/tools/moc/moc.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/tools/moc/moc.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 231 231 } 232 232 while (test(CONST) || test(VOLATILE) || test(SIGNED) || test(UNSIGNED) 233 || test(STAR) || test(AND) ) {233 || test(STAR) || test(AND) || test(ANDAND)) { 234 234 type.name += ' '; 235 235 type.name += lexem(); 236 236 if (lookup(0) == AND) 237 237 type.referenceType = Type::Reference; 238 else if (lookup(0) == ANDAND) 239 type.referenceType = Type::RValueReference; 238 240 else if (lookup(0) == STAR) 239 241 type.referenceType = Type::Pointer; … … 726 728 727 729 checkSuperClasses(&def); 730 checkProperties(&def); 728 731 729 732 classList += def; … … 1207 1210 } 1208 1211 } 1212 1213 //when searching commas within the default argument, we should take care of template depth (anglecount) 1214 // unfortunatelly, we do not have enough semantic information to know if '<' is the operator< or 1215 // the beginning of a template type. so we just use heuristics. 1216 int possible = -1; 1217 1209 1218 while (index < symbols.size()) { 1210 1219 Token t = symbols.at(index++).token; … … 1225 1234 && brackCount <= 0 1226 1235 && parenCount <= 0 1227 && (target != RANGLE || angleCount <= 0)) 1236 && (target != RANGLE || angleCount <= 0)) { 1237 if (target != COMMA || angleCount <= 0) 1238 return true; 1239 possible = index; 1240 } 1241 1242 if (target == COMMA && t == EQ && possible != -1) { 1243 index = possible; 1228 1244 return true; 1245 } 1229 1246 1230 1247 if (braceCount < 0 || brackCount < 0 || parenCount < 0 … … 1234 1251 } 1235 1252 } 1253 1254 if(target == COMMA && angleCount != 0 && possible != -1) { 1255 index = possible; 1256 return true; 1257 } 1258 1236 1259 return false; 1237 1260 } … … 1291 1314 } 1292 1315 1316 void Moc::checkProperties(ClassDef *cdef) 1317 { 1318 // 1319 // specify get function, for compatibiliy we accept functions 1320 // returning pointers, or const char * for QByteArray. 1321 // 1322 for (int i = 0; i < cdef->propertyList.count(); ++i) { 1323 PropertyDef &p = cdef->propertyList[i]; 1324 if (p.read.isEmpty()) 1325 continue; 1326 for (int j = 0; j < cdef->publicList.count(); ++j) { 1327 const FunctionDef &f = cdef->publicList.at(j); 1328 if (f.name != p.read) 1329 continue; 1330 if (!f.isConst) // get functions must be const 1331 continue; 1332 if (f.arguments.size()) // and must not take any arguments 1333 continue; 1334 PropertyDef::Specification spec = PropertyDef::ValueSpec; 1335 QByteArray tmp = f.normalizedType; 1336 if (p.type == "QByteArray" && tmp == "const char *") 1337 tmp = "QByteArray"; 1338 if (tmp.left(6) == "const ") 1339 tmp = tmp.mid(6); 1340 if (p.type != tmp && tmp.endsWith('*')) { 1341 tmp.chop(1); 1342 spec = PropertyDef::PointerSpec; 1343 } else if (f.type.name.endsWith('&')) { // raw type, not normalized type 1344 spec = PropertyDef::ReferenceSpec; 1345 } 1346 if (p.type != tmp) 1347 continue; 1348 p.gspec = spec; 1349 break; 1350 } 1351 if(!p.notify.isEmpty()) { 1352 int notifyId = -1; 1353 for (int j = 0; j < cdef->signalList.count(); ++j) { 1354 const FunctionDef &f = cdef->signalList.at(j); 1355 if(f.name != p.notify) { 1356 continue; 1357 } else { 1358 notifyId = j /* Signal indexes start from 0 */; 1359 break; 1360 } 1361 } 1362 p.notifyId = notifyId; 1363 if (notifyId == -1) { 1364 QByteArray msg = "NOTIFY signal '" + p.notify + "' of property '" + p.name 1365 + "' does not exist in class " + cdef->classname + "."; 1366 error(msg.constData()); 1367 } 1368 } 1369 } 1370 } 1371 1372 1293 1373 1294 1374 QT_END_NAMESPACE
Note:
See TracChangeset
for help on using the changeset viewer.