QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCCompression Namespace Reference

Classes

struct  ArchiveEntry
 Metadata for a single entry in an archive. More...
 
struct  ArchiveStats
 Summary statistics for an archive. More...
 

Typedefs

using ProgressCallback = std::function< bool(qint64 bytesProcessed, qint64 totalBytes)>
 
using EntryFilter = std::function< bool(const ArchiveEntry &entry)>
 

Enumerations

enum class  Error {
  None , FileNotFound , PermissionDenied , InvalidArchive ,
  UnsupportedFormat , SizeLimitExceeded , Cancelled , FileNotInArchive ,
  IoError , InternalError
}
 Error codes for decompression operations. More...
 
enum class  Format {
  Auto , ZIP , SEVENZ , GZIP ,
  XZ , ZSTD , BZIP2 , LZ4 ,
  TAR , TAR_GZ , TAR_XZ , TAR_ZSTD ,
  TAR_BZ2 , TAR_LZ4
}
 Archive and compression format types (for decompression) More...
 

Functions

Error lastError ()
 Get the error code from the last operation (thread-local)
 
QString lastErrorString ()
 Get a human-readable error message from the last operation (thread-local)
 
QString errorName (Error error)
 Get a human-readable name for an error code.
 
QString detectedFormatName ()
 
QString detectedFilterName ()
 
static bool validateFileInput (const QString &filePath, Format &format)
 
static bool validateArchiveInput (const QString &archivePath, Format &format)
 Validate archive input: file exists, format detected, and is archive format.
 
static bool validateDeviceInput (QIODevice *device)
 Validate device input for streaming operations.
 
static void captureFormatInfo ()
 Capture format detection info from QGClibarchive after an operation.
 
static Format detectFormatFromExtension (const QString &filePath)
 Extension-based format detection (internal helper)
 
Format detectFormat (const QString &filePath, bool useContentFallback)
 
Format detectFormatFromFile (const QString &filePath)
 
Format detectFormatFromData (const QByteArray &data)
 
QString formatExtension (Format format)
 Get file extension for a format.
 
QString formatName (Format format)
 Get human-readable name for a format.
 
bool isArchiveFormat (Format format)
 Check if format is an archive (contains multiple files)
 
bool isCompressionFormat (Format format)
 Check if format is a compression format (single stream)
 
QString strippedPath (const QString &filePath)
 
bool decompressFile (const QString &inputPath, const QString &outputPath, Format format, ProgressCallback progress, qint64 maxDecompressedBytes)
 
QString decompressIfNeeded (const QString &filePath, const QString &outputPath, bool removeOriginal)
 
QByteArray decompressData (const QByteArray &data, Format format, qint64 maxDecompressedBytes)
 
bool extractArchive (const QString &archivePath, const QString &outputDirectoryPath, Format format, ProgressCallback progress, qint64 maxDecompressedBytes)
 
bool extractArchiveAtomic (const QString &archivePath, const QString &outputDirectoryPath, Format format, ProgressCallback progress, qint64 maxDecompressedBytes)
 
bool extractArchiveFiltered (const QString &archivePath, const QString &outputDirectoryPath, EntryFilter filter, ProgressCallback progress, qint64 maxDecompressedBytes)
 
QStringList listArchive (const QString &archivePath, Format format)
 
QList< ArchiveEntrylistArchiveDetailed (const QString &archivePath, Format format)
 
ArchiveStats getArchiveStats (const QString &archivePath, Format format)
 
bool validateArchive (const QString &archivePath, Format format)
 
bool fileExists (const QString &archivePath, const QString &fileName, Format format)
 
bool extractFile (const QString &archivePath, const QString &fileName, const QString &outputPath, Format format)
 
QByteArray extractFileData (const QString &archivePath, const QString &fileName, Format format)
 
bool extractFiles (const QString &archivePath, const QStringList &fileNames, const QString &outputDirectoryPath, Format format)
 
bool extractByPattern (const QString &archivePath, const QStringList &patterns, const QString &outputDirectoryPath, QStringList *extractedFiles, Format format)
 
