TOP

OssBit

The OssBit class represents an individual bit in an ASN.1 BIT STRING value. This class is used together with the OssBitString class. This class has no public constructors other than the copy constructor, so it can be produced only by the call of the indexing operator of the OssBitString class.

Definition

class OssBit
{
    OssBit(const OssBit &);
    ~OssBit();
    operator int() const;
    OssBit & operator = (int);
};

Methods

operator int() const;
This is a conversion operator. It returns 1 if the corresponding bit in the BIT STRING is set, and 0 if it is not set.
OssBit & operator = (int);
The assignment operator clears the corresponding bit in the BIT STRING if the parameter is 0, and sets the bit if the parameter is not 0.

XML Time and Date Classes

An XML schema may be converted to ASN.1 using the XSD to ASN.1 mapping described in the ITU-T Recommendation X.694. The resulting ASN.1 specification may be processed by the OSS ASN.1 Tools for C++. However, according to this recommendation, the XML Schema time and date types (such as xsd:time, xsd:date, xsd:duration, etc.) are mapped to a simple VisibleString with a user-defined constraint. So the OSS ASN.1 Tools for C++ represents it with the universal OssString class. The user is likely to want to access individual components of XML time/date values, such as, year, month, day, hours, minutes, etc. in the numeric form. However, the OssString class is a general string-like type and does not contain any functions that may facilitate such access.

The OSS ASN.1 Tools for C++ contains special utility classes that may be used to extract and replace individual time/date components from a character string containing a textual value of some of XML Schema time/date types. These utility classes act as containers comprising both the textual representation and the numeric representation (a set of numeric components). The user may set the value in either form – numeric or textual (the latter may be useful, e.g., if the user wants to present the value with a specific formatting). Conversion from one representation to the other is automatic. If the user tries to access any of the numeric components, and the numeric representation is not available, it is created from the textual one. If the user asks for the value in the textual form, and the textual form is not available, it is created from the numeric components. The methods preserve the consistency between the stored representations, e.g., if the user changes any of the numeric components, the textual representation is invalidated and will be recreated from the components if needed.

Components in Each XML Time/Date Class

  • Default constructor
  • Copy constructor
  • Destructor
  • Assignment operator
  • String initializing constructor that takes a textual representation (a null-terminated C string) as a parameter
  • Numeric initializing constructor that takes several numeric parameters
  • String conversion operator that returns the textual representation of the value (a null-terminated C string)
  • String assignment operator that sets the textual representation of the value (a null-terminated C string is specified as the assignment source)
  • Set of accessors to access individual numeric components
  • Set of mutators to change individual numeric components

The string initializing constructor and the string assignment operator do not require the source string to be a correct value of the corresponding XSD type. Any string that does not contain a null character can be assigned to an XML time/date object. However, if you try to access any numeric component of the invalid string, you will get a BAD_TIME error from the ASN.1/C++ error signaling mechanism; see Error Handling. Analogously, the numeric constructor and the mutators do not check the correctness of the value, but the error will be signaled as an attempt to convert the value to the textual representation.

Note that XML date/time classes are not representation classes and cannot be used as the encoder's input. They are intended for intermediate manipulations only. To encode the value of an object, the user should first extract it in the textual form and insert it in an object of a representation class.


OssXMLDate

This class represents the XML Schema xsd:date type. It contains four numeric components: year, month (1..12), day (1..31), and timezone value (signed difference between the local time and the UTC time in minutes). There are also two special values for local time difference - OSS_UTC_DIFF_Z means UTC time (so the textual representation will have the 'Z' suffix) and OSS_UTC_DIFF_ABSENT means local time without the timezone specification (the textual representation will have no suffix).

Definition

class OssXMLDate
{
    OssXMLDate();
    OssXMLDate(const OssXMLDate &);
    OssXMLDate & operator = (const OssXMLDate &);
    ~OssXMLDate();
    OssXMLDate(const char *xmlString);
    OssXMLDate(int yearval, unsigned monthval, unsigned dayval, int local_utc_mindiffval = 0);
    operator const char *();
    OssXMLDate & operator = (const char *xmlString);
    int get_year();
    unsigned get_month();
    unsigned get_day();
    int get_local_utc_mindiff();
    int get_components(int &yearval, unsigned &monthval, unsigned &dayval, int &local_utc_mindiffval);
    int set_year(int yearval);
    int set_month(unsigned monthval);
    int set_day(unsigned dayval);
    int set_local_utc_mindiff(int local_utc_mindiffval);
    int set_components(int yearval, unsigned monthval, unsigned dayval, int local_utc_mindiffval = 0);
};

Methods

OssXMLDate(const char *xmlString);
This is a string initialization constructor. The parameter is a null-terminated C string that is copied to the object as its textual representation. The source string is not checked for correctness. It may be any string.
OssXMLDate(int yearval, unsigned monthval, unsigned dayval, int local_utc_mindiffval = 0);
This is a numeric initialization constructor. The parameters represent the numeric components of the date value: yearval – year, monthval – month, dayval – day, mindiffval – the timezone value.
operator const char *();
This is the conversion operator. It returns the value in the textual form. The returned value is a pointer to the textual component of the object. If the textual representation is currently invalid, the operator reconstructs it from the numeric components. If the numeric components do not represent a correct xsd:date value, the conversion routine calls the error handling function with the BAD_TIME error code. If the error handling function does not throw a C++ exception, the operator then returns NULL.
OssXMLDate & operator = (const char *xmlString);
This is a string assignment operator. The parameter is a null-terminated C string that is copied to the object as its textual representation. The numeric representation is invalidated. The source string is not checked for correctness. It may be any string.
int get_year();
unsigned get_month();
unsigned get_day();
int get_local_utc_mindiff();
These are the accessor functions. Each of them returns the value of the correspondent component of the xsd:date value. If the numeric representation is currently invalid, the function reconstructs it from the textual representation. If the textual representation is not a correct xsd:date value, the conversion routine calls the error handling function with the BAD_TIME error code. If the error handling function does not throw a C++ exception, the accessor returns 0. NOTE: You cannot determine whether the function was successful by the return code. If you are unsure of your result, we recommend using the default "full-exception" error handling mode. As an alternative, check the last error value after the call using the legacy "no-exception" error handling mode.
int get_components(int & yearval, unsigned & monthval, unsigned & dayval, int local_utc_& mindiffval);
This is an accessor function that allows access to all of the numeric components of the value at once. If the function succeeds, the function returns 0 and the parameters are assigned new values equal to the value's components. If the numeric representation is currently invalid, the function reconstructs it from the textual representation. If the textual representation is not a correct xsd:date value, the function returns BAD_TIME and the parameters retain their original values. In the default "full-exception" error handling mode, error conditions cause C++ exceptions to be thrown instead, so the function always returns 0.
int set_year(int yearval);
int set_month(unsigned monthval);
int set_day(unsigned dayval);
int set_local_utc_mindiff(int local_utc_mindiffval);
These are the mutator functions. Each of them changes the value of the correspondent component of the xsd:date value. The stored textual representation is invalidated. In case of success, the function returns 0. If the numeric representation is currently invalid, the function reconstructs it from the textual representation prior to making the change. If the textual representation is not a correct xsd:date value, the function returns the BAD_TIME error code. In the default "full-exception" error handling mode, error conditions cause C++ exceptions to be thrown instead, so the function always returns 0.
int set_components(int yearval, unsigned monthval, unsigned dayval, int local_utc_mindiffval = 0);
This is a mutator function that changes all of the numeric components of the value at once. The numeric components are assigned new values equal to the parameter values. The stored textual representation is invalidated. This function always returns 0 (success).

OssXMLDateTime

This class represents the XML Schema xsd:dateTime type. It contains eight numeric components: year, month (1..12), day (1..31), hours (0..23), minutes (0..59), seconds (0..59), fraction of seconds (a textual string; see below), and timezone value (signed difference between the local time and the UTC time in minutes). There are also two special values for local time difference - OSS_UTC_DIFF_Z means UTC time (so the textual representation will have the 'Z' suffix) and OSS_UTC_DIFF_ABSENT means local time without the timezone specification (the textual representation will have no suffix).

Definition

