Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
sese::archive::ArchiveWriter Class Reference

Archive writer. More...

#include <ArchiveWriter.h>

Public Member Functions

 ArchiveWriter (io::OutputStream *output)
 
virtual ~ArchiveWriter ()
 
int setFilterGZip ()
 
int setFilterBZip2 ()
 
int setFilterLZ4 ()
 
int setFilterLZip ()
 
int setFilterZstd ()
 
int setFilterXZ ()
 
int setFilterLzma ()
 
int setFilterLzop ()
 
int setFilterGRZip ()
 
int setFilterLRZip ()
 
int setFilterNone ()
 
int setFormatXar ()
 
int setFormatTar ()
 
int setFormatZip ()
 
int setFormat7z ()
 
int setFormatISO ()
 
int setPassword (const std::string &pwd)
 
int setOptions (const std::string &opt)
 
int getError ()
 
const char * getErrorString ()
 
bool begin ()
 
bool done ()
 
bool addPath (const std::filesystem::path &path)
 
bool addPath (const std::filesystem::path &base, const std::filesystem::path &path)
 
bool addFile (const std::filesystem::path &file)
 
bool addFile (const std::filesystem::path &base, const std::filesystem::path &file)
 
bool addDirectory (const std::filesystem::path &dir)
 
bool addDirectory (const std::filesystem::path &base, const std::filesystem::path &dir)
 
bool addStream (const std::filesystem::path &path, io::InputStream *input, size_t len)
 

Static Public Member Functions

static int openCallback (void *archive, ArchiveWriter *archive_this)
 
static int64_t writeCallback (void *archive, ArchiveWriter *archive_this, const void *buffer, size_t len)
 
static int closeCallback (void *archive, ArchiveWriter *archive_this)
 
static int freeCallback (void *archive, ArchiveWriter *archive_this)
 
static const char * passphraseCallback (void *archive, ArchiveWriter *archive_this)
 

Protected Attributes

io::OutputStreamoutput {}
 
void * archive {}
 

Detailed Description

Archive writer.

Constructor & Destructor Documentation

◆ ArchiveWriter()

ArchiveWriter::ArchiveWriter ( io::OutputStream * output)
explicit

Constructs the writer

Parameters
outputThe output stream

References passphrase(), and XX.

◆ ~ArchiveWriter()

ArchiveWriter::~ArchiveWriter ( )
virtual

References XX.

Member Function Documentation

◆ addDirectory() [1/2]

bool ArchiveWriter::addDirectory ( const std::filesystem::path & base,
const std::filesystem::path & dir )

◆ addDirectory() [2/2]

bool ArchiveWriter::addDirectory ( const std::filesystem::path & dir)

References addDirectory().

Referenced by addDirectory(), addDirectory(), and addPath().

◆ addFile() [1/2]

bool ArchiveWriter::addFile ( const std::filesystem::path & base,
const std::filesystem::path & file )

◆ addFile() [2/2]

bool ArchiveWriter::addFile ( const std::filesystem::path & file)

References addFile().

Referenced by addFile(), and addPath().

◆ addPath() [1/2]

bool ArchiveWriter::addPath ( const std::filesystem::path & base,
const std::filesystem::path & path )

Entity operation function, adds a file or folder to the specified path in the current archive

Parameters
baseThe path within the archive
pathThe target path
Returns
Whether the operation was successful

References addDirectory(), and addFile().

◆ addPath() [2/2]

bool ArchiveWriter::addPath ( const std::filesystem::path & path)

Entity operation function, adds a file or folder to the root directory of the current archive

Parameters
pathThe target path
Returns
Whether the operation was successful

References addPath().

Referenced by addPath().

◆ addStream()

bool ArchiveWriter::addStream ( const std::filesystem::path & path,
io::InputStream * input,
size_t len )

Entity operation function, reads content from the stream and writes it to the specified path in the archive

Parameters
pathThe path within the archive
inputThe input stream
lenThe size to be written
Returns
Whether the operation was successful

References sese::io::InputStream::read(), WRITE, and XX.

◆ begin()

bool ArchiveWriter::begin ( )

Starts the entity addition

Returns
The result of the operation

References close(), free(), open(), output, write(), and XX.

◆ closeCallback()

int ArchiveWriter::closeCallback ( void * archive,
ArchiveWriter * archive_this )
static

Referenced by close().

◆ done()

bool ArchiveWriter::done ( )

Ends the entity addition

Returns
The result of the operation

References XX.

◆ freeCallback()

int ArchiveWriter::freeCallback ( void * archive,
ArchiveWriter * archive_this )
static

Referenced by free().

◆ getError()

int ArchiveWriter::getError ( )

Retrieves the current error code

Returns
The error code

References XX.

◆ getErrorString()

const char * ArchiveWriter::getErrorString ( )

Retrieves the current error message

Returns
The error message

References XX.

◆ openCallback()

int ArchiveWriter::openCallback ( void * archive,
ArchiveWriter * archive_this )
static

Referenced by open().

◆ passphraseCallback()

const char * ArchiveWriter::passphraseCallback ( void * archive,
archive::ArchiveWriter * archive_this )
static

Referenced by passphrase().

◆ setFilterBZip2()

int ArchiveWriter::setFilterBZip2 ( )

References XX.

◆ setFilterGRZip()

int ArchiveWriter::setFilterGRZip ( )

References XX.

◆ setFilterGZip()

int ArchiveWriter::setFilterGZip ( )

References XX.

◆ setFilterLRZip()

int ArchiveWriter::setFilterLRZip ( )

References XX.

◆ setFilterLZ4()

int ArchiveWriter::setFilterLZ4 ( )

References XX.

◆ setFilterLZip()

int ArchiveWriter::setFilterLZip ( )

References XX.

◆ setFilterLzma()

int ArchiveWriter::setFilterLzma ( )

References XX.

◆ setFilterLzop()

int ArchiveWriter::setFilterLzop ( )

References XX.

◆ setFilterNone()

int ArchiveWriter::setFilterNone ( )

References XX.

◆ setFilterXZ()

int ArchiveWriter::setFilterXZ ( )

References XX.

◆ setFilterZstd()

int ArchiveWriter::setFilterZstd ( )

References XX.

◆ setFormat7z()

int ArchiveWriter::setFormat7z ( )

References XX.

◆ setFormatISO()

int ArchiveWriter::setFormatISO ( )

References XX.

◆ setFormatTar()

int ArchiveWriter::setFormatTar ( )

References XX.

◆ setFormatXar()

int ArchiveWriter::setFormatXar ( )

References XX.

◆ setFormatZip()

int ArchiveWriter::setFormatZip ( )

References XX.

◆ setOptions()

int ArchiveWriter::setOptions ( const std::string & opt)

Sets the libarchive options for the archive

Parameters
optThe options
Returns
Returns 0 if successful

References XX.

◆ setPassword()

int ArchiveWriter::setPassword ( const std::string & pwd)

Sets the password used for writing to the archive

Parameters
pwdThe password
Returns
Returns 0 if successful

References XX.

◆ writeCallback()

int64_t ArchiveWriter::writeCallback ( void * archive,
ArchiveWriter * archive_this,
const void * buffer,
size_t len )
static

References output, and sese::io::OutputStream::write().

Referenced by write().

Member Data Documentation

◆ archive

void* sese::archive::ArchiveWriter::archive {}
protected

◆ output

io::OutputStream* sese::archive::ArchiveWriter::output {}
protected

Referenced by begin(), and writeCallback().


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