]>
git.saurik.com Git - apple/security.git/blob - SecurityASN1/c++/sm_x520sa.cpp
1 // NOTE: this is a machine generated file--editing not recommended
3 // sm_x520sa.cpp - class member functions for ASN.1 module SelectedAttributeTypes
5 // This file was generated by snacc on Mon Apr 22 22:34:19 2002
6 // UBC snacc written by Mike Sample
7 // A couple of enhancements made by IBM European Networking Center
11 #include "sm_vdatypes.h"
12 #include "sm_x501ud.h"
13 #include "sm_x411ub.h"
14 #include "sm_x411mtsas.h"
15 #include "sm_x501if.h"
16 #include "sm_x520sa.h"
17 #include "sm_x509cmn.h"
18 #include "sm_x509af.h"
19 #include "sm_x509ce.h"
20 #include "pkcs1oids.h"
21 #include "pkcs9oids.h"
26 #include "appleoids.h"
29 //------------------------------------------------------------------------------
33 //------------------------------------------------------------------------------
34 // class member definitions:
36 DirectoryString::DirectoryString()
38 choiceId
= teletexStringCid
;
40 teletexString
= new TeletexString
;
42 teletexString
= NULL
; // incomplete initialization of mandatory element!
46 DirectoryString::DirectoryString (const DirectoryString
&)
48 Asn1Error
<< "use of incompletely defined DirectoryString::DirectoryString (const DirectoryString &)" << endl
;
52 DirectoryString::~DirectoryString()
56 case teletexStringCid
:
59 case printableStringCid
:
60 delete printableString
;
62 case universalStringCid
:
63 delete universalString
;
72 } // end of destructor
74 AsnType
*DirectoryString::Clone() const
76 return new DirectoryString
;
79 AsnType
*DirectoryString::Copy() const
81 return new DirectoryString (*this);
85 DirectoryString
&DirectoryString::operator = (const DirectoryString
&that
)
86 #else // SNACC_DEEP_COPY
87 DirectoryString
&DirectoryString::operator = (const DirectoryString
&)
88 #endif // SNACC_DEEP_COPY
95 case teletexStringCid
:
98 case printableStringCid
:
99 delete printableString
;
101 case universalStringCid
:
102 delete universalString
;
111 switch (choiceId
= that
.choiceId
)
113 case teletexStringCid
:
114 teletexString
= new TeletexString
;
115 *teletexString
= *that
.teletexString
;
117 case printableStringCid
:
118 printableString
= new PrintableString
;
119 *printableString
= *that
.printableString
;
121 case universalStringCid
:
122 universalString
= new UniversalString
;
123 *universalString
= *that
.universalString
;
126 bmpString
= new BMPString
;
127 *bmpString
= *that
.bmpString
;
130 utf8String
= new UTF8String
;
131 *utf8String
= *that
.utf8String
;
137 #else // SNACC_DEEP_COPY
138 Asn1Error
<< "use of incompletely defined DirectoryString &DirectoryString::operator = (const DirectoryString &)" << endl
;
140 // if your compiler complains here, check the -novolat option
141 #endif // SNACC_DEEP_COPY
145 DirectoryString::BEncContent (BUF_TYPE b
)
150 case teletexStringCid
:
151 l
= teletexString
->BEncContent (b
);
152 l
+= BEncDefLen (b
, l
);
154 l
+= BEncTag1 (b
, UNIV
, PRIM
, TELETEXSTRING_TAG_CODE
);
157 case printableStringCid
:
158 l
= printableString
->BEncContent (b
);
159 l
+= BEncDefLen (b
, l
);
161 l
+= BEncTag1 (b
, UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
);
164 case universalStringCid
:
165 l
= universalString
->BEncContent (b
);
166 l
+= BEncDefLen (b
, l
);
168 l
+= BEncTag1 (b
, UNIV
, PRIM
, UNIVERSALSTRING_TAG_CODE
);
172 l
= bmpString
->BEncContent (b
);
173 l
+= BEncDefLen (b
, l
);
175 l
+= BEncTag1 (b
, UNIV
, PRIM
, BMPSTRING_TAG_CODE
);
179 l
= utf8String
->BEncContent (b
);
180 l
+= BEncDefLen (b
, l
);
182 l
+= BEncTag1 (b
, UNIV
, PRIM
, 12);
187 } // DirectoryString::BEncContent
190 void DirectoryString::BDecContent (BUF_TYPE b
, AsnTag tag
, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
194 case MAKE_TAG_ID (UNIV
, PRIM
, TELETEXSTRING_TAG_CODE
):
195 case MAKE_TAG_ID (UNIV
, CONS
, TELETEXSTRING_TAG_CODE
):
196 choiceId
= teletexStringCid
;
197 teletexString
= new TeletexString
;
198 teletexString
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
201 case MAKE_TAG_ID (UNIV
, PRIM
, PRINTABLESTRING_TAG_CODE
):
202 case MAKE_TAG_ID (UNIV
, CONS
, PRINTABLESTRING_TAG_CODE
):
203 choiceId
= printableStringCid
;
204 printableString
= new PrintableString
;
205 printableString
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
208 case MAKE_TAG_ID (UNIV
, PRIM
, UNIVERSALSTRING_TAG_CODE
):
209 case MAKE_TAG_ID (UNIV
, CONS
, UNIVERSALSTRING_TAG_CODE
):
210 choiceId
= universalStringCid
;
211 universalString
= new UniversalString
;
212 universalString
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
215 case MAKE_TAG_ID (UNIV
, PRIM
, BMPSTRING_TAG_CODE
):
216 case MAKE_TAG_ID (UNIV
, CONS
, BMPSTRING_TAG_CODE
):
217 choiceId
= bmpStringCid
;
218 bmpString
= new BMPString
;
219 bmpString
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
222 case MAKE_TAG_ID (UNIV
, PRIM
, 12):
223 case MAKE_TAG_ID (UNIV
, CONS
, 12):
224 choiceId
= utf8StringCid
;
225 utf8String
= new UTF8String
;
226 utf8String
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
230 Asn1Error
<< "ERROR - unexpected tag in CHOICE" << endl
;
231 SnaccExcep::throwMe(-100);
234 } // DirectoryString::BDecContent
237 AsnLen
DirectoryString::BEnc (BUF_TYPE b
)
244 void DirectoryString::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
249 /* CHOICEs are a special case - grab identifying tag */
250 /* this allows easier handling of nested CHOICEs */
251 tag
= BDecTag (b
, bytesDecoded
, env
);
252 elmtLen
= BDecLen (b
, bytesDecoded
, env
);
253 BDecContent (b
, tag
, elmtLen
, bytesDecoded
, env
);
256 void DirectoryString::Print (ostream
&os
) const
261 case teletexStringCid
:
262 os
<< "teletexString ";
264 os
<< *teletexString
;
266 os
<< "-- void3 --\n";
269 case printableStringCid
:
270 os
<< "printableString ";
272 os
<< *printableString
;
274 os
<< "-- void3 --\n";
277 case universalStringCid
:
278 os
<< "universalString ";
280 os
<< *universalString
;
282 os
<< "-- void3 --\n";
290 os
<< "-- void3 --\n";
298 os
<< "-- void3 --\n";
303 } // DirectoryString::Print