IOFile

Inherited from NULL

Inherited by NULL

Friend class NULL

Description

IOFile封装了文件IO的操作,支持大于2GB的大文件的读入写出,IOFile支持二进制和文本格式的读入写出,对于文本格式,IOFile还提供了缓存模式,可以大幅提高文件IO的性能。除此之外,针对XT系统的应用,IOFile还提供了二进制数据块的校验功能(startBlock、endBlock、readBlockHeader和assertBlock),根据XT系统的文本文件格式,提供了方便的读入写出函数。

Members

Public interface


Path m_strPath

IOFile读入或者写出的文件路径

void* m_pFp

IOFile操作的目标文件指针

int64 m_liSize

文件大小,一般用于显示文件读入或者写出进度

char * m_pBuf

缓存模式时,缓存空间的地址

int m_iBufSize

缓存模式时缓存空间的大小


IOFile(const char * path = 0)

bool open(IOFlag f)

bool isEnd()

void close()

int64 size()

void writeBinary(void * data,int size)

void readBinary(void * data,int size)

void writeChar(char c)

char readChar()

void writeText(const char * data)

void readText(const char * data)

void setPath(const char * path)

int64 getCurPos()

void setPos(int64 pos)

const char * getPath()

BlockHeader * getHeader(bool bKeepPos = true)

DBVersion * getVersion(bool bKeepPos = true)

void startBlock(BlockHeader & header,bool bAuto = true)

void endBlock(BlockHeader & header,bool bAuto = true)

ErrorCode readBlockHeader(BlockHeader & header)

void assertBlock(BlockHeader & header)

void skipBlock()

int readInt()

double readDouble()

char * readName(char * str = 0)

void writeInt(int v)

void writeDouble(double v)

void writeName(char * str)

char * readKeyword()

bool isNextKeyword(const char * key = 0)

int readTextInt()

double readTextDouble()

bool readTextBool()

void writeTextInt(int v)

void writeTextDouble(double v)

void writeTextBool(bool v)

void writeKeyword(char * v)

void nextLine()

void skipLine()

void readPath(char * path)

void skipWhite()

void skipComment()

void showProgress()

void enableBuffer(int size)

void disableBuffer()

void resetBuffer()

void flushBuffer()

IOFile & operator « (double v)

IOFile & operator « (int v)

IOFile & operator « (ulong v)

IOFile & operator « (bool v)

IOFile & operator « (char * keyword)

IOFile & operator « (IOCharacter c)

IOFile & operator » (double& v)

IOFile & operator » (int& v)

IOFile & operator » (ulong& v)

IOFile & operator » (bool& v)

IOFile & operator » (char * keyword)

IOFile & operator » (IOCharacter c)

void pumpBuffer()