3065 some functions in the tcp module can be static
[unleashed.git] / usr / src / cmd / man / src / util / nsgmls.src / include / ContentState.h
blob888918794374f4cb58e2eb3685b7a62fb0371d5e
1 // Copyright (c) 1994, 1996 James Clark
2 // See the file COPYING for copying permission.
3 #pragma ident "%Z%%M% %I% %E% SMI"
5 #ifndef ContentState_INCLUDED
6 #define ContentState_INCLUDED 1
8 #ifdef __GNUG__
9 #pragma interface
10 #endif
12 #include <stddef.h>
13 #include "OpenElement.h"
14 #include "IList.h"
15 #include "Vector.h"
16 #include "Message.h"
17 #include "Dtd.h"
18 #include "Mode.h"
19 #include "Boolean.h"
21 #ifdef SP_NAMESPACE
22 namespace SP_NAMESPACE {
23 #endif
25 class SP_API ContentState {
26 public:
27 ContentState();
28 void startContent(const Dtd &);
29 void pushElement(OpenElement *);
30 OpenElement *popSaveElement();
31 void popElement();
32 OpenElement &currentElement();
33 const OpenElement &currentElement() const;
34 void getOpenElementInfo(Vector<OpenElementInfo> &,
35 const StringC &rniPcdata) const;
36 unsigned tagLevel() const;
37 Boolean elementIsIncluded(const ElementType *) const;
38 Boolean elementIsExcluded(const ElementType *) const;
39 Boolean elementIsOpen(const ElementType *) const;
40 Boolean afterDocumentElement() const;
41 const ElementType *lastEndedElementType() const;
42 Mode contentMode() const;
43 ElementType *lookupCreateUndefinedElement(const StringC &,
44 const Location &,
45 Dtd &);
46 Boolean checkImplyLoop(unsigned);
47 static const ShortReferenceMap theEmptyMap;
48 private:
49 IList<OpenElement> openElements_;
50 Vector<unsigned> openElementCount_;
51 Vector<unsigned> includeCount_;
52 Vector<unsigned> excludeCount_;
53 unsigned totalExcludeCount_;
54 unsigned tagLevel_;
55 unsigned netEnablingCount_;
56 unsigned long nextIndex_;
57 const ElementType *lastEndedElementType_;
58 ElementType documentElementContainer_;
61 inline
62 OpenElement &ContentState::currentElement()
64 return *openElements_.head();
67 inline
68 const OpenElement &ContentState::currentElement() const
70 return *openElements_.head();
73 inline
74 Boolean ContentState::elementIsOpen(const ElementType *e) const
76 return openElementCount_[e->index()] != 0;
79 inline
80 Boolean ContentState::elementIsIncluded(const ElementType *e) const
82 return includeCount_[e->index()] != 0 && excludeCount_[e->index()] == 0;
85 inline
86 Boolean ContentState::elementIsExcluded(const ElementType *e) const
88 return excludeCount_[e->index()] != 0;
91 inline
92 const ElementType *ContentState::lastEndedElementType() const
94 return lastEndedElementType_;
97 inline
98 unsigned ContentState::tagLevel() const
100 return tagLevel_;
103 inline
104 Boolean ContentState::afterDocumentElement() const
106 return tagLevel() == 0 && currentElement().isFinished();
109 inline
110 Mode ContentState::contentMode() const
112 return openElements_.head()->mode(netEnablingCount_ > 0);
115 #ifdef SP_NAMESPACE
117 #endif
119 #endif /* not ContentState_INCLUDED */