QuaCompress Class Reference

`#include <QuaCompress.h>`

## Public Types

typedef JlCompress::Options::CompressionStrategy | CompressionStrategy
| Compression strategy - shared with JlCompress::Options::CompressionStrategy.

## Public Member Functions

| QuaCompress ()
| Construct a QuaCompress instance.
QuaCompress & | withUtf8Enabled (bool enabled=true)
| Enable or disable UTF-8 encoding for file names and comments.
QuaCompress & | withStrategy (CompressionStrategy strategy)
| Set the compression strategy/level.
QuaCompress & | withDateTime (const QDateTime &dateTime)
| Set the date/time to use for compressed files.
QuaCompress & | withPassword (const QByteArray &password)
| Set the password for encryption.
bool | compressFile (const QString &newArchive, const QString &file) const
| Compress a single file.
bool | compressFiles (const QString &newArchive, const QStringList &files) const
| Compress multiple files.
bool | compressDir (const QString &newArchive, const QString &dir=QString(), bool recursive=true, QDir::Filters filters=QDir::AllEntries|QDir::NoDotAndDotDot) const
| Compress a directory.
bool | addFile (const QString &existingArchive, const QString &file) const
| Add a single file to an existing archive.
bool | addFiles (const QString &existingArchive, const QStringList &files) const
| Add multiple files to an existing archive.
bool | addDir (const QString &existingArchive, const QString &dir=QString(), bool recursive=true, QDir::Filters filters=QDir::AllEntries|QDir::NoDotAndDotDot) const
| Add a directory to an existing archive.

## Static Public Attributes

static constexpr CompressionStrategy | Storage = JlCompress::Options::Storage
static constexpr CompressionStrategy | Fastest = JlCompress::Options::Fastest
static constexpr CompressionStrategy | Faster = JlCompress::Options::Faster
static constexpr CompressionStrategy | Standard = JlCompress::Options::Standard
static constexpr CompressionStrategy | Better = JlCompress::Options::Better
static constexpr CompressionStrategy | Best = JlCompress::Options::Best
static constexpr CompressionStrategy | Default = JlCompress::Options::Default

## Detailed Description

QuaCompress provides a fluent API for ZIP compression operations.

Example usage:

QuaCompress()
.withUtf8Enabled()
.withCompression(QuaCompress::Best)
.compressDir("archive.zip", "mydir/");
QuaCompress::QuaCompress
QuaCompress()
Construct a QuaCompress instance.
Definition QuaCompress.cpp:34

## Member Function Documentation

## withUtf8Enabled()

QuaCompress & QuaCompress::withUtf8Enabled | ( | bool | enabled = true | ) |

Enable or disable UTF-8 encoding for file names and comments.

Parameters

  enabled | If true, use UTF-8 encoding. If false, use the configured codec (or system default).

Returns
  Reference to this instance for method chaining.

References QuaCompress().

## withStrategy()

QuaCompress & QuaCompress::withStrategy | ( | CompressionStrategy | strategy | ) |

Set the compression strategy/level.

Parameters

  strategy | The compression level to use.

Returns
  Reference to this instance for method chaining.

References QuaCompress().

## withDateTime()

QuaCompress & QuaCompress::withDateTime | ( | const QDateTime & | dateTime | ) |

Set the date/time to use for compressed files.

Parameters

  dateTime | The date/time to set. Default is to use current time.

Returns
  Reference to this instance for method chaining.

References QuaCompress().

## withPassword()

QuaCompress & QuaCompress::withPassword | ( | const QByteArray & | password | ) |

Set the password for encryption.

Parameters

  password | The password to use for encrypting files during compression.

Returns
  Reference to this instance for method chaining.

References QuaCompress().

## compressFile()

bool QuaCompress::compressFile | ( | const QString & | newArchive,
|  | const QString & | file ) const

Compress a single file.

Parameters

  newArchive | The name of the archive to create.
  file | The file to compress.

Returns
  true if successful, false otherwise.

References JlCompress::compressFile().

## compressFiles()

bool QuaCompress::compressFiles | ( | const QString & | newArchive,
|  | const QStringList & | files ) const

Compress multiple files.

Parameters

  newArchive | The name of the archive to create.
  files | List of files to compress.

Returns
  true if successful, false otherwise.

References JlCompress::compressFiles().

## compressDir()

bool QuaCompress::compressDir | ( | const QString & | newArchive,
|  | const QString & | dir = QString(),
|  | bool | recursive = true,
|  | QDir::Filters | filters = QDir::AllEntries | QDir::NoDotAndDotDot ) const

Compress a directory.

Parameters

  newArchive | The name of the archive to create.
  dir | The directory to compress. If empty, uses current directory.
  recursive | If true, include subdirectories recursively.
  filters | QDir filters to apply when selecting files.

Returns
  true if successful, false otherwise.

References JlCompress::compressDir().

## addFile()

bool QuaCompress::addFile | ( | const QString & | existingArchive,
|  | const QString & | file ) const

Add a single file to an existing archive.

Parameters

  existingArchive | The existing archive to add to.
  file | The file to add.

Returns
  true if successful, false otherwise.

References JlCompress::addFile().

## addFiles()

bool QuaCompress::addFiles | ( | const QString & | existingArchive,
|  | const QStringList & | files ) const

Add multiple files to an existing archive.

Parameters

  existingArchive | The existing archive to add to.
  files | List of files to add.

Returns
  true if successful, false otherwise.

Warning
  The UTF-8 setting must match the existing archive's encoding.

References JlCompress::addFiles().

## addDir()

bool QuaCompress::addDir | ( | const QString & | existingArchive,
|  | const QString & | dir = QString(),
|  | bool | recursive = true,
|  | QDir::Filters | filters = QDir::AllEntries | QDir::NoDotAndDotDot ) const

Add a directory to an existing archive.

Parameters

  existingArchive | The existing archive to add to.
  dir | The directory to add. If empty, uses current directory.
  recursive | If true, include subdirectories recursively.
  filters | QDir filters to apply when selecting files.

Returns
  true if successful, false otherwise.

References JlCompress::addDir().

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

- quazip/QuaCompress.h
- quazip/QuaCompress.cpp