mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-11 14:00:32 +08:00
45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <iostream>
|
|
#include <list>
|
|
#include "sector.h"
|
|
#include "slist.h"
|
|
#include "svector.h"
|
|
|
|
namespace CFCPP
|
|
{
|
|
class StreamView
|
|
{
|
|
public:
|
|
StreamView(const SVector<Sector> §orChain, int sectorSize, Stream stream);
|
|
StreamView(const SVector<Sector> §orChain, int sectorSize, std::streamsize length,
|
|
SList<Sector> &availableSectors, Stream stream, bool isFatStream = false);
|
|
|
|
void Write(const char *buffer, std::streamsize offset, std::streamsize count);
|
|
std::streamsize Read(char *buffer, std::streamsize offset, std::streamsize count);
|
|
std::streamsize Seek(std::streamsize offset, int origin);
|
|
void SetLength(std::streamsize value);
|
|
std::streamsize getLength() const;
|
|
inline SVector<Sector>& BaseSectorChain() {return sectorChain;}
|
|
|
|
int ReadInt32();
|
|
void WriteInt32(int val);
|
|
|
|
private:
|
|
void adjustLength(std::streamsize value);
|
|
void adjustLength(std::streamsize value, SList<Sector> &availableSectors);
|
|
private:
|
|
int sectorSize;
|
|
std::streamsize length;
|
|
|
|
SVector<Sector> sectorChain;
|
|
bool isFatStream = false;
|
|
int buf = 0;
|
|
|
|
public:
|
|
Stream stream;
|
|
SList<Sector> freeSectors;
|
|
std::streamsize position;
|
|
};
|
|
}
|