class OssXMLDateTime
{
    OssXMLDateTime();
    OssXMLDateTime(const OssXMLDateTime &);
    OssXMLDateTime & operator = (const OssXMLDateTime &);
    ~OssXMLDateTime();
    OssXMLDateTime(const char *xmlString);
    OssXMLDateTime(int yearval, unsigned monthval, unsigned dayval,
            unsigned hoursval = 0, unsigned minutesval = 0,
            unsigned secondsval = 0,
            const char *fractionval = NULL, unsigned precisionval = 0,
            int local_utc_mindiffval = 0);
    operator const char *();
    OssXMLDateTime & operator = (const char *xmlString);
    int get_year();
    unsigned get_month();
    unsigned get_day();
    unsigned get_hours();
    unsigned get_minutes();
    unsigned get_seconds();
    const char *get_fraction(unsigned &precisionval);
    int get_local_utc_mindiff();
    int get_components(int &yearval, unsigned &monthval, unsigned &dayval,
            unsigned &hoursval, unsigned &minutesval, unsigned &secondsval,
            const char *&fractionval, unsigned &precisionval,
            int &local_utc_mindiffval);
    int set_year(int yearval);
    int set_month(unsigned monthval);
    int set_day(unsigned dayval);
    int set_hours(unsigned hoursval);
    int set_minutes(unsigned minutesval);
    int set_seconds(unsigned secondsval);
    int set_fraction(const char *fractionval, unsigned precisionval = 0);
    int set_local_utc_mindiff(int local_utc_mindiffval);
    int set_components(int yearval, unsigned int monthval, unsigned int dayval,
            unsigned hoursval = 0, unsigned minutesval = 0,
            unsigned secondsval = 0,
            const char *fractionval = NULL, unsigned precisionval = 0,
            int local_utc_mindiffval = 0);
};

Methods

OssXMLDateTime(const char *xmlString);
This is a string initialization constructor. The parameter is a null-terminated C string that is copied to the object as its textual representation. The source string is not checked for correctness. It may be any string.
OssXMLDateTime(int yearval, unsigned monthval, unsigned dayval, unsigned hoursval = 0, unsigned minutesval = 0, unsigned secondsval = 0, const char *fractionval = NULL, unsigned precisionval = 0, int local_utc_mindiffval = 0);
This is a numeric initialization constructor. The parameters represent the numeric components of the date value: yearval – year, monthval – month, dayval – day, hoursval – hours, minutesval – minutes, secondsval – seconds, mindiffval – the timezone value. The fractional part is specified in a textual form. The fractionval parameter is a pointer to a character string containing the fraction of seconds as a decimal fraction; the precisionval parameter contains the length of the string. Therefore, the string need not be null-terminated. E.g., to specify a three-fourths of a second you may specify fractionval as "75" and precisionval as 2.
operator const char *();
This is the conversion operator. It returns the value in the textual form. The returned value is a pointer to the textual component of the object. If the textual representation is currently invalid, the operator reconstructs it from the numeric components. If the numeric components do not represent a correct xsd:dateTime value, the conversion routine calls the error handling function with the BAD_TIME error code. If the error handling function does not throw a C++ exception, the operator then returns NULL.
OssXMLDateTime & operator = (const char *xmlString);
This is a string assignment operator. The parameter is a null-terminated C string that is copied to the object as its textual representation. The numeric representation is invalidated. The source string is not checked for correctness. It may be any string.
int get_year();
unsigned get_month();
unsigned get_day();
unsigned get_hours();
unsigned get_minutes();
unsigned get_seconds();
int get_local_utc_mindiff();
These are the accessor functions. Each of them returns the value of the correspondent component of the xsd:dateTime value. If the numeric representation is currently invalid, the function reconstructs it from the textual representation. If the textual representation is not a correct xsd:dateTime value, the conversion routine calls the error handling function with the BAD_TIME error code. If the error handling function does not throw a C++ exception, the accessor returns 0. NOTE: You cannot determine whether the function was successful by the return code. If you are unsure of your result, we recommend using the default "full-exception" error handling mode. As an alternative, check the last error value after the call using the legacy "no-exception" error handling mode.
const char *get_fraction(unsigned & precisionval);
This is the accessor function for the fraction component. It acts just like any other accessor method of the XMLDateTime class but returns a pointer to a constant character string representing the fractional part. This string is not null-terminated; its size is determined by the value stored in the parameter variable.
int get_components(int & yearval, unsigned & monthval, unsigned & dayval, unsigned & hoursval, unsigned & minutesval, unsigned & secondsval, const char * & fractionval, unsigned & precisionval, int & local_utc_mindiffval);
This is an accessor function that allows access to all of the numeric components of the value at once. If the function succeeds, the function returns 0 and the parameters are assigned new values equal to the value's components. If the numeric representation is currently invalid, the function reconstructs it from the textual representation. If the textual representation is not a correct xsd:dateTime value, the function returns BAD_TIME and the parameters retain their original values. In the default "full-exception" error handling mode, error conditions cause C++ exceptions to be thrown instead, so the function always returns 0.
int set_year(int yearval);
int set_month(unsigned monthval);
int set_day(unsigned dayval);
int set_hours(unsigned hoursval);
int set_minutes(unsigned minutesval);
int set_seconds(unsigned secondsval);
int set_local_utc_mindiff(int local_utc_mindiffval);
These are the mutator functions. Each of them changes the value of the correspondent component of the xsd:dateTime value. The stored textual representation is invalidated. In case of success, the function returns 0. If the numeric representation is currently invalid, the function reconstructs it from the textual representation prior to making the change. If the textual representation is not a correct xsd:dateTime value, the function returns the BAD_TIME error code. In the default "full-exception" error handling mode, error conditions cause C++ exceptions to be thrown instead, so the function always returns 0.
int set_fraction(const char *fractionval, unsigned precisionval = 0);
This is the mutator function for the fraction component. It acts just like any other mutator method of the XMLDateTime class but takes two parameters to specify the fraction component in the textual form, just as described for the numeric initialization constructor.
int set_components(int yearval, unsigned monthval, unsigned dayval, unsigned hoursval = 0, unsigned minutesval = 0, unsigned secondsval = 0, const char * fractionval = NULL, unsigned precisionval = 0, int local_utc_mindiffval = 0);
This is a mutator function that changes all of the numeric components of the value at once. The numeric components are assigned new values equal to the parameter values. The stored textual representation is invalidated. This function always returns 0 (success).

OssXMLDuration

This class represents the XML Schema xsd:duration type. It contains eight numeric components: years, months, days, hours, minutes, seconds, fraction of seconds (a textual string; see below), and negativeness (a boolean value – TRUE if the whole duration value is negative and FALSE if it is positive; all the other components represent the absolute value of the duration).

Definition

class OssXMLDuration
{
    OssXMLDuration();
    OssXMLDuration(const OssXMLDuration &);
    OssXMLDuration & operator = (const OssXMLDuration &);
    ~OssXMLDuration();
    OssXMLDuration(const char *xmlString);
    OssXMLDuration(int negative, unsigned yearsval, unsigned monthsval = 0,
            unsigned daysval = 0, unsigned hoursval = 0,
            unsigned minutesval = 0, unsigned secondsval = 0,
            const char *fractionval = NULL, unsigned precisionval = 0);
    operator const char *();
    OssXMLDuration & operator = (const char *xmlString);
    int get_negative();
    unsigned get_years();
    unsigned get_months();
    unsigned get_days();
    unsigned get_hours();
    unsigned get_minutes();
    unsigned get_seconds();
    const char *get_fraction(unsigned &precisionval);
    int get_components(int &negative, unsigned &yearsval,
            unsigned &monthsval, unsigned &daysval,
            unsigned &hoursval, unsigned &minutesval,
            unsigned &secondsval,
            const char *&fractionval, unsigned &precisionval);
    int set_negative(int negative);
    int set_years(unsigned yearsval);
    int set_months(unsigned monthsval);
    int set_days(unsigned daysval);
    int set_hours(unsigned hoursval);
    int set_minutes(unsigned minutesval);
    int set_seconds(unsigned secondsval);
    int set_fraction(const char *fractionval, unsigned precisionval = 0);
    int set_components(int negative, unsigned yearsval,
            unsigned monthsval = 0,
            unsigned daysval = 0, unsigned hoursval = 0,
            unsigned minutesval = 0, unsigned secondsval = 0,
            const char *fractionval = NULL, unsigned precisionval = 0);
};

Methods

