src/model.h

changeset 1187
46dc716238fd
parent 1186
eae8b3bce545
child 1188
872c4a3f4151
--- a/src/model.h	Sun Mar 05 16:47:52 2017 +0200
+++ b/src/model.h	Sun Mar 05 16:50:06 2017 +0200
@@ -36,12 +36,12 @@
 	Model(const Model& other) = delete;
 
 	bool swapObjects(LDObject* one, LDObject* other);
-	template<typename T, typename... Args> T* emplace(Args&& ...args);
-	template<typename T, typename... Args> T* emplaceAt(int position, Args&& ...args);
-	template<typename T, typename... Args> T* emplaceReplacement(LDObject* object, Args&& ...args);
+	template<typename T, typename... Args> T* append(Args&& ...args);
+	template<typename T, typename... Args> T* insert(int position, Args&& ...args);
+	template<typename T, typename... Args> T* replace(LDObject* object, Args&& ...args);
 	void removeAt(int position);
 	void remove(LDObject* object);
-	void replace(LDObject *object, Model& model);
+	void replace(LDObject* object, Model& model);
 	void clear();
 	void merge(Model& other, int position = -1, Filter filter = nullptr, Callback callback = nullptr);
 	int size() const;
@@ -54,7 +54,7 @@
 	bool isEmpty() const;
 	class DocumentManager* documentManager() const;
 	LDObject* insertFromString(int position, QString line);
-	LDObject* addFromString(QString line);
+	LDObject* appendFromString(QString line);
 	LDObject* replaceWithFromString(LDObject* object, QString line);
 
 signals:
@@ -89,10 +89,10 @@
  *
  * This constructor can be invoked as such:
  *
- *     model->emplace<LDLine>(v1, v2);
+ *     model->append<LDLine>(v1, v2);
  */
 template<typename T, typename... Args>
-T* Model::emplace(Args&& ...args)
+T* Model::append(Args&& ...args)
 {
 	T* object = _objects.append<T>(args..., this);
 	finalizeNewObject(size() - 1, object);
@@ -100,11 +100,11 @@
 }
 
 /*
- * Like emplace<>() but also takes a position as the first argument and emplaces the object at the given position instead of the
+ * Like append<>() but also takes a position as the first argument and emplaces the object at the given position instead of the
  * end of the model.
  */
 template<typename T, typename... Args>
-T* Model::emplaceAt(int position, Args&& ...args)
+T* Model::insert(int position, Args&& ...args)
 {
 	T* object = _objects.insert<T>(position, args..., this);
 	finalizeNewObject(position, object);
@@ -112,11 +112,11 @@
 }
 
 /*
- * Like emplace<>() but instead of inserting the constructed object, the new object replaces the object given in the first parameter.
+ * Like append<>() but instead of inserting the constructed object, the new object replaces the object given in the first parameter.
  * If the old object cannot be replaced, the new object will not be constructed at all.
  */
 template<typename T, typename... Args>
-T* Model::emplaceReplacement(LDObject* object, Args&& ...args)
+T* Model::replace(LDObject* object, Args&& ...args)
 {
 	if (object->model() == this)
 	{

mercurial