BDE 4.14.0 Production release
Loading...
Searching...
No Matches
balber_beruniversaltagnumber

Detailed Description

Outline

Purpose

Enumerate the set of BER universal tag numbers.

Classes

See also
balber_berencoder, balber_berdecoder

Description

This component provides a namespace for the enum type balber::BerUniversalTagNumber::Value. Value enumerates the set of BER universal tag numbers used by the BER encoder and decoder. The universal tag numbers are defined in the X.680 standard, in section 8 (See http://www.itu.int/ITU-T/studygroups/com17/languages/X.680-0207.pdf).

In addition, this component supports functions that convert the Value enumerations to a well-defined ASCII representation.

This component also provides a function that returns the universal tag number for an object with formatting mode, according to the following table:

C++ Type Formatting Mode Universal Tag Number
-------- --------------- --------------------
bool DEFAULT e_BER_BOOL
DEC e_BER_BOOL
TEXT e_BER_BOOL
char DEFAULT e_BER_INT
DEC e_BER_INT
TEXT e_BER_UTF8_STRING
unsigned char DEFAULT e_BER_INT
DEC e_BER_INT
[unsigned] short DEFAULT e_BER_INT
DEC e_BER_INT
[unsigned] int DEFAULT e_BER_INT
DEC e_BER_INT
[unsigned] long DEFAULT e_BER_INT
DEC e_BER_INT
bsls::Types::[Uint64|Int64] DEFAULT e_BER_INT
DEC e_BER_INT
float DEFAULT e_BER_REAL
double DEFAULT e_BER_REAL
bdldfp::Decimal64 DEFAULT e_BER_OCTET_STRING
bsl::string[_view] DEFAULT e_BER_UTF8_STRING
TEXT e_BER_UTF8_STRING
BASE64 e_BER_OCTET_STRING
HEX e_BER_OCTET_STRING
bslstl::StringRef DEFAULT e_BER_UTF8_STRING
TEXT e_BER_UTF8_STRING
BASE64 e_BER_OCTET_STRING
HEX e_BER_OCTET_STRING
bdlt::Date DEFAULT e_BER_VISIBLE_STRING
bdlt::DateTz DEFAULT e_BER_VISIBLE_STRING
bdlt::Datetime DEFAULT e_BER_VISIBLE_STRING
bdlt::DateTimeTz DEFAULT e_BER_VISIBLE_STRING
bdlt::Time DEFAULT e_BER_VISIBLE_STRING
bdlt::TimeTz DEFAULT e_BER_VISIBLE_STRING
bsl::vector<char> DEFAULT e_BER_OCTET_STRING
BASE64 e_BER_OCTET_STRING
HEX e_BER_OCTET_STRING
TEXT e_BER_UTF8_STRING
Definition bdldfp_decimal.h:1834
Definition bdlt_datetz.h:162
Definition bdlt_date.h:294
Definition bdlt_datetime.h:331
Definition bdlt_timetz.h:190
Definition bdlt_time.h:196
Definition bslstl_string.h:1281
Definition bslstl_vector.h:1025
Definition bslstl_stringref.h:372
Definition bsls_types.h:118

If the object is not one of these types, then the universal tag number is selected based on the object's type category, as follows:

Category Universal Tag Number
-------- --------------------
CustomizedType Use universal tag number of the base type.
Enumeration 'e_BER_ENUMERATION' when formatting mode is either
'DEFAULT', 'DEC', or 'TEXT'.
Sequence 'e_BER_SEQUENCE' when formatting mode is 'DEFAULT'.
Choice 'e_BER_SEQUENCE' when formatting mode is 'DEFAULT'.
Array 'e_BER_SEQUENCE' when formatting mode is 'DEFAULT'.

The behavior is undefined if the object does not fall into one the above categories or formatting modes.

Usage

This section illustrates intended use of this component.

Example 1: Basic Syntax

The following snippets of code provide a simple illustration of balber::BerUniversalTagNumber operation.

First, create a variable tagNumber of type balber::BerUniversalTagNumber::Value and initialize it to the value balber::BerUniversalTagNumber::e_BER_INT:

Value
Definition balber_beruniversaltagnumber.h:194
@ e_BER_INT
Definition balber_beruniversaltagnumber.h:200

Next, store its representation in a variable rep of type const char *:

const char *rep = balber::BerUniversalTagNumber::toString(tagNumber);
assert(0 == strcmp(rep, "INT"));
static const char * toString(Value value)

Finally, print the value of tagNumber to bsl::cout:

bsl::cout << tagNumber << bsl::endl;

This statement produces the following output on bsl::cout:

INT