src/file.h

changeset 498
791c831c8020
parent 494
bd005c78a089
child 500
cad8cdc42a64
equal deleted inserted replaced
497:c51941e590b6 498:791c831c8020
61 61
62 public: 62 public:
63 LDFile(); 63 LDFile();
64 ~LDFile(); 64 ~LDFile();
65 65
66 ulong addObject (LDObject* obj); // Adds an object to this file at the end of the file. 66 int addObject (LDObject* obj); // Adds an object to this file at the end of the file.
67 void addObjects (const List<LDObject*> objs); 67 void addObjects (const List<LDObject*> objs);
68 void forgetObject (LDObject* obj); // Deletes the given object from the object chain. 68 void forgetObject (LDObject* obj); // Deletes the given object from the object chain.
69 str getShortName(); 69 str getShortName();
70 bool hasUnsavedChanges() const; // Does this file have unsaved changes? 70 bool hasUnsavedChanges() const; // Does this file have unsaved changes?
71 List<LDObject*> inlineContents (LDSubfile::InlineFlags flags); 71 List<LDObject*> inlineContents (LDSubfile::InlineFlags flags);
72 void insertObj (const ulong pos, LDObject* obj); 72 void insertObj (int pos, LDObject* obj);
73 ulong numObjs() const; 73 int numObjs() const;
74 LDObject* object (ulong pos) const; 74 LDObject* object (int pos) const;
75 LDObject* obj (ulong pos) const; 75 LDObject* obj (int pos) const;
76 bool save (str path = ""); // Saves this file to disk. 76 bool save (str path = ""); // Saves this file to disk.
77 bool safeToClose(); // Perform safety checks. Do this before closing any files! 77 bool safeToClose(); // Perform safety checks. Do this before closing any files!
78 void setObject (ulong idx, LDObject* obj); 78 void setObject (int idx, LDObject* obj);
79 79
80 inline LDFile& operator<< (LDObject* obj) 80 inline LDFile& operator<< (LDObject* obj)
81 { addObject (obj); 81 { addObject (obj);
82 return *this; 82 return *this;
83 } 83 }
145 void reloadAllSubfiles(); 145 void reloadAllSubfiles();
146 146
147 // Is it safe to close all files? 147 // Is it safe to close all files?
148 bool safeToCloseAll(); 148 bool safeToCloseAll();
149 149
150 List<LDObject*> loadFileContents (File* f, ulong* numWarnings, bool* ok = null); 150 List<LDObject*> loadFileContents (File* f, int* numWarnings, bool* ok = null);
151 151
152 extern List<LDFile*> g_loadedFiles; 152 extern List<LDFile*> g_loadedFiles;
153 153
154 void addRecentFile (str path); 154 void addRecentFile (str path);
155 void loadLogoedStuds(); 155 void loadLogoedStuds();
168 // ============================================================================= 168 // =============================================================================
169 class FileLoader : public QObject 169 class FileLoader : public QObject
170 { Q_OBJECT 170 { Q_OBJECT
171 READ_PROPERTY (List<LDObject*>, objs, setObjects) 171 READ_PROPERTY (List<LDObject*>, objs, setObjects)
172 READ_PROPERTY (bool, done, setDone) 172 READ_PROPERTY (bool, done, setDone)
173 READ_PROPERTY (ulong, progress, setProgress) 173 READ_PROPERTY (int, progress, setProgress)
174 READ_PROPERTY (bool, aborted, setAborted) 174 READ_PROPERTY (bool, aborted, setAborted)
175 PROPERTY (List<str>, lines, setLines) 175 PROPERTY (List<str>, lines, setLines)
176 PROPERTY (ulong*, warningsPointer, setWarningsPointer) 176 PROPERTY (int*, warningsPointer, setWarningsPointer)
177 PROPERTY (bool, concurrent, setConcurrent) 177 PROPERTY (bool, concurrent, setConcurrent)
178 178
179 public slots: 179 public slots:
180 void start(); 180 void start();
181 void abort(); 181 void abort();

mercurial