IOFile(const char * path = 0) | 原型 | IOFile(const char * path = 0) | | 描述 | 构造IOFile | | 参数 | [i]const char * path = 0: 文件路径 | | 返回值 | 无 | bool open(IOFlag f) | 原型 | bool open(IOFlag f) | | 描述 | 设置文件读写模式并打开文件,此时m_pFp将被赋予一个有效文件指针 | | 参数 | [i]IOFlag f: 文件模式,支持四种:二进制读入、二进制写出、文本读入、文本写出 | | 返回值 | 打开文件成功则返回true,否则返回false | bool isEnd() | 原型 | bool isEnd() | | 描述 | 当读入文件时,判断是否到文件结束位置 | | 参数 | 无 | | 返回值 | 到达文件结束位置返回true,否则返回false | void close() | 原型 | void close() | | 描述 | 关闭文件,重置文件指针m_pFp | | 参数 | 无 | | 返回值 | 无 | int64 size() | 原型 | int64 size() | | 描述 | 当读入文件时,获取文件大小 | | 参数 | 无 | | 返回值 | 文件大小 | void writeBinary(void * data,int size) | 原型 | void writeBinary(void * data,int size) | | 描述 | 二进制写出时,将大小为size的数据块data写出 | | 参数 | [i]void * data: 数据块地址 \\ [i]int size: 数据块大小 | | 返回值 | 无 | void readBinary(void * data,int size) | 原型 | void readBinary(void * data,int size) | | 描述 | 二进制读入时,读入大小为size的数据块到内存data中 | | 参数 | [i]void * data: 有效内存空间 \\ [i]int size: 读入的数据块大小 | | 返回值 | 无 | void writeChar(char c) | 原型 | void writeChar(char c) | | 描述 | 二进制写出时,写出一个字节 | | 参数 | [i]char c: 待写出的字节 | | 返回值 | 无 | char readChar() | 原型 | char readChar() | | 描述 | 二进制读入时,读入一个字节 | | 参数 | 无 | | 返回值 | 读入的字节 | void writeText(const char * data) | 原型 | void writeText(const char * data) | | 描述 | 文本格式输出时,输出字符串 | | 参数 | [i]const char * data: 输出的字符串 | | 返回值 | 无 | void readText(const char * data) | 原型 | void readText(const char * data) | | 描述 | 文本格式读入时,读入字符串到内存空间data中 | | 参数 | [i]const char * data: 放置字符串的内存空间 | | 返回值 | 无 | void setPath(const char * path) | 原型 | void setPath(const char * path) | | 描述 | 重新设置文件路径 | | 参数 | [i]const char * path: 文件路径字符串 | | 返回值 | 无 | int64 getCurPos() | 原型 | int64 getCurPos() | | 描述 | 获取文件当前的位置 | | 参数 | 无 | | 返回值 | 文件当前的位置 | void setPos(int64 pos) | 原型 | void setPos(int64 pos) | | 描述 | 设置文件当前位置到pos | | 参数 | [i]int64 pos: 文件的目标位置 | | 返回值 | 无 | const char * getPath() | 原型 | const char * getPath() | | 描述 | 获取文件路径 | | 参数 | 无 | | 返回值 | 文件路径 | BlockHeader * getHeader(bool bKeepPos = true) | 原型 | BlockHeader * getHeader(bool bKeepPos = true) | | 描述 | 获取二进制数据块的块头结构 | | 参数 | [i]bool bKeepPos = true: 若保持位置,则读出一个块头结构之后将文件当前位置回位到读出之前的位置,否则将在读出之后的位置 | | 返回值 | 读出的块头结构指针 | DBVersion * getVersion(bool bKeepPos = true) | 原型 | DBVersion * getVersion(bool bKeepPos = true) | | 描述 | 获取二进制数据的块头结构的版本信息 | | 参数 | [i]bool bKeepPos = true: 若保持位置,则读出一个版本信息之后将文件当前位置回位到读出之前的位置,否则将在读出之后的位置 | | 返回值 | 读出的版本信息结构体指针 | void startBlock(BlockHeader & header,bool bAuto = true) | 原型 | void startBlock(BlockHeader & header,bool bAuto = true) | | 描述 | 二进制写出模式时,开始一个数据块的输出 | | 参数 | [i]BlockHeader & header: 数据块的块头结构 \\ [i]bool bAuto = true: 若为true,则在结束数据块输出时(endblock)自动计算该数据块的大小;否则由调用者自己计算大小 | | 返回值 | 无 | void endBlock(BlockHeader & header,bool bAuto = true) | 原型 | void endBlock(BlockHeader & header,bool bAuto = true) | | 描述 | 二进制文件写出时,结束一个数据块的输出 | | 参数 | [i]BlockHeader & header: 数据块的块头结构 \\ [i]bool bAuto = true: 若为真,则自动计算数据块的大小; | | 返回值 | 无 | ErrorCode readBlockHeader(BlockHeader & header) | 原型 | ErrorCode readBlockHeader(BlockHeader & header) | | 描述 | 二进制文件读入时,开始读入数据块的块头结构。注意,该函数一般与assertBlock配套使用 | | 参数 | [i]BlockHeader & header: 块头结构 | | 返回值 | 根据实际情况返回错误编码,若没有错误返回Error_None | void assertBlock(BlockHeader & header) | 原型 | void assertBlock(BlockHeader & header) | | 描述 | 二进制文件读入时,结束读入数据块,并对数据块大小进行校验 | | 参数 | [i]BlockHeader & header: 数据块的块头信息 | | 返回值 | 无 | void skipBlock() | 原型 | void skipBlock() | | 描述 | 二进制文件读入时,根据数据块的大小信息略过该数据块 | | 参数 | 无 | | 返回值 | 无 | int readInt() | 原型 | int readInt() | | 描述 | 二进制文件读入时,读入一个整型数 | | 参数 | 无 | | 返回值 | 读入的整型值 | double readDouble() | 原型 | double readDouble() | | 描述 | 二进制文件读入时,读入一个浮点数 | | 参数 | 无 | | 返回值 | 读入的浮点数值 | char * readName(char * str = 0) | 原型 | char * readName(char * str = 0) | | 描述 | 二进制文件读入时,读入一个名字(为MAX_NAME_LENGTH大小) | | 参数 | [i]char * str = 0: 存放名字的内存空间,可为空 | | 返回值 | 若存放名字的内存空间为空,则返回读入的名字地址 | void writeInt(int v) | 原型 | void writeInt(int v) | | 描述 | 二进制文件写出时,写出一个整型数 | | 参数 | [i]int v: 写出的整型数 | | 返回值 | 无 | void writeDouble(double v) | 原型 | void writeDouble(double v) | | 描述 | 二进制文件写出时,写出一个浮点数 | | 参数 | [i]double v: 写出的浮点数 | | 返回值 | 无 | void writeName(char * str) | 原型 | void writeName(char * str) | | 描述 | 二进制文件写出时,写出一个名字 | | 参数 | [i]char * str: 写出的名字 | | 返回值 | 无 | char * readKeyword() | 原型 | char * readKeyword() | | 描述 | 文本格式读入时,读入一个关键字(大小为32个字节) | | 参数 | 无 | | 返回值 | 关键字字符串 | bool isNextKeyword(const char * key = 0) | 原型 | bool isNextKeyword(const char * key = 0) | | 描述 | 文本格式读入时,判断下面是否为指定的关键字 | | 参数 | [i]const char * key = 0: 待匹配的关键字,若为0,则匹配任意关键字 | | 返回值 | 若匹配成功,则返回true,否则返回false; | int readTextInt() | 原型 | int readTextInt() | | 描述 | 文本格式读入时,读入一个整型数(12个字节大小) | | 参数 | 无 | | 返回值 | 读入的整型数值 | double readTextDouble() | 原型 | double readTextDouble() | | 描述 | 文本格式读入时,读入一个浮点数(18个字节大小) | | 参数 | 无 | | 返回值 | 读入的浮点数值 | bool readTextBool() | 原型 | bool readTextBool() | | 描述 | 文本格式读入时,读入一个bool变量(%-8s) | | 参数 | 无 | | 返回值 | 若为“true”则返回true,否则返回false | void writeTextInt(int v) | 原型 | void writeTextInt(int v) | | 描述 | 文本格式写出时,写出一个整型数(%12d) | | 参数 | [i]int v: 整型数 | | 返回值 | 无 | void writeTextDouble(double v) | 原型 | void writeTextDouble(double v) | | 描述 | 文本格式写出时,写出一个浮点数(%18.9e) | | 参数 | [i]double v: 浮点数 | | 返回值 | 无 | void writeTextBool(bool v) | 原型 | void writeTextBool(bool v) | | 描述 | 文本格式写出时,写出一个bool值(%-8s) | | 参数 | [i]bool v: 若v为true,写出“true”,否则写出“false” | | 返回值 | 无 | void writeKeyword(char * v) | 原型 | void writeKeyword(char * v) | | 描述 | 文本格式写出时写出一个关键字(@%31s) | | 参数 | [i]char * v: 关键字字符串 | | 返回值 | 无 | void nextLine() | 原型 | void nextLine() | | 描述 | 文本格式写出时,开始新的一行 | | 参数 | 无 | | 返回值 | 无 | void skipLine() | 原型 | void skipLine() | | 描述 | 文本格式读入时,略过一行 | | 参数 | 无 | | 返回值 | 无 | void readPath(char * path) | 原型 | void readPath(char * path) | | 描述 | 文本格式读入时,读入文本路径,最大为MAX_PATH_LENGTH. | | 参数 | [i]char * path: 放置文本路径的内存地址 | | 返回值 | 无 | void skipWhite() | 原型 | void skipWhite() | | 描述 | 略过空白字符(回车符、制表符和空格) | | 参数 | 无 | | 返回值 | 无 | void skipComment() | 原型 | void skipComment() | | 描述 | 文本格式读入时,略过注释 | | 参数 | 无 | | 返回值 | 无 | void showProgress() | 原型 | void showProgress() | | 描述 | 向主框架通知当前的读入/写出进度信息,当写出时,需预先计算写出的文件大小 | | 参数 | 无 | | 返回值 | 无 | void enableBuffer(int size) | 原型 | void enableBuffer(int size) | | 描述 | 开启缓存模式并分配缓存空间,仅在文本格式时有效 | | 参数 | [i]int size: 缓存空间大小 | | 返回值 | 无 | void disableBuffer() | 原型 | void disableBuffer() | | 描述 | 关闭缓存模式 | | 参数 | 无 | | 返回值 | 无 | void resetBuffer() | 原型 | void resetBuffer() | | 描述 | 读入数据内容到缓存空间中 | | 参数 | 无 | | 返回值 | 无 | void flushBuffer() | 原型 | void flushBuffer() | | 描述 | 将缓存空间内容一次性写出到文件中 | | 参数 | 无 | | 返回值 | 无 | IOFile & operator << (double v) | 原型 | IOFile & operator << (double v) | | 描述 | 读入文本浮点数的简化函数,同[[iofile#writetextdouble|writeTextDouble]] | | 参数 | [i]double v: 浮点数 | | 返回值 | 当前IOFile的引用 | IOFile & operator << (int v) | 原型 | IOFile & operator << (int v) | | 描述 | 同[[iofile#writetextint|writeTextInt]] | | 参数 | [i]int v: 整数 | | 返回值 | 当前IOFile的引用 | IOFile & operator << (ulong v) | 原型 | IOFile & operator << (ulong v) | | 描述 | 同[[iofile#writetextint|writeTextInt]] | | 参数 | [i]ulong v: 无符号整数值 | | 返回值 | 当前IOFile的引用 | IOFile & operator << (bool v) | 原型 | IOFile & operator << (bool v) | | 描述 | 同[[iofile#writetextbool|writeTextBool]] | | 参数 | [i]bool v: bool值 | | 返回值 | 当前IOFile的引用 | IOFile & operator << (char * keyword) | 原型 | IOFile & operator << (char * keyword) | | 描述 | 同[[iofile#writekeyword|writeKeyword]] | | 参数 | [i]char * keyword: 关键字字符串,最长31个字符 | | 返回值 | 当前IOFile的引用 | IOFile & operator << (IOCharacter c) | 原型 | IOFile & operator << (IOCharacter c) | | 描述 | 文本输出模式时,输出特殊字符。目前只支持NewLine,等同于[[iofile#nextline|nextLine]] | | 参数 | [i]IOCharacter c: 特殊字符,目前只支持NewLine | | 返回值 | 当前IOFile的引用 | IOFile & operator >> (double& v) | 原型 | IOFile & operator >> (double& v) | | 描述 | 文本读入模式时,读入浮点数,同[[iofile#readtextdouble|readTextDouble]] | | 参数 | [i]double& v: 读入的浮点数将赋值到v上 | | 返回值 | 当前IOFile的引用 | IOFile & operator >> (int& v) | 原型 | IOFile & operator >> (int& v) | | 描述 | 文本读入模式时,读入整数,同[[iofile#readtextint|readTextInt]] | | 参数 | [i]int& v: 读入的整型数将赋值到v上 | | 返回值 | 当前IOFile的引用 | IOFile & operator >> (ulong& v) | 原型 | IOFile & operator >> (ulong& v) | | 描述 | 文本读入模式时,读入无符号整数 | | 参数 | [i]ulong& v: 读入的无符号整数将赋值到v上 | | 返回值 | 当前IOFile的引用 | IOFile & operator >> (bool& v) | 原型 | IOFile & operator >> (bool& v) | | 描述 | 文本读入模式时,读入bool值,同[[iofile#readtextdouble|readTextDouble]] | | 参数 | [i]bool& v: 读入的bool值将赋值到v上 | | 返回值 | 当前IOFile的引用 | IOFile & operator >> (char * keyword) | 原型 | IOFile & operator >> (char * keyword) | | 描述 | 文本读入模式时,读入关键字,同[[iofile#readtextdouble|readTextDouble]] | | 参数 | [i]char * keyword: 读入的关键字将放到keyword中,最长31个有效字符 | | 返回值 | 当前IOFile的引用 | IOFile & operator >> (IOCharacter c) | 原型 | IOFile & operator >> (IOCharacter c) | | 描述 | 文本读入模式时,读入特殊字符。目前只支持NewLine,等同于[[iofile#skipline|skipLine]] | | 参数 | [i]IOCharacter c: 特殊字符 | | 返回值 | 当前IOFile的引用 | void pumpBuffer() | 原型 | void pumpBuffer() | | 描述 | 从文件中读入新的内容到缓存空间中 | | 参数 | 无 | | 返回值 | 无 |