Quick Links:

bal | bbl | bdl | bsl

Public Types | Static Public Member Functions

balber::BerUtil_DateImpUtil Struct Reference

#include <balber_berutil.h>

List of all members.

Public Types

enum  { k_COMPACT_BINARY_DATE_EPOCH = 737425 }
typedef
BerUtil_DateAndTimeHeaderImpUtil 
DateAndTimeHeaderUtil
typedef BerUtil_DateEncoding DateEncoding
typedef BerUtil_DateTzEncoding DateTzEncoding
typedef
BerUtil_DateOrDateTzEncoding 
DateOrDateTzEncoding
typedef BerUtil_IntegerImpUtil IntegerUtil
typedef BerUtil_Iso8601ImpUtil Iso8601Util
typedef BerUtil_LengthImpUtil LengthUtil
typedef BerUtil_StreambufUtil StreambufUtil
typedef BerUtil_StringImpUtil StringUtil
typedef
BerUtil_TimezoneOffsetImpUtil 
TimezoneUtil
typedef bdlb::Variant2
< bdlt::Date, bdlt::DateTz
DateOrDateTz

Static Public Member Functions

static void dateToDaysSinceEpoch (bsls::Types::Int64 *daysSinceEpoch, const bdlt::Date &date)
static int daysSinceEpochToDate (bdlt::Date *date, bsls::Types::Int64 daysSinceEpoch)
static int getDateValue (bdlt::Date *date, bsl::streambuf *streamBuf, int length)
static int putDateValue (bsl::streambuf *streamBuf, const bdlt::Date &value, const BerEncoderOptions *options)
static int getDateTzValue (bdlt::DateTz *value, bsl::streambuf *streamBuf, int length)
static int putDateTzValue (bsl::streambuf *streamBuf, const bdlt::DateTz &date, const BerEncoderOptions *options)
static int getDateOrDateTzValue (DateOrDateTz *value, bsl::streambuf *streamBuf, int length)

Detailed Description

This component-private struct provides a namespace for a suite of functions used by BerUtil to implement BER encoding and decoding operations for date values. Within the definition of this struct:

the specification:
Refers to the August 2015 revision of the ITU-T Recommendation X.690, and
the default set of options:
Refers to a balber::BerEncoderOptions value having a datetimeFractionalSecondPrecision attribute of 3 and a encodeDateAndTimeTypesAsBinary attribute of false.

See the package level documentation of balber for a definition of the compact and extended binary formats for date and time values.

See Component balber_berutil

Member Typedef Documentation


Member Enumeration Documentation

anonymous enum
Enumerator:
k_COMPACT_BINARY_DATE_EPOCH 

The serial date of January 1st, 2020. Note that the serial date of a date is defined as the number of days between that date and January 1st year 1 in the Proleptic Gregorian calendar.


Member Function Documentation

static void balber::BerUtil_DateImpUtil::dateToDaysSinceEpoch ( bsls::Types::Int64 daysSinceEpoch,
const bdlt::Date date 
) [static]

Load to the specified daysSinceEpoch the number of days between the compact-binary date epoch and the specified date. The compact-binary date epoch is the date defined by the k_COMPACT_BINARY_DATE_EPOCH serial date. Note that this quantity may be negative if the specified date occurs before the compact-binary date epoch.

static int balber::BerUtil_DateImpUtil::daysSinceEpochToDate ( bdlt::Date date,
bsls::Types::Int64  daysSinceEpoch 
) [static]

Load to the specified date the date represented by the serial date indicated by adding the specified daysSinceEpoch to k_COMPACT_BINARY_DATE_EPOCH. Return 0 on success, and a non-zero value otherwise. This operation succeeds if the resulting value represents a date in the range [0001JAN01 .. 9999DEC31]. Note that daysSinceEpoch may be negative to indicate a serial date that occurs before k_COMPACT_BINARY_DATE_EPOCH.

static int balber::BerUtil_DateImpUtil::getDateValue ( bdlt::Date date,
bsl::streambuf *  streamBuf,
int  length 
) [static]

Read the specified length number of bytes from the input sequence of the specified streamBuf and load to the specified value the date value represented those bytes. Return 0 on success, and a non-zero value otherwise. The operation succeeds if length bytes are successfully read from the input sequence of the streamBuf without the read position becoming unavailable, and the bytes contain a valid representation of a date value. See the package-level documentation of balber for a description of the decision procedure used to detect the encoding format for a bdlt::Date value.

static int balber::BerUtil_DateImpUtil::putDateValue ( bsl::streambuf *  streamBuf,
const bdlt::Date value,
const BerEncoderOptions options 
) [static]

Write a representation of the specified value date to the output sequence of the specified streamBuf according to the specified options. If options is 0, the default set of options is used. Return 0 on success, and a non-zero value otherwise. This operation succeeds if all bytes in the representation of the value are written to the output sequence of the streamBuf without the write position becoming unavailable. See the class documentation for a description of the default options. See the package-level documentation of balber for a description of the decision procedure used to select an encoding format for the value.

static int balber::BerUtil_DateImpUtil::getDateTzValue ( bdlt::DateTz value,
bsl::streambuf *  streamBuf,
int  length 
) [static]

Read the specified length number of bytes from the input sequence of the specified streamBuf and load to the specified value the date and time zone value represented by those bytes. Return 0 on success, and a non-zero value otherwise. The operation succeeds if length bytes are successfully read from the input sequence of the streamBuf without the read position becoming unavailable, and the bytes contain a valid representation of a date and time zone value. See the package-level documentation of balber for a description of the decision procedure used to detect the encoding format for a bdlt::DateTz value.

static int balber::BerUtil_DateImpUtil::putDateTzValue ( bsl::streambuf *  streamBuf,
const bdlt::DateTz date,
const BerEncoderOptions options 
) [static]

Write a representation of the specified value date and time zone to the output sequence of the specified streamBuf according to the specified options. If options is 0, the default set of options is used. Return 0 on success, and a non-zero value otherwise. This operation succeeds if all bytes in the representation of the value are written to the output sequence of the streamBuf without the write position becoming unavailable. See the class documentation for a description of the default options. See the package-level documentation of balber for a description of the decision procedure used to select an encoding format for the value.

static int balber::BerUtil_DateImpUtil::getDateOrDateTzValue ( DateOrDateTz value,
bsl::streambuf *  streamBuf,
int  length 
) [static]

Read the specified length number of bytes from the input sequence of the specified streamBuf and load to the specified value the date and optional time zone value represented by those bytes. Return 0 on success, and a non-zero value otherwise. The operation succeeds if length bytes are successfully read from the input sequence of the streamBuf without the read position becoming unavailable, and the bytes contain a valid representation of a date and optional time zone value. See the package-level documentation of balber for a description of the decision procedure used to detect the encoding format for a DateOrDateTz value.


The documentation for this struct was generated from the following file: