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.
 
virtual std::string getStringFromFile (const std::string &filename)
 Gets string from a file.
 
virtual Data getDataFromFile (const std::string &filename)
 Creates binary data from a file. More...
 

Static Public Member Functions

static FileUtilsgetInstance ()
 Gets the instance of FileUtils.
 
static void 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 ()
static void 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

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

Creates binary data from a file.

A data object.


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