|
QGroundControl
Ground Control Station for MAVLink Drones
|
Classes | |
| class | ArchiveReader |
| RAII wrapper for libarchive reader with automatic cleanup. More... | |
Typedefs | |
| using | ProgressCallback = QGCCompression::ProgressCallback |
| using | ArchiveEntry = QGCCompression::ArchiveEntry |
| using | ArchiveStats = QGCCompression::ArchiveStats |
| using | EntryFilter = QGCCompression::EntryFilter |
Enumerations | |
| enum class | ReaderMode { AllFormats , RawFormat } |
| Mode for ArchiveReader format support. More... | |
Functions | |
| QString | lastDetectedFormatName () |
| QString | lastDetectedFilterName () |
| la_ssize_t | deviceReadCallback (struct archive *, void *clientData, const void **buffer) |
| la_int64_t | deviceSkipCallback (struct archive *, void *clientData, la_int64_t request) |
| int | deviceCloseCallback (struct archive *, void *) |
| la_int64_t | deviceSeekCallback (struct archive *, void *clientData, la_int64_t offset, int whence) |
| ArchiveEntry | toArchiveEntry (struct archive_entry *entry) |
| bool | openArchiveForReading (struct archive *a, const QString &filePath, QByteArray &resourceData) |
| bool | extractAnyArchive (const QString &archivePath, const QString &outputDirectoryPath, ProgressCallback progress, qint64 maxBytes) |
| bool | extractArchiveAtomic (const QString &archivePath, const QString &outputDirectoryPath, ProgressCallback progress, qint64 maxBytes) |
| bool | extractSingleFile (const QString &archivePath, const QString &fileName, const QString &outputPath) |
| QByteArray | extractFileToMemory (const QString &archivePath, const QString &fileName) |
| bool | extractMultipleFiles (const QString &archivePath, const QStringList &fileNames, const QString &outputDirectoryPath) |
| bool | extractByPattern (const QString &archivePath, const QStringList &patterns, const QString &outputDirectoryPath, QStringList *extractedFiles) |
| bool | validateArchive (const QString &archivePath) |
| bool | fileExistsInArchive (const QString &archivePath, const QString &fileName) |
| QStringList | listArchiveEntries (const QString &archivePath) |
| QList< ArchiveEntry > | listArchiveEntriesDetailed (const QString &archivePath) |
| ArchiveStats | getArchiveStats (const QString &archivePath) |
| bool | extractWithFilter (const QString &archivePath, const QString &outputDirectoryPath, EntryFilter filter, ProgressCallback progress, qint64 maxBytes) |
| bool | decompressSingleFile (const QString &inputPath, const QString &outputPath, ProgressCallback progress, qint64 maxBytes) |
| QByteArray | decompressDataFromMemory (const QByteArray &data, qint64 maxBytes) |
| bool | extractFromDevice (QIODevice *device, const QString &outputDirectoryPath, ProgressCallback progress, qint64 maxBytes) |
| QByteArray | extractFileDataFromDevice (QIODevice *device, const QString &fileName) |
| bool | decompressFromDevice (QIODevice *device, const QString &outputPath, ProgressCallback progress, qint64 maxBytes) |
| QByteArray | decompressDataFromDevice (QIODevice *device, qint64 maxBytes) |
| using QGClibarchive::ArchiveEntry = typedef QGCCompression::ArchiveEntry |
Definition at line 27 of file QGClibarchive.h.
| using QGClibarchive::ArchiveStats = typedef QGCCompression::ArchiveStats |
Definition at line 28 of file QGClibarchive.h.
| using QGClibarchive::EntryFilter = typedef QGCCompression::EntryFilter |
Definition at line 29 of file QGClibarchive.h.
| using QGClibarchive::ProgressCallback = typedef QGCCompression::ProgressCallback |
Definition at line 26 of file QGClibarchive.h.
|
strong |
Mode for ArchiveReader format support.
| Enumerator | |
|---|---|
| AllFormats | Support all archive formats (ZIP, TAR, 7z, etc.) |
| RawFormat | Raw format for single-file decompression (.gz, .xz, etc.) |
Definition at line 38 of file QGClibarchive.h.
| QByteArray QGClibarchive::decompressDataFromDevice | ( | QIODevice * | device, |
| qint64 | maxBytes = 0 |
||
| ) |
Decompress single-file format from QIODevice to memory
| device | QIODevice to read from (must be open and readable) |
| maxBytes | Maximum decompressed bytes (0 = unlimited) |
Definition at line 1398 of file QGClibarchive.cc.
References QGClibarchive::ArchiveReader::handle(), QGClibarchive::ArchiveReader::open(), and RawFormat.
Referenced by QGCCompression::decompressFromDevice().
| QByteArray QGClibarchive::decompressDataFromMemory | ( | const QByteArray & | data, |
| qint64 | maxBytes = 0 |
||
| ) |
Decompress data in memory
| data | Compressed input data |
| maxBytes | Maximum decompressed bytes (0 = unlimited) |
Definition at line 1291 of file QGClibarchive.cc.
Referenced by QGCCompression::decompressData().
| bool QGClibarchive::decompressFromDevice | ( | QIODevice * | device, |
| const QString & | outputPath, | ||
| ProgressCallback | progress = nullptr, |
||
| qint64 | maxBytes = 0 |
||
| ) |
Decompress single-file format from QIODevice to disk
| device | QIODevice to read from (must be open and readable) |
| outputPath | Output file path |
| progress | Optional progress callback |
| maxBytes | Maximum decompressed bytes (0 = unlimited) |
Definition at line 1377 of file QGClibarchive.cc.
References QGCFileHelper::ensureParentExists(), QGClibarchive::ArchiveReader::handle(), QGClibarchive::ArchiveReader::open(), and RawFormat.
Referenced by QGCCompression::decompressFromDevice().
| bool QGClibarchive::decompressSingleFile | ( | const QString & | inputPath, |
| const QString & | outputPath, | ||
| ProgressCallback | progress = nullptr, |
||
| qint64 | maxBytes = 0 |
||
| ) |
Decompress a single compressed file (.gz, .xz, .zst, etc.) to disk
| inputPath | Path to compressed file (or Qt resource path) |
| outputPath | Path for decompressed output |
| progress | Optional progress callback |
| maxBytes | Maximum decompressed bytes (0 = unlimited) |
Definition at line 1271 of file QGClibarchive.cc.
References QGClibarchive::ArchiveReader::dataSize(), QGCFileHelper::ensureParentExists(), QGClibarchive::ArchiveReader::handle(), QGClibarchive::ArchiveReader::open(), and RawFormat.
Referenced by QGCCompression::decompressFile().
| int QGClibarchive::deviceCloseCallback | ( | struct archive * | a, |
| void * | clientData | ||
| ) |
Close callback for QIODevice streaming (does not close device)
| clientData | QIODevice pointer |
Definition at line 114 of file QGClibarchive.cc.
Referenced by QGClibarchive::ArchiveReader::open(), and QGCArchiveDeviceBase::openArchive().
| la_ssize_t QGClibarchive::deviceReadCallback | ( | struct archive * | a, |
| void * | clientData, | ||
| const void ** | buffer | ||
| ) |
Read callback for QIODevice streaming
| clientData | QIODevice pointer |
| buffer | Output pointer to buffer |
Definition at line 75 of file QGClibarchive.cc.
References QGCFileHelper::kBufferSizeMax.
Referenced by QGClibarchive::ArchiveReader::open(), and QGCArchiveDeviceBase::openArchive().
| la_int64_t QGClibarchive::deviceSeekCallback | ( | struct archive * | a, |
| void * | clientData, | ||
| la_int64_t | offset, | ||
| int | whence | ||
| ) |
Seek callback for random-access QIODevice (improves ZIP performance)
| clientData | QIODevice pointer |
| offset | Seek offset |
| whence | SEEK_SET, SEEK_CUR, or SEEK_END |
Definition at line 120 of file QGClibarchive.cc.
Referenced by QGClibarchive::ArchiveReader::open(), and QGCArchiveDeviceBase::openArchive().
| la_int64_t QGClibarchive::deviceSkipCallback | ( | struct archive * | a, |
| void * | clientData, | ||
| la_int64_t | request | ||
| ) |
Skip callback for QIODevice streaming
| clientData | QIODevice pointer |
| request | Bytes to skip |
Definition at line 89 of file QGClibarchive.cc.
References QGCFileHelper::kBufferSizeMax.
Referenced by QGClibarchive::ArchiveReader::open(), and QGCArchiveDeviceBase::openArchive().
| bool QGClibarchive::extractAnyArchive | ( | const QString & | archivePath, |
| const QString & | outputDirectoryPath, | ||
| ProgressCallback | progress = nullptr, |
||
| qint64 | maxBytes = 0 |
||
| ) |
Extract any supported archive format using libarchive's auto-detection Supports: ZIP, 7z, TAR (all variants), cpio, ar, xar, etc.
| archivePath | Path to the archive file (or Qt resource path) |
| outputDirectoryPath | Path where files will be extracted |
| progress | Optional progress callback (return false to cancel) |
| maxBytes | Maximum total decompressed bytes (0 = unlimited) |
Definition at line 747 of file QGClibarchive.cc.
References AllFormats, QGClibarchive::ArchiveReader::dataSize(), QGCFileHelper::ensureDirectoryExists(), getArchiveStats(), QGCFileHelper::hasSufficientDiskSpace(), QGClibarchive::ArchiveReader::open(), QGClibarchive::ArchiveReader::release(), and QGCCompression::ArchiveStats::totalUncompressedSize.
Referenced by QGCCompression::extractArchive().
| bool QGClibarchive::extractArchiveAtomic | ( | const QString & | archivePath, |
| const QString & | outputDirectoryPath, | ||
| ProgressCallback | progress = nullptr, |
||
| qint64 | maxBytes = 0 |
||
| ) |
Extract archive atomically using a temporary staging directory Provides all-or-nothing semantics: if extraction fails, no partial files remain. Uses a staging directory and atomic rename/swap in the output parent directory.
| archivePath | Path to the archive file (or Qt resource path) |
| outputDirectoryPath | Path where files will be extracted |
| progress | Optional progress callback (return false to cancel) |
| maxBytes | Maximum total decompressed bytes (0 = unlimited) |
Definition at line 771 of file QGClibarchive.cc.
References AllFormats, QGClibarchive::ArchiveReader::dataSize(), QGCFileHelper::ensureDirectoryExists(), getArchiveStats(), QGCFileHelper::hasSufficientDiskSpace(), QGCFileHelper::joinPath(), QGClibarchive::ArchiveReader::open(), QGClibarchive::ArchiveReader::release(), QGCCompression::ArchiveStats::totalEntries, and QGCCompression::ArchiveStats::totalUncompressedSize.
Referenced by QGCCompression::extractArchiveAtomic().
| bool QGClibarchive::extractByPattern | ( | const QString & | archivePath, |
| const QStringList & | patterns, | ||
| const QString & | outputDirectoryPath, | ||
| QStringList * | extractedFiles = nullptr |
||
| ) |
Extract files matching glob patterns from archive (uses libarchive archive_match) Supports wildcards: * (any chars), ? (single char), [...] (char class)
| archivePath | Path to the archive file (or Qt resource path) |
| patterns | Glob patterns to match (e.g., "*.json", "dir/*", "file.txt") |
| outputDirectoryPath | Output directory |
| extractedFiles | Optional output list of files that were extracted |
Definition at line 994 of file QGClibarchive.cc.
References AllFormats, QGCFileHelper::ensureDirectoryExists(), QGCFileHelper::ensureParentExists(), QGClibarchive::ArchiveReader::handle(), QGCFileHelper::joinPath(), and QGClibarchive::ArchiveReader::open().
Referenced by QGCCompression::extractByPattern().
| QByteArray QGClibarchive::extractFileDataFromDevice | ( | QIODevice * | device, |
| const QString & | fileName | ||
| ) |
Extract a single file from archive device directly to memory
| device | QIODevice to read from (must be open and readable) |
| fileName | Name of file inside archive |
Definition at line 1349 of file QGClibarchive.cc.
References AllFormats, QGClibarchive::ArchiveReader::handle(), and QGClibarchive::ArchiveReader::open().
Referenced by QGCCompression::extractFileDataFromDevice().
| QByteArray QGClibarchive::extractFileToMemory | ( | const QString & | archivePath, |
| const QString & | fileName | ||
| ) |
Extract a single file from any archive directly to memory
| archivePath | Path to the archive file (or Qt resource path) |
| fileName | Name of file inside archive |
Definition at line 909 of file QGClibarchive.cc.
References AllFormats, QGClibarchive::ArchiveReader::handle(), and QGClibarchive::ArchiveReader::open().
Referenced by QGCCompression::extractFileData().
| bool QGClibarchive::extractFromDevice | ( | QIODevice * | device, |
| const QString & | outputDirectoryPath, | ||
| ProgressCallback | progress = nullptr, |
||
| qint64 | maxBytes = 0 |
||
| ) |
Extract archive from QIODevice to directory
| device | QIODevice to read from (must be open and readable) |
| outputDirectoryPath | Path where files will be extracted |
| progress | Optional progress callback (return false to cancel) |
| maxBytes | Maximum total decompressed bytes (0 = unlimited) |
Definition at line 1332 of file QGClibarchive.cc.
References AllFormats, QGCFileHelper::ensureDirectoryExists(), QGClibarchive::ArchiveReader::open(), and QGClibarchive::ArchiveReader::release().
Referenced by QGCCompression::extractFromDevice().
| bool QGClibarchive::extractMultipleFiles | ( | const QString & | archivePath, |
| const QStringList & | fileNames, | ||
| const QString & | outputDirectoryPath | ||
| ) |
Extract multiple files from any archive by name in one pass
| archivePath | Path to the archive file (or Qt resource path) |
| fileNames | Names of files inside archive |
| outputDirectoryPath | Output directory |
Definition at line 941 of file QGClibarchive.cc.
References AllFormats, QGCFileHelper::ensureDirectoryExists(), QGCFileHelper::ensureParentExists(), QGClibarchive::ArchiveReader::handle(), QGCFileHelper::joinPath(), and QGClibarchive::ArchiveReader::open().
Referenced by QGCCompression::extractFiles().
| bool QGClibarchive::extractSingleFile | ( | const QString & | archivePath, |
| const QString & | fileName, | ||
| const QString & | outputPath | ||
| ) |
Extract a single file from any archive by name
| archivePath | Path to the archive file (or Qt resource path) |
| fileName | Name of file inside archive |
| outputPath | Output file path |
Definition at line 885 of file QGClibarchive.cc.
References AllFormats, QGCFileHelper::ensureParentExists(), QGClibarchive::ArchiveReader::handle(), and QGClibarchive::ArchiveReader::open().
Referenced by QGCCompression::extractFile().
| bool QGClibarchive::extractWithFilter | ( | const QString & | archivePath, |
| const QString & | outputDirectoryPath, | ||
| EntryFilter | filter, | ||
| ProgressCallback | progress = nullptr, |
||
| qint64 | maxBytes = 0 |
||
| ) |
Extract archive with per-entry filtering
| archivePath | Path to the archive file (or Qt resource path) |
| outputDirectoryPath | Path where files will be extracted |
| filter | Callback to decide which entries to extract |
| progress | Optional progress callback (return false to cancel) |
| maxBytes | Maximum total decompressed bytes (0 = unlimited) |
Definition at line 1188 of file QGClibarchive.cc.
References AllFormats, QGClibarchive::ArchiveReader::dataSize(), QGCFileHelper::ensureDirectoryExists(), QGCFileHelper::ensureParentExists(), getArchiveStats(), QGClibarchive::ArchiveReader::handle(), QGCFileHelper::hasSufficientDiskSpace(), QGCCompression::ArchiveEntry::isDirectory, QGCFileHelper::joinPath(), QGCCompression::ArchiveEntry::name, QGClibarchive::ArchiveReader::open(), QGCCompression::ArchiveEntry::size, toArchiveEntry(), and QGCCompression::ArchiveStats::totalUncompressedSize.
Referenced by QGCCompression::extractArchiveFiltered().
| bool QGClibarchive::fileExistsInArchive | ( | const QString & | archivePath, |
| const QString & | fileName | ||
| ) |
Check if a file exists in an archive without extracting
| archivePath | Path to the archive file (or Qt resource path) |
| fileName | Name of file to check for |
Definition at line 1096 of file QGClibarchive.cc.
References AllFormats, QGClibarchive::ArchiveReader::handle(), and QGClibarchive::ArchiveReader::open().
Referenced by QGCCompression::fileExists().
| ArchiveStats QGClibarchive::getArchiveStats | ( | const QString & | archivePath | ) |
Get summary statistics for an archive
| archivePath | Path to the archive file (or Qt resource path) |
Definition at line 1154 of file QGClibarchive.cc.
References AllFormats, QGCCompression::ArchiveStats::directoryCount, QGCCompression::ArchiveStats::fileCount, QGClibarchive::ArchiveReader::handle(), QGCCompression::ArchiveStats::largestFileName, QGCCompression::ArchiveStats::largestFileSize, QGClibarchive::ArchiveReader::open(), QGCCompression::ArchiveStats::totalEntries, and QGCCompression::ArchiveStats::totalUncompressedSize.
Referenced by extractAnyArchive(), extractArchiveAtomic(), extractWithFilter(), and QGCCompression::getArchiveStats().
| QString QGClibarchive::lastDetectedFilterName | ( | ) |
Get the detected filter name from the last archive operation (thread-local)
Definition at line 62 of file QGClibarchive.cc.
Referenced by QGCCompression::captureFormatInfo().
| QString QGClibarchive::lastDetectedFormatName | ( | ) |
Get the detected format name from the last archive operation (thread-local)
Definition at line 57 of file QGClibarchive.cc.
Referenced by QGCCompression::captureFormatInfo().
| QStringList QGClibarchive::listArchiveEntries | ( | const QString & | archivePath | ) |
List all entries in an archive
| archivePath | Path to the archive file (or Qt resource path) |
Definition at line 1118 of file QGClibarchive.cc.
References AllFormats, QGClibarchive::ArchiveReader::handle(), and QGClibarchive::ArchiveReader::open().
Referenced by QGCCompression::listArchive().
| QList< ArchiveEntry > QGClibarchive::listArchiveEntriesDetailed | ( | const QString & | archivePath | ) |
List all entries in an archive with detailed metadata
| archivePath | Path to the archive file (or Qt resource path) |
Definition at line 1136 of file QGClibarchive.cc.
References AllFormats, QGClibarchive::ArchiveReader::handle(), QGClibarchive::ArchiveReader::open(), and toArchiveEntry().
Referenced by QGCCompression::listArchiveDetailed().
| bool QGClibarchive::openArchiveForReading | ( | struct archive * | a, |
| const QString & | filePath, | ||
| QByteArray & | resourceData | ||
| ) |
Open an archive for reading, handling both Qt resources and regular files Qt resources are loaded into resourceData; regular files are streamed
| a | Initialized archive reader (call archive_read_support_* first) |
| filePath | Path to file (Qt resource :/ or filesystem path) |
| resourceData | Output buffer for Qt resource data (must stay alive until archive is closed) |
Definition at line 707 of file QGClibarchive.cc.
References QGCFileHelper::isQtResource(), and QGCFileHelper::optimalBufferSize().
Referenced by QGClibarchive::ArchiveReader::open().
| ArchiveEntry QGClibarchive::toArchiveEntry | ( | struct archive_entry * | entry | ) |
Convert libarchive entry to ArchiveEntry struct
| entry | libarchive entry pointer (from archive_read_next_header) |
Definition at line 154 of file QGClibarchive.cc.
References QGCCompression::ArchiveEntry::isDirectory, QGCCompression::ArchiveEntry::modified, QGCCompression::ArchiveEntry::name, QGCCompression::ArchiveEntry::permissions, and QGCCompression::ArchiveEntry::size.
Referenced by extractWithFilter(), and listArchiveEntriesDetailed().
| bool QGClibarchive::validateArchive | ( | const QString & | archivePath | ) |
Validate archive integrity by reading all entries
| archivePath | Path to the archive file |
Definition at line 1068 of file QGClibarchive.cc.
References AllFormats, QGClibarchive::ArchiveReader::handle(), QGCFileHelper::kBufferSizeMax, and QGClibarchive::ArchiveReader::open().
Referenced by QGCCompression::validateArchive().