⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dictionary.h

📁 一个简单的虚拟机和虚拟操作系统
💻 H
字号:
#pragma once
#include "StdAfx.h"
#include "all.h"
#include "file.h"

class Dictionary
{
	friend class FS;
public:
	Dictionary(const CString& dname,Dictionary* father);
	~Dictionary(void);

public:
	int createFile(const CString& fname,File*&f,char* data,int size);
	int createDic(const CString& dname,Dictionary*& dic);
	bool deleteFile(const CString& fname);
	bool deleteDic(const CString& dname);
	bool removeFile(File*f);
	bool removeDic(Dictionary*d);
	int enumFiles(File**&f)const;
	int enumDics(Dictionary**&d)const;
	int addFile(File*f);
	int addDic(Dictionary*d);
	File* getFile(const CString& fname)const;
	Dictionary* getDic(const CString& dname)const;
	Dictionary* getCopy(Dictionary*father)const;
	bool getValidName(CString&s)const;

public:
	CString getPath()const;
	int getDicsNum()const;
	int getFilesNum()const;
	int getSize()const;
	int getSpace()const;
	int getBlockNum()const;

public:
	int getFcount()const
	{
		return fcount;
	}
	int getDcount()const
	{
		return dcount;
	}
	Dictionary* getFather()const
	{
		return father;
	}
	CString getName()const
	{
		return name;
	}
	bool setName(const CString&name)
	{
		if(!isValidName(name))
			return false;
		this->name = name;
		return true;
	}
public:
	void save(CArchive&ar)const;
	void load(CArchive&ar);
public:
	static bool isValidName(const CString&name)
	{
		if(name.GetLength() == 0)
			return false;
		if(name.Find('\\')>=0)
			return false;
		if(name[0] == ' '||name[name.GetLength()-1] == ' ')
			return false;
		return true;
	}
private:
	CString name;
	Dictionary* father;
	int fcount;
	int dcount;

private:
	File* files[FILE_NUM];
	Dictionary* dics[FILE_NUM];
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -