xref: /onnv-gate/usr/src/cmd/man/src/util/nsgmls.src/lib/ModeInfo.h (revision 396:3db554328fa9)
1 /*
2  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*
7  * Copyright 1994 James Clark
8  * See the file COPYING for copying permission.
9  */
10 
11 #pragma ident	"%Z%%M%	%I%	%E% SMI"
12 
13 #ifndef _MODEINFO_H
14 #define	_MODEINFO_H
15 
16 #ifndef ModeInfo_INCLUDED
17 #define	ModeInfo_INCLUDED 1
18 #ifdef __GNUG__
19 #pragma interface
20 #endif
21 
22 #include <stdlib.h>
23 #include "Boolean.h"
24 #include "Syntax.h"
25 #include "Mode.h"
26 #include "Priority.h"
27 
28 #ifdef SP_NAMESPACE
29 namespace SP_NAMESPACE {
30 #endif
31 
32 struct TokenInfo {
33 	enum Type {
34 		delimType,
35 		setType,
36 		functionType,
37 		delimDelimType,
38 		delimSetType
39 		};
40 	Type type;
41 	Priority::Type priority;
42 	Token token;
43 	Syntax::DelimGeneral delim1;
44 	union {
45 		Syntax::DelimGeneral delim2;
46 		Syntax::Set set;
47 		Syntax::StandardFunction function;
48 	};
49 };
50 
51 class Sd;
52 struct PackedTokenInfo;
53 
54 class ModeInfo {
55 public:
56 	ModeInfo(Mode mode, const Sd &sd);
57 	Boolean nextToken(TokenInfo *);
58 	Boolean includesShortref() const;
59 private:
60 	Mode mode_;
61 	const PackedTokenInfo *p_;		// points to next
62 	size_t count_;
63 	unsigned missingRequirements_;
64 };
65 
includesShortref()66 inline Boolean ModeInfo::includesShortref() const
67 {
68 	return (mode_ >= (enum Mode) minShortrefMode);
69 }
70 
71 #ifdef SP_NAMESPACE
72 }
73 #endif
74 
75 #endif /* not ModeInfo_INCLUDED */
76 
77 #endif /* _MODEINFO_H */
78