]> git.saurik.com Git - apple/security.git/blame - SecuritySNACCRuntime/c++-lib/inc/str-stk.h
Security-54.1.9.tar.gz
[apple/security.git] / SecuritySNACCRuntime / c++-lib / inc / str-stk.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/str-stk.h - maintains a stack of the components of a bit string or octet string so they can be copied into a single chunk
20//
21// MS 92/07/06
22//
23// Copyright (C) 1992 Michael Sample and the University of British Columbia
24//
25// This library is free software; you can redistribute it and/or
26// modify it provided that this copyright/license information is retained
27// in original form.
28//
29// If you modify this file, you must clearly indicate your changes.
30//
31// This source code is distributed in the hope that it will be
32// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
33// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
34//
a66d0d4a 35// $Header: /cvs/root/Security/SecuritySNACCRuntime/c++-lib/inc/Attic/str-stk.h,v 1.1.1.1 2001/05/18 23:14:06 mb Exp $
bac41a7b
A
36// $Log: str-stk.h,v $
37// Revision 1.1.1.1 2001/05/18 23:14:06 mb
38// Move from private repository to open source repository
39//
40// Revision 1.3 2001/05/05 00:59:18 rmurphy
41// Adding darwin license headers
42//
43// Revision 1.2 2000/06/15 18:48:25 dmitch
44// Snacc-generated source files, now part of CVS tree to allow for cross-platform build of snaccRuntime.
45//
46// Revision 1.1.1.1 2000/03/09 01:00:05 rmurphy
47// Base Fortissimo Tree
48//
49// Revision 1.2 1999/06/04 21:43:20 mb
50// Fixed several memory leaks.
51//
52// Revision 1.1 1999/02/25 05:21:48 mb
53// Added snacc c++ library
54//
55// Revision 1.5 1997/02/16 20:25:56 rj
56// check-in of a few cosmetic changes
57//
58// Revision 1.4 1995/07/25 21:09:14 rj
59// changed `_' to `-' in file names.
60//
61// Revision 1.3 1994/10/08 04:15:30 rj
62// fixed both Copy()'s name and implementation to CopyOut() that always returns the number of bytes copied out instead of 0 in case less than the requested amount is available.
63//
64// several `unsigned long int' turned into `size_t'.
65//
66// Revision 1.2 1994/08/28 10:01:01 rj
67// comment leader fixed.
68//
69// Revision 1.1 1994/08/28 09:20:49 rj
70// first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
71
72#ifndef _str_stk_h_
73#define _str_stk_h_
74
75#ifndef _IBM_ENC_
76class StrStk
77#else
78#include "shmmgr.h" // Guido Grassel 4.8.93
79
80class StrStk: public MemMgr // Guido Grassel 12.8.93
81#endif /* _IBM_ENC_ */
82{
83public:
84 struct Elmt
85 {
86 char *str;
87 size_t len;
88 } *stk;
89 size_t size;
90 size_t growSize;
91 size_t nextFreeElmt;
92 size_t totalByteLen;
93
94 StrStk (int stkSize, int growIncrement);
95 ~StrStk ();
96
97 void Reset();
98
99 void Push (char *str, size_t strLen);
100
101 // copy string pieces (buffer refs) into single block.
102 // assumes that the buf is at least totalByteLen byte long.
103 void CopyOut (char *buf);
104
105};
106
107#endif /* conditional include */