Resource Class
class QInstaller::ResourceThe Resource class is an interface for wrapping a file as read only device. More...
Header: | #include <Resource> |
Public Functions
Resource(const QString &path, const Range<qint64> &segment) | |
Resource(const QString &path, const QByteArray &name) | |
Resource(const QString &path) | |
virtual | ~Resource() |
QByteArray | name() const |
bool | open() |
Range<qint64> | segment() const |
void | setName(const QByteArray &name) |
void | setSegment(const Range<qint64> &segment) |
Reimplemented Public Functions
virtual void | close() override |
virtual bool | seek(qint64 pos) override |
virtual qint64 | size() const override |
Detailed Description
Resource is an interface for reading inside a file, but is not supposed to write to the file it wraps. The Resource
class is created by passing a path to an existing binary (such as a zipped archive or a Qt resource file).
The resource name can be set at any time using setName() or during construction. The segment supplied during construction represents the offset and size of the resource inside the file.
Member Function Documentation
Resource::Resource(const QString &path, const Range<qint64> &segment)
Creates a resource providing the data in path limited to segment.
Resource::Resource(const QString &path, const QByteArray &name)
Creates a resource providing the data in path identified by name.
Resource::Resource(const QString &path)
Creates a resource providing the data in path.
[virtual]
Resource::~Resource()
Destroys the resource. Calls close() if necessary before destroying the resource.
[override virtual]
void Resource::close()
QByteArray Resource::name() const
Returns the name of the resource.
See also setName().
bool Resource::open()
Opens a resource in QIODevice::ReadOnly mode. The function returns true
if successful.
[override virtual]
bool Resource::seek(qint64 pos)
Range<qint64> Resource::segment() const
Returns the range inside the file this resource represents.
See also setSegment().
void Resource::setName(const QByteArray &name)
Sets the name of the resource to name.
See also name().
void Resource::setSegment(const Range<qint64> &segment)
Sets the range to the segment of the file that this resource represents.
See also segment().