mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
59 lines
1014 B
C++
59 lines
1014 B
C++
#pragma once
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
#include <mutex>
|
|
#include "stream.h"
|
|
#include "../../DesktopEditor/common/Types.h"
|
|
|
|
namespace CFCPP
|
|
{
|
|
|
|
enum SectorType
|
|
{
|
|
Normal,
|
|
Mini,
|
|
FAT,
|
|
DIFAT,
|
|
RangeLockSector,
|
|
Directory
|
|
};
|
|
|
|
class Sector
|
|
{
|
|
public:
|
|
Sector(int size, const Stream stream);
|
|
Sector(int size, const std::vector<BYTE> &data);
|
|
Sector(int size);
|
|
|
|
bool IsStreamed();
|
|
void ZeroData();
|
|
void InitFATData();
|
|
void ReleaseData();
|
|
|
|
virtual void Dispose(bool disposing=false);
|
|
std::vector<BYTE> &GetData();
|
|
|
|
public:
|
|
static int MINISECTOR_SIZE;
|
|
const static int FREESECT = 0xFFFFFFFF;
|
|
const static int ENDOFCHAIN = 0xFFFFFFFE;
|
|
const static int FATSECT = 0xFFFFFFFD;
|
|
const static int DIFSECT = 0xFFFFFFFC;
|
|
|
|
int getSize() const;
|
|
|
|
SectorType type;
|
|
bool dirtyFlag = false;
|
|
int id = -1;
|
|
|
|
private:
|
|
int size = 0;
|
|
Stream stream;
|
|
std::vector<BYTE> data;
|
|
std::mutex lockObject;
|
|
bool _disposed;//false
|
|
};
|
|
|
|
}
|