cocos2d-x 3.0
- 首页 - 相关页面 - 模块 - 命名空间 - - 文件 -
Public 成员函数 - 图1 Public 成员函数 - 图2)
- 类列表 - 类索引 - 类继承关系 - 类成员

全部)) 命名空间) 文件) 函数) 变量) 类型定义) 枚举) 枚举值) 属性) 友元) 宏定义)))

Public 成员函数 | Protected 成员函数 | 友元 | 所有成员列表

FileUtilsWin32类 参考 Platform Adaptor

Helper class to handle file operations. 更多…

#include

类 FileUtilsWin32 继承关系图:

Public 成员函数 - 图3 FileUtils

## Public 成员函数
bool init ()
初始化FileUtils实例. 更多…
virtual std::string getWritablePath () const
获取可写的路径 更多…
virtual bool isAbsolutePath (const std::string &strPath) const
检查路径是不是绝对路径 更多…
- Public 成员函数 继承自 FileUtils
virtual ~FileUtils ()
FileUtils的析构函数 NA NA. 更多…
virtual void purgeCachedEntries ()
清理文件查找缓存 更多…
virtual unsigned char getFileDataFromZip (const std::string &zipFilePath, const std::string &filename, ssize_t size)
从zip文件中获取资源文件数据 更多…
virtual std::string fullPathForFilename (const std::string &filename)
返回给定的文件名的完整路径 更多…
virtual void loadFilenameLookupDictionaryFromFile (const std::string &filename)
通过文件名加载文件查找词典。 更多…
virtual void setFilenameLookupDictionary (const ValueMap &filenameLookupDict)
设置文件查找词典 更多…
virtual std::string fullPathFromRelativeFile (const std::string &filename, const std::string &relativeFile)
通过文件名和文件的湘桂路径获取完整路径 更多…
virtual void setSearchResolutionsOrder (const std::vector< std::string > &searchResolutionsOrder)
设置包含资源查找路径的array 更多…
virtual void addSearchResolutionsOrder (const std::string &order)
添加资源的查找顺序 更多…
virtual const std::vector < std::string > & getSearchResolutionsOrder ()
获取包含资源查找顺序的array 更多…
virtual void setSearchPaths (const std::vector< std::string > &searchPaths)
设置一组查找路径 更多…
void addSearchPath (const std::string &path)
添加查找路径 更多…
virtual const std::vector < std::string > & getSearchPaths () const
获取一组查找路径 更多…
virtual bool isFileExist (const std::string &filename) const
检查文件是否存在 更多…
virtual void setPopupNotify (bool notify)
设置或获得当图片加载失败的时候是否弹出一个消息框 更多…
virtual bool isPopupNotify ()
virtual ValueMap getValueMapFromFile (const std::string &filename)
把文件的内容转换成ValueMap 更多…
virtual bool writeToFile (ValueMap &dict, const std::string &fullPath)
把ValueMap写到一个plist文件中 更多…
virtual ValueVector getValueVectorFromFile (const std::string &filename)
Converts the contents of a file to a ValueVector. 更多…
const std::unordered_map < std::string, std::string > & getFullPathCache () const
返回完整路径的缓存 更多…
## Protected 成员函数
virtual bool isFileExistInternal (const std::string &strFilePath) const
在不考虑查找路径和解析顺序的情况下,检查文件是否存在 更多…
virtual unsigned char getFileData (const std::string &filename, const char mode, ssize_t *size) override
Gets resource file data. 更多…
virtual std::string getStringFromFile (const std::string &filename) override
Gets string from a file. 更多…
virtual Data getDataFromFile (const std::string &filename) override
Creates binary data from a file. 更多…
virtual std::string getPathForFilename (const std::string &filename, const std::string &resolutionDirectory, const std::string &searchPath) override
Gets full path for filename, resolution directory and search path. 更多…
virtual std::string getFullPathForDirectoryAndFilename (const std::string &directory, const std::string &filename) override
Gets full path for the directory and the filename. 更多…
- Protected 成员函数 继承自 FileUtils
FileUtils ()
默认构造函数. 更多…
virtual std::string getNewFilename (const std::string &filename) const
从文件名查找词典中获取新的文件名 它可能有一个重写的名字 更多…
## 友元
class FileUtils
## 额外继承的成员函数
- 静态 Public 成员函数 继承自 FileUtils
static FileUtils getInstance ()
获取 FileUtils的实例 更多…
static void destroyInstance ()
销毁FileUtils的实例 更多…
static CC_DEPRECATED_ATTRIBUTE FileUtils sharedFileUtils ()
static CC_DEPRECATED_ATTRIBUTE void purgeFileUtils ()
- Protected 属性 继承自 FileUtils
ValueMap _filenameLookupDict
基于键值查找文件名的Dictionary变量 常下面的这些方法中使用: 更多…
std::vector< std::string > _searchResolutionsOrderArray
包含分辨率文件夹的vector对象 在vector中的索引值越小,对应的分辨率从目录的优先级就越高 更多…
std::vector< std::string > _searchPathArray
包含查找路径的vector变量 在vector中的索引值越小,对应的查找路径的优先级就越高 更多…
std::string _defaultResRootPath
资源的默认的根路径 如果要改变这个资源的默认的根路径,我们可以在FileUtils子类的init方法中完成 例如: 在Android平台上,资源的默认根路径会在FileUtilsAndroid::init()中被赋值为"assets/" 在Blackberry平台上,我们在FileUtilsBlackberry::init()中把"app/native/Resources/"赋给这个变量。 更多…
std::unordered_map < std::string, std::string > _fullPathCache
完整路径的缓存。在文件被查找到之后,会把文件的完整路径添加到这个缓存中。 这个变量是用来提高文件查找性能的。 更多…
- 静态 Protected 属性 继承自 FileUtils
static FileUtils * s_sharedFileUtils
FileUtils的单例指针 更多…

