ASN1C C# Runtime Library  7.3
Public Member Functions | Static Public Member Functions | Public Attributes | Properties | List of all members
Asn1AbstractTime Class Referenceabstract
Inheritance diagram for Asn1AbstractTime:
Asn18BitCharString Asn1CharString Asn1Type Asn1TypeIF Asn1GeneralizedTime Asn1UTCTime

Public Member Functions

 Asn1AbstractTime (short typeCode, bool useDerRules)
 
 Asn1AbstractTime (System.String data, short typeCode, bool useDerRules)
 
virtual void Clear ()
 
virtual int CompareTo (System.Object other)
 
override void Decode (Asn1PerDecodeBuffer buffer)
 
override void DecodeXML (System.String buffer, System.String attrs)
 
override void Encode (Asn1PerEncodeBuffer buffer)
 
virtual void Encode (Asn1BerOutputStream outs, bool explicitTagging, Asn1Tag tag)
 
override void Encode (Asn1PerOutputStream outs)
 
override void Encode (Asn1XmlEncoder buffer, System.String elemName, System.String nsPrefix)
 
void EncodeXER (Asn1XmlEncoder buffer, String elemName, String nsPrefix)
 
virtual void EncodeXMLData (Asn1XmlXerEncoder buffer)
 
override bool Equals (System.Object value)
 
virtual int GetDiff ()
 
override int GetHashCode ()
 
virtual System.DateTime GetTime ()
 
abstract void ParseString (System.String data)
 
virtual void ParseXmlString (System.String data)
 
virtual void SetDiff (int dhour, int dminute)
 
virtual void SetDiff (int inMinutes)
 
virtual void SetTime (System.DateTime time)
 
- Public Member Functions inherited from Asn18BitCharString
virtual void Decode (Asn1PerDecodeBuffer buffer, Asn1CharSet charSet)
 
virtual void Decode (Asn1PerDecodeBuffer buffer, Asn1CharSet charSet, long lower, long upper)
 
virtual void Encode (Asn1PerEncodeBuffer buffer, Asn1CharSet charSet)
 
virtual void Encode (Asn1PerEncodeBuffer buffer, Asn1CharSet charSet, long lower, long upper)
 
virtual void Encode (Asn1PerOutputStream outs, Asn1CharSet charSet)
 
virtual void Encode (Asn1PerOutputStream outs, Asn1CharSet charSet, long lower, long upper)
 
- Public Member Functions inherited from Asn1CharString
virtual void DecodeXER (System.String buffer, System.String attrs)
 
override void DecodeXML (System.String buffer, System.String attrs)
 
override void Encode (Asn1XerEncoder buffer, System.String elemName)
 
override void Encode (Asn1XmlEncoder buffer, System.String elemName, System.String nsPrefix)
 
bool Equals (System.String value)
 
override bool Equals (System.Object value)
 
override int GetHashCode ()
 
override System.String ToString ()
 
bool validate (Asn1CharSet charSet)
 
- Public Member Functions inherited from Asn1Type
void _SetKey (byte[] rtkey)
 
virtual void Decode (Asn1BerDecodeBuffer buffer, bool explicitTagging, int implicitLength)
 
virtual void Decode (Asn1BerDecodeBuffer buffer)
 
virtual void Decode (System.Object reader, System.String xmlURI)
 
virtual void Decode (System.Object reader, System.IO.Stream byteStream)
 
virtual void DecodeXML (String buffer, String attrs)
 
virtual int Encode (Asn1BerEncodeBuffer buffer, bool explicitTagging)
 
virtual int Encode (Asn1BerEncodeBuffer buffer)
 
virtual void Encode (Asn1XerEncoder buffer)
 
virtual void Encode (Asn1XmlEncoder buffer)
 
virtual void Encode (Asn1BerOutputStream outs, bool explicitTagging)
 
virtual void Encode (Asn1CerOutputStream outs, bool explicitTagging)
 
virtual void EncodeAttribute (Asn1XmlEncoder buffer, System.String attrName)
 
virtual bool Equals (Asn1Type obj)
 
String GetNonParameterizedTypeName ()
 
virtual void Indent (System.IO.TextWriter outs, int level)
 
virtual bool IsOpenType ()
 
virtual bool MatchTypeName (System.String typeName)
 
virtual void Pdiag (System.String s)
 
virtual void Print (System.IO.TextWriter outs, System.String varName, int level)
 
virtual void Print (System.String varName)
 
void SetNonParameterizedTypeName (String value)
 
virtual void SetOpenType ()
 

Static Public Member Functions

static void PutInteger (System.Text.StringBuilder data, int width, int value)
 
- Static Public Member Functions inherited from Asn1Type
static void _SetKey2 (byte[] rtkey)
 
static Asn1Type Decode (Asn1BerDecodeBuffer buffer, Asn1OpenTypeField openTypeField, bool explicitTag, int implicitLength)
 
static Asn1Type Decode (Asn1PerDecodeBuffer buffer, Asn1OpenTypeField openTypeField)
 
static System.String GetTypeName (short typeCode)
 

Public Attributes

const int Apr = 4
 
const int April = 4
 
const int Aug = 8
 
const int August = 8
 
const int Dec = 12
 
const int December = 12
 
const int Feb = 2
 
const int February = 2
 
const int Jan = 1
 
const int January = 1
 
const int Jul = 7
 
const int July = 7
 
const int Jun = 6
 
const int June = 6
 
const int Mar = 3
 
const int March = 3
 
const int May = 5
 
const int Nov = 11
 
const int November = 11
 
const int Oct = 10
 
const int October = 10
 
const int Sep = 9
 
const int September = 9
 
- Public Attributes inherited from Asn18BitCharString
const int BITSPERCHAR_A = 8
 
const int BITSPERCHAR_U = 7
 
- Public Attributes inherited from Asn1CharString
System.String mValue
 
- Public Attributes inherited from Asn1Type
const short BIT_STRING = 3
 
const short BMPString = 30
 
const short BOOLEAN = 1
 
const short DATE = 31
 
const short ENUMERATED = 10
 
const short EOC = 0
 
const short EXTERNAL = 8
 
const short GeneralString = 27
 
const short GeneralTime = 24
 
const short GraphicString = 25
 
const short IA5String = 22
 
const short INTEGER = 2
 
const short NULL = 5
 
const short NumericString = 18
 
const short OBJECT_IDENTIFIER = 6
 
const short ObjectDescriptor = 7
 
const short OCTET_STRING = 4
 
const short OpenType = 99
 
const short PrintableString = 19
 
const short REAL = 9
 
const short RELATIVE_OID_IRI = 36
 
const short RelativeOID = 13
 
const short SEQUENCE = 16
 
const short SET = 17
 
const short T61String = TeletexString
 
const short TeletexString = 20
 
const short TIME = 14
 
const short UniversalString = 28
 
const short UTCTime = 23
 
const short UTF8String = 12
 
const short VideotexString = 21
 
const short VisibleString = 26
 

Properties

virtual bool [set]
 
virtual int Day [get, set]
 
virtual int DiffHour [get, set]
 
virtual int DiffMinute [get]
 
virtual string Fraction [get, set]
 
virtual int Hour [get, set]
 
virtual int Minute [get, set]
 
virtual int Month [get, set]
 
virtual int Second [get, set]
 
virtual bool UTC [get, set]
 
virtual int Year [get, set]
 
- Properties inherited from Asn1CharString
override int Length [get]
 
- Properties inherited from Asn1Type
virtual String AsnTypeName [get]
 
virtual int Length [get]
 

Additional Inherited Members

- Static Public Attributes inherited from Asn1Type
static readonly Asn1Tag _TAG
 
- Static Protected Member Functions inherited from Asn1CharString
static int Encode (Asn1BerEncodeBuffer buffer, String val, bool explicitTagging, Asn1Tag tag)
 

Detailed Description

This is a base class for holding the components of an ASN.1 generalized and universal times string value.

Constructor & Destructor Documentation

◆ Asn1AbstractTime() [1/2]

Asn1AbstractTime ( short  typeCode,
bool  useDerRules 
)

This constructor creates an empty time string object.

Parameters
typeCodeInteger constant from Asn1Type class (Asn1Type.GeneralTime or Asn1Type.UTCTime).
useDerRules'true' if time string should be encoded with DER/PER.
See also
<seealso cref=Asn1Type.GeneralTime GeneralTime code
<seealso cref=Asn1Type.UTCTime UTCTime code

◆ Asn1AbstractTime() [2/2]

Asn1AbstractTime ( System.String  data,
short  typeCode,
bool  useDerRules 
)

This constructor creates a time string from String value.

Parameters
dataString representation of time value
typeCodeInteger constant from Asn1Type class (Asn1Type.GeneralTime or Asn1Type.UTCTime).
useDerRules'true' if time string should be encoded with DER/PER.
See also
<seealso cref=Asn1Type.GeneralTime GeneralTime code
<seealso cref=Asn1Type.UTCTime UTCTime code

Member Function Documentation

◆ Clear()

virtual void Clear ( )
virtual

This method clears time string. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Reimplemented in Asn1UTCTime.

◆ CompareTo()

virtual int CompareTo ( System.Object  other)
virtual

This method compares this object with Asn1Time class instance or with System.DateTime instance. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Parameters
otherthe Object to be compared.
Returns
The difference in Ticks with the specified object.

Reimplemented in Asn1UTCTime, and Asn1GeneralizedTime.

References IntHolder.mValue.

◆ Decode()

override void Decode ( Asn1PerDecodeBuffer  buffer)
virtual

This method is the base implementation of the standard Packed Encoding Rules (PER) Decode method. It throws an exception because it should never be invoked by compiler generated code.

Parameters
bufferPER Encode message buffer object

Reimplemented from Asn18BitCharString.

◆ DecodeXML()

override void DecodeXML ( System.String  buffer,
System.String  attrs 
)

This method decodes ASN.1 Time type, using the XML schema encoding rules(asn2xsd).

Parameters
bufferString containing data to be decoded
attrsAttributes string from element tag

◆ Encode() [1/4]

override void Encode ( Asn1PerEncodeBuffer  buffer)
virtual

This method is the base implementation of the standard Packed Encoding Rules (PER) encode method. It throws an exception because it should never be invoked by compiler generated code.

Parameters
bufferPER Encode message buffer object

Reimplemented from Asn18BitCharString.

References Asn1BerOutputStream.EncodeCharString(), and IntHolder.mValue.

◆ Encode() [2/4]

virtual void Encode ( Asn1BerOutputStream  outs,
bool  explicitTagging,
Asn1Tag  tag 
)
virtual

This method encodes and writes to the stream an ASN.1 time string value including the UNIVERSAL tag value and length if explicit tagging is specified. This overloaded version uses the Basic Encoding Rules (BER).

Throws, Exception thrown by C# System.IO.Stream for I/O error

Parameters
outsBER Output Stream object
explicitTaggingFlag indicating explicit tagging should be done
tagUniversal tag to apply
Exceptions
Asn1ExceptionThrown, if operation is failed.

◆ Encode() [3/4]

override void Encode ( Asn1PerOutputStream  outs)
virtual

This method encodes and writes to stream an ASN.1 time string value using the standard Packed Encoding Rules (PER) encode method.

Also throws any exception thrown by the Asn1PerOutputStream.

Parameters
outsPER Output Stream object
Exceptions
Asn1ExceptionThrown, if operation is failed.

Reimplemented from Asn18BitCharString.

◆ Encode() [4/4]

override void Encode ( Asn1XmlEncoder  buffer,
System.String  elemName,
System.String  nsPrefix 
)
virtual

This method encodes ASN.1 time into xsd:dateTime format with element and namespace prefix tag according to the XML Encoding as specified in the XML schema standard(asn2xsd). This is for use with Obj-Sys XML encoding rules.

Parameters
bufferEncode message buffer object
elemNameXML element name used to wrap string
nsPrefixXML element namespace value

Reimplemented from Asn1Type.

References Asn1XmlEncoder.EncodeEndElement(), and Asn1XmlEncoder.EncodeStartElement().

◆ EncodeXER()

void EncodeXER ( Asn1XmlEncoder  buffer,
String  elemName,
String  nsPrefix 
)

This method encodes this ASN.1 time according to XER encoding rules. It is used by generated code when compiling for extended-XER.

Parameters
bufferEncode message buffer object

<param name="elemName> XML element name used to wrap string

<param name="nsPrefix> Element namespace prefix value

References Asn1XmlXerEncoder.EncodeData(), Asn1XmlEncoder.EncodeEndElement(), and Asn1XmlEncoder.EncodeStartElement().

◆ EncodeXMLData()

virtual void EncodeXMLData ( Asn1XmlXerEncoder  buffer)
virtual

This method encodes this ASN.1 time string into xsd:dateTime format.

XML dateTime format is YYYY-MM-DDTHH:MM:SS[.SSSS][(Z|(+|-) HH:MM)]

