ASN1C C/C++ Common Runtime  ASN1C v7.2.x
ASN1CUTCTime.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1997-2018 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 
56 #ifndef _NO_UTILS_CLASSES
57 
68 class EXTRTCLASS ASN1CUTCTime : public ASN1CTime {
69  protected:
70  ASN1TUTCTime timeObj;
71 
72  virtual ASN1TTime& getTimeObj () { return timeObj; }
73  virtual const ASN1TTime& getTimeObj () const { return timeObj; }
74 
75  EXTRTMETHOD ASN1CUTCTime(char*& buf, int bufSize, OSBOOL useDerRules = FALSE);
76  EXTRTMETHOD ASN1CUTCTime(ASN1UTCTime& buf, OSBOOL useDerRules = FALSE);
77 
78  public:
93  EXTRTMETHOD ASN1CUTCTime(OSRTMessageBufferIF& msgBuf, char*& buf, int bufSize,
94  OSBOOL useDerRules = FALSE);
95 
109  EXTRTMETHOD ASN1CUTCTime(OSRTMessageBufferIF& msgBuf, ASN1UTCTime& buf,
110  OSBOOL useDerRules = FALSE);
111 
112  EXTRTMETHOD ASN1CUTCTime(OSRTContext& ctxt, char*& buf, int bufSize,
113  OSBOOL useDerRules = FALSE);
114 
115  EXTRTMETHOD ASN1CUTCTime(OSRTContext& ctxt, ASN1UTCTime& buf,
116  OSBOOL useDerRules = FALSE);
117 
118  // copy ctor
119 
120  ASN1CUTCTime (const ASN1CUTCTime& original) :
121  ASN1CTime (original) {}
122 
134  EXTRTMETHOD int setTime(time_t time, OSBOOL diffTime);
135 
136  const ASN1CUTCTime& operator = (const ASN1CUTCTime& tm) {
137  return (ASN1CUTCTime&) ASN1CTime::operator = (tm);
138  }
139 
140  protected:
141  /*
142  * Compiles new time string accoring X.680 (clause 42) and ISO 8601.
143  * Returns 0, if successful, or error code, if error.
144  */
145  EXTRTMETHOD int compileString();
146 
147  /*
148  * Gets fraction of second, 0..9.
149  * Returns: Zero.
150  */
151  EXTRTMETHOD int getFraction();
152 
153  /*
154  * This method is not applicable for ASN1CUTCTime.
155  * Returns RTERR_NOTSUPP.
156  */
157  EXTRTMETHOD int setFraction(int fraction);
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 
Definition: ASN1TTime.h:71
virtual int setTime(time_t time, OSBOOL diffTime)=0
Definition: ASN1TTime.h:792
Definition: ASN1CTime.h:86
EXTRTMETHOD const ASN1CTime & operator=(const ASN1CTime &)
Definition: ASN1CUTCTime.h:68
Definition: OSRTContext.h:65
virtual EXTRTMETHOD int getFraction()
virtual int compileString()=0
virtual EXTRTMETHOD int setFraction(int fraction, int fracLen=-1)