QtlMovie 1.12 (A specialized FFmpeg front-end)
QtlTlv< TAG, LENGTH, ORDER > Class Template Reference

A template class for TLV items (Tag / Length / Value). More...

Public Types

typedef LENGTH Length
 Redefinition of the length integer type. More...
 
typedef TAG Tag
 Redefinition of the tag integer type. More...
 

Public Member Functions

 QtlTlv (TAG tag=0, const QtlByteBlock &value=QtlByteBlock())
 Default constructor. More...
 
 QtlTlv (const QtlTlv &other)
 Copy constructor. More...
 
void appendTo (QtlByteBlock &data) const
 Serialize the TLV at end of a given byte block. More...
 
template<typename INT >
bool getIntValue (INT &value) const
 Get the value as an integer. More...
 
template<typename INT >
INT getIntValue () const
 Get the value as an integer. More...
 
bool operator!= (const QtlTlv &other) const
 Comparison operator. More...
 
const QtlTlvoperator= (const QtlTlv &other)
 Assignment operator. More...
 
bool operator== (const QtlTlv &other) const
 Comparison operator. More...
 
bool readAt (const QtlByteBlock &data, int &index, int end=-1)
 Deserialize the TLV from a given byte block. More...
 
template<typename INT >
void setIntValue (const INT &value)
 Set the value as an integer. More...
 
void setTag (const TAG &tag)
 Set the tag. More...
 
void setValue (const QtlByteBlock &value)
 Set the binary value. More...
 
TAG tag () const
 Get the tag. More...
 
const QtlByteBlockvalue () const
 Get the binary value. More...
 
int valueSize () const
 Get the size of binary value. More...
 

Static Public Attributes

static const QtlByteBlock::ByteOrder ByteOrder = ORDER
 Redefinition of the byte order for this class. More...
 

Static Private Member Functions

static int intLengthMax ()
 Get the maximal value length as an int type. More...
 
static LENGTH lengthMax ()
 Get the maximal value length as a LENGTH type. More...
 

Private Attributes

TAG _tag
 Tag. More...
 
QtlByteBlock _value
 Binary value. More...
 

Detailed Description

template<typename TAG, typename LENGTH, QtlByteBlock::ByteOrder ORDER>
class QtlTlv< TAG, LENGTH, ORDER >

A template class for TLV items (Tag / Length / Value).

Template Parameters
TAGAn integer type representing tag fields.
LENGTHAn integer type representing length fields.
ORDERByte order to use for serialization.

Member Typedef Documentation

◆ Tag

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
typedef TAG QtlTlv< TAG, LENGTH, ORDER >::Tag

Redefinition of the tag integer type.

◆ Length

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
typedef LENGTH QtlTlv< TAG, LENGTH, ORDER >::Length

Redefinition of the length integer type.

Constructor & Destructor Documentation

◆ QtlTlv() [1/2]

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
QtlTlv< TAG, LENGTH, ORDER >::QtlTlv ( TAG  tag = 0,
const QtlByteBlock value = QtlByteBlock() 
)
inlineexplicit

Default constructor.

Parameters
[in]tagTag value.
[in]valueBinary data.

◆ QtlTlv() [2/2]

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
QtlTlv< TAG, LENGTH, ORDER >::QtlTlv ( const QtlTlv< TAG, LENGTH, ORDER > &  other)
inline

Copy constructor.

Parameters
[in]otherOther instance to copy.

Member Function Documentation

◆ operator=()

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
const QtlTlv& QtlTlv< TAG, LENGTH, ORDER >::operator= ( const QtlTlv< TAG, LENGTH, ORDER > &  other)
inline

Assignment operator.

Parameters
[in]otherOther instance to copy.
Returns
A reference to this object.

◆ operator==()

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
bool QtlTlv< TAG, LENGTH, ORDER >::operator== ( const QtlTlv< TAG, LENGTH, ORDER > &  other) const
inline

Comparison operator.

Parameters
[in]otherOther instance to compare.
Returns
True is the two objects are identical, false otherwise.

