src/model.h

changeset 1079
67c6e5d32e68
parent 1077
952d6b3e7d11
child 1082
1738bdaf36d6
equal deleted inserted replaced
1078:c72e3115a297 1079:67c6e5d32e68
3 #include "ldObject.h" 3 #include "ldObject.h"
4 4
5 class Model 5 class Model
6 { 6 {
7 public: 7 public:
8 Model(); 8 Model(DocumentManager* manager);
9 Model(const Model& other) = delete; 9 Model(const Model& other) = delete;
10 ~Model(); 10 ~Model();
11 11
12 virtual void addObject(LDObject* object); 12 virtual void addObject(LDObject* object);
13 virtual void insertObject(int position, LDObject* object); 13 virtual void insertObject(int position, LDObject* object);
25 void recountTriangles(); 25 void recountTriangles();
26 int triangleCount() const; 26 int triangleCount() const;
27 QVector<LDObject*>::iterator begin(); 27 QVector<LDObject*>::iterator begin();
28 QVector<LDObject*>::iterator end(); 28 QVector<LDObject*>::iterator end();
29 bool isEmpty() const; 29 bool isEmpty() const;
30 DocumentManager* documentManager() const;
31 LDObject* insertFromString(int position, QString line);
32 LDObject* addFromString(QString line);
33 LDObject* replaceWithFromString(LDObject* object, QString line);
30 34
31 template<typename T, typename... Args> 35 template<typename T, typename... Args>
32 T* emplace(Args&& ...args) 36 T* emplace(Args&& ...args)
33 { 37 {
34 T* object = constructObject<T>(args...); 38 T* object = constructObject<T>(args...);
83 87
84 void withdraw(LDObject* object); 88 void withdraw(LDObject* object);
85 virtual LDObject* withdrawAt(int position); 89 virtual LDObject* withdrawAt(int position);
86 90
87 QVector<LDObject*> _objects; 91 QVector<LDObject*> _objects;
92 DocumentManager* _manager;
88 mutable int _triangleCount = 0; 93 mutable int _triangleCount = 0;
89 mutable bool _needsTriangleRecount; 94 mutable bool _needsTriangleRecount;
90 }; 95 };

mercurial