src/file.h

changeset 538
2f85d4d286e5
parent 522
afa691788bdb
child 539
72ad83a67165
equal deleted inserted replaced
537:1add0ee96fb3 538:2f85d4d286e5
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19 #ifndef FILE_H 19 #ifndef LDFORGE_FILE_H
20 #define FILE_H 20 #define LDFORGE_FILE_H
21 21
22 #include "common.h" 22 #include "common.h"
23 #include "ldtypes.h" 23 #include "ldtypes.h"
24 #include "history.h" 24 #include "history.h"
25 #include <QObject> 25 #include <QObject>
65 65
66 public: 66 public:
67 LDFile(); 67 LDFile();
68 ~LDFile(); 68 ~LDFile();
69 69
70 int addObject (LDObject* obj); // Adds an object to this file at the end of the file. 70 int addObject (LDObject* obj); // Adds an object to this file at the end of the file.
71 void addObjects (const QList<LDObject*> objs); 71 void addObjects (const QList<LDObject*> objs);
72 void clearSelection(); 72 void clearSelection();
73 void forgetObject (LDObject* obj); // Deletes the given object from the object chain. 73 void forgetObject (LDObject* obj); // Deletes the given object from the object chain.
74 str getShortName(); 74 str getShortName();
75 const QList<LDObject*>& selection() const; 75 const QList<LDObject*>& getSelection() const;
76 bool hasUnsavedChanges() const; // Does this file have unsaved changes? 76 bool hasUnsavedChanges() const; // Does this file have unsaved changes?
77 QList<LDObject*> inlineContents (LDSubfile::InlineFlags flags); 77 QList<LDObject*> inlineContents (LDSubfile::InlineFlags flags);
78 void insertObj (int pos, LDObject* obj); 78 void insertObj (int pos, LDObject* obj);
79 int numObjs() const; 79 int getObjectCount() const;
80 LDObject* object (int pos) const; 80 LDObject* getObject (int pos) const;
81 LDObject* obj (int pos) const; 81 bool save (str path = ""); // Saves this file to disk.
82 bool save (str path = ""); // Saves this file to disk. 82 bool isSafeToClose(); // Perform safety checks. Do this before closing any files!
83 bool safeToClose(); // Perform safety checks. Do this before closing any files!
84 void setObject (int idx, LDObject* obj); 83 void setObject (int idx, LDObject* obj);
85 84
86 inline LDFile& operator<< (LDObject* obj) 85 inline LDFile& operator<< (LDObject* obj)
87 { addObject (obj); 86 { addObject (obj);
88 return *this; 87 return *this;
163 QList<LDObject*> loadFileContents (File* f, int* numWarnings, bool* ok = null); 162 QList<LDObject*> loadFileContents (File* f, int* numWarnings, bool* ok = null);
164 163
165 extern QList<LDFile*> g_loadedFiles; 164 extern QList<LDFile*> g_loadedFiles;
166 165
167 inline const QList<LDObject*>& selection() 166 inline const QList<LDObject*>& selection()
168 { return LDFile::current()->selection(); 167 { return LDFile::current()->getSelection();
169 } 168 }
170 169
171 void addRecentFile (str path); 170 void addRecentFile (str path);
172 void loadLogoedStuds(); 171 void loadLogoedStuds();
173 str basename (str path); 172 str basename (str path);
207 signals: 206 signals:
208 void progressUpdate (int progress); 207 void progressUpdate (int progress);
209 void workDone(); 208 void workDone();
210 }; 209 };
211 210
212 #endif // FILE_H 211 #endif // LDFORGE_FILE_H

mercurial