bool decompressFromDevice (QIODevice *device, const QString &outputPath, ProgressCallback progress, qint64 maxDecompressedBytes)
 
QByteArray decompressFromDevice (QIODevice *device, qint64 maxDecompressedBytes)
 
bool extractFromDevice (QIODevice *device, const QString &outputDirectoryPath, ProgressCallback progress, qint64 maxDecompressedBytes)
 
QByteArray extractFileDataFromDevice (QIODevice *device, const QString &fileName)
 
bool isCompressedFile (const QString &filePath)
 Check if file path indicates a compressed file (.gz, .xz, .zst)
 
bool isArchiveFile (const QString &filePath)
 Check if file path indicates an archive file (.zip, .tar, .tar.gz, etc.)
 

Variables

constexpr quint32 kDefaultFilePermissions = 0644
 Default Unix permissions for extracted files (rw-r–r–)
 

Detailed Description

Unified decompression interface for archives and single-file compression Uses libarchive for all operations (ZIP, GZIP, XZ, ZSTD, TAR, etc.) NOTE: This module is decompression-only; QGC does not create compressed files

Typedef Documentation

◆ EntryFilter

using QGCCompression::EntryFilter = typedef std::function<bool(const ArchiveEntry &entry)>

Entry filter callback for selective extraction Called for each entry before extraction; return true to extract, false to skip

Parameters
entryMetadata for the archive entry
Returns
true to extract this entry, false to skip it

Definition at line 53 of file QGCCompressionTypes.h.

◆ ProgressCallback

using QGCCompression::ProgressCallback = typedef std::function<bool(qint64 bytesProcessed, qint64 totalBytes)>

Progress callback for long-running operations

Parameters
bytesProcessedBytes processed so far
totalBytesTotal bytes to process (0 if unknown)
Returns
true to continue, false to cancel operation

Definition at line 21 of file QGCCompressionTypes.h.

Enumeration Type Documentation

◆ Error

enum class QGCCompression::Error
strong

Error codes for decompression operations.

Enumerator
None 

No error (success)

FileNotFound 

Input file does not exist.

PermissionDenied 

Cannot read input or write output.

InvalidArchive 

Archive is corrupt or invalid.

UnsupportedFormat 

Format not recognized or not supported.

SizeLimitExceeded 

Decompressed size exceeded limit.

Cancelled 

Operation cancelled by progress callback.

FileNotInArchive 

Requested file not found in archive.

IoError 

General I/O error (read/write failure)

InternalError 

Unexpected internal error.

Definition at line 20 of file QGCCompression.h.

◆ Format

enum class QGCCompression::Format
strong

Archive and compression format types (for decompression)

Enumerator
Auto 

Auto-detect from file extension or magic bytes.

ZIP 

ZIP archive (multiple files)

SEVENZ 

7-Zip archive (.7z)

GZIP 

GZIP compression (single file, .gz)

XZ 

XZ/LZMA compression (single file, .xz)

ZSTD 

Zstandard compression (single file, .zst)

BZIP2 

BZip2 compression (single file, .bz2)

LZ4 

LZ4 compression (single file, .lz4)

TAR 

TAR archive (uncompressed, multiple files)

TAR_GZ 

TAR + GZIP (.tar.gz, .tgz)

TAR_XZ 

TAR + XZ (.tar.xz, .txz)

TAR_ZSTD 

TAR + Zstandard (.tar.zst)

TAR_BZ2 

TAR + BZip2 (.tar.bz2, .tbz2)

TAR_LZ4 

TAR + LZ4 (.tar.lz4)

Definition at line 47 of file QGCCompression.h.

Function Documentation

◆ captureFormatInfo()

◆ decompressData()

QByteArray QGCCompression::decompressData ( const QByteArray &  data,
Format  format = Format::Auto,
qint64  maxDecompressedBytes = 0 
)

Decompress data in memory

Parameters
dataCompressed input data
formatCompression format (Auto = detect from magic bytes)
maxDecompressedBytesMaximum decompressed size in bytes (0 = unlimited)
Returns
Decompressed data, or empty on failure or if size limit exceeded

