Cocos2d-x  v3.12
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
FileUtils Class Reference

Helper class to handle file operations. More...

Inherited by FileUtilsTizen.

Public Member Functions

virtual ~FileUtils ()
 The destructor of FileUtils.
 
virtual void purgeCachedEntries ()
 Purges full path caches.
 
local purgeCachedEntries ()
 Purges full path caches.
 
virtual std::string getStringFromFile (const std::string &filename)
 Gets string from a file.
 
var getStringFromFile ( var filename)
 Gets string from a file.
 
local getStringFromFile ( local filename)
 Gets string from a file.
 
virtual Data getDataFromFile (const std::string &filename)
 Creates binary data from a file. More...
 
var getDataFromFile ( var filename)
 Creates binary data from a file. More...
 
local getDataFromFile ( local filename)
 Creates binary data from a file. More...
 

Static Public Member Functions

static FileUtilsgetInstance ()
 Gets the instance of FileUtils.
 
var getInstance ()
 Gets the instance of FileUtils.
 
local getInstance ()
 Gets the instance of FileUtils.
 
static void destroyInstance ()
 Destroys the instance of FileUtils.
 
local destroyInstance ()
 Destroys the instance of FileUtils.
 
static void setDelegate (FileUtils *delegate)
 You can inherit from platform dependent implementation of FileUtils, such as FileUtilsAndroid, and use this function to set delegate, then FileUtils will invoke delegate's implementation. More...
 
static FileUtilssharedFileUtils ()
local sharedFileUtils ()
static void purgeFileUtils ()
local purgeFileUtils ()

Detailed Description

Helper class to handle file operations.

Member Function Documentation

static void setDelegate ( FileUtils delegate)
static

You can inherit from platform dependent implementation of FileUtils, such as FileUtilsAndroid, and use this function to set delegate, then FileUtils will invoke delegate's implementation.

For example, your resources are encrypted, so you need to decrypt it after reading data from resources, then you can implement all getXXX functions, and engine will invoke your own getXX functions when reading data of resources.

If you don't want to system default implementation after setting delegate, you can just pass nullptr to this function.

It will delete previous delegate

var setDelegate ( var  delegate)
static

You can inherit from platform dependent implementation of FileUtils, such as FileUtilsAndroid, and use this function to set delegate, then FileUtils will invoke delegate's implementation.

For example, your resources are encrypted, so you need to decrypt it after reading data from resources, then you can implement all getXXX functions, and engine will invoke your own getXX functions when reading data of resources.

If you don't want to system default implementation after setting delegate, you can just pass nullptr to this function.

It will delete previous delegate

static FileUtils* sharedFileUtils ( )
inlinestatic
var sharedFileUtils ( )
inlinestatic
local sharedFileUtils ( )
inlinestatic
static void purgeFileUtils ( )
inlinestatic
var purgeFileUtils ( )
inlinestatic
local purgeFileUtils ( )
inlinestatic
virtual Data getDataFromFile ( const std::string &  filename)
virtual

Creates binary data from a file.

A data object.

var getDataFromFile ( var  filename)
virtual

Creates binary data from a file.

A data object.

local getDataFromFile ( local  filename)
virtual

Creates binary data from a file.

A data object.


The documentation for this class was generated from the following file: