libdrmconf
0.11.3
A library to program DMR radios.
|
Represents a single image within a DFUFile
.
More...
#include <dfufile.hh>
Public Member Functions | |
Image () | |
Default constructor. More... | |
Image (const QString &name, uint8_t altSettings=0) | |
Constructs an image with the given name and optional "alternative settings". | |
Image (const Image &other) | |
Copy constructor. | |
virtual | ~Image () |
Destructor. | |
Image & | operator= (const Image &other) |
Copying assignment. | |
uint8_t | alternateSettings () const |
Returns the alternate settings byte. | |
void | setAlternateSettings (uint8_t s) |
Sets the alternate settings byte. | |
bool | isNamed () const |
Returns true if the image is named. | |
const QString & | name () const |
Returns the name of the image. | |
void | setName (const QString &name) |
Sets the name of the image. | |
uint32_t | size () const |
Returns the total size of the image (including headers). | |
uint32_t | memSize () const |
Returns the memory size stored in the image. | |
int | numElements () const |
Returns the number of elements of this image. | |
const Element & | element (int i) const |
Returns a reference to the i-th element of the image. | |
Element & | element (int i) |
Returns a reference to the i-th element of the image. | |
void | addElement (uint32_t addr, uint32_t size, int index=-1) |
Adds an element to the image with the given address and size at the specified index. More... | |
void | addElement (const Element &element) |
Adds an element to the image. | |
void | remElement (int i) |
Removes the i-th element from this image. | |
bool | isAligned (unsigned blocksize) const |
Checks if all element addresses and sizes is aligned with the given block size. | |
bool | read (QFile &file, CRC32 &crc, QString &errorMessage) |
Reads an image from the given file and updates the CRC. | |
bool | write (QFile &file, CRC32 &crc, QString &errorMessage) const |
Writes this image to the given file and updates the CRC. | |
void | dump (QTextStream &stream) const |
Prints a textual representation of the image into the given stream. | |
virtual bool | isAllocated (uint32_t offset) const |
Returns true if the specified address is allocated. | |
virtual unsigned char * | data (uint32_t offset) |
Returns a pointer to the encoded raw data at the specified offset. | |
virtual const unsigned char * | data (uint32_t offset) const |
Returns a const pointer to the encoded raw data at the specified offset. | |
void | sort () |
Sorts all elements with respect to their addresses. | |
Protected Attributes | |
uint8_t | _alternate_settings |
Alternate settings byte. | |
QString | _name |
Optional image name. | |
QVector< Element > | _elements |
The elements of the image. | |
AddressMap | _addressmap |
Maps an address range to element index. | |
Represents a single image within a DFUFile
.
DFUFile::Image::Image | ( | ) |
Default constructor.
Constructs an empty image.
void DFUFile::Image::addElement | ( | uint32_t | addr, |
uint32_t | size, | ||
int | index = -1 |
||
) |
Adds an element to the image with the given address and size at the specified index.
If the index is negative, the element gets appended.