Definition at line 618 of file QGCCompression.cc.

References captureFormatInfo(), decompressData(), QGClibarchive::decompressDataFromMemory(), detectFormatFromData(), formatName, and isCompressionFormat().

Referenced by decompressData(), and QGCNetworkHelper::parseCompressedJson().

◆ decompressFile()

bool QGCCompression::decompressFile ( const QString &  inputPath,
const QString &  outputPath = QString(),
Format  format = Format::Auto,
ProgressCallback  progress = nullptr,
qint64  maxDecompressedBytes = 0 
)

Decompress a single file

Parameters
inputPathPath to compressed file (or Qt resource path :/)
outputPathPath for decompressed output (if empty, strips compression extension)
formatCompression format (Auto = detect from inputPath)
progressOptional progress callback (return false to cancel)
maxDecompressedBytesMaximum decompressed size in bytes (0 = unlimited)
Returns
true on success, false on failure or if size limit exceeded

Definition at line 553 of file QGCCompression.cc.

References captureFormatInfo(), decompressFile(), QGClibarchive::decompressSingleFile(), extractArchive(), formatExtension(), formatName, isArchiveFormat(), isCompressionFormat(), and validateFileInput().

Referenced by decompressFile(), QGCCompressionJob::decompressFile(), and decompressIfNeeded().

◆ decompressFromDevice() [1/2]

bool QGCCompression::decompressFromDevice ( QIODevice *  device,
const QString &  outputPath,
ProgressCallback  progress = nullptr,
qint64  maxDecompressedBytes = 0 
)

Decompress from QIODevice to file Enables streaming decompression from QNetworkReply, QBuffer, etc.

Parameters
deviceQIODevice to read from (must be open and readable)
outputPathOutput file path
progressOptional progress callback
maxDecompressedBytesMaximum decompressed size in bytes (0 = unlimited)
Returns
true on success, false on failure or if size limit exceeded

Definition at line 840 of file QGCCompression.cc.

References captureFormatInfo(), QGClibarchive::decompressFromDevice(), decompressFromDevice(), and validateDeviceInput().

Referenced by decompressFromDevice(), and decompressFromDevice().

◆ decompressFromDevice() [2/2]

QByteArray QGCCompression::decompressFromDevice ( QIODevice *  device,
qint64  maxDecompressedBytes = 0 
)

Decompress from QIODevice to memory

Parameters
deviceQIODevice to read from (must be open and readable)
maxDecompressedBytesMaximum decompressed size in bytes (0 = unlimited)
Returns
Decompressed data, or empty QByteArray on failure or if size limit exceeded

Definition at line 855 of file QGCCompression.cc.

References captureFormatInfo(), QGClibarchive::decompressDataFromDevice(), decompressFromDevice(), and validateDeviceInput().

◆ decompressIfNeeded()

QString QGCCompression::decompressIfNeeded ( const QString &  filePath,
const QString &  outputPath = QString(),
bool  removeOriginal = false 
)

Decompress file if it's a compressed format, otherwise return original path

Parameters
filePathInput file (may or may not be compressed)
outputPathOutput path (if empty, uses strippedPath)
removeOriginalRemove compressed file after successful decompression (default: false)
Returns
Path to result file (decompressed or original), empty string on failure

Definition at line 595 of file QGCCompression.cc.

References decompressFile(), decompressIfNeeded(), isCompressedFile(), and strippedPath().

Referenced by decompressIfNeeded().

◆ detectedFilterName()

QString QGCCompression::detectedFilterName ( )

Get the detected compression filter name from the last operation (thread-local) Returns names like "gzip", "xz", "zstd", "bzip2", "none", etc. Empty string if no filter was detected

Definition at line 195 of file QGCCompression.cc.

References detectedFilterName().

Referenced by detectedFilterName().

◆ detectedFormatName()

QString QGCCompression::detectedFormatName ( )

Get the detected archive format name from the last operation (thread-local) Returns names like "ZIP 2.0", "POSIX ustar", "RAW", etc. Empty string if no format was detected

