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

Zip file reader. More...

#include <ziparchive.h>

+ Collaboration diagram for ZipArchive:

Public Member Functions

 ZipArchive ()=delete
 
 ZipArchive (const ZipArchive &other)=delete
 
ZipArchiveoperator= (const ZipArchive &rhs)=delete
 
 ZipArchive (const QByteArray &data)
 Open in-memory Zip from QByteArray
 
 ZipArchive (const FilePath &fp)
 Open Zip file.
 
std::size_t getEntriesCount () const noexcept
 Get number of ZIp entries (files & directories)
 
QString getFileName (std::size_t index)
 Get the file name of an entry.
 
QByteArray readFile (std::size_t index)
 Read the content of a file.
 
void extractTo (const FilePath &dir)
 Extract whole Zip to a directory (overwriting)
 

Private Attributes

RustHandle< rs::ZipArchive > mHandle
 

Detailed Description

Zip file reader.

Note
This is just a wrapper around its Rust implementation.

Constructor & Destructor Documentation

◆ ZipArchive() [1/4]

ZipArchive ( )
delete

◆ ZipArchive() [2/4]

ZipArchive ( const ZipArchive other)
delete

◆ ZipArchive() [3/4]

ZipArchive ( const QByteArray &  data)

Open in-memory Zip from QByteArray

Parameters
dataRaw Zip content.
Exceptions
Exceptionon any error

◆ ZipArchive() [4/4]

ZipArchive ( const FilePath fp)

Open Zip file.

Parameters
fpPath to Zip file.
Exceptions
Exceptionon any error

Member Function Documentation

◆ operator=()

ZipArchive & operator= ( const ZipArchive rhs)
delete

◆ getEntriesCount()

std::size_t getEntriesCount ( ) const
noexcept

Get number of ZIp entries (files & directories)

Returns
Number of entries
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFileName()

QString getFileName ( std::size_t  index)

Get the file name of an entry.

Parameters
indexEntry index
Returns
Entry file name (directory if it ends with slash or backslash)
Exceptions
Oninvalid index or if the entry file name is somehow invalid or dangerous (zeros in its name, path outside Zip, ...).
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readFile()

QByteArray readFile ( std::size_t  index)

Read the content of a file.

Parameters
indexEntry index
Returns
File content
Exceptions
Oninvalid index or I/O errors.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ extractTo()

void extractTo ( const FilePath dir)

Extract whole Zip to a directory (overwriting)

Parameters
dirTarget directory
Exceptions
Oninvalid/unsafe Zip content or I/O errors. In that case, the extraction might have been only partially (not atomically).
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ mHandle

RustHandle<rs::ZipArchive> mHandle
private

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