This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine::FileSystem Class

Unigine virtual file system. This interface allows accessing external resources.

To use this class, include the UnigineFileSystem.h file.

Unigine::FileSystem Class

Members


virtual ~FileSystem ()

Virtual destructor.

static FileSystem * get ()

Returns a pointer to the existing render.

Return value

Pointer to the existing render.

static void addPackage (const char * name, Package * package)

Adds a package to the file system.

Arguments

  • const char * name - Name of the package.
  • Package * package - Pointer to the package.

static Package * getPackage (const char * name)

Returns a package from the file system.

Arguments

  • const char * name - Name of the package.

Return value

Pointer to the package.

static int reloadPackage ()

Reloads package files.

Return value

Returns 1 if the package is reloaded successfully; otherwise, 0.

static void addDirectory (const char * name)

Adds a directory to the file system.

Arguments

  • const char * name - Directory name.

virtual int getNumModifiers () const =0

Returns the total number of file modifiers registered in the file system.

Return value

Number of modifiers.

virtual const char * getModifier (int num) const =0

Returns the name of the given modifier.

Arguments

  • int num - ID number of the modifier.

Return value

Modifier name.

virtual void addModifier (const char * name) const =0

Registers a new modifier in the file system.

Arguments

  • const char * name - Modifier name.

virtual void removeModifier (const char * name) const =0

Unregisters a given modifier in the file system.

Arguments

  • const char * name - Modifier name.

virtual void clearModifiers () const =0

Unregister all modifiers in the file system.

virtual int getNumFiles () const =0

Returns the number of files cached by the file system.

Return value

Number of cached files.

virtual void getFileNames (Vector< String > & names) const =0

Fills the given vector with the list of unarchived files cached by the file system.

Arguments

  • Vector< String > & names - A vector where file names will be saved.

virtual const char * getFileName (const char * name) const =0

Returns the relative path to the file by the given partial one. The path will be relative to the binary executable.

Arguments

  • const char * name - File name or the partial path to it.

Return value

The path which is relative to the binary executable.

virtual int isFile (const char * name) const =0

Checks if a given file exists in the file system.

Arguments

  • const char * name - File name.

Return value

1 if the file is found; otherwise, 0.

virtual int isKnownFile (const char * name) const =0

Checks if the given file is known to the filesystem.

Arguments

  • const char * name - File name.

Return value

1 if the file is known to the filesystem; otherwise, 0.

virtual int addKnownFile (const char * name) const =0

Registers the regular file name as known and appends it into the map used for fast searching.

Arguments

  • const char * name - File name to register as known.

Return value

1 if the file name is appended successfully; otherwise, 0.

virtual int getNumPackages () const =0

Returns the number of ZIP and UNG packages inside data_path directory.

Return value

Number of packages.

virtual int findPackage (const char * name) const =0

Checks if an UNG or ZIP package has been added into the file system.

Arguments

  • const char * name - Package name. It can be an absolute path or a path relative to data (data_path) directory, if it is inside of it.

Return value

Number of the ZIP or UNG package, or -1 if it is not found.

virtual const char * getPackageName (int num) const =0

Returns a name of a given ZIP or UNG package.

Arguments

  • int num - Number of the ZIP or UNG package.

Return value

Name of the package.

virtual int getNumPackageFiles (int num) const =0

Returns the number of files inside of a given ZIP or UNG package.

Arguments

  • int num - Number of the ZIP or UNG package.

Return value

Number of files inside a package.

virtual void getPackageFileNames (int num, Vector< String > & names) const =0

Fills the given vector with the list of files in the specified ZIP or UNG package.

Arguments

  • int num - Number of the ZIP or UNG package.
  • Vector< String > & names - A vector where file names will be saved.

virtual const char * getPackageFileName (int num, const char * name) const =0

Returns the full path with a file name relative to the package root directory given only the file name.

Arguments

  • int num - Number of the ZIP or UNG package.
  • const char * name - File name.

Return value

A path.

virtual int isPackageFile (int num, const char * name) const =0

Checks if the given file exists in the package.

Arguments

  • int num - Number of the ZIP or UNG package.
  • const char * name - File name.

Return value

1 if the file exists; otherwise, 0.

virtual int isBlobFile (const char * name) const =0

Checks if the given file is a blob file.

Arguments

  • const char * name - File name.

Return value

Returns 1 if the file is blobed; otherwise, 0.

virtual int addBlobFile (const char * name) const =0

Blobs a file in the memory.

Arguments

  • const char * name - File name.

Return value

Returns 1 if the file is successfully added into a blob; otherwise, 0.

virtual int removeBlobFile (const char * name) const =0

Removes a blob with a file from the memory. Blobing can be used for files that are frequently modified in run-time (for example, images). After such file is loaded from a disk and written into a blob in the memory, its modifications can be saved fast into this blob.

Arguments

  • const char * name - File name.

Return value

Returns 1 if the file is removed successfully; otherwise, 0.

virtual int isCacheFile (const char * name) const =0

Checks if the given file is loaded into a cache.

Arguments

  • const char * name - File name.

Return value

Returns 1 if the file is added into a cache; otherwise, 0.

