ASN1C C/C++ Common Runtime  ASN1C v7.8.x
ASN1CUTCTime.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1997-2022 Objective Systems, Inc.
3  *
4  * This software is furnished under a license and may be used and copied
5  * only in accordance with the terms of such license and with the
6  * inclusion of the above copyright notice. This software or any other
7  * copies thereof may not be provided or otherwise made available to any
8  * other person. No title to and ownership of the software is hereby
9  * transferred.
10  *
11  * The information in this software is subject to change without notice
12  * and should not be construed as a commitment by Objective Systems, Inc.
13  *
14  * PROPRIETARY NOTICE
15  *
16  * This software is an unpublished work subject to a confidentiality agreement
17  * and is protected by copyright and trade secret law. Unauthorized copying,
18  * redistribution or other use of this work is prohibited.
19  *
20  * The above notice of copyright on this source code product does not indicate
21  * any actual or intended publication of such source code.
22  *
23  *****************************************************************************/
24 
25 #ifndef __ASN1CUTCTIME_H__
26 #define __ASN1CUTCTIME_H__
27 
28 #include "rtsrc/ASN1CTime.h"
29 
31 //
32 // ASN1CUTCTime
33 //
34 // ISO 8601 time and date for ITU-T X.680.
35 //
36 // Author Artem Bolgar.
37 // version 3.00 03 Sep, 2004 (refactored to use ASN1TUTCTime)
38 //
39 // version 2.13 11 Jul, 2003 (2038 year problem fixed + some other fixes)
40 // version 1.11 3 Aug, 2002
41 //
42 
53 #ifndef _NO_UTILS_CLASSES
54 
65 class EXTRTCLASS ASN1CUTCTime : public ASN1CTime {
66  protected:
67  ASN1TUTCTime timeObj;
68 
69  virtual ASN1TTime& getTimeObj () { return timeObj; }
70  virtual const ASN1TTime& getTimeObj () const { return timeObj; }
71 
72  EXTRTMETHOD ASN1CUTCTime(char*& buf, int bufSize, OSBOOL useDerRules = FALSE);
73  EXTRTMETHOD ASN1CUTCTime(ASN1UTCTime& buf, OSBOOL useDerRules = FALSE);
74 
75  public:
90  EXTRTMETHOD ASN1CUTCTime(OSRTMessageBufferIF& msgBuf, char*& buf, int bufSize,
91  OSBOOL useDerRules = FALSE);
92 
106  EXTRTMETHOD ASN1CUTCTime(OSRTMessageBufferIF& msgBuf, ASN1UTCTime& buf,
107  OSBOOL useDerRules = FALSE);
108 
109  EXTRTMETHOD ASN1CUTCTime(OSRTContext& ctxt, char*& buf, int bufSize,
110  OSBOOL useDerRules = FALSE);
111 
112  EXTRTMETHOD ASN1CUTCTime(OSRTContext& ctxt, ASN1UTCTime& buf,
113  OSBOOL useDerRules = FALSE);
114 
115  // copy ctor
116 
117  ASN1CUTCTime (const ASN1CUTCTime& original) :
118  ASN1CTime (original) {}
119 
131  EXTRTMETHOD int setTime(time_t time, OSBOOL diffTime);
132 
133  const ASN1CUTCTime& operator = (const ASN1CUTCTime& tm) {
134  return (ASN1CUTCTime&) ASN1CTime::operator = (tm);
135  }
136 
137  protected:
138  /*
139  * Compiles new time string accoring X.680 (clause 42) and ISO 8601.
140  * Returns 0, if successful, or error code, if error.
141  */
142  EXTRTMETHOD int compileString();
143 
144  /*
145  * Gets fraction of second, 0..9.
146  * Returns: Zero.
147  */
148  EXTRTMETHOD int getFraction();
149 
150  /*
151  * This method is not applicable for ASN1CUTCTime.
152  * Returns RTERR_NOTSUPP.
153  */
154  EXTRTMETHOD int setFraction(int fraction);
155 #if __cplusplus >= 201103L
157 #endif
158 
159 } ;
160 #else
161 typedef class _ASN1CUTCTime : public _ASN1CTime {
162  protected:
163  _ASN1CUTCTime(char*& buf, int bufSize, OSBOOL useDerRules) {}
164  _ASN1CUTCTime(ASN1VisibleString& buf, OSBOOL useDerRules) {}
165  public:
166  _ASN1CUTCTime (OSRTMessageBufferIF& msgBuf, char*& buf, int sz,
167  OSBOOL useDerRules = FALSE) :
168  _ASN1CTime (msgBuf, buf, sz, useDerRules) {}
169  _ASN1CUTCTime (OSRTMessageBufferIF& msgBuf, ASN1VisibleString& buf,
170  OSBOOL useDerRules = FALSE) :
171  _ASN1CTime (msgBuf, buf, useDerRules) {}
172  _ASN1CUTCTime(OSRTContext& ctxt, char*& buf, int bufSize,
173  OSBOOL useDerRules) : _ASN1CTime (ctxt, buf, bufSize, useDerRules) {}
174  _ASN1CUTCTime(OSRTContext& ctxt, ASN1VisibleString& buf,
175  OSBOOL useDerRules) : _ASN1CTime (ctxt, buf, bufSize, useDerRules) {}
176 } ASN1CUTCTime;
177 #endif // _NO_UTILS_CLASSES
178 #endif //__ASN1CUTCTIME_H__
179  // end ingroup asn1ctrl asn1ctime
Definition: ASN1TTime.h:66
virtual int setTime(time_t time, OSBOOL diffTime)=0
Definition: ASN1TTime.h:790
Definition: ASN1CTime.h:85
EXTRTMETHOD const ASN1CTime & operator=(const ASN1CTime &)
Definition: ASN1CUTCTime.h:65
Definition: OSRTContext.h:64
virtual EXTRTMETHOD int getFraction()
virtual int compileString()=0
virtual EXTRTMETHOD int setFraction(int fraction, int fracLen=-1)