Renamed the OpenFile class to LDOpenFile as MinGW doesn't appear to like the former name

Tue, 21 May 2013 14:07:33 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Tue, 21 May 2013 14:07:33 +0300
changeset 232
4e44c92e21dd
parent 231
6ee9917b79f8
child 233
524cb0833027

Renamed the OpenFile class to LDOpenFile as MinGW doesn't appear to like the former name

src/addObjectDialog.cpp file | annotate | diff | comparison | revisions
src/common.h file | annotate | diff | comparison | revisions
src/file.cpp file | annotate | diff | comparison | revisions
src/file.h file | annotate | diff | comparison | revisions
src/gui_editactions.cpp file | annotate | diff | comparison | revisions
src/ldtypes.cpp file | annotate | diff | comparison | revisions
src/ldtypes.h file | annotate | diff | comparison | revisions
src/main.cpp file | annotate | diff | comparison | revisions
--- a/src/addObjectDialog.cpp	Tue May 21 14:06:06 2013 +0300
+++ b/src/addObjectDialog.cpp	Tue May 21 14:07:33 2013 +0300
@@ -480,7 +480,7 @@
 			if (~name == 0)
 				return; // no subfile filename
 			
-			OpenFile* file = loadSubfile (name);
+			LDOpenFile* file = loadSubfile (name);
 			if (!file) {
 				critical (fmt ("Couldn't open `%s': %s", name.c (), strerror (errno)));
 				return;
--- a/src/common.h	Tue May 21 14:06:06 2013 +0300
+++ b/src/common.h	Tue May 21 14:07:33 2013 +0300
@@ -110,7 +110,7 @@
 class ForgeWindow;
 class LDObject;
 class bbox;
-class OpenFile;
+class LDOpenFile;
 class QApplication;
 
 // -----------------------------------------------------------------------------
@@ -179,7 +179,7 @@
 
 // -----------------------------------------------------------------------------
 // Pointer to the OpenFile which is currently being edited by the user.
-extern OpenFile* g_curfile;
+extern LDOpenFile* g_curfile;
 
 // -----------------------------------------------------------------------------
 // Pointer to the bounding box.
@@ -187,7 +187,7 @@
 
 // -----------------------------------------------------------------------------
 // Vector of all currently opened files.
-extern vector<OpenFile*> g_loadedFiles;
+extern vector<LDOpenFile*> g_loadedFiles;
 
 // -----------------------------------------------------------------------------
 // Pointer to the main application.
--- a/src/file.cpp	Tue May 21 14:06:06 2013 +0300
+++ b/src/file.cpp	Tue May 21 14:07:33 2013 +0300
@@ -85,13 +85,13 @@
 }
 
 // =============================================================================