详细描述

Helper class to handle file operations.

成员函数说明

virtual Data getDataFromFile ( const std::string & filename)

overrideprotectedvirtual

Creates binary data from a file.

  • 返回
  • A data object.

重载 FileUtils .

virtual unsigned char getFileData ( const std::string & filename,
const char mode,
ssize_t * size
)

overrideprotectedvirtual

Gets resource file data.

  • 参数
  • [in]filenameThe resource file name which contains the path. [in]modeThe read mode of the file. [out]sizeIf the file read operation succeeds, it will be the data size, otherwise 0.

  • 返回
  • Upon success, a pointer to the data is returned, otherwise NULL.
  • 警告
  • Recall: you are responsible for calling delete[] on any Non-NULL pointer returned.

重载 FileUtils .

virtual std::string getFullPathForDirectoryAndFilename ( const std::string & directory,
const std::string & filename
)

overrideprotectedvirtual

Gets full path for the directory and the filename.

  • 注解
  • Only iOS and Mac need to override this method since they are using [[NSBundle mainBundle] pathForResource: ofType: inDirectory:] to make a full path. Other platforms will use the default implementation of this method.
  • 参数
  • directoryThe directory contains the file we are looking for. filenameThe name of the file.

  • 返回
  • The full path of the file, if the file can't be found, it will return an empty string.

重载 FileUtils .

virtual std::string getPathForFilename ( const std::string & filename,
const std::string & resolutionDirectory,
const std::string & searchPath
)

overrideprotectedvirtual

Gets full path for filename, resolution directory and search path.

  • 参数
  • filenameThe file name. resolutionDirectoryThe resolution directory. searchPathThe search path.

  • 返回
  • The full path of the file. It will return an empty string if the full path of the file doesn't exist.

重载 FileUtils .

virtual std::string getStringFromFile ( const std::string & filename)

overrideprotectedvirtual

Gets string from a file.

重载 FileUtils .

virtual std::string getWritablePath ( ) const

virtual

获取可写的路径

  • 返回
  • 返回一个可以写入或读取文件的路径

实现了 FileUtils.

bool init ( )

virtual

初始化FileUtils实例.

set _searchPathArray and _searchResolutionsOrderArray 将被赋予默认的值

  • 注解
  • 当你把Cocos2d-x移植到一个新的平台,你要注意这个方法。 你可以在FileUtils的子类中(如:FileUtilsAndroid)给value to _defaultResRootPath赋一个默认值,然后调用FileUtils::init().
  • 返回
  • 如果成功则返回true,否则返回false

重载 FileUtils .

virtual bool isAbsolutePath ( const std::string & path) const

virtual

检查路径是不是绝对路径

  • 注解
  • 在Android平台上,如果传递进来的参数是相对于"assets/",这个方法就会把它当成绝对路径 在blackBarry平台上,以"app/native/Resources/"开头的路径被看成绝对路径
  • 参数
  • strPath需要检查的路径

  • 返回
  • 如果是绝对路径返回true,否则返回false

重载 FileUtils .

virtual bool isFileExistInternal ( const std::string & filename) const

protectedvirtual

在不考虑查找路径和解析顺序的情况下,检查文件是否存在

实现了 FileUtils.

友元及相关函数文档

friend class FileUtils

friend


该类的文档由以下文件生成: