//-----------------------------------------------------------------------------+ // Copyright (C), 1998-2007, SH Software Co. Ltd. // = FileName : XASLibMan 类 // = Version : ver2.0 // = Author : zjq // = CreateDate : 2002-09-09 // = Description: XASLibMan 声明 // = Maintainers: // //-----------------------------------------------------------------------------+ #ifndef _XASLibMan_H_ #define _XASLibMan_H_ #ifndef _DLIST_H_ #include "DList.h" #endif #ifndef _XASTRING_H_ #include "XAString.h" #endif #ifndef _XWCSTRING_H_ #include "XWString.h" #endif #include #include "XStreamFile.h" using namespace XGeLib; class GEOAPI XASLibMan { friend class DlgSlbMan; public: XASLibMan(const TCHAR *fname, const TCHAR *ext = SLD_EXT, const TCHAR *t = SLB_TITLE, int opMode = (_ios::in | _ios::out | _ios::binary)); virtual ~XASLibMan(); //拷贝第 n 个记录到磁盘文件 virtual int Copy(int n, const TCHAR *sldfile); virtual int QuickCopy(const TCHAR *sldfile); // 往库文件添加一个记录 virtual int Append(const TCHAR *sldfile, const TCHAR *szEntryName = NULL); //移第 n 个记录到磁盘文件 virtual int Move(int n, const TCHAR *sldfile); int operator !(); int Open(const TCHAR *file = NULL, int mode = (_ios::in | _ios::out | _ios::binary)); // 文件打开状态可用 //取得库文件的第 n 个记录 int GetRecord(int n, Catalogue *rec); //取得所有幻灯列表 int GetAll(DList &res); int GetAll(DList &res); //取得记录的个数 int Length(); // 判断一记录在库文件里是否存在 int IsExist(const TCHAR *sldname, int *index); // 删除库文件第 n 个记录 int Remove(int n); int Remove(const TCHAR *sld); //改第 n 个记录的名称 int Rename(int n, const TCHAR *sldfile); void Close(); char * ReadItem(const TCHAR *szItemName, unsigned *nLen); protected: enum FileOperation { File_Add, File_Del, File_Copy, File_Move }; int MoveFilePtr(int n); //把文件指针移到第 n 个记录的起始 // 必须以读或写方式打开 int MainTain(const TCHAR *sldname, FileOperation opr, const TCHAR *szItem = NULL); int MoveOrCopy(int n, const TCHAR *sldfile, FileOperation opr); protected: #if (ARX>15) std::fstream _libfile; #else fstream _libfile; #endif int openMode; XString slbfile; XString libExt, itemExt; XAString title; XStreamFile* m_pStreamFile; }; #endif