OssXMLDuration(const char *xmlString);
This is a string initialization constructor. The parameter is a null-terminated C string that is copied to the object as its textual representation. The source string is not checked for correctness. It may be any string.
OssXMLDuration(int negative, unsigned yearsval, unsigned monthsval = 0, unsigned hoursval = 0, unsigned minutesval = 0, unsigned secondsval = 0, const char *fractionval = NULL, unsigned precisionval = 0);
This is a numeric initialization constructor. The parameters represent the numeric components of the date value: yearval – years, monthval – months, dayval – days, hoursval – hours, minutesval – minutes, secondsval – seconds. The negative parameter means that the whole duration value is negative if it is not 0. The fractional part is specified in a textual form. The fractionval parameter is a pointer to a character string containing the fraction of seconds as a decimal fraction; the precisionval parameter contains the length of the string. Therefore, the string need not be null-terminated. E.g., to specify a three-fourths of a second you may specify fractionval as "75" and precisionval as 2.
operator const char *();
This is the conversion operator. It returns the value in the textual form. The returned value is a pointer to the textual component of the object. If the textual representation is currently invalid, the operator reconstructs it from the numeric components. If the numeric components do not represent a correct xsd:duration value, the conversion routine calls the error handling function with the BAD_TIME error code. If the error handling function does not throw a C++ exception, the operator then returns NULL.
OssXMLDuration & operator = (const char *xmlString);
This is a string assignment operator. The parameter is a null-terminated C string that is copied to the object as its textual representation. The numeric representation is invalidated. The source string is not checked for correctness. It may be any string.
unsigned get_years();
unsigned get_months();
unsigned get_days();
unsigned get_hours();
unsigned get_minutes();
unsigned get_seconds();
These are the accessor functions. Each of them returns the value of the correspondent component of the xsd:duration value. If the numeric representation is currently invalid, the function reconstructs it from the textual representation. If the textual representation is not a correct xsd:duration value, the conversion routine calls the error handling function with the BAD_TIME error code. If the error handling function does not throw a C++ exception, the accessor returns 0. NOTE: You cannot determine whether the function was successful by the return code. If you are unsure of your result, we recommend using the default "full-exception" error handling mode. As an alternative, check the last error value after the call using the legacy "no-exception" error handling mode.
const char *get_fraction(unsigned & precisionval);
This is the accessor function for the fraction component. It acts just like any other accessor method of the XMLDuration class but returns a pointer to a constant character string representing the fractional part. This string is not null-terminated; its size is determined by the value stored in the parameter variable.
int get_negative();
This is the accessor function for the negativeness component. It acts just like any other accessor method of the XMLDuration class but returns 1 if the total duration value is negative and 0 otherwise.
int get_components(int & negative, unsigned & yearsval, unsigned & monthsval, unsigned & daysval, unsigned & hoursval, unsigned & minutesval, unsigned & secondsval, const char * & fractionval, unsigned & precisionval;
This is an accessor function that allows access to all of the numeric components of the value at once. If the function succeeds, the function returns 0 and the parameters are assigned new values equal to the value's components. If the numeric representation is currently invalid, the function reconstructs it from the textual representation. If the textual representation is not a correct xsd:duration value, the function returns BAD_TIME and the parameters retain their original values. In the default "full-exception" error handling mode, error conditions cause C++ exceptions to be thrown instead, so the function always returns 0.
int set_negative(int negative);
int set_years(unsigned yearsval);
int set_months(unsigned monthsval);
int set_days(unsigned daysval);
int set_hours(unsigned hoursval);
int set_minutes(unsigned minutesval);
int set_seconds(unsigned secondsval);
These are the mutator functions. Each of them changes the value of the correspondent component of the xsd:duration value. The stored textual representation is invalidated. In case of success, the function returns 0. If the numeric representation is currently invalid, the function reconstructs it from the textual representation prior to making the change. If the textual representation is not a correct xsd:duration value, the function returns the BAD_TIME error code. In the default "full-exception" error handling mode, error conditions cause C++ exceptions to be thrown instead, so the function always returns 0.
int set_fraction(const char *fractionval, unsigned precisionval = 0);
This is the mutator function for the fraction component. It acts just like any other mutator method of the XMLDuration class but takes two parameters to specify the fraction component in the textual form, just as described for the numeric initialization constructor.
int set_components(int negative, unsigned yearsval, unsigned monthsval = 0, unsigned dayval = 0, unsigned hoursval = 0, unsigned minutesval = 0, unsigned secondsval = 0, const char * fractionval = NULL, unsigned precisionval = 0);
This is a mutator function that changes all of the numeric components of the value at once. The numeric components are assigned new values equal to the parameter values. The stored textual representation is invalidated. This function always returns 0 (success).

OssXMLGDay

This class represents the XML Schema xsd:gDay type. It contains two numeric components: day (1..31) and a timezone value (signed difference between the local time and the UTC time in minutes). There are also two special values for local time difference - OSS_UTC_DIFF_Z means UTC time (so the textual representation will have the 'Z' suffix) and OSS_UTC_DIFF_ABSENT means local time without the timezone specification (the textual representation will have no suffix).

Definition

class OssXMLGDay
{
    OssXMLGDay();
    OssXMLGDay(const OssXMLGDay &);
    OssXMLGDay & operator = (const OssXMLGDay &);
    ~OssXMLGDay();
    OssXMLGDay(const char *xmlString);
    OssXMLGDay(unsigned dayval, int local_utc_mindiffval = 0);
    operator const char *();
    OssXMLGDay & operator = (const char *xmlString);
    unsigned get_day();
    int get_local_utc_mindiff();
    int get_components(unsigned &dayval, int &local_utc_mindiffval);
    int set_day(unsigned dayval);
    int set_local_utc_mindiff(int local_utc_mindiffval);
    int set_components(unsigned dayval, int local_utc_mindiffval = 0);
};

Methods

OssXMLGDay(const char *xmlString);
This is a string initialization constructor. The parameter is a null-terminated C string that is copied to the object as its textual representation. The source string is not checked for correctness. It may be any string.
OssXMLGDay(unsigned dayval, int local_utc_mindiffval = 0);
This is a numeric initialization constructor. The parameters represent the numeric components of the date value: dayval – day, mindiffval – the timezone value.
operator const char *();
This is the conversion operator. It returns the value in the textual form. The returned value is a pointer to the textual component of the object. If the textual representation is currently invalid, the operator reconstructs it from the numeric components. If the numeric components do not represent a correct xsd:gDay value, the conversion routine calls the error handling function with the BAD_TIME error code. If the error handling function does not throw a C++ exception, the operator then returns NULL.
OssXMLGDay & operator = (const char *xmlString);
This is a string assignment operator. The parameter is a null-terminated C string that is copied to the object as its textual representation. The numeric representation is invalidated. The source string is not checked for correctness. It may be any string.
unsigned get_day();
int get_local_utc_mindiff();
These are the accessor functions. Each of them returns the value of the correspondent component of the xsd:gDay value. If the numeric representation is currently invalid, the function reconstructs it from the textual representation. If the textual representation is not a correct xsd:gDay value, the conversion routine calls the error handling function with the BAD_TIME error code. If the error handling function does not throw a C++ exception, the accessor returns 0. NOTE: You cannot determine whether the function was successful by the return code. If you are unsure of your result, we recommend using the default "full-exception" error handling mode. As an alternative, check the last error value after the call using the legacy "no-exception" error handling mode.
int get_components(unsigned & dayval, int local_utc_& mindiffval);
This is an accessor function that allows access to all of the numeric components of the value at once. If the function succeeds, the function returns 0 and the parameters are assigned new values equal to the value's components. If the numeric representation is currently invalid, the function reconstructs it from the textual representation. If the textual representation is not a correct xsd:gDay value, the function returns BAD_TIME and the parameters retain their original values. In the default "full-exception" error handling mode, error conditions cause C++ exceptions to be thrown instead, so the function always returns 0.
int set_day(unsigned dayval);
int set_local_utc_mindiff(int local_utc_mindiffval);
These are the mutator functions. Each of them changes the value of the correspondent component of the xsd:gDay value. The stored textual representation is invalidated. In case of success, the function returns 0. If the numeric representation is currently invalid, the function reconstructs it from the textual representation prior to making the change. If the textual representation is not a correct xsd:gDay value, the function returns the BAD_TIME error code. In the default "full-exception" error handling mode, error conditions cause C++ exceptions to be thrown instead, so the function always returns 0.
int set_components(unsigned dayval, int local_utc_mindiffval = 0);
This is a mutator function that changes all of the numeric components of the value at once. The numeric components are assigned new values equal to the parameter values. The stored textual representation is invalidated. This function always returns 0 (success).

OssXMLGMonthDay

This class represents the XML Schema xsd:gMonthDay type. It contains three numeric components: month (1..12), day (1..31), and timezone value (signed difference between the local time and the UTC time in minutes). There are also two special values for local time difference - OSS_UTC_DIFF_Z means UTC time (so the textual representation will have the 'Z' suffix) and OSS_UTC_DIFF_ABSENT means local time without the timezone specification (the textual representation will have no suffix).

Definition

class OssXMLGMonthDay
{
    OssXMLGMonthDay();
    OssXMLGMonthDay(const OssXMLGMonthDay &);
    OssXMLGMonthDay & operator = (const OssXMLGMonthDay &);
    ~OssXMLGMonthDay();
    OssXMLGMonthDay(const char *xmlString);
    OssXMLGMonthDay(unsigned monthval, unsigned dayval, int local_utc_mindiffval = 0);
    operator const char *();
    OssXMLGMonthDay & operator = (const char *xmlString);
    unsigned get_month();
    unsigned get_day();
    int get_local_utc_mindiff();
    int get_components(unsigned &monthval, unsigned &dayval, int &local_utc_mindiffval);
    int set_month(unsigned monthval);
    int set_day(unsigned dayval);
    int set_local_utc_mindiff(int local_utc_mindiffval);
    int set_components(unsigned monthval, unsigned dayval, int local_utc_mindiffval = 0);
};

Methods

OssXMLGMonthDay(const char *xmlString);
This is a string initialization constructor. The parameter is a null-terminated C string that is copied to the object as its textual representation. The source string is not checked for correctness. It may be any string.
OssXMLGmonthDay(unsigned monthval, unsigned dayval, int local_utc_mindiffval = 0);
This is a numeric initialization constructor. The parameters represent the numeric components of the date value: monthval – month, dayval – day, mindiffval – the timezone value.
operator const char *();
This is the conversion operator. It returns the value in the textual form. The returned value is a pointer to the textual component of the object. If the textual representation is currently invalid, the operator reconstructs it from the numeric components. If the numeric components do not represent a correct xsd:gMonthDay value, the conversion routine calls the error handling function with the BAD_TIME error code. If the error handling function does not throw a C++ exception, the operator then returns NULL.
OssXMLGMonthDay & operator = (const char *xmlString);
This is a string assignment operator. The parameter is a null-terminated C string that is copied to the object as its textual representation. The numeric representation is invalidated. The source string is not checked for correctness. It may be any string.
unsigned get_month();
unsigned get_day();
int get_local_utc_mindiff();
These are the accessor functions. Each of them returns the value of the correspondent component of the xsd:gMonthDay value. If the numeric representation is currently invalid, the function reconstructs it from the textual representation. If the textual representation is not a correct xsd:gMonthDay value, the conversion routine calls the error handling function with the BAD_TIME error code. If the error handling function does not throw a C++ exception, the accessor returns 0. NOTE: You cannot determine whether the function was successful by the return code. If you are unsure of your result, we recommend using the default "full-exception" error handling mode. As an alternative, check the last error value after the call using the legacy "no-exception" error handling mode.
int get_components(unsigned & monthval, unsigned & dayval, int local_utc_& mindiffval);
This is an accessor function that allows access to all of the numeric components of the value at once. If the function succeeds, the function returns 0 and the parameters are assigned new values equal to the value's components. If the numeric representation is currently invalid, the function reconstructs it from the textual representation. If the textual representation is not a correct xsd:gMonthDay value, the function returns BAD_TIME and the parameters retain their original values. In the default "full-exception" error handling mode, error conditions cause C++ exceptions to be thrown instead, so the function always returns 0.
int set_month(unsigned monthval);
int set_day(unsigned dayval);
int set_local_utc_mindiff(int local_utc_mindiffval);
These are the mutator functions. Each of them changes the value of the correspondent component of the xsd:gMonthDay value. The stored textual representation is invalidated. In case of success, the function returns 0. If the numeric representation is currently invalid, the function reconstructs it from the textual representation prior to making the change. If the textual representation is not a correct xsd:gMonthDay value, the function returns the BAD_TIME error code. In the default "full-exception" error handling mode, error conditions cause C++ exceptions to be thrown instead, so the function always returns 0.
int set_components(unsigned monthval, unsigned dayval, int local_utc_mindiffval = 0);
This is a mutator function that changes all of the numeric components of the value at once. The numeric components are assigned new values equal to the parameter values. The stored textual representation is invalidated. This function always returns 0 (success).

OssXMLGMonth

This class represents the XML Schema xsd:gMonth type. It contains two numeric components: month (1..12) and a timezone value (signed difference between the local time and the UTC time in minutes). There are also two special values for local time difference - OSS_UTC_DIFF_Z means UTC time (so the textual representation will have the 'Z' suffix) and OSS_UTC_DIFF_ABSENT means local time without the timezone specification (the textual representation will have no suffix).

Definition

class OssXMLGMonthDay
{
    OssXMLGMonth();
    OssXMLGMonth(const OssXMLGMonth &);
    OssXMLGMonth & operator = (const OssXMLGMonth &);
    ~OssXMLGMonth();
    OssXMLGMonth(const char *xmlString);
    OssXMLGMonth(unsigned monthval, int local_utc_mindiffval = 0);
    operator const char *();
    OssXMLGMonth & operator = (const char *xmlString);
    unsigned get_month();
    int get_local_utc_mindiff();
    int get_components(unsigned &monthval, int &local_utc_mindiffval);
    int set_month(unsigned monthval);
    int set_local_utc_mindiff(int local_utc_mindiffval);
    int set_components(unsigned monthval, int local_utc_mindiffval = 0);
};

Methods

OssXMLGMonth(const char *xmlString);
This is a string initialization constructor. The parameter is a null-terminated C string that is copied to the object as its textual representation. The source string is not checked for correctness. It may be any string.
OssXMLGmonth(unsigned monthval, int local_utc_mindiffval = 0);
This is a numeric initialization constructor. The parameters represent the numeric components of the date value: monthval – month, mindiffval – the timezone value.
operator const char *();
This is the conversion operator. It returns the value in the textual form. The returned value is a pointer to the textual component of the object. If the textual representation is currently invalid, the operator reconstructs it from the numeric components. If the numeric components do not represent a correct xsd:gMonth value, the conversion routine calls the error handling function with the BAD_TIME error code. If the error handling function does not throw a C++ exception, the operator then returns NULL.
OssXMLGMonth & operator = (const char *xmlString);
This is a string assignment operator. The parameter is a null-terminated C string that is copied to the object as its textual representation. The numeric representation is invalidated. The source string is not checked for correctness. It may be any string.
unsigned get_month();
int get_local_utc_mindiff();
These are the accessor functions. Each of them returns the value of the correspondent component of the xsd:gMonth value. If the numeric representation is currently invalid, the function reconstructs it from the textual representation. If the textual representation is not a correct xsd:gMonth value, the conversion routine calls the error handling function with the BAD_TIME error code. If the error handling function does not throw a C++ exception, the accessor returns 0. NOTE: You cannot determine whether the function was successful by the return code. If you are unsure of your result, we recommend using the default "full-exception" error handling mode. As an alternative, check the last error value after the call using the legacy "no-exception" error handling mode.
int get_components(unsigned & monthval, int local_utc_& mindiffval);
This is an accessor function that allows access to all of the numeric components of the value at once. If the function succeeds, the function returns 0 and the parameters are assigned new values equal to the value's components. If the numeric representation is currently invalid, the function reconstructs it from the textual representation. If the textual representation is not a correct xsd:gMonth value, the function returns BAD_TIME and the parameters retain their original values. In the default "full-exception" error handling mode, error conditions cause C++ exceptions to be thrown instead, so the function always returns 0.
int set_month(unsigned monthval);
int set_local_utc_mindiff(int local_utc_mindiffval);
These are the mutator functions. Each of them changes the value of the correspondent component of the xsd:gMonth value. The stored textual representation is invalidated. In case of success, the function returns 0. If the numeric representation is currently invalid, the function reconstructs it from the textual representation prior to making the change. If the textual representation is not a correct xsd:gMonth value, the function returns the BAD_TIME error code. In the default "full-exception" error handling mode, error conditions cause C++ exceptions to be thrown instead, so the function always returns 0.
int set_components(unsigned monthval, int local_utc_mindiffval = 0);
This is a mutator function that changes all of the numeric components of the value at once. The numeric components are assigned new values equal to the parameter values. The stored textual representation is invalidated. This function always returns 0 (success).

OssXMLGYear

This class represents the XML Schema xsd:gYear type. It contains two numeric components: year and a timezone value (signed difference between the local time and the UTC time in minutes). There are also two special values for local time difference - OSS_UTC_DIFF_Z means UTC time (so the textual representation will have the 'Z' suffix) and OSS_UTC_DIFF_ABSENT means local time without the timezone specification (the textual representation will have no suffix).

Definition

class OssXMLGYear
{
    OssXMLGYear();
    OssXMLGYear(const OssXMLGYear &);
    OssXMLGYear & operator = (const OssXMLGYear &);
    ~OssXMLGYear();
    OssXMLGYear(const char *xmlString);
    OssXMLGYear(int yearval, int local_utc_mindiffval = 0);
    operator const char *();
    OssXMLGYear & operator = (const char *xmlString);
    int get_year();
    int get_local_utc_mindiff();
    int get_components(int &yearval, int &local_utc_mindiffval);
    int set_year(int yearval);
    int set_local_utc_mindiff(int local_utc_mindiffval);
    int set_components(int yearval, int local_utc_mindiffval = 0);
};

Methods

OssXMLGYear(const char *xmlString);
This is a string initialization constructor. The parameter is a null-terminated C string that is copied to the object as its textual representation. The source string is not checked for correctness. It may be any string.
OssXMLGYear(int yearval, int local_utc_mindiffval = 0);
This is a numeric initialization constructor. The parameters represent the numeric components of the date value: yearval – year, mindiffval – the timezone value.
operator const char *();
This is the conversion operator. It returns the value in the textual form. The returned value is a pointer to the textual component of the object. If the textual representation is currently invalid, the operator reconstructs it from the numeric components. If the numeric components do not represent a correct xsd:gYear value, the conversion routine calls the error handling function with the BAD_TIME error code. If the error handling function does not throw a C++ exception, the operator then returns NULL.
OssXMLGYear & operator = (const char *xmlString);
This is a string assignment operator. The parameter is a null-terminated C string that is copied to the object as its textual representation. The numeric representation is invalidated. The source string is not checked for correctness. It may be any string.
int get_year();
int get_local_utc_mindiff();
These are the accessor functions. Each of them returns the value of the correspondent component of the xsd:gYear value. If the numeric representation is currently invalid, the function reconstructs it from the textual representation. If the textual representation is not a correct xsd:gYear value, the conversion routine calls the error handling function with the BAD_TIME error code. If the error handling function does not throw a C++ exception, the accessor returns 0. NOTE: You cannot determine whether the function was successful by the return code. If you are unsure of your result, we recommend using the default "full-exception" error handling mode. As an alternative, check the last error value after the call using the legacy "no-exception" error handling mode.
int get_components(int & yearval, int local_utc_& mindiffval);
This is an accessor function that allows the access to all of the numeric components of the value at once. If the function succeeds, the function returns 0 and the parameters are assigned new values equal to the value's components. If the numeric representation is currently invalid, the function reconstructs it from the textual representation. If the textual representation is not a correct xsd:gYear value, the function returns BAD_TIME and the parameters retain their original values. In the default "full-exception" error handling mode, error conditions cause C++ exceptions to be thrown instead, so the function always returns 0.
int set_year(int yearval);
int set_local_utc_mindiff(int local_utc_mindiffval);
These are the mutator functions. Each of them changes the value of the correspondent component of the xsd:gYear value. The stored textual representation is invalidated. In case of success, the function returns 0. If the numeric representation is currently invalid, the function reconstructs it from the textual representation prior to making the change. If the textual representation is not a correct xsd:gYear value, the function returns the BAD_TIME error code. In the default "full-exception" error handling mode, error conditions cause C++ exceptions to be thrown instead, so the function always returns 0.
int set_components(int yearval, int local_utc_mindiffval = 0);
This is a mutator function that changes all of the numeric components of the value at once. The numeric components are assigned new values equal to the parameter values. The stored textual representation is invalidated. This function always returns 0 (success).

OssXMLGYearMonth

This class represents the XML Schema xsd:gYearMonth type. It contains three numeric components: year, month (1..12), and a timezone value (signed difference between the local time and the UTC time in minutes). There are also two special values for local time difference - OSS_UTC_DIFF_Z means UTC time (so the textual representation will have the 'Z' suffix) and OSS_UTC_DIFF_ABSENT means local time without the timezone specification (the textual representation will have no suffix).

Definition

class OssXMLGYearMonth
{
    OssXMLGYearMonth();
    OssXMLGYearMonth(const OssXMLGYearMonth &);
    OssXMLGYearMonth & operator = (const OssXMLGYearMonth &);
    ~OssXMLGYearMonth();
    OssXMLGYearMonth(const char *xmlString);
    OssXMLGYearMonth(int yearval, unsigned monthval, int local_utc_mindiffval = 0);
    operator const char *();
    OssXMLGYearMonth & operator = (const char *xmlString);
    int get_year();
    unsigned get_month();
    int get_local_utc_mindiff();
    int get_components(int &yearval, unsigned &monthval, int &local_utc_mindiffval);
    int set_year(int yearval);
    int set_month(unsigned monthval);
    int set_local_utc_mindiff(int local_utc_mindiffval);
    int set_components(int yearval, unsigned monthval, int local_utc_mindiffval = 0);
};

Methods

OssXMLGYearMonth(const char *xmlString);
This is a string initialization constructor. The parameter is a null-terminated C string that is copied to the object as its textual representation. The source string is not checked for correctness. It may be any string.
OssXMLGYearMonth(int yearval, unsigned monthval, int local_utc_mindiffval = 0);
This is a numeric initialization constructor. The parameters represent the numeric components of the date value: yearval – year, monthval – month, mindiffval – the timezone value.
operator const char *();
This is the conversion operator. It returns the value in the textual form. The returned value is a pointer to the textual component of the object. If the textual representation is currently invalid, the operator reconstructs it from the numeric components. If the numeric components do not represent a correct xsd:gYearMonth value, the conversion routine calls the error handling function with the BAD_TIME error code. If the error handling function does not throw a C++ exception, the operator then returns NULL.
OssXMLGYearMonth & operator = (const char *xmlString);
This is a string assignment operator. The parameter is a null-terminated C string that is copied to the object as its textual representation. The numeric representation is invalidated. The source string is not checked for correctness. It may be any string.
int get_year();
unsigned get_month();
int get_local_utc_mindiff();
These are the accessor functions. Each of them returns the value of the correspondent component of the xsd:gYearMonth value. If the numeric representation is currently invalid, the function reconstructs it from the textual representation. If the textual representation is not a correct xsd:gYearMonth value, the conversion routine calls the error handling function with the BAD_TIME error code. If the error handling function does not throw a C++ exception, the accessor returns 0. NOTE: You cannot determine whether the function was successful by the return code. If you are unsure of your result, we recommend using the default "full-exception" error handling mode. As an alternative, check the last error value after the call using the legacy "no-exception" error handling mode.
int get_components(int & yearval, unsigned & monthval, int local_utc_& mindiffval);
This is an accessor function that allows access to all of the numeric components of the value at once. If the function succeeds, the function returns 0 and the parameters are assigned new values equal to the value's components. If the numeric representation is currently invalid, the function reconstructs it from the textual representation. If the textual representation is not a correct xsd:gYearMonth value, the function returns BAD_TIME and the parameters retain their original values. In the default "full-exception" error handling mode, error conditions cause C++ exceptions to be thrown instead, so the function always returns 0.
int set_year(int yearval);
int set_month(unsigned monthval);
int set_local_utc_mindiff(int local_utc_mindiffval);
These are the mutator functions. Each of them changes the value of the correspondent component of the xsd:gYearMonth value. The stored textual representation is invalidated. In case of success, the function returns 0. If the numeric representation is currently invalid, the function reconstructs it from the textual representation prior to making the change. If the textual representation is not a correct xsd:gYearMonth value, the function returns the BAD_TIME error code. In the default "full-exception" error handling mode, error conditions cause C++ exceptions to be thrown instead, so the function always returns 0.
int set_components(int yearval, unsigned monthval, int local_utc_mindiffval = 0);
This is a mutator function that changes all of the numeric components of the value at once. The numeric components are assigned new values equal to the parameter values. The stored textual representation is invalidated. This function always returns 0 (success).

OssXMLTime

This class represents the XML Schema xsd:time type. It contains five numeric components: hours (0..23), minutes (0..59), seconds (0..59), fraction of a second (a textual string; see below), and a timezone value (signed difference between the local time and the UTC time in minutes). There are also two special values for local time difference - OSS_UTC_DIFF_Z means UTC time (so the textual representation will have the 'Z' suffix) and OSS_UTC_DIFF_ABSENT means local time without the timezone specification (the textual representation will have no suffix).

Definition

class OssXMLTime
{
    OssXMLTime();
    OssXMLTime(const OssXMLTime &);
    OssXMLTime & operator = (const OssXMLTime &);
    ~OssXMLTime();
    OssXMLTime(const char *xmlString);
    OssXMLTime(unsigned hoursval, unsigned minutesval = 0,
            unsigned secondsval = 0,
            const char *fractionval = NULL, unsigned precisionval = 0,
            int local_utc_mindiffval = 0);
    operator const char *();
    OssXMLTime & operator = (const char *xmlString);
    unsigned get_hours();
    unsigned get_minutes();
    unsigned get_seconds();
    const char *get_fraction(unsigned &precisionval);
    int get_local_utc_mindiff();
    int get_components(unsigned &hoursval, unsigned &minutesval,
            unsigned &secondsval,
            const char *&fractionval, unsigned &precisionval,
            int &local_utc_mindiffval);
    int set_hours(unsigned hoursval);
    int set_minutes(unsigned minutesval);
    int set_seconds(unsigned secondsval);
    int set_fraction(const char *fractionval, unsigned precisionval = 0);
    int set_local_utc_mindiff(int local_utc_mindiffval);
    int set_components(unsigned hoursval, unsigned minutesval = 0,
            unsigned secondsval = 0,
            const char *fractionval = NULL, unsigned precisionval = 0,
            int local_utc_mindiffval = 0);
};

Methods

OssXMLTime(const char *xmlString);
This is a string initialization constructor. The parameter is a null-terminated C string that is copied to the object as its textual representation. The source string is not checked for correctness. It may be any string.
OssXMLDateTime(unsigned hoursval, unsigned minutesval = 0, unsigned secondsval = 0, const char *fractionval = NULL, unsigned precisionval = 0, int local_utc_mindiffval = 0);
This is a numeric initialization constructor. The parameters represent the numeric components of the date value: hoursval – hours, minutesval – minutes, secondsval – seconds, mindiffval – the timezone value. The fractional part is specified in a textual form. The fractionval parameter is a pointer to a character string containing the fraction of a second as a decimal fraction; the precisionval parameter contains the length of the string. Therefore, the string need not be null-terminated. E.g., to specify three-fourths of a second you may specify fractionval as "75" and precisionval as 2.
operator const char *();
This is the conversion operator. It returns the value in the textual form. The returned value is a pointer to the textual component of the object. If the textual representation is currently invalid, the operator reconstructs it from the numeric components. If the numeric components do not represent a correct xsd:time value, the conversion routine calls the error handling function with the BAD_TIME error code. If the error handling function does not throw a C++ exception, the operator then returns NULL.
OssXMLTime & operator = (const char *xmlString);
This is a string assignment operator. The parameter is a null-terminated C string that is copied to the object as its textual representation. The numeric representation is invalidated. The source string is not checked for correctness. It may be any string.
unsigned get_hours();
unsigned get_minutes();
unsigned get_seconds();
int get_local_utc_mindiff();
These are the accessor functions. Each of them returns the value of the correspondent component of the xsd:time value. If the numeric representation is currently invalid, the function reconstructs it from the textual representation. If the textual representation is not a correct xsd:time value, the conversion routine calls the error handling function with the BAD_TIME error code. If the error handling function does not throw a C++ exception, the accessor returns 0. NOTE: You cannot determine whether the function was successful by the return code. If you are unsure of your result, we recommend using the default "full-exception" error handling mode. As an alternative, check the last error value after the call using the legacy "no-exception" error handling mode.
const char *get_fraction(unsigned & precisionval);
This is the accessor function for the fraction component. It acts just like any other accessor method of the XMLTime class but returns a pointer to a constant character string representing the fractional part. This string is not null-terminated; its size is determined by the value stored in the parameter variable.
int get_components(unsigned & hoursval, unsigned & minutesval, unsigned & secondsval, const char * & fractionval, unsigned & precisionval, int & local_utc_mindiffval);
This is an accessor function that allows access to all of the numeric components of the value at once. If the function succeeds, the function returns 0 and the parameters are assigned new values equal to the value's components. If the numeric representation is currently invalid, the function reconstructs it from the textual representation. If the textual representation is not a correct xsd:time value, the function returns BAD_TIME and the parameters retain their original values. In the default "full-exception" error handling mode, error conditions cause C++ exceptions to be thrown instead, so the function always returns 0.
int set_hours(unsigned hoursval);
int set_minutes(unsigned minutesval);
int set_seconds(unsigned secondsval);
int set_local_utc_mindiff(int local_utc_mindiffval);
These are the mutator functions. Each of them changes the value of the correspondent component of the xsd:time value. The stored textual representation is invalidated. In case of success, the function returns 0. If the numeric representation is currently invalid, the function reconstructs it from the textual representation prior to making the change. If the textual representation is not a correct xsd:time value, the function returns the BAD_TIME error code. In the default "full-exception" error handling mode, error conditions cause C++ exceptions to be thrown instead, so the function always returns 0.
int set_fraction(const char *fractionval, unsigned precisionval = 0);
This is the mutator function for the fraction component. It acts just like any other mutator method of the XMLTime class but takes two parameters to specify the fraction component in the textual form, as described for the numeric initialization constructor.
int set_components(unsigned hoursval, unsigned minutesval = 0, unsigned secondsval = 0, const char * fractionval = NULL, unsigned precisionval = 0, int local_utc_mindiffval = 0);
This is a mutator function that changes all of the numeric components of the value at once. The numeric components are assigned new values equal to the parameter values. The stored textual representation is invalidated. This function always returns 0 (success).

ISO 8601 Time Utility Classes

The ASN.1/C++ compiler maps ISO 8601 time types (TIME, DATE, DATE-TIME, TIME-OF-DAY, DURATION) to the OssTime representation class. OssTime is a simple container for a character string, which allows easy obtainment of the time value in textual form. However, in many cases the user will want to access individual components of time values, such as year, month, day, hour, minute, etc., in numeric form.

The ASN.1 Tools for C++ contains special utility classes that may be used to extract and replace individual time components from a character string that contains a textual value of some ISO 8601 time types. These utility classes act as containers comprising a set of numeric components of a time value. The user can inspect or modify any of the numeric components. The utility classes do not check the conformance of the value to ITU-T Recommendation X.680:2015 because, when the user is in the process of changing a time value, intermediate values can be nonconformant. The validity of the value is checked only when the value is assigned to an OssTime object.

Note that ISO 8601 time utility classes are not representation classes and cannot be used as encoder input. They are intended for intermediate manipulations only. To encode the value of an object, the user should assign it to an object of the representation class (OssTime).


OssTimePoint

This class represents a time point. It contains the following optional components:

  • Century
  • Year
  • Week
  • Month
  • Day
  • Hour
  • Minute
  • Second
  • Fractional part
  • UTC designator ('Z')
  • Time difference

Any of the components may be omitted. Also, any of the components may be changed regardless of the presence or absence of any other components. Therefore, some of the possible component combinations are invalid ISO 8601 time values, but the OssTimePoint class does not check the validity of the current value. The validity is checked only by the set_time_point function of the OssTime class.

The time difference component, if present, contains one mandatory component (hours of difference) and one optional component (minutes of difference). This means that, say, 6 hours and 6 hours 00 minutes are considered different time values.

Definition

class OssTimePoint {
public:
    OssTimePoint();
    OssTimePoint(const OssTimePoint &);
    OssTimePoint & operator = (const OssTimePoint &);
    void clear();
    int has_century() const;
    int get_century() const;
    int set_century(int centval);
    int omit_century();
    int has_year() const;
    int get_year() const;
    int set_year(int yearval);
    int omit_year();
    int has_week() const;
    unsigned short get_week() const;
    int set_week(unsigned short weekval);
    int omit_week();
    int has_month() const;
    unsigned short get_month() const;
    int set_month(unsigned short monthval);
    int omit_month();
    int has_day() const;
    unsigned short get_day() const;
    int set_day(unsigned short dayval);
    int omit_day();
    int has_hours() const;
    unsigned short get_hours() const;
    int set_hours(unsigned short hoursval);
    int omit_hours();
    int has_minutes() const;
    unsigned short get_minutes() const;
    int set_minutes(unsigned short minutesval);
    int omit_minutes();
    int has_seconds() const;
    unsigned short get_seconds() const;
    int set_seconds(unsigned short secondsval);
    int omit_seconds();
    int has_fraction() const;
    unsigned get_fraction(unsigned & precision) const;
    int set_fraction(unsigned fractionval, unsigned precisionval);
    int omit_fraction();
    int is_utc() const;
    int set_utc(int utcval);
    int has_difference() const;
    int has_difference_minutes() const;
    short get_difference_hours() const;
    unsigned short get_difference_minutes() const;
    int set_difference_hours(short hoursval);
    int set_difference(short hoursval, unsigned short minutesval);
    int omit_difference();
    int omit_difference_minutes();
};

Methods

void clear();
Makes all of the components of the value absent. Note that this is not a valid ISO 8601 time value, however, it may be useful as a starting point for value creation.
int has_century() const;
Returns 1 if the century component is present or 0 if it is absent.
int get_century() const;
Returns the century component. If it is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
int set_century(int centval);
Sets the century component to the value of the parameter. Returns 0 if the value was successfully set or a non-zero error code otherwise.
int omit_century();
Makes the century component absent. Returns 0 on success or a non-zero error code otherwise.
int has_year() const;
Returns 1 if the year component is present or 0 if it is absent.
int get_year() const;
Returns the year component. If it is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
int set_year(int yearval);
Sets the year component to the value of the parameter. Returns 0 if the value was successfully set or a non-zero error code otherwise.
int omit_year();
Makes the year component absent. Returns 0 on success or a non-zero error code otherwise.
int has_week() const;
Returns 1 if the week component is present or 0 if it is absent.
unsigned short get_week() const;
Returns the week component. If it is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
int set_week(unsigned short weekval);
Sets the week component to the value of the parameter. Returns 0 if the value was successfully set or a non-zero error code otherwise.
int omit_week();
Makes the week component absent. Returns 0 on success or a non-zero error code otherwise.
int has_month() const;
Returns 1 if the month component is present or 0 if it is absent.
unsigned short get_month() const;
Returns the month component. If it is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
int set_month(unsigned short monthval);
Sets the month component to the value of the parameter. Returns 0 if the value was successfully set or a non-zero error code otherwise.
int omit_month();
Makes the month component absent. Returns 0 on success or a non-zero error code otherwise.
int has_day() const;
Returns 1 if the day component is present or 0 if it is absent.
unsigned short get_day() const;
Returns the day component. If it is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
int set_day(unsigned short dayval);
Sets the day component to the value of the parameter. Returns 0 if the value was successfully set or a non-zero error code otherwise.
int omit_day();
Makes the day component absent. Returns 0 on success and a non-zero error code otherwise.
int has_hours() const;
Returns 1 if the hours component is present and 0 if it is absent.
unsigned short get_hours() const;
Returns the hours component. If it is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
int set_hours(unsigned short hoursval);
Sets the hours component to the value of the parameter. Returns 0 if the value was successfully set or a non-zero error code otherwise.
int omit_hours();
Makes the hours component absent. Returns 0 on success or a non-zero error code otherwise.
int has_minutes() const;
Returns 1 if the minutes component is present or 0 if it is absent.
unsigned short get_minutes() const;
Returns the minutes component. If it is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
int set_minutes(unsigned short minutesval);
Sets the minutes component to the value of the parameter. Returns 0 if the value was successfully set or a non-zero error code otherwise.
int omit_minutes();
Makes the minutes component absent. Returns 0 on success or a non-zero error code otherwise.
int has_seconds() const;
Returns 1 if the seconds component is present or 0 if it is absent.
unsigned short get_seconds() const;
Returns the seconds component. If it is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
int set_seconds(unsigned short secondsval);
Sets the seconds component to the value of the parameter. Returns 0 if the value was successfully set or a non-zero error code otherwise.
int omit_seconds();
Makes the seconds component absent. Returns 0 on success or a non-zero error code otherwise.
int has_fraction() const;
Returns 1 if the fractional part component is present or 0 if it is absent.
unsigned get_fraction(unsigned &precision) const;
Returns the fractional part component. The number of decimal digits in the fractional part is assigned to the variable passed as the parameter. For example, if the fractional part is ".5678", the function returns 5678 and the precision variable gets the value of 4. If the fractional part is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
int set_fraction(unsigned fractionval, unsigned precisionval);
Sets the fractional part component to the value of the parameter. The precisionval parameter is the number of decimal digits in the fractionval parameter. For example, set_fraction(123, 3); sets the fractional part of ".123". Returns 0 if the value was successfully set or a non-zero error code otherwise.
int omit_fraction();
Makes the fractional part component absent. Returns 0 on success or a non-zero error code otherwise.
int is_utc() const;
Returns 1 if the week component is UTC (has the UTC designator 'Z') or 0 if it is not.
int set_utc(int utcval);
Sets the UTC component to the value of the parameter. That is, if the parameter is not 0, the value is set to UTC, if it is 0, the value is set to non-UTC. Returns 0 if the value was successfully set or a non-zero error code otherwise.
int has_difference() const;
Returns 1 if the time difference component is present or 0 if it is absent.
int has_difference_minutes() const;
Returns 1 if the minutes subcomponent of the time difference component is present or 0 if it is absent (or if the time difference component is absent as a whole).
short get_difference_hours() const;
Returns the hours subcomponent of the time difference component. If it is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
unsigned short get_difference_minutes() const;
Returns the minutes subcomponent of the time difference component. If it is absent or the time difference component is absent as a whole, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
int set_difference_hours(short hoursval);
Sets the hours subcomponent of the time difference component to the value of the parameter. The minutes subcomponent is set to be absent. Returns 0 if the value was successfully set or a non-zero error code otherwise.
int set_difference(short hoursval, unsigned short minutesval);
Sets the hours and minutes subcomponents of the time difference component to the values of the corresponding parameters. Returns 0 if the value was successfully set or a non-zero error code otherwise.
int omit_difference();
Makes the time difference component absent. Returns 0 on success or a non-zero error code otherwise.
int omit_difference_minutes();
Makes the minutes subcomponent of the time difference component absent. Returns 0 on success or a non-zero error code otherwise.

NOTE: In the current version, the set_<component> and omit_<component> functions of the OssTimePoint class always succeed and return 0. This may change in later versions.


OssDuration

This class represents a duration of time. It contains the following optional components:

  • Years
  • Weeks
  • Months
  • Days
  • Hours
  • Minutes
  • Seconds
  • Fractional part

Any of the components may be omitted. Also, any of the components may be changed regardless of the presence or absence of any other components. Therefore, some of the possible component combinations are invalid ISO 8601 duration values, but the OssDuration class does not check the validity of the current value. The validity is checked only by the set_duration function of the OssTime class.

Definition

class OssDuration {
public:
    OssDuration();
    OssDuration(const OssDuration &);
    OssDuration & operator = (const OssDuration &);
    void clear();
    int has_years() const;
    unsigned int get_years() const;
    int set_years(unsigned yearsval);
    int omit_years();
    int has_months() const;
    unsigned get_months() const;
    int set_months(unsigned monthsval);
    int omit_months();
    int has_weeks() const;
    unsigned get_weeks() const;
    int set_weeks(unsigned weeksval);
    int omit_weeks();
    int has_days() const;
    unsigned get_days() const;
    int set_days(unsigned dayval);
    int omit_days();
    int has_hours() const;
    unsigned get_hours() const;
    int set_hours(unsigned hoursval);
    int omit_hours();
    int has_minutes() const;
    unsigned get_minutes() const;>
    int set_minutes(unsigned minutesval);
    int omit_minutes();
    int has_seconds() const;
    unsigned get_seconds() const;
    int set_seconds(unsigned secondsval);
    int omit_seconds();
    int has_fraction() const;
    unsigned get_fraction(unsigned & precision) const;
    int set_fraction(unsigned fractionval, unsigned precisionval);
    int omit_fraction();
};

Methods

void clear();
Makes all of the components of the value absent. Note that this is not a valid ISO 8601 duration value, however, it may be useful as a starting point for value creation.
int has_years() const;
Returns 1 if the years component is present or 0 if it is absent.
unsigned get_years() const;
Returns the years component. If it is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
int set_years(unsigned yearsval);
Sets the years component to the value of the parameter. Returns 0 if the value was successfully set or a non-zero error code otherwise.
int omit_years();
Makes the years component absent. Returns 0 on success or a non-zero error code otherwise.
int has_months() const;
Returns 1 if the months component is present or 0 if it is absent.
unsigned get_months() const;
Returns the months component. If it is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
int set_months(unsigned monthsval);
Sets the months component to the value of the parameter. Returns 0 if the value was successfully set or a non-zero error code otherwise.
int omit_months();
Makes the months component absent. Returns 0 on success or a non-zero error code otherwise.
int has_weeks() const;
Returns 1 if the weeks component is present or 0 if it is absent.
unsigned get_weeks() const;
Returns the weeks component. If it is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
int set_weeks(unsigned weeksval);
Sets the weeks component to the value of the parameter. Returns 0 if the value was successfully set or a non-zero error code otherwise.
int omit_weeks();
Makes the weeks component absent. Returns 0 on success or a non-zero error code otherwise.
int has_days() const;
Returns 1 if the days component is present or 0 if it is absent.
unsigned get_days() const;
Returns the days component. If it is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
int set_days(unsigned daysval);
Sets the days component to the value of the parameter. Returns 0 if the value was successfully set or a non-zero error code otherwise.
int omit_days();
Makes the days component absent. Returns 0 on success or a non-zero error code otherwise.
int has_hours() const;
Returns 1 if the hours component is present or 0 if it is absent.
unsigned get_hours() const;
Returns the hours component. If it is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
int set_hours(unsigned hoursval);
Sets the hours component to the value of the parameter. Returns 0 if the value was successfully set or a non-zero error code otherwise.
int omit_hours();
Makes the hours component absent. Returns 0 on success or a non-zero error code otherwise.
int has_minutes() const;
Returns 1 if the minutes component is present or 0 if it is absent.
unsigned get_minutes() const;
Returns the minutes component. If it is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
int set_minutes(unsigned minutesval);
Sets the minutes component to the value of the parameter. Returns 0 if the value was successfully set or a non-zero error code otherwise.
int omit_minutes();
Makes the minutes component absent. Returns 0 on success or a non-zero error code otherwise.
int has_seconds() const;
Returns 1 if the seconds component is present or 0 if it is absent.
unsigned get_seconds() const;
Returns the seconds component. If it is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
int set_seconds(unsigned secondsval);
Sets the seconds component to the value of the parameter. Returns 0 if the value was successfully set or a non-zero error code otherwise.
int omit_seconds();
Makes the seconds component absent. Returns 0 on success or a non-zero error code otherwise.
int has_fraction() const;
Returns 1 if the fractional part component is present or 0 if it is absent.
unsigned get_fraction(unsigned &precision) const;
Returns the fractional part component. The number of decimal digits in the fractional part is assigned to the variable passed as the parameter. For example, if the fractional part is ".5678", the function returns 5678 and the precision variable gets the value of 4. If the fractional part is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
int set_fraction(unsigned fractionval, unsigned precisionval);
Sets the fractional part component to the value of the parameter. The precisionval parameter is the number of decimal digits in the fractionval parameter. For example, set_fraction(123, 3); sets the fractional part of ".123". Returns 0 if the value was successfully set or a non-zero error code otherwise.
int omit_fraction();
Makes the fractional part component absent. Returns 0 on success or a non-zero error code otherwise.

NOTE: In the current version, all the set_<component> and omit_<component> functions of the OssDuration class always succeed and return 0. This may change in later versions.


OssTimeInterval

This class represents a time interval or a recurring time interval. It contains the following optional components:

  • Starting time point – a value of the OssTimePoint class.
  • Ending time point – a value of the OssTimePoint class.
  • Duration – a value of the OssTimePoint class.
  • Recurrence information – an unsigned integer value or a special value of "unbounded".

Any of the components may be omitted. Also, any of the components may be changed regardless of the presence or absence of any other components. Therefore, some of the possible component combinations are invalid ISO 8601 time interval values, but the OssTimeInterval class does not check the validity of the current value. The validity is checked only by the set_interval function of the OssTime class. However, the OssTimeInterval class prevents the user from setting the three first components of the interval value all at the same time. This is illegal.

Definition

class PUBLIC OssTimeInterval {
public:
    OssTimeInterval();
    OssTimeInterval(const OssTimeInterval &);
    OssTimeInterval & operator = (const OssTimeInterval &);
    void clear();
    int has_start_point() const;
    OssTimePoint *get_start_point();
    const OssTimePoint *get_start_point() const;
    int set_start_point(const OssTimePoint & sp);
    int omit_start_point();
    int has_end_point() const;
    OssTimePoint *get_end_point();
    const OssTimePoint *get_end_point() const;
    int set_end_point(const OssTimePoint & ep);
    int omit_end_point();
    int has_duration() const;
OssDuration *get_duration();
    const OssDuration *get_duration() const;
    int set_duration(const OssDuration & dur);
    int omit_duration();
int has_recurrence() const;
    int is_unbounded() const;
    unsigned get_recurrence() const;
    int set_recurrence(unsigned recval);
    int set_unbounded();
    int omit_recurrence();
};

Methods

void clear();
Makes all of the components of the value absent. Note that this is not a valid ISO 8601 time interval value, however, it may be useful as a starting point for value creation.
int has_start_point() const;
Returns 1 if the start-point component is present or 0 if it is absent.
OssTimePoint *get_start_point();
const OssTimePoint *get_start_point() const;
Returns a pointer to the start-point component. Every change of the returned object is automatically reflected in the OssTimeInterval value. The returned object remains owned by the OssTimeInterval object, you should not deallocate it. If the start-point component is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns NULL.
int set_start_point(const OssTimePoint &);
Sets the start-point component to the value of the parameter. The value of the parameter is copied to the OssTimeInterval object, the input object remains unchanged and owned by the caller. Returns 0 if the value was successfully set or a non-zero error code otherwise (e.g., if the object already has both the duration and the end-point components).
int omit_start_point();
Makes the start-point component absent. Returns 0 on success or a non-zero error code otherwise.
int has_end_point() const;
Returns 1 if the end-point component is present or 0 if it is absent.
OssTimePoint *get_end_point();
const OssTimePoint *get_end_point() const;
Returns a pointer to the end-point component. Every change of the returned object is automatically reflected in the OssTimeInterval value. The returned object remains owned by the OssTimeInterval object, you should not deallocate it. If the end-point component is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns NULL.
int set_end_point(const OssTimePoint &);
Sets the end-point component to the value of the parameter. The value of the parameter is copied to the OssTimeInterval object, the input object remains unchanged and owned by the caller. Returns 0 if the value was successfully set or a non-zero error code otherwise (e.g., if the object already has both the start-point and the duration components).
int omit_end_point();
Makes the end-point component absent. Returns 0 on success or a non-zero error code otherwise.
int has_duration() const;
Returns 1 if the duration component is present or 0 if it is absent.
OssDuration *get_duration();
const OssDuration *get_duration() const;
Returns a pointer to the duration component. Every change of the returned object is automatically reflected in the OssTimeInterval value. The returned object remains owned by the OssTimeInterval object, you should not deallocate it. If the duration component is absent, the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns NULL.
int set_duration(const OssDuration &);
Sets the duration component to the value of the parameter. The value of the parameter is copied to the OssTimeInterval object, the input object remains unchanged and owned by the caller. Returns 0 if the value was successfully set or a non-zero error code otherwise (e.g., if the object already has both the start-point and the end-point components).
int omit_duration();
Makes the duration component absent. Returns 0 on success or a non-zero error code otherwise.
int has_recurrence() const;
Returns 1 if the recurrence component is present or 0 if it is absent.
int is_unbounded() const;
Returns 1 if the recurrence component is present and set to "unbounded" or 0 if it is absent.
unsigned get_recurrence() const;
Returns the recurrence component. If the recurrence component is absent or "unbounded", the OSS_DATA_MISSING error is reported using the usual ASN.1/C++ error reporting mechanism (see Error Handling) and the function returns 0.
int set_recurrence(unsigned recval);
Sets the recurrence component to the value of the parameter. Returns 0 if the value was successfully set or a non-zero error code otherwise.
int set_unbounded();
Sets the recurrence component to "unbounded". Returns 0 if the value was successfully set or a non-zero error code otherwise.
int omit_recurrence();
Makes the recurrence component absent. Returns 0 on success or a non-zero error code otherwise.

This documentation applies to release 6.5 and later of the OSS® ASN.1 Tools for C++.

Copyright © 2017 OSS Nokalva, Inc. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means electronic, mechanical, photocopying, recording or otherwise, without the prior permission of OSS Nokalva, Inc.
Every distributed copy of the OSS® ASN.1 Tools for C++ is associated with a specific license and related unique license number. That license determines, among other things, what functions of the OSS ASN.1 Tools for C++ are available to you.