Definition at line 190 of file QGCCompression.cc.

References detectedFormatName().

Referenced by detectedFormatName().

◆ detectFormat()

Format QGCCompression::detectFormat ( const QString &  filePath,
bool  useContentFallback = true 
)

Detect format from file path (extension-based, with content fallback) First tries extension-based detection; if that fails, reads file content and uses magic bytes and Qt MIME detection as fallback

Parameters
filePathPath to file
useContentFallbackIf true (default), read file content when extension fails
Returns
Detected format, or Format::Auto if detection failed

Definition at line 318 of file QGCCompression.cc.

References detectFormat(), detectFormatFromExtension(), detectFormatFromFile(), QGCFileHelper::exists(), and formatName.

Referenced by detectFormat(), isArchiveFile(), isCompressedFile(), strippedPath(), and validateFileInput().

◆ detectFormatFromData()

Format QGCCompression::detectFormatFromData ( const QByteArray &  data)

Detect format from data (magic bytes + MIME detection)

Parameters
dataRaw file data (at least first 512 bytes recommended)
Returns
Detected format, or Format::Auto if detection failed

Definition at line 368 of file QGCCompression.cc.

References detectFormatFromData(), and formatName.

Referenced by decompressData(), detectFormatFromData(), detectFormatFromFile(), and QGCNetworkHelper::looksLikeCompressedData().

◆ detectFormatFromExtension()

static Format QGCCompression::detectFormatFromExtension ( const QString &  filePath)
static

Extension-based format detection (internal helper)

Definition at line 268 of file QGCCompression.cc.

References detectFormatFromExtension().

Referenced by detectFormat(), and detectFormatFromExtension().

◆ detectFormatFromFile()

Format QGCCompression::detectFormatFromFile ( const QString &  filePath)

Detect format from file content only (ignores extension) Reads file and uses magic bytes + Qt MIME detection

Parameters
filePathPath to file
Returns
Detected format, or Format::Auto if detection failed

Definition at line 337 of file QGCCompression.cc.

References detectFormatFromData(), detectFormatFromFile(), formatName, and QGCFileHelper::isQtResource().

Referenced by detectFormat(), and detectFormatFromFile().

◆ errorName()

QString QGCCompression::errorName ( Error  error)

Get a human-readable name for an error code.

Definition at line 163 of file QGCCompression.cc.

References error, and errorName().

Referenced by errorName(), and lastErrorString().

◆ extractArchive()

bool QGCCompression::extractArchive ( const QString &  archivePath,
const QString &  outputDirectoryPath,
Format  format = Format::Auto,
ProgressCallback  progress = nullptr,
qint64  maxDecompressedBytes = 0 
)

Extract an archive to a directory

Parameters
archivePathPath to archive file (or Qt resource path :/)
outputDirectoryPathOutput directory path
formatArchive format (Auto = detect from archivePath)
progressOptional progress callback (return false to cancel)
maxDecompressedBytesMaximum total decompressed size in bytes (0 = unlimited)
Returns
true on success, false on failure or if size limit exceeded

Definition at line 651 of file QGCCompression.cc.

References captureFormatInfo(), QGClibarchive::extractAnyArchive(), extractArchive(), formatName, and validateArchiveInput().

Referenced by decompressFile(), extractArchive(), and QGCCompressionJob::extractArchive().

◆ extractArchiveAtomic()

bool QGCCompression::extractArchiveAtomic ( const QString &  archivePath,
const QString &  outputDirectoryPath,
Format  format = Format::Auto,
ProgressCallback  progress = nullptr,
qint64  maxDecompressedBytes = 0 
)

Extract an archive to a directory atomically (all-or-nothing) Uses staged extraction and an atomic directory swap on success. If extraction or commit fails, the pre-existing output directory is restored.

Parameters
archivePathPath to archive file (or Qt resource path :/)
outputDirectoryPathOutput directory path
formatArchive format (Auto = detect from archivePath)
progressOptional progress callback (return false to cancel)
maxDecompressedBytesMaximum total decompressed size in bytes (0 = unlimited)
Returns
true on success, false on failure or if size limit exceeded

Definition at line 670 of file QGCCompression.cc.

References captureFormatInfo(), extractArchiveAtomic(), QGClibarchive::extractArchiveAtomic(), formatName, and validateArchiveInput().

Referenced by extractArchiveAtomic(), and QGCCompressionJob::extractArchiveAtomic().

◆ extractArchiveFiltered()

bool QGCCompression::extractArchiveFiltered ( const QString &  archivePath,
const QString &  outputDirectoryPath,
EntryFilter  filter,
ProgressCallback  progress = nullptr,
qint64  maxDecompressedBytes = 0 
)

Extract an archive with per-entry filtering

Parameters
archivePathPath to archive file (or Qt resource path :/)
outputDirectoryPathOutput directory path
filterCallback to decide which entries to extract (return true to extract)
progressOptional progress callback (return false to cancel)
maxDecompressedBytesMaximum total decompressed size in bytes (0 = unlimited)
Returns
true on success (even if filter skipped all entries), false on failure

Definition at line 689 of file QGCCompression.cc.

References captureFormatInfo(), extractArchiveFiltered(), QGClibarchive::extractWithFilter(), and validateArchiveInput().

Referenced by extractArchiveFiltered().

◆ extractByPattern()

bool QGCCompression::extractByPattern ( const QString &  archivePath,
const QStringList &  patterns,
const QString &  outputDirectoryPath,
QStringList *  extractedFiles = nullptr,
Format  format = Format::Auto 
)

Extract files matching glob patterns from an archive Supports wildcards: * (any chars), ? (single char), [...] (char class)

Parameters
archivePathPath to archive file (or Qt resource path :/)
patternsGlob patterns to match (e.g., "*.json", "subdir/*", "file.txt")
outputDirectoryPathOutput directory (files extracted with their archive names)
extractedFilesOptional output list of files that were extracted
formatArchive format (Auto = detect from archivePath)
Returns
true if at least one file matched and extracted, false on error or no matches

Definition at line 818 of file QGCCompression.cc.

References QGClibarchive::extractByPattern(), extractByPattern(), and validateArchiveInput().

Referenced by extractByPattern().

◆ extractFile()

bool QGCCompression::extractFile ( const QString &  archivePath,
const QString &  fileName,
const QString &  outputPath = QString(),
Format  format = Format::Auto 
)

Extract a single file from an archive to disk

Parameters
archivePathPath to archive file (or Qt resource path :/)
fileNameName of file inside archive (as shown by listArchive)
outputPathOutput file path (if empty, extracts to current directory)
formatArchive format (Auto = detect from archivePath)
Returns
true on success, false if file not found or extraction failed

Definition at line 777 of file QGCCompression.cc.

References extractFile(), QGClibarchive::extractSingleFile(), and validateArchiveInput().

Referenced by QGCCompressionJob::extractFile(), and extractFile().

◆ extractFileData()

QByteArray QGCCompression::extractFileData ( const QString &  archivePath,
const QString &  fileName,
Format  format = Format::Auto 
)

Extract a single file from an archive directly to memory

Parameters
archivePathPath to archive file (or Qt resource path :/)
fileNameName of file inside archive (as shown by listArchive)
formatArchive format (Auto = detect from archivePath)
Returns
File contents, or empty QByteArray if not found or extraction failed

Definition at line 792 of file QGCCompression.cc.

References extractFileData(), QGClibarchive::extractFileToMemory(), and validateArchiveInput().

Referenced by extractFileData().

◆ extractFileDataFromDevice()

QByteArray QGCCompression::extractFileDataFromDevice ( QIODevice *  device,
const QString &  fileName 
)

Extract a single file from archive device to memory

Parameters
deviceQIODevice to read from (must be open and readable)
fileNameName of file inside archive
Returns
File contents, or empty QByteArray if not found

Definition at line 884 of file QGCCompression.cc.

References captureFormatInfo(), extractFileDataFromDevice(), QGClibarchive::extractFileDataFromDevice(), and validateDeviceInput().

Referenced by extractFileDataFromDevice().

