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

#include <Tag.h>

Inherits enable_shared_from_this< Tag >.

Public Types

enum  TagType { TagType::PRIMITIVE, TagType::CONSTRUCTED }
 
enum  TagClass : uint8_t { TagClass::UNIVERSAL = 0, TagClass::APPLICATION, TagClass::CONTEXT, TagClass::PRIVATE }
 

Public Member Functions

 Tag (int tagNumber, const TagClass tagClass, const TagType tagType, int tagSize)
 
 Tag (const std::vector< uint8_t > &binary, int offset)
 
int getTagNumber () const
 
TagClass getTagClass () const
 
TagType getTagType () const
 
int getTagSize () const
 
bool operator== (const Tag &o) const
 
bool operator!= (const Tag &o) const
 

Friends

KEYPLECORE_API std::ostream & operator<< (std::ostream &os, const Tag::TagClass &tc)
 
KEYPLECORE_API std::ostream & operator<< (std::ostream &os, const Tag::TagType &tt)
 
KEYPLECORE_API std::ostream & operator<< (std::ostream &os, const Tag &t)
 

Detailed Description

This class represent a TAG as defined by the Basic Encoding Rules for ASN.1
This implementation limits the tag size to 2.
(ITU-T X.690 / ISO 8825)

Member Enumeration Documentation

◆ TagClass

Enumerator
UNIVERSAL 
APPLICATION 
CONTEXT 
PRIVATE 

◆ TagType

Enumerator
PRIMITIVE 
CONSTRUCTED 

Constructor & Destructor Documentation

◆ Tag() [1/2]

keyple::core::util::bertlv::Tag::Tag ( int  tagNumber,
const TagClass  tagClass,
const TagType  tagType,
int  tagSize 
)

Creates a tag from its attributes.

Parameters
tagNumberthe tag value.
tagClassthe tag class.
tagTypeconstructed or primitive
tagSizethe tag size (1 or 2)

◆ Tag() [2/2]

keyple::core::util::bertlv::Tag::Tag ( const std::vector< uint8_t > &  binary,
int  offset 
)

Create a tag from a binary stream.

Parameters
binarythe byte array containing the TLV data
offsetthe start offset in the byte array
Exceptions
IndexOutOfBoundsExceptionif the offset is too large

Member Function Documentation

◆ getTagClass()

Tag::TagClass keyple::core::util::bertlv::Tag::getTagClass ( ) const

◆ getTagNumber()

int keyple::core::util::bertlv::Tag::getTagNumber ( ) const

◆ getTagSize()

int keyple::core::util::bertlv::Tag::getTagSize ( ) const

◆ getTagType()

Tag::TagType keyple::core::util::bertlv::Tag::getTagType ( ) const

◆ operator!=()

bool keyple::core::util::bertlv::Tag::operator!= ( const Tag o) const

◆ operator==()

bool keyple::core::util::bertlv::Tag::operator== ( const Tag o) const

Friends And Related Function Documentation

◆ operator<< [1/3]

KEYPLECORE_API std::ostream& operator<< ( std::ostream &  os,
const Tag t 
)
friend

◆ operator<< [2/3]

KEYPLECORE_API std::ostream& operator<< ( std::ostream &  os,
const Tag::TagClass tc 
)
friend

◆ operator<< [3/3]

KEYPLECORE_API std::ostream& operator<< ( std::ostream &  os,
const Tag::TagType tt 
)
friend

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