Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
correlation::utils::ZipArchiveWriter Class Reference

Move-only RAII wrapper around miniz for creating ZIP archives. More...

#include <ZipArchiveWriter.hpp>

Classes

struct  Impl

Public Member Functions

 ZipArchiveWriter ()
 ~ZipArchiveWriter ()
 ZipArchiveWriter (const ZipArchiveWriter &)=delete
ZipArchiveWriter & operator= (const ZipArchiveWriter &)=delete
 ZipArchiveWriter (ZipArchiveWriter &&other) noexcept
ZipArchiveWriter & operator= (ZipArchiveWriter &&other) noexcept
std::expected< void, std::string > open (const std::filesystem::path &archive_path)
 Opens a new ZIP archive for writing on disk.
std::expected< void, std::string > addFileFromMemory (std::string_view entry_name, std::span< const std::byte > data)
 Adds a file to the archive from an in-memory buffer.
std::expected< void, std::string > addFileFromString (std::string_view entry_name, std::string_view content)
 Adds a text file to the archive from a string or string_view.
std::expected< void, std::string > addFileFromDisk (std::string_view entry_name, const std::filesystem::path &source_path)
 Adds a file from the local filesystem to the archive.
std::expected< void, std::string > finalize ()
 Finalizes and closes the archive.
bool isOpen () const noexcept
 Checks if an archive is currently open.

Private Attributes

std::unique_ptr< Impl > impl_

Detailed Description

Move-only RAII wrapper around miniz for creating ZIP archives.

Constructor & Destructor Documentation

◆ ZipArchiveWriter() [1/3]

correlation::utils::ZipArchiveWriter::ZipArchiveWriter ( )
Here is the caller graph for this function:

◆ ~ZipArchiveWriter()

correlation::utils::ZipArchiveWriter::~ZipArchiveWriter ( )
default

◆ ZipArchiveWriter() [2/3]

correlation::utils::ZipArchiveWriter::ZipArchiveWriter ( const ZipArchiveWriter & )
delete
Here is the call graph for this function:

◆ ZipArchiveWriter() [3/3]

correlation::utils::ZipArchiveWriter::ZipArchiveWriter ( ZipArchiveWriter && other)
defaultnoexcept
Here is the call graph for this function:

Member Function Documentation

◆ addFileFromDisk()

std::expected< void, std::string > correlation::utils::ZipArchiveWriter::addFileFromDisk ( std::string_view entry_name,
const std::filesystem::path & source_path )

Adds a file from the local filesystem to the archive.

Parameters
entry_namePath inside the ZIP archive.
source_pathPath on disk to read from.
Returns
std::expected<void, std::string> Success or error message.

◆ addFileFromMemory()

std::expected< void, std::string > correlation::utils::ZipArchiveWriter::addFileFromMemory ( std::string_view entry_name,
std::span< const std::byte > data )

Adds a file to the archive from an in-memory buffer.

Parameters
entry_namePath inside the ZIP archive (e.g. "plots/rdf.svg").
dataBinary data buffer.
Returns
std::expected<void, std::string> Success or error message.
Here is the caller graph for this function:

◆ addFileFromString()

std::expected< void, std::string > correlation::utils::ZipArchiveWriter::addFileFromString ( std::string_view entry_name,
std::string_view content )

Adds a text file to the archive from a string or string_view.

Parameters
entry_namePath inside the ZIP archive (e.g. "summary.txt").
contentText or data string.
Returns
std::expected<void, std::string> Success or error message.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ finalize()

std::expected< void, std::string > correlation::utils::ZipArchiveWriter::finalize ( )

Finalizes and closes the archive.

Returns
std::expected<void, std::string> Success or error message.
Here is the caller graph for this function:

◆ isOpen()

bool correlation::utils::ZipArchiveWriter::isOpen ( ) const
nodiscardnoexcept

Checks if an archive is currently open.

◆ open()

std::expected< void, std::string > correlation::utils::ZipArchiveWriter::open ( const std::filesystem::path & archive_path)

Opens a new ZIP archive for writing on disk.

Parameters
archive_pathThe destination path for the ZIP file.
Returns
std::expected<void, std::string> Success or error message.
Here is the caller graph for this function:

◆ operator=() [1/2]

ZipArchiveWriter & correlation::utils::ZipArchiveWriter::operator= ( const ZipArchiveWriter & )
delete
Here is the call graph for this function:

◆ operator=() [2/2]

ZipArchiveWriter & correlation::utils::ZipArchiveWriter::operator= ( ZipArchiveWriter && other)
defaultnoexcept
Here is the call graph for this function:

Member Data Documentation

◆ impl_

std::unique_ptr<Impl> correlation::utils::ZipArchiveWriter::impl_
private

The documentation for this class was generated from the following files: