mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-11 14:00:32 +08:00
39 lines
700 B
C++
39 lines
700 B
C++
#pragma once
|
|
|
|
#include "../pole/pole.h"
|
|
#include "../../DesktopEditor/common/Types.h"
|
|
|
|
namespace ASCDocFileFormat
|
|
{
|
|
struct IStreamWriter
|
|
{
|
|
virtual ~IStreamWriter()
|
|
{
|
|
|
|
}
|
|
|
|
virtual long WriteToStream(POLE::Stream* pStream, unsigned long offset = 0) const
|
|
{
|
|
HRESULT hr = S_FALSE;
|
|
|
|
unsigned long size = 0;
|
|
ULONG writtenSize = 0;
|
|
|
|
unsigned char* bytes = GetBytes(&size);
|
|
|
|
if (NULL != bytes)
|
|
{
|
|
pStream->seek(offset/*, STREAM_SEEK_SET*/);
|
|
writtenSize = pStream->write(bytes, size );
|
|
|
|
RELEASEARRAYOBJECTS (bytes);
|
|
}
|
|
|
|
return hr;
|
|
}
|
|
|
|
//
|
|
virtual unsigned char* GetBytes(unsigned long* size) const = 0;
|
|
};
|
|
}
|