IKlvItem interface.
More...
|
virtual char * | Init (const char *key, const char *value, const size_t size, size_t &length)=0 |
| Initialize KlvItem using ASCII key and a value. More...
|
|
virtual char * | Init (const char *key, KEY_LENGTH keySize, const char *value, const size_t size, size_t &length)=0 |
| Initialize KlvItem using Binary key and a value. More...
|
|
virtual void | Parse (KEY_LENGTH keyLength, const char *buf, size_t &size)=0 |
|
virtual const char * | GetKeyString ()=0 |
| Get Key as ASCII string. More...
|
|
virtual const char * | GetKey (KEY_LENGTH &len)=0 |
| Get Key as a binary array. More...
|
|
virtual const size_t | GetLength ()=0 |
| Get a Value Length. More...
|
|
virtual const char * | GetValue ()=0 |
| Get a Value. More...
|
|
virtual const size_t | GetSize ()=0 |
| Get a size of entire KLV. More...
|
|
virtual const char * | GetBuffer (size_t &length)=0 |
| Get an encoded KLV buffer. More...
|
|
virtual | ~IKlvItem () |
| Virtual destructor.
|
|
IKlvItem interface defines a KLV item and allows numerous operations on it.
- Examples:
- klvtestapp.cpp, klvtestappfile.cpp, and klvtestappuds.cpp.
KEY_LENGTH enumeration defines a Key length of the KLV.
Enumerator |
---|
UNDEFINED |
Undefined state.
|
ONE_BYTE |
1 byte key length
|
TWO_BYTES |
2 byte key length
|
FOUR_BYTES |
4 byte key length
|
SIXTEEN_BYTES |
16 byte key length
|
virtual const char* IKlvItem::GetBuffer |
( |
size_t & |
length | ) |
|
|
pure virtual |
Returns a KLV buffer.
- Parameters
-
length | a size_t&. A size of the returned buffer. |
- Returns
- const char*. Returns a Value.
virtual const char* IKlvItem::GetKey |
( |
KEY_LENGTH & |
len | ) |
|
|
pure virtual |
Returns an item Key.
- Parameters
-
len | a KEY_LENGTH& a Key's letngth. |
- Returns
- const char*. Returns a Key.
virtual const char* IKlvItem::GetKeyString |
( |
| ) |
|
|
pure virtual |
virtual const size_t IKlvItem::GetLength |
( |
| ) |
|
|
pure virtual |
virtual const size_t IKlvItem::GetSize |
( |
| ) |
|
|
pure virtual |
Returns a KLV size.
- Returns
- const size_t. Returns a size of entire KLV.
virtual const char* IKlvItem::GetValue |
( |
| ) |
|
|
pure virtual |
Returns an item Value.
- Returns
- const char*. Returns a Value.
virtual char* IKlvItem::Init |
( |
const char * |
key, |
|
|
const char * |
value, |
|
|
const size_t |
size, |
|
|
size_t & |
length |
|
) |
| |
|
pure virtual |
Initializes a KlvItem with key (ASCII) and value, returns encoded data buffer and its length.
- Parameters
-
key | a const char*. The Key String. 2 characters per byte, see Note below. |
value | a const char*. A binary Value. |
size | a size_t. Value's size. |
length | a size_t&. A size of the returned buffer. |
- Returns
- char*. KLV buffer.
- Note
- Note, 2 characters per byte MUST be used! For example - "060E2B34020101010E01010201010000"
virtual char* IKlvItem::Init |
( |
const char * |
key, |
|
|
KEY_LENGTH |
keySize, |
|
|
const char * |
value, |
|
|
const size_t |
size, |
|
|
size_t & |
length |
|
) |
| |
|
pure virtual |
Initializes KlvItem with key (Binary) and value, returns encoded data buffer and its length.
- Parameters
-
key | a const char*. A binary Key. |
keySize | a KEY_LENGTH. Key's size. |
value | a const char*. A binary Value. |
size | a size_t. Value's size. |
length | a size_t&. A size of the returned buffer. |
- Returns
- char*. KLV buffer.
CreateKlvItem helper function. Instantiates the KlvItem class
- Returns
- IKlvItem* Pointer to the KlvItem instance.
KLVLIB_API IKlvItem * CreateNonInitializedKlvItem |
( |
| ) |
|
|
related |
CreateKlvItem helper function. Creates the KlvItem and copies key, value and length. Does not perform BER encoding and other initialization procedures
- Returns
- IKlvItem* Pointer to the KlvItem instance.