📄 fs.h
字号:
#pragma once
#include "StdAfx.h"
#include "disk.h"
#include "dictionary.h"
#include "iostream"
using namespace std;
class FS
{
public:
FS();
~FS();
public:
/*
* free the blocks whose indexes are stroed
* in the array tofree
*/
bool free(int num,int*tofree);
/*
* allocate blocks for file, if successful
* then store their indexes in the array alloc
*/
bool allocate(int num,int*alloc);
public:
/*
* return the free size
*/
int getFreeSize()const;
/*
* return a pointer point to the block of
* the given index
*/
char* getBlock(int index)const;
bool readBlock(int index,char* buffer)const;
bool writeBlock(int index,const char* buffer);
Dictionary*getRoot()const
{
return root;
}
Dictionary*getCurrent()const
{
return current;
}
Dictionary*setCurrent(Dictionary*c)
{
if(c == NULL)return NULL;
current = c;
Dictionary*old = current;
return old;
}
public:
void save(CArchive&ar)const;
void load(CArchive&ar);
void reset();
void format();
private:
bool used[BLOCK_NUM];
int freeSize;
Dictionary* root;
Dictionary* current;
Disk disk;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -