src/ldDocument.cpp

changeset 1063
1f15c52c11f6
parent 1045
f726f8f49c7e
child 1064
4c7a353cf583
--- a/src/ldDocument.cpp	Sat Jan 28 13:49:09 2017 +0200
+++ b/src/ldDocument.cpp	Sat Jan 28 14:01:19 2017 +0200
@@ -49,7 +49,7 @@
 {
 	m_flags |= IsBeingDestroyed;
 
-	for (int i = 0; i < m_objects.size(); ++i)
+	for (int i = 0; i < length(m_objects); ++i)
 		m_objects[i]->destroy();
 
 	delete m_history;
@@ -294,7 +294,7 @@
 		data.append (subdata);
 
 		if (sizeptr)
-			*sizeptr += subdata.size();
+			*sizeptr += length(subdata);
 	}
 
 	QFile f (path);
@@ -326,8 +326,8 @@
 //
 static void CheckTokenCount (const QStringList& tokens, int num)
 {
-	if (tokens.size() != num)
-		throw QString (format ("Bad amount of tokens, expected %1, got %2", num, tokens.size()));
+	if (length(tokens) != num)
+		throw QString (format ("Bad amount of tokens, expected %1, got %2", num, length(tokens)));
 }
 
 // =============================================================================
@@ -395,7 +395,7 @@
 	{
 		QStringList tokens = line.split (" ", QString::SkipEmptyParts);
 
-		if (tokens.size() <= 0)
+		if (length(tokens) <= 0)
 		{
 			// Line was empty, or only consisted of whitespace
 			return LDSpawn<LDEmpty>();
@@ -415,7 +415,7 @@
 				QString commentTextSimplified (commentText.simplified());
 
 				// Handle BFC statements
-				if (tokens.size() > 2 and tokens[1] == "BFC")
+				if (length(tokens) > 2 and tokens[1] == "BFC")
 				{
 					for (BfcStatement statement : iterateEnum<BfcStatement>())
 					{
@@ -434,7 +434,7 @@
 						return LDSpawn<LDBfc> (BfcStatement::NoClip);
 				}
 
-				if (tokens.size() > 2 and tokens[1] == "!LDFORGE")
+				if (length(tokens) > 2 and tokens[1] == "!LDFORGE")
 				{
 					// Handle LDForge-specific types, they're embedded into comments too
 					if (tokens[2] == "OVERLAY")
@@ -605,7 +605,7 @@
 //
 int LDDocument::addObject (LDObject* obj)
 {
-	history()->add (new AddHistoryEntry (objects().size(), obj));
+	history()->add (new AddHistoryEntry (length(objects()), obj));
 	m_objects << obj;
 	addKnownVertices (obj);
 	obj->setDocument (this);
@@ -683,7 +683,7 @@
 //
 void LDDocument::setObjectAt (int idx, LDObject* obj)
 {
-	if (idx < 0 or idx >= m_objects.size())
+	if (idx < 0 or idx >= length(m_objects))
 		return;
 
 	// Mark this change to history
@@ -708,7 +708,7 @@
 //
 LDObject* LDDocument::getObject (int pos) const
 {
-	if (pos < m_objects.size())
+	if (pos < length(m_objects))
 		return m_objects[pos];
 	else
 		return nullptr;
@@ -718,7 +718,7 @@
 //
 int LDDocument::getObjectCount() const
 {
-	return objects().size();
+	return length(objects());
 }
 
 // =============================================================================

mercurial