◆ extractFiles()

bool QGCCompression::extractFiles ( const QString &  archivePath,
const QStringList &  fileNames,
const QString &  outputDirectoryPath,
Format  format = Format::Auto 
)

Extract multiple files from an archive in one pass

Parameters
archivePathPath to archive file (or Qt resource path :/)
fileNamesNames of files inside archive
outputDirectoryPathOutput directory (files extracted with their archive names)
formatArchive format (Auto = detect from archivePath)
Returns
true if all files found and extracted, false otherwise

Definition at line 805 of file QGCCompression.cc.

References extractFiles(), QGClibarchive::extractMultipleFiles(), and validateArchiveInput().

Referenced by QGCCompressionJob::extractFiles(), and extractFiles().

◆ extractFromDevice()

bool QGCCompression::extractFromDevice ( QIODevice *  device,
const QString &  outputDirectoryPath,
ProgressCallback  progress = nullptr,
qint64  maxDecompressedBytes = 0 
)

Extract archive from QIODevice to directory

Parameters
deviceQIODevice to read from (must be open and readable)
outputDirectoryPathOutput directory path
progressOptional progress callback
maxDecompressedBytesMaximum total decompressed size in bytes (0 = unlimited)
Returns
true on success, false on failure or if size limit exceeded

Definition at line 869 of file QGCCompression.cc.

References captureFormatInfo(), QGClibarchive::extractFromDevice(), extractFromDevice(), and validateDeviceInput().

Referenced by extractFromDevice().

◆ fileExists()

bool QGCCompression::fileExists ( const QString &  archivePath,
const QString &  fileName,
Format  format = Format::Auto 
)

Check if a file exists in an archive without extracting

Parameters
archivePathPath to archive file (or Qt resource path :/)
fileNameName of file to check for (as shown by listArchive)
formatArchive format (Auto = detect from archivePath)
Returns
true if file exists in archive

Definition at line 765 of file QGCCompression.cc.

References fileExists(), QGClibarchive::fileExistsInArchive(), and validateArchiveInput().

Referenced by fileExists().

◆ formatExtension()

QString QGCCompression::formatExtension ( Format  format)

Get file extension for a format.

Definition at line 433 of file QGCCompression.cc.

References formatExtension().

Referenced by decompressFile(), formatExtension(), and strippedPath().

◆ formatName()

QString QGCCompression::formatName ( Format  format)

Get human-readable name for a format.

Definition at line 468 of file QGCCompression.cc.

◆ getArchiveStats()

ArchiveStats QGCCompression::getArchiveStats ( const QString &  archivePath,
Format  format = Format::Auto 
)

Get summary statistics for an archive without extracting

Parameters
archivePathPath to archive file (or Qt resource path :/)
formatArchive format (Auto = detect from archivePath)
Returns
ArchiveStats struct (all zeros on failure)

Definition at line 748 of file QGCCompression.cc.

References QGClibarchive::getArchiveStats(), getArchiveStats(), and validateArchiveInput().

Referenced by getArchiveStats().

◆ isArchiveFile()

bool QGCCompression::isArchiveFile ( const QString &  filePath)
inline

Check if file path indicates an archive file (.zip, .tar, .tar.gz, etc.)

Definition at line 105 of file QGCCompression.h.

References detectFormat(), and isArchiveFormat().

Referenced by PlanMasterController::loadFromArchive().

◆ isArchiveFormat()

bool QGCCompression::isArchiveFormat ( Format  format)

Check if format is an archive (contains multiple files)

Definition at line 503 of file QGCCompression.cc.

References isArchiveFormat().

Referenced by decompressFile(), isArchiveFile(), isArchiveFormat(), and validateArchiveInput().

◆ isCompressedFile()

bool QGCCompression::isCompressedFile ( const QString &  filePath)
inline

Check if file path indicates a compressed file (.gz, .xz, .zst)

Definition at line 100 of file QGCCompression.h.

References detectFormat(), and isCompressionFormat().

Referenced by QGCFileHelper::computeDecompressedFileHash(), decompressIfNeeded(), and QGCFileHelper::readFile().

