Files

113 lines
2.4 KiB
C++
Raw Permalink Normal View History

2026-10-04 00:04:20 +08:00
//-----------------------------------------------------------------------------+
2026-09-28 15:28:50 +08:00
// Copyright (C), 1998-2007, SH Software Co. Ltd.
2026-10-04 00:04:20 +08:00
// = FileName : XASLibMan 类
2026-09-28 15:28:50 +08:00
// = Version : ver2.0
// = Author : zjq
// = CreateDate : 2002-09-09
2026-10-04 00:04:20 +08:00
// = Description: XASLibMan 声明
2026-09-28 15:28:50 +08:00
// = 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 <fstream>
#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();
2026-10-04 00:04:20 +08:00
//拷贝第 n 个记录到磁盘文件
2026-09-28 15:28:50 +08:00
virtual int Copy(int n, const TCHAR *sldfile);
virtual int QuickCopy(const TCHAR *sldfile);
2026-10-04 00:04:20 +08:00
// 往库文件添加一个记录
2026-09-28 15:28:50 +08:00
virtual int Append(const TCHAR *sldfile, const TCHAR *szEntryName = NULL);
2026-10-04 00:04:20 +08:00
//移第 n 个记录到磁盘文件
2026-09-28 15:28:50 +08:00
virtual int Move(int n, const TCHAR *sldfile);
int operator !();
int Open(const TCHAR *file = NULL, int mode = (_ios::in | _ios::out | _ios::binary));
2026-10-04 00:04:20 +08:00
// 文件打开状态可用
//取得库文件的第 n 个记录
2026-09-28 15:28:50 +08:00
int GetRecord(int n, Catalogue *rec);
2026-10-04 00:04:20 +08:00
//取得所有幻灯列表
2026-09-28 15:28:50 +08:00
int GetAll(DList<TCHAR> &res);
int GetAll(DList<Catalogue> &res);
2026-10-04 00:04:20 +08:00
//取得记录的个数
2026-09-28 15:28:50 +08:00
int Length();
2026-10-04 00:04:20 +08:00
// 判断一记录在库文件里是否存在
2026-09-28 15:28:50 +08:00
int IsExist(const TCHAR *sldname, int *index);
2026-10-04 00:04:20 +08:00
// 删除库文件第 n 个记录
2026-09-28 15:28:50 +08:00
int Remove(int n);
int Remove(const TCHAR *sld);
2026-10-04 00:04:20 +08:00
//改第 n 个记录的名称
2026-09-28 15:28:50 +08:00
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
};
2026-10-04 00:04:20 +08:00
int MoveFilePtr(int n); //把文件指针移到第 n 个记录的起始
2026-09-28 15:28:50 +08:00
2026-10-04 00:04:20 +08:00
// 必须以读或写方式打开
2026-09-28 15:28:50 +08:00
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