Parameters
bufferString buffer to hold the converted xml time string
Exceptions
Asn1Exceptionany exception exist in Asn.1 Generalized Time string

References Asn1XmlXerEncoder.Copy().

◆ Equals()

override bool Equals ( System.Object  value)

This method compares this object with Asn1Time class instance or with Calendar instance. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Parameters
valueThe Object to compare with the current Object. Object should be instance of Asn1Time or System.DateTime.
Returns
true if the specified Object is equal to the current Object; otherwise, false.

◆ GetDiff()

virtual int GetDiff ( )
virtual

This method returns the difference between the time zone of the object and Coordinated Universal Time (UTC), in minutes. The UTC time is the sum of the local time and positive or negative time difference. Note that the return value may differentiate for different inherited Asn1Time classes.

Returns
The negative or positive difference, in minutes, between the time zone of the object and UTC time (-12*60..+12*60) is returned if the operation is successful.
Exceptions
Asn1ExceptionThrown, if operation is failed.

◆ GetHashCode()

override int GetHashCode ( )

Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.

Returns
A hash code for the current Object.

◆ GetTime()

virtual System.DateTime GetTime ( )
virtual

This method converts the time string to the System.DateTime value. If time represented as UTC time plus or minus difference time, then the result System.DateTime will ignore zone offset, as it doesn't support it. Note that the return value may differentiate for different inherited Asn1Time classes.

Returns
The System.DateTime value.

◆ ParseString()

abstract void ParseString ( System.String  data)
pure virtual

This method parses passed time string. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Parameters
dataString representation of Time to be parsed.
Exceptions
Asn1ExceptionThrown, if operation is failed.

Implemented in Asn1UTCTime, and Asn1GeneralizedTime.

◆ ParseXmlString()

virtual void ParseXmlString ( System.String  data)
virtual

This method parses the given time string value. String must be in XML schema dateTime format. It will throw and exception if the string is not in the valid time format.

Parameters
dataThe time string value to be parsed.
Exceptions
Asn1ExceptionThrown, if operation is failed.

References IntHolder.mValue.

◆ PutInteger()

static void PutInteger ( System.Text.StringBuilder  data,
int  width,
int  value 
)
static

Puts integer in string buffer

Parameters
datadestination buffer
widthnumber of digits in integer value
valueinteger value to be added

◆ SetDiff() [1/2]

virtual void SetDiff ( int  dhour,
int  dminute 
)
virtual

This method sets the hour and minute components of the difference between the time zone of the object and Coordinated Universal Time (UTC). The UTC time is the sum of the local time and positive or negative time difference. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Parameters
dhourThe negative or positive hour component of the difference between the time zone of the object and UTC time (-12..+12).
dminuteThe negative or positive minute component of the difference between the time zone of the object and UTC time (-59..+59).
Exceptions
Asn1ExceptionThrown, if operation is failed.

◆ SetDiff() [2/2]

virtual void SetDiff ( int  inMinutes)
virtual

This method sets the difference between the time zone of the object and Coordinated Universal Time (UTC), in minutes. The UTC time is the sum of the local time and positive or negative time difference. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Parameters
inMinutesThe negative or positive difference, in minutes, between the time zone of the object and UTC time (-12*60..+12*60).
Exceptions
Asn1ExceptionThrown, if operation is failed.

◆ SetTime()

virtual void SetTime ( System.DateTime  time)
virtual

This method converts the System.DateTime value to time string. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Parameters
timeThe System.DateTime time value.
Exceptions
Asn1ExceptionThrown, if operation is failed.

Reimplemented in Asn1UTCTime.

Member Data Documentation

◆ Apr

const int Apr = 4

Constant to represent April month

◆ April

const int April = 4

Constant to represent April month

◆ Aug

const int Aug = 8

Constant to represent August month

◆ August

const int August = 8

Constant to represent August month

◆ Dec

const int Dec = 12

Constant to represent December month

◆ December

const int December = 12

Constant to represent December month

◆ Feb

const int Feb = 2

Constant to represent February month

◆ February

const int February = 2

Constant to represent February month

◆ Jan

const int Jan = 1

Constant to represent January month

◆ January

const int January = 1

Constant to represent January month

◆ Jul

const int Jul = 7

Constant to represent July month

◆ July

const int July = 7

Constant to represent July month

◆ Jun

const int Jun = 6

