]> git.saurik.com Git - apple/security.git/blame - SecuritySNACCRuntime/c++-lib/inc/asn-int.h
Security-54.1.9.tar.gz
[apple/security.git] / SecuritySNACCRuntime / c++-lib / inc / asn-int.h
CommitLineData
bac41a7b
A
1/*
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
3 *
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
8 * using this file.
9 *
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
16 */
17
18
19// file: .../c++-lib/inc/asn-int.h - c++ version of ASN.1 integer
20//
21// MS 92/06/15
22// Copyright (C) 1992 Michael Sample and the University of British Columbia
23//
24// This library is free software; you can redistribute it and/or
25// modify it provided that this copyright/license information is retained
26// in original form.
27//
28// If you modify this file, you must clearly indicate your changes.
29//
30// This source code is distributed in the hope that it will be
31// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
32// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
33//
a66d0d4a 34// $Header: /cvs/root/Security/SecuritySNACCRuntime/c++-lib/inc/Attic/asn-int.h,v 1.1.1.1 2001/05/18 23:14:06 mb Exp $
bac41a7b
A
35// $Log: asn-int.h,v $
36// Revision 1.1.1.1 2001/05/18 23:14:06 mb
37// Move from private repository to open source repository
38//
39// Revision 1.3 2001/05/05 00:59:18 rmurphy
40// Adding darwin license headers
41//
42// Revision 1.2 2000/06/15 18:48:23 dmitch
43// Snacc-generated source files, now part of CVS tree to allow for cross-platform build of snaccRuntime.
44//
45// Revision 1.1.1.1 2000/03/09 01:00:05 rmurphy
46// Base Fortissimo Tree
47//
48// Revision 1.2 1999/03/21 02:07:32 mb
49// Added Copy to every AsnType.
50//
51// Revision 1.1 1999/02/25 05:21:42 mb
52// Added snacc c++ library
53//
54// Revision 1.5 1995/09/07 18:49:19 rj
55// long int replaced by newly introduced AsnIntType at a lot of places.
56// it shall provide a 32 bit integer type on all platforms.
57//
58// Revision 1.4 1995/07/24 17:53:56 rj
59// #if TCL ... #endif wrapped into #if META ... #endif
60//
61// changed `_' to `-' in file names.
62//
63// Revision 1.3 1994/10/08 04:18:02 rj
64// code for meta structures added (provides information about the generated code itself).
65//
66// code for Tcl interface added (makes use of the above mentioned meta code).
67//
68// virtual inline functions (the destructor, the Clone() function, BEnc(), BDec() and Print()) moved from inc/*.h to src/*.C because g++ turns every one of them into a static non-inline function in every file where the .h file gets included.
69//
70// made Print() const (and some other, mainly comparison functions).
71//
72// several `unsigned long int' turned into `size_t'.
73//
74// Revision 1.2 1994/08/28 10:00:49 rj
75// comment leader fixed.
76//
77// Revision 1.1 1994/08/28 09:20:35 rj
78// first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
79
80#ifndef _asn_int_h_
81#define _asn_int_h_
82
83class AsnInt: public AsnType
84{
85protected:
86 AsnIntType value;
87
88public:
89 AsnInt() {}
90 AsnInt (AsnIntType val):
91 value (val)
92 {}
93
94 virtual AsnType *Clone() const;
95 virtual AsnType *Copy() const;
96
97 operator AsnIntType() const { return value; }
98 AsnInt &operator = (AsnIntType newvalue) { value = newvalue; return *this; }
99
100 void Set (AsnIntType i) { value = i; }
101 void ReSet (AsnIntType i) { value = i; }
102
103 AsnLen BEncContent (BUF_TYPE b);
104 void BDecContent (BUF_TYPE b, AsnTag tagId, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
105 AsnLen BEnc (BUF_TYPE b);
106 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
107
108 PDU_MEMBER_MACROS
109
110 void Print (ostream &os) const;
111
112#if META
113 static const AsnIntTypeDesc _desc;
114
115 const AsnTypeDesc *_getdesc() const;
116
117#if TCL
118 int TclGetVal (Tcl_Interp *) const;
119 int TclSetVal (Tcl_Interp *, const char *val);
120#endif /* TCL */
121#endif /* META */
122};
123
124#endif /* conditional include */