-OpenFile::OpenFile () {
+LDOpenFile::LDOpenFile () {
 	m_implicit = true;
 	savePos = -1;
 }
 
 // =============================================================================
-OpenFile::~OpenFile () {
+LDOpenFile::~LDOpenFile () {
 	// Clear everything from the model
 	for (LDObject* obj : m_objs)
 		delete obj;
@@ -102,8 +102,8 @@
 }
 
 // =============================================================================
-OpenFile* findLoadedFile (str zName) {
-	for (OpenFile* file : g_loadedFiles)
+LDOpenFile* findLoadedFile (str zName) {
+	for (LDOpenFile* file : g_loadedFiles)
 		if (file->m_filename == zName)
 			return file;
 	
@@ -214,7 +214,7 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-OpenFile* openDATFile (str path, bool search, bool mainfile) {
+LDOpenFile* openDATFile (str path, bool search, bool mainfile) {
 	logf ("Opening %s...\n", path.chars());
 	
 	// Convert the file name to lowercase since some parts contain uppercase
@@ -231,7 +231,7 @@
 		return null;
 	}
 	
-	OpenFile* load = new OpenFile;
+	LDOpenFile* load = new LDOpenFile;
 	load->m_filename = path;
 	
 	if (mainfile)
@@ -255,7 +255,7 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-bool OpenFile::safeToClose () {
+bool LDOpenFile::safeToClose () {
 	setlocale (LC_ALL, "C");
 	
 	// If we have unsaved changes, warn and give the option of saving.
@@ -309,7 +309,7 @@
 		return;
 	
 	// Remove all loaded files and the objects they contain
-	for (OpenFile* file : g_loadedFiles)
+	for (LDOpenFile* file : g_loadedFiles)
 		delete file;
 	
 	// Clear the array
@@ -326,7 +326,7 @@
 	// Create a new anonymous file and set it to our current
 	closeAll ();
 	
-	OpenFile* f = new OpenFile;
+	LDOpenFile* f = new LDOpenFile;
 	f->m_filename = "";
 	f->m_implicit = false;
 	g_loadedFiles.push_back (f);
@@ -382,7 +382,7 @@
 void openMainFile (str path) {
 	closeAll ();
 	
-	OpenFile* file = openDATFile (path, false, true);
+	LDOpenFile* file = openDATFile (path, false, true);
 	
 	if (!file) {
 		// Tell the user loading failed.
@@ -411,7 +411,7 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-bool OpenFile::save (str path) {
+bool LDOpenFile::save (str path) {
 	if (!~path)
 		path = m_filename;
 	
@@ -587,7 +587,7 @@
 			CHECK_TOKEN_NUMBERS (1, 13)
 			
 			// Try open the file
-			OpenFile* pFile = loadSubfile (tokens[14]);
+			LDOpenFile* pFile = loadSubfile (tokens[14]);
 			
 			// If we cannot open the file, mark it an error
 			if (!pFile)
@@ -671,9 +671,9 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-OpenFile* loadSubfile (str zFile) {
+LDOpenFile* loadSubfile (str zFile) {
 	// Try open the file
-	OpenFile* pFile = findLoadedFile (zFile);
+	LDOpenFile* pFile = findLoadedFile (zFile);
 	if (!pFile)
 		pFile = openDATFile (zFile, true, false);
 	
@@ -688,7 +688,7 @@
 		return;
 	
 	// First, close all but the current open file.
-	for (OpenFile* file : g_loadedFiles)
+	for (LDOpenFile* file : g_loadedFiles)
 		if (file != g_curfile)
 			delete file;
 	
@@ -700,7 +700,7 @@
 		if (obj->getType() == LDObject::Subfile) {
 			// Note: ref->pFile is invalid right now since all subfiles were closed.
 			LDSubfile* ref = static_cast<LDSubfile*> (obj);
-			OpenFile* pFile = loadSubfile (ref->fileName);
+			LDOpenFile* pFile = loadSubfile (ref->fileName);
 			
 			if (pFile)
 				ref->fileInfo = pFile;
@@ -720,7 +720,7 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-ulong OpenFile::addObject (LDObject* obj) {
+ulong LDOpenFile::addObject (LDObject* obj) {
 	m_objs.push_back (obj);
 	
 	if (this == g_curfile)
@@ -732,7 +732,7 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-void OpenFile::insertObj (const ulong pos, LDObject* obj) {
+void LDOpenFile::insertObj (const ulong pos, LDObject* obj) {
 	m_objs.insert (m_objs.begin () + pos, obj);
 	
 	if (this == g_curfile)
@@ -742,7 +742,7 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-void OpenFile::forgetObject (LDObject* obj) {
+void LDOpenFile::forgetObject (LDObject* obj) {
 	// Find the index for the given object
 	ulong ulIndex;
 	for (ulIndex = 0; ulIndex < (ulong)m_objs.size(); ++ulIndex)
@@ -817,7 +817,7 @@
 
 // =============================================================================
 bool safeToCloseAll () {
-	for (OpenFile* f : g_loadedFiles)
+	for (LDOpenFile* f : g_loadedFiles)
 		if (!f->safeToClose ())
 			return false;
 	
--- a/src/file.h	Tue May 21 14:06:06 2013 +0300
+++ b/src/file.h	Tue May 21 14:07:33 2013 +0300
@@ -33,12 +33,12 @@
 }
 
 // =============================================================================
-// OpenFile
+// LDOpenFile
 //
-// The OpenFile class stores a file opened in LDForge either as a editable file
+// The LDOpenFile class stores a file opened in LDForge either as a editable file
 // for the user or for subfile caching. Its methods handle file input and output.
 // =============================================================================
-class OpenFile {
+class LDOpenFile {
 public:
 	typedef std::vector<LDObject*>::iterator it;
 	typedef std::vector<LDObject*>::const_iterator c_it;
@@ -53,8 +53,8 @@
 	// caching purposes and are hidden from the user.
 	bool m_implicit;
 	
-	OpenFile ();
-	~OpenFile ();
+	LDOpenFile ();
+	~LDOpenFile ();
 	
 	// Saves this file to disk.
 	bool save (str zPath = "");
@@ -90,11 +90,11 @@
 void openMainFile (str zPath);
 
 // Finds an OpenFile by name or null if not open
-OpenFile* findLoadedFile (str name);
+LDOpenFile* findLoadedFile (str name);
 
 // Opens the given file and parses the LDraw code within. Returns a pointer
 // to the opened file or null on error.
-OpenFile* openDATFile (str path, bool search, bool mainfile);
+LDOpenFile* openDATFile (str path, bool search, bool mainfile);
 
 // Opens the given file and returns a pointer to it, potentially looking in /parts and /p
 FILE* openLDrawFile (str path, bool bSubDirectories);
@@ -106,7 +106,7 @@
 LDObject* parseLine (str line);
 
 // Retrieves the pointer to - or loads - the given subfile.
-OpenFile* loadSubfile (str zFile);
+LDOpenFile* loadSubfile (str zFile);
 
 // Re-caches all subfiles.
 void reloadAllSubfiles ();
@@ -123,7 +123,7 @@
 
 std::vector< LDObject* > loadFileContents (FILE* fp, ulong* numWarnings);
 
-extern vector<OpenFile*> g_loadedFiles;
+extern vector<LDOpenFile*> g_loadedFiles;
 extern vector<partListEntry> g_PartList;
 
 #endif // FILE_H
\ No newline at end of file
--- a/src/gui_editactions.cpp	Tue May 21 14:06:06 2013 +0300
+++ b/src/gui_editactions.cpp	Tue May 21 14:07:33 2013 +0300
@@ -198,7 +198,7 @@
 		LDRadial* rad = static_cast<LDRadial*> (obj);
 		str name = rad->makeFileName ();
 		
-		OpenFile* file = loadSubfile (name);
+		LDOpenFile* file = loadSubfile (name);
 		if (file == null) {
 			fails.push_back (name);
 			continue;
--- a/src/ldtypes.cpp	Tue May 21 14:06:06 2013 +0300
+++ b/src/ldtypes.cpp	Tue May 21 14:07:33 2013 +0300
@@ -328,7 +328,7 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-long LDObject::getIndex (OpenFile* pFile) const {
+long LDObject::getIndex (LDOpenFile* pFile) const {
 	for (ulong i = 0; i < pFile->m_objs.size(); ++i)
 		if (pFile->m_objs[i] == this)
 			return i;
--- a/src/ldtypes.h	Tue May 21 14:06:06 2013 +0300
+++ b/src/ldtypes.h	Tue May 21 14:07:33 2013 +0300
@@ -102,7 +102,7 @@
 	virtual ~LDObject ();
 	
 	// Index (i.e. line number) of this object
-	long getIndex (OpenFile* pFile) const;
+	long getIndex (LDOpenFile* pFile) const;
 	
 	// Color used by this object. Comments, gibberish and empty entries
 	// do not use this field.
@@ -269,7 +269,7 @@
 	LDOBJ_HAS_MATRIX
 	
 	str fileName; // Filename of the subpart (TODO: rid this too - use fileInfo->fileName instead)
-	OpenFile* fileInfo; // Pointer to opened file for this subfile. null if unopened.
+	LDOpenFile* fileInfo; // Pointer to opened file for this subfile. null if unopened.
 	
 	// Inlines this subfile. Note that return type is an array of heap-allocated
 	// LDObject-clones, they must be deleted one way or another.
--- a/src/main.cpp	Tue May 21 14:06:06 2013 +0300
+++ b/src/main.cpp	Tue May 21 14:07:33 2013 +0300
@@ -25,8 +25,8 @@
 #include "colors.h"
 #include "types.h"
 
-vector<OpenFile*> g_loadedFiles;
-OpenFile* g_curfile = null;
+vector<LDOpenFile*> g_loadedFiles;
+LDOpenFile* g_curfile = null;
 ForgeWindow* g_win = null; 
 bbox g_BBox;
 const QApplication* g_app = null;

mercurial