2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: SgmlsEventHandler.h /main/1 1996/07/29 17:04:25 cde-hp $ */
24 // Copyright (c) 1994 James Clark
25 // See the file COPYING for copying permission.
27 #ifndef SgmlsEventHandler_INCLUDED
28 #define SgmlsEventHandler_INCLUDED 1
34 #include "OutputCharStream.h"
35 #include "StringSet.h"
40 #include "LinkProcess.h"
42 #include "ErrorCountEventHandler.h"
45 namespace SP_NAMESPACE {
49 struct StorageObjectSpec;
51 class SgmlsSubdocState {
54 SgmlsSubdocState(const SgmlParser *);
55 void init(const SgmlParser *);
56 void swap(SgmlsSubdocState &);
58 const SgmlParser *parser_;
59 StringSet definedEntities_;
60 StringSet definedNotations_;
61 Boolean haveLinkProcess_;
62 LinkProcess linkProcess_;
64 SgmlsSubdocState(const SgmlsSubdocState &); // undefined
65 void operator=(const SgmlsSubdocState &); // undefined
68 class SgmlsEventHandler : public ErrorCountEventHandler,
69 private SgmlsSubdocState, private Messenger {
76 outputNotationSysid = 020
79 SgmlsEventHandler(const SgmlParser *,
82 unsigned outputFlags);
84 void data(DataEvent *);
85 void startElement(StartElementEvent *);
86 void endElement(EndElementEvent *);
88 void sdataEntity(SdataEntityEvent *);
89 void externalDataEntity(ExternalDataEntityEvent *);
90 void subdocEntity(SubdocEntityEvent *);
91 void appinfo(AppinfoEvent *);
92 void uselink(UselinkEvent *);
93 void sgmlDecl(SgmlDeclEvent *);
94 void endProlog(EndPrologEvent *);
95 void message(MessageEvent *);
96 void entityDefaulted(EntityDefaultedEvent *event);
98 void dispatchMessage(const Message &);
99 void dispatchMessage(Message &);
100 void initMessage(Message &);
102 SgmlsEventHandler(const SgmlsEventHandler &); // undefined
103 void operator=(const SgmlsEventHandler &); // undefined
105 void attributes(const AttributeList &attributes, char code,
106 const StringC *ownerName);
107 void startAttribute(const StringC &name, char code,
108 const StringC *ownerName);
109 void defineEntity(const Entity *entity);
110 void defineExternalDataEntity(const ExternalDataEntity *entity);
111 void defineSubdocEntity(const SubdocEntity *entity);
112 void defineExternalTextEntity(const ExternalEntity *entity);
113 void defineInternalEntity(const InternalEntity *entity);
114 void defineNotation(const Notation *notation);
115 void externalId(const ExternalId &id, Boolean outputFile = 1);
116 Boolean markEntity(const Entity *);
117 Boolean markNotation(const Notation *);
121 void outputLocation(const Location &loc);
122 void outputLocation1(const Location &loc);
123 void outputString(const StringC &str);
124 void outputString(const Char *, size_t);
125 static void escape(OutputCharStream &, Char);
127 OutputCharStream &os();
129 Messenger *messenger_;
130 Location currentLocation_;
131 OutputCharStream *os_;
134 ConstPtr<Syntax> syntax_;
135 const StorageObjectSpec *lastSos_;
136 unsigned long lastLineno_;
138 PackedBoolean outputLine_;
139 PackedBoolean outputIncluded_;
140 PackedBoolean outputEntity_;
141 PackedBoolean outputId_;
142 PackedBoolean outputNotationSysid_;
146 void SgmlsEventHandler::outputString(const StringC &str)
148 outputString(str.data(), str.size());
152 OutputCharStream &SgmlsEventHandler::os()
161 #endif /* not SgmlsEventHandler_INCLUDED */