📄 fileindexlist.cpp
字号:
// FileIndexList.cpp: implementation of the CFileIndexList class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Compress.h"
#include "FileIndexList.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
FILEINDEXLIST::FILEINDEXLIST()
{
root=new FILEINDEXLISTNODE;
root->next=NULL;
tail=root;
tail->nIndex=-1;
}
FILEINDEXLIST::~FILEINDEXLIST()
{
Clear();
delete root;
}
void FILEINDEXLIST::Clear()
{
FILEINDEXLISTNODE *p=root->next,*q;
while (p)
{
q=p;p=p->next;
delete q;
}
tail=root;tail->next=NULL;
}
void FILEINDEXLIST::Append(LPFILEINFO lpfi)
{
FILEINDEXLISTNODE *p=new FILEINDEXLISTNODE;
p->nIndex=tail->nIndex+1;
p->szFileName=lpfi->szFileName;
p->dwFileSize=lpfi->dwFileSize;
p->dwPackedSize=lpfi->dwPackedSize;
p->dwDateTime=lpfi->dwDateTime;
p->dwFileAttr=lpfi->dwFileAttr;
p->dwCRC32=lpfi->dwCRC32;
p->bEncrypted=lpfi->bEncrypted;
p->bIsDirectory=lpfi->bIsDirectory;
p->next=NULL;
tail->next=p;
tail=p;
}
void FILEINDEXLIST::Delete(int nIndex)
{
FILEINDEXLISTNODE *p=root,*q;
while (p->next && p->next->nIndex!=nIndex) p=p->next;
q=p->next;
if (p)
{
if (tail==q) tail=p;
q=p->next;
p->next=q->next;
delete q;
}
Arrange();
}
void FILEINDEXLIST::Arrange()
{
FILEINDEXLISTNODE *p=root->next;
int i=0;
while (p) {p->nIndex=i++;p=p->next;}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -