Allow switch vector to span
This commit is contained in:
@@ -118,7 +118,7 @@ namespace OpenVulkano
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool ArchiveWriter::AddFile(const FileDescription& description, const std::vector<std::pair<const void*, size_t>>& buffers)
|
||||
bool ArchiveWriter::AddFile(const FileDescription& description, const std::span<std::pair<const void*, size_t>>& buffers)
|
||||
{
|
||||
WriteHeader(description);
|
||||
for(const auto& buffer : buffers)
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace OpenVulkano
|
||||
[[nodiscard]] size_t GetTotalWrittenBytes() const { return m_bytesWritten; }
|
||||
|
||||
bool AddFile(const FileDescription& description, const void* buffer) override;
|
||||
bool AddFile(const FileDescription& description, const std::vector<std::pair<const void*, size_t>>& buffers) override;
|
||||
bool AddFile(const FileDescription& description, const std::span<std::pair<const void*, size_t>>& buffers) override;
|
||||
bool AddFile(const char* fileName, const char* inArchiveName) override;
|
||||
[[nodiscard]] ArchiveOStream AddFileStream(const FileDescription& description) override;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "ArchiveOStream.hpp"
|
||||
#include "IO/FileDescription.hpp"
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <span>
|
||||
|
||||
namespace OpenVulkano
|
||||
{
|
||||
@@ -24,7 +24,7 @@ namespace OpenVulkano
|
||||
virtual void SetShouldCompressFunction(const std::function<bool(const FileDescription&)>& shouldComp) = 0;
|
||||
|
||||
virtual bool AddFile(const FileDescription& description, const void* buffer) = 0;
|
||||
virtual bool AddFile(const FileDescription& description, const std::vector<std::pair<const void*, size_t>>& buffers) = 0;
|
||||
virtual bool AddFile(const FileDescription& description, const std::span<std::pair<const void*, size_t>>& buffers) = 0;
|
||||
virtual bool AddFile(const char* fileName, const char* inArchiveName) = 0;
|
||||
|
||||
/**
|
||||
@@ -56,7 +56,7 @@ namespace OpenVulkano
|
||||
return AddFile(description, buffer);
|
||||
}
|
||||
|
||||
bool AddFile(const char* fileName, const std::vector<std::pair<const void*, size_t>>& buffers)
|
||||
bool AddFile(const char* fileName, const std::span<std::pair<const void*, size_t>>& buffers)
|
||||
{
|
||||
size_t size = 0;
|
||||
for(const auto& buffer : buffers)
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace OpenVulkano
|
||||
return m_writer->AddFile(description, buffer);
|
||||
}
|
||||
|
||||
bool MultiPartArchiveWriter::AddFile(const FileDescription& description, const std::vector<std::pair<const void*, size_t>>& buffers)
|
||||
bool MultiPartArchiveWriter::AddFile(const FileDescription& description, const std::span<std::pair<const void*, size_t>>& buffers)
|
||||
{
|
||||
CheckSize(description.size);
|
||||
return m_writer->AddFile(description, buffers);
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenVulkano
|
||||
~MultiPartArchiveWriter() override;
|
||||
|
||||
bool AddFile(const FileDescription& description, const void* buffer) override;
|
||||
bool AddFile(const FileDescription& description, const std::vector<std::pair<const void*, size_t>>& buffers) override;
|
||||
bool AddFile(const FileDescription& description, const std::span<std::pair<const void*, size_t>>& buffers) override;
|
||||
[[deprecated]] bool AddFile(const char* fileName, const char* inArchiveName) override;
|
||||
using IArchiveWriter::AddFile;
|
||||
[[nodiscard]] virtual ArchiveOStream AddFileStream(const FileDescription& description) override;
|
||||
|
||||
Reference in New Issue
Block a user