diff -r af81220741d9 -r 1a6f1997fcbe src/ldDocument.cc --- a/src/ldDocument.cc Sat Aug 22 13:51:20 2015 +0300 +++ b/src/ldDocument.cc Sat Aug 22 15:37:02 2015 +0300 @@ -395,7 +395,7 @@ // User wishes to abort, so stop here now. if (isAborted()) { - for (LDObjectPtr obj : m_objects) + for (LDObject* obj : m_objects) obj->destroy(); m_objects.clear(); @@ -416,13 +416,13 @@ while (line.endsWith ("\n") or line.endsWith ("\r")) line.chop (1); - LDObjectPtr obj = ParseLine (line); + LDObject* obj = ParseLine (line); // Check for parse errors and warn about tthem if (obj->type() == OBJ_Error) { print ("Couldn't parse line #%1: %2", - progress() + 1, obj.staticCast()->reason()); + progress() + 1, static_cast (obj)->reason()); if (warnings() != null) (*warnings())++; @@ -746,12 +746,12 @@ // files on the parts tracker. QStringList unknowns; - for (LDObjectPtr obj : file->objects()) + for (LDObject* obj : file->objects()) { - if (obj->type() != OBJ_Error or obj.staticCast()->fileReferenced().isEmpty()) + if (obj->type() != OBJ_Error or static_cast (obj)->fileReferenced().isEmpty(j) continue; - unknowns << obj.staticCast()->fileReferenced(); + unknowns << static_cast (obj)->fileReferenced(); } if (cfg::TryDownloadMissingFiles and not unknowns.isEmpty()) @@ -784,11 +784,11 @@ path = fullPath(); // If the second object in the list holds the file name, update that now. - LDObjectPtr nameObject = getObject (1); + LDObject* nameObject = getObject (1); if (nameObject != null and nameObject->type() == OBJ_Comment) { - LDCommentPtr nameComment = nameObject.staticCast(); + LDCommentPtr nameComment = static_cast (nameObject); if (nameComment->text().left (6) == "Name: ") { @@ -803,9 +803,8 @@ if (sizeptr != null) *sizeptr = 0; - // File is open, now save the model to it. Note that LDraw requires files to - // have DOS line endings, so we terminate the lines with \r\n. - for (LDObjectPtr obj : objects()) + // File is open, now save the model to it. Note that LDraw requires files to have DOS line endings. + for (LDObject* obj : objects()) { QByteArray subdata ((obj->asText() + "\r\n").toUtf8()); data.append (subdata); @@ -836,7 +835,7 @@ // void LDDocument::clear() { - for (LDObjectPtr obj : objects()) + for (LDObject* obj : objects()) forgetObject (obj); } @@ -908,7 +907,7 @@ // code and returns the object parsed from it. parseLine never returns null, // the object will be LDError if it could not be parsed properly. // ============================================================================= -LDObjectPtr ParseLine (QString line) +LDObject* ParseLine (QString line) { try { @@ -1066,7 +1065,7 @@ CheckTokenNumbers (tokens, 1, 13); // Quadrilateral / Conditional line - LDObjectPtr obj; + LDObject* obj; if (num == 4) obj = LDSpawn(); @@ -1113,11 +1112,11 @@ print ("Reloading subfiles of %1", getDisplayName()); // Go through all objects in the current file and reload the subfiles - for (LDObjectPtr obj : objects()) + for (LDObject* obj : objects()) { if (obj->type() == OBJ_Subfile) { - LDSubfilePtr ref = obj.staticCast(); + LDSubfilePtr ref = static_cast (obj); LDDocumentPtr fileInfo = GetDocument (ref->fileInfo()->name()); if (fileInfo != null) @@ -1134,7 +1133,7 @@ // Reparse gibberish files. It could be that they are invalid because // of loading errors. Circumstances may be different now. if (obj->type() == OBJ_Error) - obj->replace (ParseLine (obj.staticCast()->contents())); + obj->replace (ParseLine (static_cast (obj)->contents())); } m_needsReCache = true; @@ -1145,7 +1144,7 @@ // ============================================================================= // -int LDDocument::addObject (LDObjectPtr obj) +int LDDocument::addObject (LDObject* obj) { history()->add (new AddHistory (objects().size(), obj)); m_objects << obj; @@ -1159,7 +1158,7 @@ // void LDDocument::addObjects (const LDObjectList& objs) { - for (LDObjectPtr obj : objs) + for (LDObject* obj : objs) { if (obj != null) addObject (obj); @@ -1168,7 +1167,7 @@ // ============================================================================= // -void LDDocument::insertObj (int pos, LDObjectPtr obj) +void LDDocument::insertObj (int pos, LDObject* obj) { history()->add (new AddHistory (pos, obj)); m_objects.insert (pos, obj); @@ -1184,7 +1183,7 @@ // ============================================================================= // -void LDDocument::addKnownVertices (LDObjectPtr obj) +void LDDocument::addKnownVertices (LDObject* obj) { auto it = m_objectVertices.find (obj); @@ -1199,7 +1198,7 @@ // ============================================================================= // -void LDDocument::forgetObject (LDObjectPtr obj) +void LDDocument::forgetObject (LDObject* obj) { int idx = obj->lineNumber(); obj->deselect(); @@ -1230,7 +1229,7 @@ // ============================================================================= // -void LDDocument::setObject (int idx, LDObjectPtr obj) +void LDDocument::setObject (int idx, LDObject* obj) { assert (idx >= 0 and idx < m_objects.size()); @@ -1254,7 +1253,7 @@ // ============================================================================= // -LDObjectPtr LDDocument::getObject (int pos) const +LDObject* LDDocument::getObject (int pos) const { if (pos < m_objects.size()) return m_objects[pos]; @@ -1297,12 +1296,12 @@ { m_vertices.clear(); - for (LDObjectPtr obj : inlineContents (true, true)) + for (LDObject* obj : inlineContents (true, true)) { if (obj->type() == OBJ_Subfile) { print ("Warning: unable to inline %1 into %2", - obj.staticCast()->fileInfo()->getDisplayName(), + static_cast (obj)->fileInfo()->getDisplayName(), getDisplayName()); continue; } @@ -1323,7 +1322,7 @@ { m_objectVertices.clear(); - for (LDObjectPtr obj : inlineContents (true, false)) + for (LDObject* obj : inlineContents (true, false)) addKnownVertices (obj); mergeVertices(); @@ -1375,7 +1374,7 @@ LDObjectList objs, objcache; - for (LDObjectPtr obj : objects()) + for (LDObject* obj : objects()) { // Skip those without scemantic meaning if (not obj->isScemantic()) @@ -1385,7 +1384,7 @@ // just add it into the objects normally. Yay, recursion! if (deep == true and obj->type() == OBJ_Subfile) { - for (LDObjectPtr otherobj : obj.staticCast()->inlineContents (deep, renderinline)) + for (LDObject* otherobj : static_cast (obj)->inlineContents (deep, renderinline)) objs << otherobj; } else @@ -1468,7 +1467,7 @@ // ============================================================================= // -void LDDocument::addToSelection (LDObjectPtr obj) // [protected] +void LDDocument::addToSelection (LDObject* obj) // [protected] { if (obj->isSelected()) return; @@ -1481,7 +1480,7 @@ // ============================================================================= // -void LDDocument::removeFromSelection (LDObjectPtr obj) // [protected] +void LDDocument::removeFromSelection (LDObject* obj) // [protected] { if (not obj->isSelected()) return; @@ -1496,7 +1495,7 @@ // void LDDocument::clearSelection() { - for (LDObjectPtr obj : m_sel) + for (LDObject* obj : m_sel) removeFromSelection (obj); assert (m_sel.isEmpty()); @@ -1511,7 +1510,7 @@ // ============================================================================= // -void LDDocument::swapObjects (LDObjectPtr one, LDObjectPtr other) +void LDDocument::swapObjects (LDObject* one, LDObject* other) { int a = m_objects.indexOf (one); int b = m_objects.indexOf (other);