Add GetNextFileAsVector method
This commit is contained in:
@@ -206,6 +206,19 @@ namespace openVulkanoCpp
|
|||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<std::pair<FileDescription, std::vector<char>>> ArchiveReader::GetNextFileAsVector()
|
||||||
|
{
|
||||||
|
if (SkipTill(std::filesystem::file_type::regular))
|
||||||
|
{
|
||||||
|
std::pair<FileDescription, std::vector<char>> file = { GetNextDescription(), std::vector<char>() };
|
||||||
|
file.second.resize(file.first.size);
|
||||||
|
ChkErr(archive_read_data(m_archive, file.second.data(), file.second.size()));
|
||||||
|
ReadNextHeader();
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
bool ArchiveReader::GetNextFileAsStream(const std::function<void(const FileDescription&, std::istream&)>& streamReader)
|
bool ArchiveReader::GetNextFileAsStream(const std::function<void(const FileDescription&, std::istream&)>& streamReader)
|
||||||
{
|
{
|
||||||
if (SkipTill(std::filesystem::file_type::regular))
|
if (SkipTill(std::filesystem::file_type::regular))
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ namespace openVulkanoCpp
|
|||||||
|
|
||||||
std::optional<std::pair<FileDescription, Array<char>>> GetNextFile();
|
std::optional<std::pair<FileDescription, Array<char>>> GetNextFile();
|
||||||
|
|
||||||
|
std::optional<std::pair<FileDescription, std::vector<char>>> GetNextFileAsVector();
|
||||||
|
|
||||||
std::optional<FileDescription> StreamNextFile(std::ostream& stream);
|
std::optional<FileDescription> StreamNextFile(std::ostream& stream);
|
||||||
|
|
||||||
bool GetNextFileAsStream(const std::function<void(const FileDescription&, std::istream&)>& streamReader);
|
bool GetNextFileAsStream(const std::function<void(const FileDescription&, std::istream&)>& streamReader);
|
||||||
|
|||||||
Reference in New Issue
Block a user