Keyple C++  0.9.0
Keyple, an Open Source SDK for Ticketing
Public Member Functions | Friends | List of all members
keyple::core::util::bertlv::TLV Class Reference

#include <TLV.h>

Inherits enable_shared_from_this< TLV >.

Public Member Functions

 TLV (const std::vector< uint8_t > &binary)
 
bool parse (std::shared_ptr< Tag > tag, int offset)
 
const std::vector< uint8_t > getValue ()
 
int getPosition () const
 

Friends

KEYPLECORE_API std::ostream & operator<< (std::ostream &os, const TLV &tlv)
 

Detailed Description

This class helps to parse a byte array as a TLV structure

(ITU-T X.690 / ISO 8825)

Constructor & Destructor Documentation

◆ TLV()

keyple::core::util::bertlv::TLV::TLV ( const std::vector< uint8_t > &  binary)

Create a TLV object initialized with a byte array

Parameters
binarythe byte array containing the TLV structure

Member Function Documentation

◆ getPosition()

int keyple::core::util::bertlv::TLV::getPosition ( ) const
Returns
the current position in the main array

◆ getValue()

const std::vector< uint8_t > keyple::core::util::bertlv::TLV::getValue ( )

Return a byte array copied from the main array corresponding to value part of the last TLV parsing.

This method modifies the global position in the main array. Thus, it must be called once only.

Returns
a byte array

◆ parse()

bool keyple::core::util::bertlv::TLV::parse ( std::shared_ptr< Tag tag,
int  offset 
)

Parse the byte array to find the expected TLV.

The method returns true if the tag is found.

The analysis result is available with getValue and getPosition

Parameters
tagthe tag to search in the byte array
offsetthe position to start in the byte array
Returns
true or false according to the presence of the provided tag

Friends And Related Function Documentation

◆ operator<<

KEYPLECORE_API std::ostream& operator<< ( std::ostream &  os,
const TLV tlv 
)
friend

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