add operators to LDDocument

Thu, 11 Jan 2018 16:46:22 +0200

author
Santeri Piippo
date
Thu, 11 Jan 2018 16:46:22 +0200
changeset 1253
468a32ae8100
parent 1233
ff8561fc088f
child 1361
6d083035fcb4

add operators to LDDocument

src/editmodes/magicWandMode.cpp file | annotate | diff | comparison | revisions
src/ldDocument.cpp file | annotate | diff | comparison | revisions
src/ldDocument.h file | annotate | diff | comparison | revisions
--- a/src/editmodes/magicWandMode.cpp	Thu Jan 11 15:41:58 2018 +0200
+++ b/src/editmodes/magicWandMode.cpp	Thu Jan 11 16:46:22 2018 +0200
@@ -61,9 +61,15 @@
 				// Boundary found. If it's an edgeline, add it to the boundaries list, if a
 				// conditional line, select it.
 				if (candidate->type() == OBJ_CondLine)
+				{
 					m_selection << candidate;
+				}
 				else
-					boundaries.append({candidate->vertex(0), candidate->vertex(1)});
+				{
+					boundaries.append(std::make_pair(
+						candidate->vertex(0),
+						candidate->vertex(1)));
+				}
 
 				break;
 			}
--- a/src/ldDocument.cpp	Thu Jan 11 15:41:58 2018 +0200
+++ b/src/ldDocument.cpp	Thu Jan 11 16:46:22 2018 +0200
@@ -902,3 +902,11 @@
 {
 	m_needVertexMerge = true;
 }
+
+LDObject* LDDocument::operator[](int i) const
+{
+	if (i >= 0 and i < m_objects.size())
+		return m_objects[i];
+	else
+		throw std::out_of_range {"bad index"};
+}
--- a/src/ldDocument.h	Thu Jan 11 15:41:58 2018 +0200
+++ b/src/ldDocument.h	Thu Jan 11 16:46:22 2018 +0200
@@ -100,6 +100,9 @@
 
 	static QString shortenName(QString a); // Turns a full path into a relative path
 
+	void operator=(const LDDocument&) = delete;
+	LDObject* operator[](int i) const;
+
 signals:
 	void closed();
 

mercurial