file.h

Mon, 18 Mar 2013 18:29:02 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Mon, 18 Mar 2013 18:29:02 +0200
changeset 29
55406ce7446e
parent 28
208adc847377
child 30
31ff9aabd506
permissions
-rw-r--r--

Added LDraw path setting dialog

#ifndef __FILE_H__
#define __FILE_H__

#include "common.h"
#include "ldtypes.h"
#include "str.h"

// =============================================================================
// OpenFile
//
// The OpenFile 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 {
public:
	str zFileName, zTitle;
	vector<LDObject*> objects;
	
	// Closes this OpenFile. The object is deleted in the process.
	void close ();
	
	// Saves this file to disk.
	bool save (str zPath = "");
};

// Close all current loaded files and start off blank.
void newFile ();

// Opens the given file as the main file. Everything is closed first.
void openMainFile (str zPath);

// Finds an OpenFile by name or nullptr if not open
OpenFile* findLoadedFile (str name);

// Opens the given file and parses the LDraw code within. Returns a pointer
// to the opened file or nullptr on error.
OpenFile* openDATFile (str path);

// Close all open files, whether user-opened or subfile caches.
void closeAll ();

// Parses a string line containing an LDraw object and returns the object parsed.
LDObject* parseLine (str zLine);

// Retrieves the pointer to - or loads - the given subfile.
OpenFile* loadSubfile (str zFile);

// Re-caches all subfiles.
void reloadAllSubfiles ();

extern vector<OpenFile*> g_LoadedFiles;

#endif // __FILE_H__

mercurial