Files
core/ASCOfficeXlsFile2/source/XlsFormat/Binary/CFStreamCacheWriter.h
Elen.Subbotina efc8565dd2 XlsFile2 linux build
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@64116 954022d7-b5bf-4e40-9824-e11837661b57
2016-05-21 00:23:26 +03:00

36 lines
1.1 KiB
C++

#pragma once
#include "BinSmartPointers.h"
#include <Logic/GlobalWorkbookInfo.h>
namespace XLS
{
// The purpose of the writer is to avoid seeking back through IStream when, for example,
// we have write an offset of a record that would appear in processing much later.
// For example this is necessary in 'Index' record that shall reference DBCell records
// appearing later in the stream. So, this class will increase performance much
class CFStreamCacheWriter
{
public:
CFStreamCacheWriter(CFStreamPtr stream, GlobalWorkbookInfoPtr global_info);
~CFStreamCacheWriter();
// Saves the next CFRecord to the CFStream or caches for later saving. Returns whether the record was saved to file or stored for later saving
bool storeNextRecord(CFRecordPtr record);
GlobalWorkbookInfoPtr getGlobalWorkbookInfo() { return global_info_; }
private:
// Actual transporting record to the CFStream and then to IStream
const size_t writeToStream(const size_t num_of_records_min_necessary);
private:
CFStreamPtr stream_;
CFRecordPtrList records_cache;
GlobalWorkbookInfoPtr global_info_;
};
} // namespace XLS