virtual int addCacheFile (const char * name) const =0

Caches a file in the memory. It can be used for files that are accessed multiple times in run-time (for example, textures are read two times in a row). Such files are loaded into the memory for faster reading.

Arguments

  • const char * name - File name.

Return value

Returns 1 if the file is successfully added to a cache; otherwise, 0.

virtual int removeCacheFile (const char * name) const =0

Removes a cached file from the memory. Caching can be used for files that are accessed multiple times in run-time (for example, textures are read two times in a row). Such files are loaded into the memory for faster reading.

Arguments

  • const char * name - File name.

Return value

Returns 1 if the file is successfully removed from a cache; otherwise, 0.

virtual int loadFile (const char * name, int group, float weight) const =0

Adds a file to the background loading queue (i.e. threaded file loading). Files with identical priorities and weights are loaded in the alphabetical order.

Arguments

  • const char * name - File name.
  • int group - Group of the priority. The default is 0. Greater priority means faster loading.
  • float weight - File priority. Greater file priority means faster loading inside the same priority group. Default value is 0.

Return value

Returns 1 if the file is successfully appended to the queue; otherwise, 0.

virtual int removeFile (const char * name) const =0

Removes file from the loading queue.

Arguments

  • const char * name - File name.

Return value

Returns 1 if the file is removed successfully; otherwise, 0.

virtual int forceFile (const char * name) const =0

Loads the file immediately after calling this function. The file will be loaded right after the currently loading file (if any) is processed.

Arguments

  • const char * name - File name.

Return value

Returns 1 if the file is loaded successfully; otherwise, 0.

virtual int checkFile (const char * name) const =0

Checks whether the file was loaded to the queue.

Arguments

  • const char * name - File name.

Return value

Returns 1 if the file is in the queue or already loaded to the file system; otherwise, 0.

virtual int validateFile (const char * name) const =0

Checks whether the file placed in the loading queue is loaded.

Arguments

  • const char * name - File name.

Return value

Returns 1 if the file is loaded; 0 if it is pending in the queue.

virtual int loadImage (const char * name, int group, float weight) const =0

Adds an image to the background loading queue (i.e. threaded image loading). Images with the identical groups and weights are loaded in the alphabetical order.

Arguments

  • const char * name - Image name.
  • int group - Group of the priority. The default is 0. Greater priority means faster loading.
  • float weight - Image priority. Greater weight means faster loading inside the same priority group. Default value is 0.

Return value

Returns 1 if the image is successfully appended to the queue; otherwise, 0.

virtual int removeImage (const char * name) const =0

Removes an image from the loading queue.

Arguments

  • const char * name - Image name.

Return value

Returns 1 if the image is removed successfully; otherwise, 0.

virtual int forceImage (const char * name) const =0

Loads an image immediately after calling the function. The image will be loaded right after the currently loading image (if any) is processed. All the other file system operations are suspended until the forced image is loaded.

Arguments

  • const char * name - Image name.

Return value

Returns 1 if the image is loaded successfully; otherwise, 0.

virtual int checkImage (const char * name) const =0

Checks whether the image was loaded to the queue or not.

Arguments

  • const char * name - Image name.

Return value

Returns 1 if the image is in the queue or already loaded to the file system; otherwise, 0.

virtual ImagePtr getImage (const char * name) const =0

Checks whether the image is placed to the loading queue and return it if it is placed.

Arguments

  • const char * name - Image name.

Return value

Loaded image smart pointer. If the image is not placed to the queue, NULL is retuned.

virtual int loadMesh (const char * name, int group, float weight) const =0

Adds a mesh to the background loading queue (i.e. threaded mesh loading). Meshs with the identical groups and weights are loaded in the alphabetical order.

Arguments

  • const char * name - Mesh name.
  • int group - Group of the priority. The default is 0. Greater priority means faster loading.
  • float weight - Mesh priority. Greater weight means faster loading inside the same priority group. Default value is 0.

Return value

Returns 1 if the mesh is successfully appended to the queue; otherwise, 0.

virtual int removeMesh (const char * name) const =0

Removes a mesh from the loading queue.

Arguments

  • const char * name - Mesh name.

Return value

Returns 1 if the mesh is removed successfully; otherwise, 0.

virtual int forceMesh (const char * name) const =0

Loads a mesh immediately after calling the function. The mesh will be loaded right after the currently loading mesh (if any) is processed. All the other file system operations are suspended until the forced mesh is loaded.

Arguments

  • const char * name - Mesh name.

Return value

Returns 1 if the mesh is loaded successfully; otherwise, 0.

virtual int checkMesh (const char * name) const =0

Checks whether the mesh was loaded to the queue or not.

Arguments

  • const char * name - Mesh name.

Return value

Returns 1 if the mesh is in the queue or already loaded to the file system; otherwise, 0.

virtual MeshPtr getMesh (const char * name) const =0

Checks whether the mesh is placed to the loading queue.

Arguments

  • const char * name - Mesh name.

Return value

Loaded mesh smart pointer. If the mesh is not placed to the queue, NULL is retuned.
Last update: 2017-07-03
Build: ()