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
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials
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 isBufferFile (const char * name) const =0

Checks if the given file is loaded (see the addBufferFile() function) into a buffer.

Arguments

  • const char * name - File name.

Return value

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

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

Buffers a file in the memory.

Arguments

  • const char * name - File name.

Return value

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

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

Removes a buffer with a file from the memory. Buffering 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 buffer in the memory, its modifications can be saved fast into this buffer.

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.
Last update: 2017-07-03
Build: ()