|
Nebula
|
#include <path.h>
A path is an abstraction around file paths.
It encapsulates the folder path, an optional file name and accompanying file type.
A path lives entirely within Nebulas file system, meaning all paths are relative to content folders, either in 'work' or 'export'.
Public Types | |
| enum | FileTypes { Texture , Model , Material , Mesh } |
Public Member Functions | |
| Path () | |
| Constructor. | |
| ~Path () | |
| Destructor. | |
| Path (const Path &path) | |
| Copy constructor. | |
| void | Clear () |
| Clear the path. | |
| bool | IsEmpty () const |
| Returns true if path is empty. | |
| bool | IsFolder () const |
| Returns true if the path is a folder. | |
| bool | IsFile () const |
| Returns true if the path is a file. | |
| const Util::String | AsString () const |
| Serialize to string. | |
| bool | operator== (const Path &path) const |
| Comparison test. | |
| bool | operator< (const Path &path) const |
| Less test. | |
| bool | operator> (const Path &path) const |
| Greater test. | |
| Path | operator/ (const char *folder) const |
| Append to folder path. | |
| Path | operator/ (const Util::String &folder) const |
| Append to folder path. | |
| Path | operator/ (const Path &folder) const |
| Append to folder path. | |
| IO::URI | WorkURI (const char *workFolder) const |
| Convert to a URI seated in the provided folder. | |
| IO::URI | WorkURI (const Util::String &workFolder) const |
| Convert to a URI seated in the provided folder. | |
| IO::URI | ExportURI () const |
| Convert to a folder in 'export'. | |
| void | SetFolder (const Util::String &folder) |
| Set the folder. | |
| void | ClearFolder () |
| Clear the folder. | |
| void | SetFile (const Util::String &file, const Util::String &type) |
| Set the file. | |
| void | ClearFile () |
| Clear the file. | |
| const Util::String & | GetFolderAndFile () const |
| Get folder and file path. | |
| const Util::String & | GetFile () const |
| Get file. | |
| const Util::String & | GetFolder () const |
| Get folder. | |
| const Util::String & | GetType () const |
| Get type. | |
| Util::String | GetWorkFile () const |
| Get file with work extension. | |
| Util::String | GetExportFile () const |
| Get file with export extension. | |
Static Public Member Functions | |
| static Path | Parse (const Util::String &serialized) |
| Parse from serialized Path. | |
| static Path | Folder (const Util::String &folder) |
| Construct from folder. | |
| static Path | FolderAndFile (const Util::String &type, const Util::String &folderAndFile) |
| Construct from file type, combined folder and file path. | |
| static Path | FolderAndFile (const char *type, const Util::String &folderAndFile) |
| Construct from file type, combined folder and file path. | |
| static Path | File (const Util::String &folder, const Util::String &file, const Util::String &type) |
| Construct from folder, file and type separately. | |
| static Path | File (const Util::String &folder, const Util::String &file, const char *type) |
| Construct from folder, file and type separately. | |
| static void | AddExportMapping (const Util::StringAtom &ns, const Util::StringAtom &extension) |
| Add an export binding using namespace -> file extension to use with ExportURI. Adding the same binding again is allowed, binding a namespace to another extension is not. | |
| static void | AddWorkMapping (const Util::StringAtom &ns, const Util::StringAtom &extension) |
| Add a work binding using namespace -> file extension to use with WorkURI. Adding the same binding again is allowed, binding a namespace to another extension is not. | |
| static void | SetWorkRoot (const Util::StringAtom &root) |
| Set the work folder. | |
Static Public Attributes | |
| static Util::Dictionary< Util::StringAtom, Util::StringAtom > | ExportExtensions |
| static Util::Dictionary< Util::StringAtom, Util::StringAtom > | WorkExtensions |
| static Util::StringAtom | WorkRoot |
Private Member Functions | |
| void | Build () |
| Build fileAndFolder. | |
Private Attributes | |
| bool | isFile |
| Util::String | folder |
| Util::String | file |
| Util::String | type |
| Util::String | folderAndFile |
| enum IO::Path::FileTypes |
| IO::Path::Path | ( | ) |
Constructor.
| IO::Path::~Path | ( | ) |
Destructor.
| IO::Path::Path | ( | const Path & | path | ) |
Copy constructor.
|
inlinestatic |
Add an export binding using namespace -> file extension to use with ExportURI. Adding the same binding again is allowed, binding a namespace to another extension is not.
Several systems read the same namespace, such as graphics and physics both reading meshes, and each registers the mappings it needs regardless of setup order.
They have to agree though.
|
inlinestatic |
Add a work binding using namespace -> file extension to use with WorkURI. Adding the same binding again is allowed, binding a namespace to another extension is not.
Several systems read the same namespace and each registers the mappings it needs regardless of setup order.
They have to agree though.
| const Util::String IO::Path::AsString | ( | ) | const |
Serialize to string.
|
private |
Build fileAndFolder.
| void IO::Path::Clear | ( | ) |
Clear the path.
| void IO::Path::ClearFile | ( | ) |
Clear the file.
| void IO::Path::ClearFolder | ( | ) |
Clear the folder.
| URI IO::Path::ExportURI | ( | ) | const |
Convert to a folder in 'export'.
|
static |
Construct from folder, file and type separately.
|
static |
Construct from folder, file and type separately.
|
static |
Construct from folder.
|
static |
Construct from file type, combined folder and file path.
|
static |
Construct from file type, combined folder and file path.
| Util::String IO::Path::GetExportFile | ( | ) | const |
Get file with export extension.
| const Util::String & IO::Path::GetFile | ( | ) | const |
Get file.
| const Util::String & IO::Path::GetFolder | ( | ) | const |
Get folder.
| const Util::String & IO::Path::GetFolderAndFile | ( | ) | const |
Get folder and file path.
| const Util::String & IO::Path::GetType | ( | ) | const |
Get type.
| Util::String IO::Path::GetWorkFile | ( | ) | const |
Get file with work extension.
| bool IO::Path::IsEmpty | ( | ) | const |
Returns true if path is empty.
| bool IO::Path::IsFile | ( | ) | const |
Returns true if the path is a file.
| bool IO::Path::IsFolder | ( | ) | const |
Returns true if the path is a folder.
| Path IO::Path::operator/ | ( | const char * | folder | ) | const |
Append to folder path.
| Path IO::Path::operator/ | ( | const Util::String & | folder | ) | const |
Append to folder path.
| bool IO::Path::operator< | ( | const Path & | path | ) | const |
Less test.
| bool IO::Path::operator== | ( | const Path & | path | ) | const |
Comparison test.
| bool IO::Path::operator> | ( | const Path & | path | ) | const |
Greater test.
|
static |
Parse from serialized Path.
| void IO::Path::SetFile | ( | const Util::String & | file, |
| const Util::String & | type ) |
Set the file.
| void IO::Path::SetFolder | ( | const Util::String & | folder | ) |
Set the folder.
|
inlinestatic |
Set the work folder.
| URI IO::Path::WorkURI | ( | const char * | workFolder | ) | const |
Convert to a URI seated in the provided folder.
| URI IO::Path::WorkURI | ( | const Util::String & | workFolder | ) | const |
Convert to a URI seated in the provided folder.
|
static |
|
private |
|
private |
|
private |
|
private |
|
private |
|
static |
|
static |