LibrePCB Developers Documentation
Loading...
Searching...
No Matches
ZipWriter Class Referencefinal

Zip file writer. More...

#include <zipwriter.h>

+ Collaboration diagram for ZipWriter:

Public Member Functions

 ZipWriter (const ZipWriter &other)=delete
 
ZipWriteroperator= (const ZipWriter &rhs)=delete
 
 ZipWriter ()
 Create in-memory writer.
 
 ZipWriter (const FilePath &fp)
 Create file writer.
 
 ~ZipWriter () noexcept
 Destructor.
 
void writeFile (const QString &path, const QByteArray &data, uint32_t mode)
 Write a file.
 
void finish ()
 Finish writing the file.
 
const QByteArray & getData () const
 Get the in-memory ZIP data.
 

Private Attributes

QByteArray mBuffer
 
RustHandle< rs::ZipWriter > mHandle
 
bool mFinished
 

Detailed Description

Zip file writer.

Note
This is just a wrapper around its Rust implementation.

Constructor & Destructor Documentation

◆ ZipWriter() [1/3]

ZipWriter ( const ZipWriter other)
delete

◆ ZipWriter() [2/3]

ZipWriter ( )

Create in-memory writer.

Exceptions
Exceptionon any error

◆ ZipWriter() [3/3]

ZipWriter ( const FilePath fp)

Create file writer.

Parameters
fpPath to Zip file.
Exceptions
Exceptionon any error

◆ ~ZipWriter()

~ZipWriter ( )
noexcept

Destructor.

Member Function Documentation

◆ operator=()

ZipWriter & operator= ( const ZipWriter rhs)
delete

◆ writeFile()

void writeFile ( const QString &  path,
const QByteArray &  data,
uint32_t  mode 
)

Write a file.

Parameters
pathPath within archive
dataFile content
modeUnix permissions (e.g. 0644).
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ finish()

void finish ( )

Finish writing the file.

This must always be called after all files have been written.

Exceptions
OnI/O errors.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getData()

const QByteArray & getData ( ) const

Get the in-memory ZIP data.

Note
finish() must have been called first.
Returns
The ZIP content
Exceptions
Ifthe written data is empty or incomplete, or this is not an in-memory writer.
+ Here is the caller graph for this function:

Member Data Documentation

◆ mBuffer

QByteArray mBuffer
private

◆ mHandle

RustHandle<rs::ZipWriter> mHandle
private

◆ mFinished

bool mFinished
private

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