Make written bytes observable

This commit is contained in:
Georg Hagen
2025-02-09 23:56:13 +01:00
parent 5c7c961c46
commit 5fd18bf70b
3 changed files with 6 additions and 4 deletions

View File

@@ -9,6 +9,7 @@
#include "ArchiveBase.hpp"
#include "ArchiveConfiguration.hpp"
#include "IArchiveWriter.hpp"
#include "Base/Observable.hpp"
namespace OpenVulkano
{
@@ -20,7 +21,7 @@ namespace OpenVulkano
friend ArchiveStreamBufferWriter;
ArchiveConfiguration m_archiveConfig;
size_t m_bytesWritten = 0;
Observable<size_t> m_bytesWritten { 0 };
ArchiveOStream::ASBufferPtr m_asBuffer = nullptr;
bool m_lastCompressed = true;
std::function<bool(const FileDescription&)> m_shouldCompress;
@@ -49,6 +50,8 @@ namespace OpenVulkano
void SetShouldCompressFunction(const std::function<bool(const FileDescription&)>& shouldComp) override { m_shouldCompress = shouldComp; }
decltype(m_bytesWritten)& GetBytesWrittenObservable() { return m_bytesWritten; }
private:
void WriteHeader(const FileDescription& fileDescription);
@@ -56,4 +59,4 @@ namespace OpenVulkano
void SetCompressed();
};
}
}