A template class for lists of TLV items (Tag / Length / Value). More...
Classes | |
class | TagDefinition |
Internal structure to hold a tag definition. More... | |
Public Types | |
typedef QList< Tlv > | SuperClass |
Type name for the superclass. More... | |
typedef QtlTlv< TAG, LENGTH, ORDER > | Tlv |
Type name for a TLV item in the list. More... | |
Public Member Functions | |
QtlTlvList () | |
Default constructor. More... | |
QtlTlvList (const QtlTlvList &other) | |
Copy constructor. More... | |
void | addTagDefinition (TAG tag, int minCount, int maxCount, int minSize, int maxSize) |
Add a tag definition for the list. More... | |
void | appendTo (QtlByteBlock &data) const |
Serialize the TLV list at end of a given byte block. More... | |
void | clearTagDefinitions () |
Clear the list of tag definitions. More... | |
bool | readAt (const QtlByteBlock &data, int &index, int end=-1) |
Deserialize the TLV list from a given byte block. More... | |
int | tagDefinitionsCount () const |
Get the number of tag definitions. More... | |
bool | validate () const |
Validate the TLV list according to its tags definitions. More... | |
Private Types | |
typedef QMap< TAG, TagDefinition > | TagDefinitionMap |
A map of tag definitions, index by tag value. More... | |
Private Attributes | |
TagDefinitionMap | _tagMap |
The map of tag definitions. More... | |
A template class for lists of TLV items (Tag / Length / Value).
TAG | An integer type representing tag fields. |
LENGTH | An integer type representing length fields. |
ORDER | Byte order to use for serialization. |
typedef QtlTlv<TAG,LENGTH,ORDER> QtlTlvList< TAG, LENGTH, ORDER >::Tlv |
Type name for a TLV item in the list.
typedef QList<Tlv> QtlTlvList< TAG, LENGTH, ORDER >::SuperClass |
Type name for the superclass.
|
private |
A map of tag definitions, index by tag value.
|
inline |
Default constructor.
|
inline |
Copy constructor.
[in] | other | Other instance to copy. |
void QtlTlvList< TAG, LENGTH, ORDER >::appendTo | ( | QtlByteBlock & | data | ) | const |
Serialize the TLV list at end of a given byte block.
[in,out] | data | The byte block to use. Its size is increased to include the TLV list. |
bool QtlTlvList< TAG, LENGTH, ORDER >::readAt | ( | const QtlByteBlock & | data, |
int & | index, | ||
int | end = -1 |
||
) |
Deserialize the TLV list from a given byte block.
The deserialized TLV items are appended to this object.
[in] | data | The byte block to use. |
[in,out] | index | Index in the byte block where to read the TLV list. index is updated to point after the read TLV list. |
[in] | end | Next index after last byte to read. If negative, use the end of byte block. |
|
inline |
Add a tag definition for the list.
[in] | tag | The tag value. |
[in] | minCount | Minimum number of items with this tag. |
[in] | maxCount | Maximum number of items with this tag. |
[in] | minSize | Minimum size in bytes of the value of items with this tag. |
[in] | maxSize | Maximum size in bytes of the value of items with this tag. |
|
inline |
Clear the list of tag definitions.
|
inline |
Get the number of tag definitions.
bool QtlTlvList< TAG, LENGTH, ORDER >::validate | ( | ) | const |
Validate the TLV list according to its tags definitions.
|
private |
The map of tag definitions.