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

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

Public 成员函数 | 所有成员列表

FileUtilsApple类 参考 Platform Adaptor

处理文件操作的协助类 更多…

#include

类 FileUtilsApple 继承关系图:

Public 成员函数 - 图3 FileUtils

## Public 成员函数
virtual std::string getWritablePath () const override
获取可写的路径 更多…
virtual std::string getFullPathForDirectoryAndFilename (const std::string &directory, const std::string &filename) override
以目录和文件名为参数获取完整路径 更多…
virtual ValueMap getValueMapFromFile (const std::string &filename) override
把文件的内容转换成ValueMap 更多…
virtual bool writeToFile (ValueMap &dict, const std::string &fullPath) override
把ValueMap写到一个plist文件中 更多…
virtual ValueVector getValueVectorFromFile (const std::string &filename) override
Converts the contents of a file to a ValueVector. 更多…
- Public 成员函数 继承自 FileUtils
virtual ~FileUtils ()
FileUtils的析构函数 NA NA. 更多…
virtual void purgeCachedEntries ()
清理文件查找缓存 更多…
virtual std::string getStringFromFile (const std::string &filename)
通过文件名获得文件内容,返回string类型 更多…
virtual Data getDataFromFile (const std::string &filename)
创建文件内容的二进制数据 更多…
virtual CC_DEPRECATED_ATTRIBUTE unsigned char getFileData (const std::string &filename, const char mode, ssize_t size)
获取资源文件数据 更多…
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 bool isAbsolutePath (const std::string &path) const
检查路径是不是绝对路径 更多…
virtual void setPopupNotify (bool notify)
设置或获得当图片加载失败的时候是否弹出一个消息框 更多…
virtual bool isPopupNotify ()
const std::unordered_map < std::string, std::string > & getFullPathCache () const
返回完整路径的缓存 更多…
## 额外继承的成员函数
- 静态 Public 成员函数 继承自 FileUtils
static FileUtils getInstance ()
获取 FileUtils的实例 更多…
static void destroyInstance ()
销毁FileUtils的实例 更多…
static CC_DEPRECATED_ATTRIBUTE FileUtils sharedFileUtils ()
static CC_DEPRECATED_ATTRIBUTE void purgeFileUtils ()
- Protected 成员函数 继承自 FileUtils
FileUtils ()
默认构造函数. 更多…
virtual bool init ()
初始化FileUtils实例. 更多…
virtual std::string getNewFilename (const std::string &filename) const
从文件名查找词典中获取新的文件名 它可能有一个重写的名字 更多…
virtual std::string getPathForFilename (const std::string &filename, const std::string &resolutionDirectory, const std::string &searchPath)
以文件名、解析目录和查找路径为参数获取完整路径 更多…
- 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的单例指针 更多…

详细描述

处理文件操作的协助类

成员函数说明

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

overridevirtual

以目录和文件名为参数获取完整路径

  • 注解
  • 只有在IOS和Mac平台上需要重载这个方法,因为这两个平台上他们使用[[NSBundle mainBundle] pathForResource: ofType: inDirectory:] 来获得完整路径。在其他的平台上则是使用这个方法的默认实现
  • 参数
  • strDirectory包含我们将要查找文件的目录 strFilename文件名

  • 返回
  • 返回文件的完整路径,如果查找不到此文件,则放回一个空的string对象

重载 FileUtils .

virtual ValueMap getValueMapFromFile ( const std::string & filename)

overridevirtual

把文件的内容转换成ValueMap

  • 注解
  • 这是个内部调用的函数

重载 FileUtils .

virtual ValueVector getValueVectorFromFile ( const std::string & filename)

overridevirtual

Converts the contents of a file to a ValueVector.

  • 注解
  • This method is used internally.

重载 FileUtils .

virtual std::string getWritablePath ( ) const

overridevirtual

获取可写的路径

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

实现了 FileUtils.

virtual bool writeToFile ( ValueMap & dict,
const std::string & fullPath
)

overridevirtual

把ValueMap写到一个plist文件中

  • 注解
  • 这是个内部调用的函数

重载 FileUtils .


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