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: SGMLApplication.h /main/1 1996/07/29 17:03:14 cde-hp $ */
24 // Copyright (c) 1995 James Clark
25 // See the file COPYING for copying permission.
27 #ifndef SGMLApplication_INCLUDED
28 #define SGMLApplication_INCLUDED 1
37 #define SP_API /* as nothing */
40 class SP_API SGMLApplication {
43 typedef unsigned short Char;
45 typedef unsigned char Char;
47 // A Position represents a position in an OpenEntity.
48 // The meaning of a Position depends on the
49 // particular implementation of OpenEntity.
50 // It might be a line number or it might be
51 // an offset in the entity. The only thing
52 // that can be done with Position is to use
53 // it with an OpenEntityPtr to get a Location.
54 typedef unsigned long Position;
62 bool haveGeneratedSystemId;
63 CharString systemId; // valid only if haveSystemId is true
64 CharString publicId; // valid only if havePublicId is true
65 CharString generatedSystemId; // valid if haveGeneratedSystemId is true
69 ExternalId externalId;
74 enum DataType { sgml, cdata, sdata, ndata, subdoc, pi };
75 enum DeclType { general, parameter, doctype, linktype };
79 // Following valid if isInternal is true
81 // Following valid if isInternal is false
82 ExternalId externalId;
84 const Attribute *attributes;
97 specified, // not defaulted
98 definition, // defaulted from definition
99 current // defaulted from current value
101 Defaulted defaulted; // non-ESIS; valid only if type != implied
105 CharString entityName; // non-ESIS; optional for SDATA chunks
107 // Following valid if type == cdata
109 const CdataChunk *cdataChunks; // valid if type == cdata
110 // Following valid if type == tokenized
111 CharString tokens; // separated by spaces
112 bool isId; // non-ESIS (probably)
113 bool isGroup; // non-ESIS
115 const Entity *entities;
116 // length of notation.name will be 0 if no notation
122 CharString entityName; // non-ESIS; optional for PI entities
124 struct StartElementEvent {
127 empty, // declared EMPTY or with CONREF attribute
134 ContentType contentType; // non-ESIS
135 bool included; // non-ESIS
137 const Attribute *attributes;
140 struct EndElementEvent {
151 CharString entityName; // non-ESIS; optional
153 struct ExternalDataEntityRefEvent {
157 struct SubdocEntityRefEvent {
164 info, // not an error
165 warning, // not an error
174 struct AppinfoEvent {
179 struct StartDtdEvent {
183 ExternalId externalId;
189 struct EndPrologEvent {
193 struct GeneralEntityEvent {
198 struct CommentDeclEvent {
201 const CharString *comments;
202 const CharString *seps;
205 struct MarkedSectionStartEvent {
224 CharString entityName;
230 struct MarkedSectionEndEvent {
240 struct IgnoredCharsEvent {
245 struct SP_API Location {
247 Location(const OpenEntityPtr &, Position);
250 unsigned long lineNumber;
251 unsigned long columnNumber;
252 unsigned long byteOffset;
253 unsigned long entityOffset;
254 CharString entityName;
259 class SP_API OpenEntityPtr {
262 OpenEntityPtr(const OpenEntityPtr &);
263 void operator=(const OpenEntityPtr &);
264 void operator=(OpenEntity *);
266 const OpenEntity *operator->() const;
267 operator int() const;
271 class SP_API OpenEntity {
274 virtual ~OpenEntity();
275 virtual Location location(Position) const = 0;
277 OpenEntity(const OpenEntity &); // undefined
278 void operator=(const OpenEntity &); // undefined
280 friend class OpenEntityPtr;
282 virtual ~SGMLApplication();
283 virtual void appinfo(const AppinfoEvent &);
284 virtual void startDtd(const StartDtdEvent &);
285 virtual void endDtd(const EndDtdEvent &);
286 virtual void endProlog(const EndPrologEvent &);
287 virtual void startElement(const StartElementEvent &);
288 virtual void endElement(const EndElementEvent &);
289 virtual void data(const DataEvent &);
290 virtual void sdata(const SdataEvent &);
291 virtual void pi(const PiEvent &);
292 virtual void externalDataEntityRef(const ExternalDataEntityRefEvent &);
293 virtual void subdocEntityRef(const SubdocEntityRefEvent &);
294 virtual void commentDecl(const CommentDeclEvent &);
295 virtual void markedSectionStart(const MarkedSectionStartEvent &);
296 virtual void markedSectionEnd(const MarkedSectionEndEvent &);
297 virtual void ignoredChars(const IgnoredCharsEvent &);
298 virtual void generalEntity(const GeneralEntityEvent &);
299 virtual void error(const ErrorEvent &);
300 virtual void openEntityChange(const OpenEntityPtr &);
304 const SGMLApplication::OpenEntity *
305 SGMLApplication::OpenEntityPtr::operator->() const
311 void SGMLApplication::OpenEntityPtr::operator=(const OpenEntityPtr &ptr)
317 SGMLApplication::OpenEntityPtr::operator int() const
322 #endif /* not SGMLApplication_INCLUDED */