QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCDecompressDevice Class Reference

#include <QGCDecompressDevice.h>

+ Inheritance diagram for QGCDecompressDevice:
+ Collaboration diagram for QGCDecompressDevice:

Public Member Functions

 QGCDecompressDevice (QIODevice *source, QObject *parent=nullptr)
 
 QGCDecompressDevice (const QString &filePath, QObject *parent=nullptr)
 
 ~QGCDecompressDevice () override=default
 
bool open (OpenMode mode) override
 
- Public Member Functions inherited from QGCArchiveDeviceBase
 ~QGCArchiveDeviceBase () override
 
void close () override
 
bool isSequential () const override
 
qint64 bytesAvailable () const override
 
QString errorString () const
 
QString formatName () const
 
QString filterName () const
 

Protected Member Functions

bool initArchive () override
 
bool prepareForReading () override
 
bool isReadyToRead () const override
 
void resetState () override
 Reset all state (called by close())
 
- Protected Member Functions inherited from QGCArchiveDeviceBase
 QGCArchiveDeviceBase (const QString &filePath, QObject *parent=nullptr)
 
 QGCArchiveDeviceBase (QIODevice *source, QObject *parent=nullptr)
 
qint64 readData (char *data, qint64 maxSize) override
 
qint64 writeData (const char *data, qint64 maxSize) override
 
bool initSourceFromPath ()
 
void configureArchiveFormats (bool allFormats)
 
bool openArchive ()
 
bool fillBuffer ()
 
void captureFormatInfo ()
 Capture format info from the archive after first header read.
 

Additional Inherited Members

- Protected Attributes inherited from QGCArchiveDeviceBase
QString _filePath
 
QIODevice * _sourceDevice = nullptr
 
bool _ownsSource = false
 
std::unique_ptr< QIODevice > _ownedSource
 
struct archive * _archive = nullptr
 
QByteArray _resourceData
 
bool _eof = false
 
QByteArray _buffer
 
QString _errorString
 
QString _formatName
 
QString _filterName
 

Detailed Description

QIODevice wrapper for streaming decompression of single-file formats Supports .gz, .xz, .zst, .bz2, .lz4 compressed data Read-only, sequential access only

Example usage:

QGCDecompressDevice device("data.json.gz");
device.open(QIODevice::ReadOnly);
QTextStream stream(&device);
QString content = stream.readAll();

Definition at line 23 of file QGCDecompressDevice.h.

Constructor & Destructor Documentation

◆ QGCDecompressDevice() [1/2]

QGCDecompressDevice::QGCDecompressDevice ( QIODevice *  source,
QObject *  parent = nullptr 
)
explicit

Construct from QIODevice source (streaming)

Parameters
sourceCompressed data source (must be open and readable)
parentQObject parent
Note
The source device must remain valid until this device is closed

Definition at line 13 of file QGCDecompressDevice.cc.

◆ QGCDecompressDevice() [2/2]

QGCDecompressDevice::QGCDecompressDevice ( const QString &  filePath,
QObject *  parent = nullptr 
)
explicit

Construct from file path

Parameters
filePathPath to compressed file (or Qt resource path :/)
parentQObject parent

Definition at line 18 of file QGCDecompressDevice.cc.

◆ ~QGCDecompressDevice()

QGCDecompressDevice::~QGCDecompressDevice ( )
overridedefault

Member Function Documentation

◆ initArchive()

bool QGCDecompressDevice::initArchive ( )
overrideprotectedvirtual

Initialize libarchive reader with configured format support Subclasses must override to configure format support before calling base

Returns
true on success, sets _errorString on failure

Implements QGCArchiveDeviceBase.

Definition at line 56 of file QGCDecompressDevice.cc.

References QGCArchiveDeviceBase::_archive, QGCArchiveDeviceBase::_errorString, QGCArchiveDeviceBase::configureArchiveFormats(), and QGCArchiveDeviceBase::openArchive().

Referenced by open().

◆ isReadyToRead()

bool QGCDecompressDevice::isReadyToRead ( ) const
inlineoverrideprotectedvirtual

Check if ready to read data

Returns
true if archive is initialized and ready

Implements QGCArchiveDeviceBase.

Definition at line 47 of file QGCDecompressDevice.h.

◆ open()

◆ prepareForReading()

bool QGCDecompressDevice::prepareForReading ( )
overrideprotectedvirtual

Called after archive is initialized, before reading begins Subclasses override to seek to entry, read headers, etc.

Returns
true on success, sets _errorString on failure

Implements QGCArchiveDeviceBase.

Definition at line 70 of file QGCDecompressDevice.cc.

References QGCArchiveDeviceBase::_archive, QGCArchiveDeviceBase::_errorString, QGCArchiveDeviceBase::_filterName, QGCArchiveDeviceBase::_formatName, and QGCArchiveDeviceBase::captureFormatInfo().

Referenced by open().

◆ resetState()

void QGCDecompressDevice::resetState ( )
overrideprotectedvirtual

Reset all state (called by close())

Reimplemented from QGCArchiveDeviceBase.

Definition at line 90 of file QGCDecompressDevice.cc.

References QGCArchiveDeviceBase::resetState().


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