◆ isCompressionFormat()

bool QGCCompression::isCompressionFormat ( Format  format)

Check if format is a compression format (single stream)

Definition at line 520 of file QGCCompression.cc.

References isCompressionFormat().

Referenced by decompressData(), decompressFile(), isCompressedFile(), isCompressionFormat(), QGCNetworkHelper::looksLikeCompressedData(), and strippedPath().

◆ lastError()

Error QGCCompression::lastError ( )

Get the error code from the last operation (thread-local)

Definition at line 150 of file QGCCompression.cc.

References lastError().

Referenced by lastError().

◆ lastErrorString()

QString QGCCompression::lastErrorString ( )

Get a human-readable error message from the last operation (thread-local)

Definition at line 155 of file QGCCompression.cc.

References errorName(), and lastErrorString().

Referenced by lastErrorString().

◆ listArchive()

QStringList QGCCompression::listArchive ( const QString &  archivePath,
Format  format = Format::Auto 
)

List contents of an archive without extracting

Parameters
archivePathPath to archive file (or Qt resource path :/)
formatArchive format (Auto = detect from archivePath)
Returns
List of file paths in archive, empty list on failure

Definition at line 712 of file QGCCompression.cc.

References listArchive(), QGClibarchive::listArchiveEntries(), and validateArchiveInput().

Referenced by listArchive().

◆ listArchiveDetailed()

QList< ArchiveEntry > QGCCompression::listArchiveDetailed ( const QString &  archivePath,
Format  format = Format::Auto 
)

List contents of an archive with detailed metadata

Parameters
archivePathPath to archive file (or Qt resource path :/)
formatArchive format (Auto = detect from archivePath)
Returns
List of ArchiveEntry structs, empty list on failure

Definition at line 729 of file QGCCompression.cc.

References listArchiveDetailed(), QGClibarchive::listArchiveEntriesDetailed(), and validateArchiveInput().

Referenced by listArchiveDetailed().

◆ strippedPath()

QString QGCCompression::strippedPath ( const QString &  filePath)

Get path with compression extension stripped (.gz, .xz, .zst removed) Returns original path if not a compressed file format

Definition at line 534 of file QGCCompression.cc.

References detectFormat(), formatExtension(), isCompressionFormat(), and strippedPath().

Referenced by decompressIfNeeded(), and strippedPath().

◆ validateArchive()

bool QGCCompression::validateArchive ( const QString &  archivePath,
Format  format = Format::Auto 
)

Validate an archive's integrity without extracting

Parameters
archivePathPath to archive file
formatArchive format (Auto = detect from archivePath)
Returns
true if archive is valid and all entries can be read

Definition at line 756 of file QGCCompression.cc.

References QGClibarchive::validateArchive(), validateArchive(), and validateArchiveInput().

Referenced by validateArchive().

◆ validateArchiveInput()

static bool QGCCompression::validateArchiveInput ( const QString &  archivePath,
Format format 
)
static

◆ validateDeviceInput()

static bool QGCCompression::validateDeviceInput ( QIODevice *  device)
static

Validate device input for streaming operations.

Definition at line 244 of file QGCCompression.cc.

References validateDeviceInput().

Referenced by decompressFromDevice(), decompressFromDevice(), extractFileDataFromDevice(), extractFromDevice(), and validateDeviceInput().

◆ validateFileInput()

static bool QGCCompression::validateFileInput ( const QString &  filePath,
Format format 
)
static

Validate file input: check existence and detect format

Parameters
filePathPath to validate
formatFormat to use/detect (modified if Auto)
Returns
true if file exists and format was detected

Definition at line 208 of file QGCCompression.cc.

References detectFormat(), QGCFileHelper::exists(), and validateFileInput().

Referenced by decompressFile(), validateArchiveInput(), and validateFileInput().

Variable Documentation

◆ kDefaultFilePermissions

constexpr quint32 QGCCompression::kDefaultFilePermissions = 0644
constexpr

Default Unix permissions for extracted files (rw-r–r–)

Definition at line 28 of file QGCCompressionTypes.h.