Constant to represent June month

◆ June

const int June = 6

Constant to represent June month

◆ Mar

const int Mar = 3

Constant to represent March month

◆ March

const int March = 3

Constant to represent March month

◆ May

const int May = 5

Constant to represent May month

◆ Nov

const int Nov = 11

Constant to represent November month

◆ November

const int November = 11

Constant to represent November month

◆ Oct

const int Oct = 10

Constant to represent October month

◆ October

const int October = 10

Constant to represent October month

◆ Sep

const int Sep = 9

Constant to represent September month

◆ September

const int September = 9

Constant to represent September month

Property Documentation

◆ bool

virtual bool
set

Sets the 'use DER' flag which enforces the DER rules when time strings are constructed or parsed.

Value: true for DER rule; otherwise false

◆ Day

virtual int Day
getset

Gets or Sets the day of month number component of the time value. The number of the first day in month is 1, the number of the last day may be in interval from 28 to 31. Note that the behaviour value may differentiate for different inherited Asn1Time classes.

Value: Day of month component (1..31)

Exceptions
Asn1ExceptionThrown, if operation is failed.

◆ DiffHour

virtual int DiffHour
getset

Gets or Sets the hour component of the difference between the time zone of the object and Coordinated Universal Time (UTC). The UTC time is the sum of the local time and positive or negative time difference. Note that the behaviour value may differentiate for different inherited Asn1Time classes.

Value: The negative or positive hour component of the difference between the time zone of the object and UTC time (-12..+12)

Exceptions
Asn1ExceptionThrown, if operation is failed.

◆ DiffMinute

virtual int DiffMinute
get

Gets or Sets the minute component of the difference between the time zone of the object and Coordinated Universal Time (UTC). The UTC time is the sum of the local time and positive or negative time difference. Note that the behaviour value may differentiate for different inherited Asn1Time classes.

Value: The negative or positive minute component of the difference between the time zone of the object and UTC time (-59..+59)

Exceptions
Asn1ExceptionThrown, if operation is failed.

◆ Fraction

virtual string Fraction
getset

Gets or Sets the second's decimal fraction component of the time value. Second's decimal fraction is represented by one digit from 0 to 9. Note that the behaviour value may differentiate for different inherited Asn1Time classes.

Value: Second's decimal fraction component (0..9)

Exceptions
Asn1ExceptionThrown, if operation is failed.

◆ Hour

virtual int Hour
getset

Gets or Sets the hour component of the time value. As the ISO 8601 is based on the 24-hour timekeeping system, two digits represent hours from 00 to 23. Note that the behaviour value may differentiate for different inherited Asn1Time classes.

Value: Hour component (0..23)

Exceptions
Asn1ExceptionThrown, if operation is failed.

◆ Minute

virtual int Minute
getset

Gets or Sets the minute component of the time value. Minutes are represented by two digits from 00 to 59. Note that the behaviour value may differentiate for different inherited Asn1Time classes.

Value: Minute component (0..59)

Exceptions
Asn1ExceptionThrown, if operation is failed.

◆ Month

virtual int Month
getset

Gets or Sets the month number component of the time value. The number of January is 1, February - 2, December - 12. You may use enumerating values for months decoding: Asn1Time.January, Asn1Time.February, etc. Also you can use short aliases for months: Asn1Time.Jan, Asn1Time.Feb, etc. Note that the behaviour value may differentiate for different inherited Asn1Time classes.

Value: Month component (1..12)

Exceptions
Asn1ExceptionThrown, if operation is failed.

◆ Second

virtual int Second
getset

Gets or Sets the second component of the time value. Seconds are represented by two digits from 00 to 59. Note that the behaviour value may differentiate for different inherited Asn1Time classes.

Value: Second component (0..59)

Exceptions
Asn1ExceptionThrown, if operation is failed.

◆ UTC

virtual bool UTC
getset

Gets or Sets the UTC flag state. If the UTC flag is true, then the time is an UTC time and symbol 'Z' is added at the end of time string. Otherwise, it is a local time.

Value: UTC flag state.

Exceptions
Asn1ExceptionThrown, if operation is failed.

◆ Year

virtual int Year
getset

Gets or Sets the year component of the time value. Note that the behaviour value may differentiate for different inherited Asn1Time classes.

Value: Year component (full 4 digits).

Exceptions
Asn1ExceptionThrown, if operation is failed.