Added embedded libzip
Prefixed all libzip zip_ funcs to fs_zip_ to avoid clashes and link errors due to assimp Zip pack and zip writer work with libzip now
This commit was merged in pull request #2.
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
#include "IMapSource.h"
|
||||
#include "IStreamSource.h"
|
||||
#include "tl/memory_buffer.h"
|
||||
#include "fs/Api.h"
|
||||
#include "tl/ptr.h"
|
||||
|
||||
namespace fs
|
||||
{
|
||||
|
||||
class FS_API StreamSourceToMapSourceAdapter final : public IMapSource
|
||||
{
|
||||
public:
|
||||
explicit StreamSourceToMapSourceAdapter(tl::unique_ref<IStreamSource> i_srcSource);
|
||||
~StreamSourceToMapSourceAdapter() override = default;
|
||||
|
||||
tl::optional<Error> getLastError() const override;
|
||||
|
||||
size_t read(tl::span<uint8_t> data) override;
|
||||
|
||||
void seekBeg(uint64_t i_offset) override;
|
||||
void seekRel(int64_t i_offset) override;
|
||||
|
||||
uint64_t tell() const override;
|
||||
uint64_t getSize() const override;
|
||||
|
||||
bool isEOS() const override;
|
||||
|
||||
size_t getPreferredBufferSize() const override;
|
||||
|
||||
tl::span<const uint8_t> map(size_t size) override;
|
||||
|
||||
private:
|
||||
void readAll() const;
|
||||
|
||||
tl::unique_ref<IStreamSource> m_srcSource;
|
||||
mutable tl::optional<Error> m_optLastError;
|
||||
mutable tl::memory_buffer m_data;
|
||||
mutable bool m_readAll = false;
|
||||
uint64_t m_offset = 0;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user