◆ operator!=()

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
bool QtlTlv< TAG, LENGTH, ORDER >::operator!= ( const QtlTlv< TAG, LENGTH, ORDER > &  other) const
inline

Comparison operator.

Parameters
[in]otherOther instance to compare.
Returns
True is the two objects are different, false otherwise.

◆ tag()

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
TAG QtlTlv< TAG, LENGTH, ORDER >::tag ( ) const
inline

Get the tag.

Returns
The tag.

◆ setTag()

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
void QtlTlv< TAG, LENGTH, ORDER >::setTag ( const TAG &  tag)
inline

Set the tag.

Parameters
[in]tagThe tag.

◆ value()

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
const QtlByteBlock& QtlTlv< TAG, LENGTH, ORDER >::value ( ) const
inline

Get the binary value.

Returns
The binary value.

◆ valueSize()

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
int QtlTlv< TAG, LENGTH, ORDER >::valueSize ( ) const
inline

Get the size of binary value.

Returns
The size of binary value.

◆ setValue()

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
void QtlTlv< TAG, LENGTH, ORDER >::setValue ( const QtlByteBlock value)

Set the binary value.

Parameters
[in]valueThe binary value.

◆ setIntValue()

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
template<typename INT >
void QtlTlv< TAG, LENGTH, ORDER >::setIntValue ( const INT &  value)
inline

Set the value as an integer.

The binary content is set according to the size of INT and the byte order of this instance.

Template Parameters
INTThe integer type of the value.
Parameters
[in]valueThe integer value.

◆ getIntValue() [1/2]

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
template<typename INT >
bool QtlTlv< TAG, LENGTH, ORDER >::getIntValue ( INT &  value) const
inline

Get the value as an integer.

The binary content is deserialized according to the size of INT and the byte order of this instance.

Template Parameters
INTThe integer type of the value.
Parameters
[out]valueThe integer value.
Returns
True if the binary content has the right size, false otherwise.

◆ getIntValue() [2/2]

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
template<typename INT >
INT QtlTlv< TAG, LENGTH, ORDER >::getIntValue ( ) const
inline

Get the value as an integer.

The binary content is deserialized according to the size of INT and the byte order of this instance.

Template Parameters
INTThe integer type of the value.
Returns
The integer value or zero if the binary content has the wrong size.

◆ appendTo()

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
void QtlTlv< TAG, LENGTH, ORDER >::appendTo ( QtlByteBlock data) const

Serialize the TLV at end of a given byte block.

Parameters
[in,out]dataThe byte block to use. Its size is increased to include the TLV.

◆ readAt()

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
bool QtlTlv< TAG, LENGTH, ORDER >::readAt ( const QtlByteBlock data,
int &  index,
int  end = -1 
)

Deserialize the TLV from a given byte block.

Parameters
[in]dataThe byte block to use.
[in,out]indexIndex in the byte block where to read the TLV. If the TLV is correctly read, index is updated to point after the read TLV.
[in]endNext index after last byte to read. If negative, use the end of byte block.
Returns
True on success, false on error (incorrect data, block too short).

◆ intLengthMax()

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
static int QtlTlv< TAG, LENGTH, ORDER >::intLengthMax ( )
inlinestaticprivate

Get the maximal value length as an int type.

Returns
The maximal value length as an int type.

◆ lengthMax()

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
static LENGTH QtlTlv< TAG, LENGTH, ORDER >::lengthMax ( )
inlinestaticprivate

Get the maximal value length as a LENGTH type.

Returns
The maximal value length as a LENGTH type.

Member Data Documentation

◆ ByteOrder

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
const QtlByteBlock::ByteOrder QtlTlv< TAG, LENGTH, ORDER >::ByteOrder = ORDER
static

Redefinition of the byte order for this class.

◆ _tag

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
TAG QtlTlv< TAG, LENGTH, ORDER >::_tag
private

Tag.

◆ _value

template<typename TAG , typename LENGTH , QtlByteBlock::ByteOrder ORDER>
QtlByteBlock QtlTlv< TAG, LENGTH, ORDER >::_value
private

Binary value.


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