nsgmls: fix up some gcc 4.8 warnings.
[oweals/cde.git] / cde / programs / nsgmls / Event.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
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)
10  * any later version.
11  *
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
16  * details.
17  *
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
22  */
23 /* $XConsortium: Event.h /main/1 1996/07/29 16:51:20 cde-hp $ */
24 // Copyright (c) 1994 James Clark
25 // See the file COPYING for copying permission.
26
27 #ifndef Event_INCLUDED
28 #define Event_INCLUDED 1
29 #ifdef __GNUG__
30 #pragma interface
31 #endif
32
33 #include "Link.h"
34 #include "Allocator.h"
35 #include "Location.h"
36 #include "Vector.h"
37 #include "Owner.h"
38 #include "Boolean.h"
39 #include "types.h"
40 #include "Ptr.h"
41 #include "StringC.h"
42 #include "Notation.h"
43 #include "Sd.h"
44 #include "Syntax.h"
45 #include "Dtd.h"
46 #include "ElementType.h"
47 #include "Text.h"
48 #include "Lpd.h"
49 #include "Message.h"
50 #include "Markup.h"
51 #include "ShortReferenceMap.h"
52
53 #ifdef SP_NAMESPACE
54 namespace SP_NAMESPACE {
55 #endif
56
57 class EventHandler;
58
59 class SP_API Event : public Link {
60 public:
61   enum Type {
62     message,
63     characterData,
64     startElement,
65     endElement,
66     pi,
67     sdataEntity,
68     externalDataEntity,
69     subdocEntity,
70     appinfo,
71     startDtd,
72     endDtd,
73     startLpd,
74     endLpd,
75     endProlog,
76     sgmlDecl,
77     uselink,
78     usemap,
79     commentDecl,
80     sSep,
81     ignoredRs,
82     ignoredRe,
83     reOrigin,
84     ignoredChars,
85     markedSectionStart,
86     markedSectionEnd,
87     entityStart,
88     entityEnd,
89     notationDecl,
90     entityDecl,
91     elementDecl,
92     attlistDecl,                // not #NOTATION and not in LPD
93     attlistNotationDecl,
94     linkAttlistDecl,
95     linkDecl,
96     idLinkDecl,
97     shortrefDecl,
98     ignoredMarkup,
99     entityDefaulted,
100     sgmlDeclEntity
101     };
102   Event(Type);
103   virtual void handle(EventHandler &) = 0;
104   virtual void copyData();
105   void *operator new(size_t sz, Allocator &alloc) { return alloc.alloc(sz); }
106   void *operator new(size_t sz) { return Allocator::allocSimple(sz); }
107   void operator delete(void *p) { Allocator::free(p); }
108   Type type() const;
109 private:
110   Event(const Event &);         // undefined
111   void operator=(const Event &); // undefined
112   Type type_;
113 };
114
115 class LocatedEvent : public Event {
116 public:
117   LocatedEvent(Type type, const Location &);
118   const Location &location() const;
119 private:
120   LocatedEvent(const LocatedEvent &); // undefined
121   void operator=(const LocatedEvent &); // undefined
122   Location location_;
123 };
124
125 class MarkupEvent : public LocatedEvent {
126 public:
127   MarkupEvent(Type type);
128   MarkupEvent(Type type, const Location &, Markup *);
129   const Markup &markup() const;
130 private:
131   MarkupEvent(const MarkupEvent &); // undefined
132   void operator=(const MarkupEvent &);  // undefined
133   Markup markup_;
134 };
135
136 class SP_API MessageEvent : public Event {
137 public:
138   MessageEvent(Message &);
139   MessageEvent(const Message &);
140   const Message &message() const;
141   void handle(EventHandler &);
142 private:
143   MessageEvent(const MessageEvent &); // undefined
144   void operator=(const MessageEvent &); // undefined
145   Message message_;
146 };
147
148 class AttributeList;
149
150 class StartElementEvent : public LocatedEvent {
151 public:
152   StartElementEvent(const ElementType *,
153                     const ConstPtr<Dtd> &,
154                     AttributeList *,
155                     const Location &,
156                     Markup *);
157   ~StartElementEvent();
158   void handle(EventHandler &);
159   Boolean mustOmitEnd() const;
160   void setIncluded();
161   Boolean included() const;
162   const StringC &name() const;
163   const ElementType *elementType() const;
164   const Markup *markupPtr() const;
165   const AttributeList &attributes() const;
166   void copyData();
167 private:
168   StartElementEvent(const StartElementEvent &); // undefined
169   void operator=(const StartElementEvent &);    // undefined
170   const ElementType *elementType_;
171   ConstPtr<Dtd> dtd_;
172   PackedBoolean included_;
173   PackedBoolean copied_;        // has copyData() been called
174   Markup *markup_;
175   AttributeList *attributes_;
176 };
177
178 class EndElementEvent : public LocatedEvent {
179 public:
180   EndElementEvent(const ElementType *,
181                   const ConstPtr<Dtd> &,
182                   const Location &,
183                   Markup *);
184   ~EndElementEvent();
185   void handle(EventHandler &);
186   void setIncluded();
187   Boolean included() const;
188   const StringC &name() const;
189   const ElementType *elementType() const;
190   const Markup *markupPtr() const;
191   void copyData();
192 private:
193   EndElementEvent(const EndElementEvent &); // undefined
194   void operator=(const EndElementEvent &);  // undefined
195   const ElementType *elementType_;
196   ConstPtr<Dtd> dtd_;
197   PackedBoolean included_;
198   PackedBoolean copied_;        // has copyData() been called
199   Markup *markup_;
200 };
201
202 class DataEvent : public LocatedEvent {
203 public:
204   DataEvent(Type, const Char *, size_t, const Location &);
205   void handle(EventHandler &);
206   const Char *data() const;
207   size_t dataLength() const;
208   virtual Boolean isRe(unsigned long &serial) const;
209   virtual const Entity *entity() const;
210 protected:
211   const Char *p_;
212   size_t length_;
213 private:
214   DataEvent(const DataEvent &); // undefined
215   void operator=(const DataEvent &); // undefined
216 };
217
218 class ImmediateDataEvent : public DataEvent {
219 public:
220   ImmediateDataEvent(Type type, const Char *, size_t, const Location &,
221                      Boolean copy);
222   ~ImmediateDataEvent();
223   void copyData();
224 private:
225   ImmediateDataEvent(const ImmediateDataEvent &); // undefined
226   void operator=(const ImmediateDataEvent &);     // undefined
227   Char *alloc_;
228 };
229
230 class InternalDataEntity;
231
232 class DataEntityEvent : public DataEvent {
233 public:
234   DataEntityEvent(Type type, const InternalEntity *,
235                   const ConstPtr<Origin> &);
236   const Entity *entity() const;
237 private:
238   DataEntityEvent(const DataEntityEvent &); // undefined
239   void operator=(const DataEntityEvent &);  // undefined
240 };
241
242 class InternalCdataEntity;
243
244 class CdataEntityEvent : public DataEntityEvent {
245 public:
246   CdataEntityEvent(const InternalEntity *,
247                    const ConstPtr<Origin> &);
248 private:
249   CdataEntityEvent(const CdataEntityEvent &); // undefined
250   void operator=(const CdataEntityEvent &);   // undefined
251 };
252
253 class InternalSdataEntity;
254
255 class SdataEntityEvent : public DataEntityEvent {
256 public:
257   SdataEntityEvent(const InternalEntity *,
258                    const ConstPtr<Origin> &);
259   void handle(EventHandler &);
260 private:
261   SdataEntityEvent(const SdataEntityEvent &); // undefined
262   void operator=(const SdataEntityEvent &);   // undefined
263 };
264
265 class PiEntity;
266
267 class PiEvent : public LocatedEvent {
268 public:
269   PiEvent(const Char *, size_t, const Location &);
270   const Char *data() const;
271   size_t dataLength() const;
272   virtual const Entity *entity() const;
273   void handle(EventHandler &);
274 private:
275   PiEvent(const PiEvent &);     // undefined
276   void operator=(const PiEvent &); // undefined
277   const Char *data_;
278   size_t dataLength_;
279 };
280
281 class ImmediatePiEvent : public PiEvent {
282 public:
283   ImmediatePiEvent(StringC &, const Location &);
284 private:
285   ImmediatePiEvent(const ImmediatePiEvent &); // undefined
286   void operator=(const ImmediatePiEvent &);   // undefined
287   StringC string_;
288 };
289
290 class PiEntityEvent : public PiEvent {
291 public:
292   PiEntityEvent(const PiEntity *entity,
293                 const ConstPtr<Origin> &origin);
294   const Entity *entity() const;
295 private:
296   PiEntityEvent(const PiEntityEvent &); // undefined
297   void operator=(const PiEntityEvent &); // undefined
298 };
299
300 class ExternalNonTextEntity;
301 class ExternalDataEntity;
302 class SubdocEntity;
303
304 class ExternalEntityEvent : public Event {
305 public:
306   ExternalEntityEvent(Type type,
307                       const ConstPtr<EntityOrigin> &);
308   const ConstPtr<EntityOrigin> &entityOrigin() const;
309   const Location &location() const;
310 private:
311   ExternalEntityEvent(const ExternalEntityEvent &); // undefined
312   void operator=(const ExternalEntityEvent &);      // undefined
313   ConstPtr<EntityOrigin> origin_;
314 };
315
316 class ExternalDataEntityEvent : public ExternalEntityEvent {
317 public:
318   ExternalDataEntityEvent(const ExternalDataEntity *,
319                           const ConstPtr<EntityOrigin> &);
320   void handle(EventHandler &);
321   const ExternalDataEntity *entity() const;
322 private:
323   ExternalDataEntityEvent(const ExternalDataEntityEvent &); // undefined
324   void operator=(const ExternalDataEntityEvent &);          // undefined
325   const ExternalDataEntity *dataEntity_;
326 };
327
328 class SubdocEntityEvent : public ExternalEntityEvent {
329 public:
330   SubdocEntityEvent(const SubdocEntity *,
331                     const ConstPtr<EntityOrigin> &);
332   void handle(EventHandler &);
333   const SubdocEntity *entity() const;
334 private:
335   SubdocEntityEvent(const SubdocEntityEvent &); // undefined
336   void operator=(const SubdocEntityEvent &);    // undefined
337   const SubdocEntity *subdocEntity_;
338 };
339
340 class AppinfoEvent : public LocatedEvent {
341 public:
342   AppinfoEvent(const Location &);
343   AppinfoEvent(const Text &, const Location &);
344   void handle(EventHandler &);
345   Boolean literal(const StringC *&) const;
346 private:
347   AppinfoEvent(const AppinfoEvent &); // undefined
348   void operator=(const AppinfoEvent &); // undefined
349   Boolean appinfoNone_;
350   Text appinfo_;
351 };
352
353 class UselinkEvent : public MarkupEvent {
354 public:
355   UselinkEvent(const ConstPtr<Lpd> &,
356                const LinkSet *,
357                Boolean restore,
358                const Location &,
359                Markup *);
360   void handle(EventHandler &);
361   const ConstPtr<Lpd> &lpd() const;
362   const LinkSet *linkSet() const;
363   Boolean restore() const;
364 private:
365   UselinkEvent(const UselinkEvent &); // undefined
366   void operator=(const UselinkEvent &); // undefined
367   ConstPtr<Lpd> lpd_;
368   const LinkSet *linkSet_;
369   Boolean restore_;
370 };
371
372 class UsemapEvent : public MarkupEvent {
373 public:
374   UsemapEvent(const ShortReferenceMap *,
375               Vector<const ElementType *> &,
376               const ConstPtr<Dtd> &,
377               const Location &,
378               Markup *);
379   void handle(EventHandler &);
380   const ShortReferenceMap *map() const;
381   const Vector<const ElementType *> &elements() const;
382 private:
383   UsemapEvent(const UsemapEvent &); // undefined
384   void operator=(const UsemapEvent &); // undefined
385   ConstPtr<Dtd> dtd_;
386   Vector<const ElementType *> elements_;
387   const ShortReferenceMap *map_;
388 };
389
390 class StartSubsetEvent : public MarkupEvent {
391 public:
392   StartSubsetEvent(Type,
393                    const StringC &,
394                    const ConstPtr<Entity> &entity,
395                    Boolean hasInternalSubset,
396                    const Location &,
397                    Markup *);
398   const StringC &name() const;
399   const ConstPtr<Entity> &entity() const;
400   Boolean hasInternalSubset() const;
401 private:
402   StartSubsetEvent(const StartSubsetEvent &);   // undefined
403   void operator=(const StartSubsetEvent &); // undefined
404   StringC name_;
405   ConstPtr<Entity> entity_;
406   Boolean hasInternalSubset_;
407 };
408
409 class StartDtdEvent : public StartSubsetEvent {
410 public:
411   StartDtdEvent(const StringC &,
412                 const ConstPtr<Entity> &entity,
413                 Boolean hasInternalSubset,
414                 const Location &,
415                 Markup *);
416   void handle(EventHandler &);
417 private:
418   StartDtdEvent(const StartDtdEvent &); // undefined
419   void operator=(const StartDtdEvent &); // undefined
420 };
421
422 class StartLpdEvent : public StartSubsetEvent {
423 public:
424   StartLpdEvent(Boolean active,
425                 const StringC &,
426                 const ConstPtr<Entity> &entity,
427                 Boolean hasInternalSubset,
428                 const Location &,
429                 Markup *);
430   void handle(EventHandler &);
431   Boolean active() const;
432 private:
433   StartLpdEvent(const StartLpdEvent &); // undefined
434   void operator=(const StartLpdEvent &); // undefined
435   Boolean active_;
436 };
437
438 class EndDtdEvent : public MarkupEvent {
439 public:
440   EndDtdEvent(const ConstPtr<Dtd> &, const Location &,
441               Markup *);
442   void handle(EventHandler &);
443   const Dtd &dtd() const;
444   const ConstPtr<Dtd> &dtdPointer() const;
445 private:
446   EndDtdEvent(const EndDtdEvent &); // undefined
447   void operator=(const EndDtdEvent &); // undefined
448   ConstPtr<Dtd> dtd_;
449 };
450
451 class EndLpdEvent : public MarkupEvent {
452 public:
453   EndLpdEvent(const ConstPtr<Lpd> &, const Location &,
454               Markup *);
455   void handle(EventHandler &);
456   const Lpd &lpd() const;
457   const ConstPtr<Lpd> &lpdPointer() const;
458 private:
459   EndLpdEvent(const EndLpdEvent &); // undefined
460   void operator=(const EndLpdEvent &); // undefined
461   ConstPtr<Lpd> lpd_;
462 };
463
464 class EndPrologEvent : public LocatedEvent {
465 public:
466   EndPrologEvent(const ConstPtr<Dtd> &dtd,
467                  const ConstPtr<ComplexLpd> &lpd,
468                  Vector<StringC> &simpleLinkNames,
469                  Vector<AttributeList> &simpleLinkAttributes,
470                  const Location &);
471   EndPrologEvent(const ConstPtr<Dtd> &dtd,
472                  const Location &);
473   void handle(EventHandler &);
474   const Dtd &dtd() const;
475   const ConstPtr<Dtd> &dtdPointer() const;
476   const ConstPtr<ComplexLpd> &lpdPointer() const;
477   const Vector<StringC> &simpleLinkNames() const;
478   const Vector<AttributeList> &simpleLinkAttributes() const;
479 private:
480   EndPrologEvent(const EndPrologEvent &); // undefined
481   void operator=(const EndPrologEvent &); // undefined
482   ConstPtr<Dtd> dtd_;
483   ConstPtr<ComplexLpd> lpd_;
484   Vector<StringC> simpleLinkNames_;
485   Vector<AttributeList> simpleLinkAttributes_;
486 };
487
488 class SgmlDeclEvent : public MarkupEvent {
489 public:
490   // for an implied SGML declaration
491   SgmlDeclEvent(const ConstPtr<Sd> &,
492                 const ConstPtr<Syntax> &syntax);
493   // for an explicit SGML declaration
494   SgmlDeclEvent(const ConstPtr<Sd> &,
495                 const ConstPtr<Syntax> &syntax,
496                 const ConstPtr<Syntax> &instanceSyntax,
497                 const ConstPtr<Sd> &refSd,
498                 const ConstPtr<Syntax> &refSyntax,
499                 Index nextIndex,
500                 const StringC &implySystemId,
501                 const Location &,
502                 Markup *);
503   void handle(EventHandler &);
504   const Sd &sd() const;
505   const ConstPtr<Sd> &sdPointer() const;
506   const Syntax &prologSyntax() const;
507   const ConstPtr<Syntax> &prologSyntaxPointer() const;
508   const Syntax &instanceSyntax() const;
509   const ConstPtr<Syntax> &instanceSyntaxPointer() const;
510   const ConstPtr<Sd> &refSdPointer() const;
511   const ConstPtr<Syntax> &refSyntaxPointer() const;
512   const StringC &implySystemId() const;
513 private:
514   SgmlDeclEvent(const SgmlDeclEvent &); // undefined
515   void operator=(const SgmlDeclEvent &); // undefined
516   ConstPtr<Sd> sd_;
517   ConstPtr<Syntax> prologSyntax_;
518   ConstPtr<Syntax> instanceSyntax_;
519   ConstPtr<Sd> refSd_;
520   ConstPtr<Syntax> refSyntax_;
521   Index nextIndex_;
522   StringC implySystemId_;
523 };
524
525 class CommentDeclEvent : public MarkupEvent {
526 public:
527   CommentDeclEvent(const Location &, Markup *);
528   void handle(EventHandler &);
529 private:
530   CommentDeclEvent(const CommentDeclEvent &); // undefined
531   void operator=(const CommentDeclEvent &);   // undefined
532 };
533
534 class SSepEvent : public ImmediateDataEvent {
535 public:
536   SSepEvent(const Char *, size_t, const Location &, Boolean copy);
537   void handle(EventHandler &);
538 private:
539   SSepEvent(const SSepEvent &); // undefined
540   void operator=(const SSepEvent &); // undefined
541 };
542
543 class IgnoredRsEvent : public LocatedEvent {
544 public:
545   IgnoredRsEvent(Char c, const Location &);
546   void handle(EventHandler &);
547   Char rs() const;
548 private:
549   IgnoredRsEvent(const IgnoredRsEvent &); // undefined
550   void operator=(const IgnoredRsEvent &); // undefined
551   Char c_;
552 };
553
554 class IgnoredReEvent : public LocatedEvent {
555 public:
556   IgnoredReEvent(Char c, const Location &, unsigned long serial);
557   void handle(EventHandler &);
558   Char re() const;
559   unsigned long serial() const;
560 private:
561   IgnoredReEvent(const IgnoredReEvent &); // undefined
562   void operator=(const IgnoredReEvent &); // undefined
563   unsigned long serial_;
564   Char c_;
565 };
566
567 class ReEvent : public ImmediateDataEvent {
568 public:
569   ReEvent(const Char *, const Location &, unsigned long serial);
570   Boolean isRe(unsigned long &serial) const;
571 private:
572   ReEvent(const ReEvent &);     // undefined
573   void operator=(const ReEvent &); // undefined
574   unsigned long serial_;
575 };
576
577 class ReOriginEvent : public LocatedEvent {
578 public:
579   ReOriginEvent(Char c, const Location &, unsigned long serial);
580   void handle(EventHandler &);
581   Char re() const;
582   unsigned long serial() const;
583 private:
584   ReOriginEvent(const ReOriginEvent &); // undefined
585   void operator=(const ReOriginEvent &); // undefined
586   unsigned long serial_;
587   Char c_;
588 };
589
590 class IgnoredCharsEvent : public ImmediateDataEvent {
591 public:
592   IgnoredCharsEvent(const Char *, size_t, const Location &, Boolean copy);
593   void handle(EventHandler &);
594 private:
595   IgnoredCharsEvent(const IgnoredCharsEvent &); // undefined
596   void operator=(const IgnoredCharsEvent &);    // undefined
597 };
598
599 class MarkedSectionEvent : public MarkupEvent {
600 public:
601   enum Status { include, rcdata, cdata, ignore }; // in priority order
602   MarkedSectionEvent(Type, Status, const Location &, Markup *);
603   Status status() const;
604 private:
605   MarkedSectionEvent(const MarkedSectionEvent &); // undefined
606   void operator=(const MarkedSectionEvent &);     // undefined
607   Status status_;
608 };
609
610 class MarkedSectionStartEvent : public MarkedSectionEvent {
611 public:
612   MarkedSectionStartEvent(Status, const Location &, Markup *);
613   void handle(EventHandler &);
614 private:
615   MarkedSectionStartEvent(const MarkedSectionStartEvent &); // undefined
616   void operator=(const MarkedSectionStartEvent &);          // undefined
617 };
618
619 class MarkedSectionEndEvent : public MarkedSectionEvent {
620 public:
621   MarkedSectionEndEvent(Status, const Location &, Markup *);
622   void handle(EventHandler &);
623 private:
624   MarkedSectionEndEvent(const MarkedSectionEndEvent &); // undefined
625   void operator=(const MarkedSectionEndEvent &);            // undefined
626 };
627
628 class EntityStartEvent : public Event {
629 public:
630   EntityStartEvent(const ConstPtr<EntityOrigin> &origin);
631   void handle(EventHandler &);
632   const Entity *entity() const;
633   const ConstPtr<EntityOrigin> &entityOrigin() const;
634 private:
635   EntityStartEvent(const EntityStartEvent &); // undefined
636   void operator=(const EntityStartEvent &); // undefined
637
638   ConstPtr<EntityOrigin> origin_;
639 };
640
641 class EntityEndEvent : public LocatedEvent {
642 public:
643   EntityEndEvent(const Location &);
644   void handle(EventHandler &);
645 private:
646   EntityEndEvent(const EntityEndEvent &); // undefined
647   void operator=(const EntityEndEvent &); // undefined
648 };
649
650 class EntityDeclEvent : public MarkupEvent {
651 public:
652   EntityDeclEvent(const ConstPtr<Entity> &,
653                   Boolean ignored,
654                   const Location &,
655                   Markup *);
656   void handle(EventHandler &);
657   const Entity &entity() const;
658   const ConstPtr<Entity> &entityPointer() const;
659   Boolean ignored() const;
660   // The name of the entity will be empty if this is the default entity.
661 private:
662   Boolean ignored_;
663   // This will actually point to an external entity.
664   ConstPtr<Entity> entity_;
665 };
666
667 class NotationDeclEvent : public MarkupEvent {
668 public:
669   NotationDeclEvent(const ConstPtr<Notation> &,
670                     const Location &,
671                     Markup *);
672   void handle(EventHandler &);
673   const Notation &notation() const;
674   const ConstPtr<Notation> &notationPointer() const;
675 private:
676   NotationDeclEvent(const NotationDeclEvent &); // undefined
677   void operator=(const NotationDeclEvent &);    // undefined
678   ConstPtr<Notation> notation_;
679 };
680
681 class ElementDeclEvent : public MarkupEvent {
682 public:
683   ElementDeclEvent(Vector<const ElementType *> &elements,
684                    const ConstPtr<Dtd> &,
685                    const Location &,
686                    Markup *);
687   void handle(EventHandler &);
688   const Vector<const ElementType *> &elements() const;
689 private:
690   ElementDeclEvent(const ElementDeclEvent &); // undefined
691   void operator=(const ElementDeclEvent &);   // undefined
692   Vector<const ElementType *> elements_;
693   ConstPtr<Dtd> dtd_;
694 };
695
696 class AttlistDeclEvent : public MarkupEvent {
697 public:
698   AttlistDeclEvent(Vector<const ElementType *> &elements,
699                    const ConstPtr<Dtd> &,
700                    const Location &,
701                    Markup *);
702   void handle(EventHandler &);
703   const Vector<const ElementType *> &elements() const;
704 private:
705   AttlistDeclEvent(const AttlistDeclEvent &); // undefined
706   void operator=(const AttlistDeclEvent &);   // undefined
707   Vector<const ElementType *> elements_;
708   ConstPtr<Dtd> dtd_;
709 };
710
711 class AttlistNotationDeclEvent : public MarkupEvent {
712 public:
713   AttlistNotationDeclEvent(Vector<ConstPtr<Notation> > &notations,
714                            const Location &,
715                            Markup *);
716   void handle(EventHandler &);
717   const Vector<ConstPtr<Notation> > &notations() const;
718 private:
719   AttlistNotationDeclEvent(const AttlistNotationDeclEvent &); // undefined
720   void operator=(const AttlistDeclEvent &);                   // undefined
721   Vector<ConstPtr<Notation> > notations_;
722 };
723
724 class LinkAttlistDeclEvent : public MarkupEvent {
725 public:
726   LinkAttlistDeclEvent(Vector<const ElementType *> &elements,
727                        const ConstPtr<Lpd> &,
728                        const Location &,
729                        Markup *);
730   void handle(EventHandler &);
731   const Vector<const ElementType *> &elements() const;
732   const Lpd &lpd() const;
733 private:
734   LinkAttlistDeclEvent(const LinkAttlistDeclEvent &); // undefined
735   void operator=(const LinkAttlistDeclEvent &);   // undefined
736   Vector<const ElementType *> elements_;
737   ConstPtr<Lpd> lpd_;
738 };
739
740 class LinkDeclEvent : public MarkupEvent {
741 public:
742   LinkDeclEvent(const LinkSet *linkSet,
743                 const ConstPtr<ComplexLpd> &,
744                 const Location &,
745                 Markup *);
746   void handle(EventHandler &);
747   const LinkSet *linkSet() const;
748   const ComplexLpd &lpd() const;
749 private:
750   LinkDeclEvent(const LinkDeclEvent &); // undefined
751   void operator=(const LinkDeclEvent &); // undefined
752   const LinkSet *linkSet_;
753   ConstPtr<ComplexLpd> lpd_;
754 };
755
756 class IdLinkDeclEvent : public MarkupEvent {
757 public:
758   IdLinkDeclEvent(const ConstPtr<ComplexLpd> &,
759                   const Location &,
760                   Markup *);
761   void handle(EventHandler &);
762   const ComplexLpd &lpd() const;
763 private:
764   IdLinkDeclEvent(const IdLinkDeclEvent &); // undefined
765   void operator=(const IdLinkDeclEvent &); // undefined
766   ConstPtr<ComplexLpd> lpd_;
767 };
768
769 class ShortrefDeclEvent : public MarkupEvent {
770 public:
771   ShortrefDeclEvent(const ShortReferenceMap *,
772                     const ConstPtr<Dtd> &,
773                     const Location &,
774                     Markup *);
775   void handle(EventHandler &);
776   const ShortReferenceMap *map() const;
777 private:
778   ShortrefDeclEvent(const ShortrefDeclEvent &); // undefined
779   void operator=(const ShortrefDeclEvent &);    // undefined
780   const ShortReferenceMap *map_;
781   ConstPtr<Dtd> dtd_;
782 };
783
784 class IgnoredMarkupEvent : public MarkupEvent {
785 public:
786   IgnoredMarkupEvent(const Location &, Markup *);
787   void handle(EventHandler &);
788 private:
789   IgnoredMarkupEvent(const IgnoredMarkupEvent &); // undefined
790   void operator=(const IgnoredMarkupEvent &);     // undefined
791 };
792
793 // This is for an undeclared entity whose first occurrence
794 // is in the instance, when there is a default entity:
795 // ie it extends the namespace of general entities after
796 // the end of the prolog.
797
798 class EntityDefaultedEvent : public LocatedEvent {
799 public:
800   EntityDefaultedEvent(const ConstPtr<Entity> &,
801                        const Location &);
802   void handle(EventHandler &);
803   const Entity &entity() const;
804   const ConstPtr<Entity> &entityPointer() const;
805 private:
806   EntityDefaultedEvent(const EntityDefaultedEvent &); // undefined
807   void operator=(const EntityDefaultedEvent &);       // undefined
808   ConstPtr<Entity> entity_;
809 };
810
811 class SgmlDeclEntityEvent : public LocatedEvent {
812 public:
813   SgmlDeclEntityEvent(const PublicId &publicId,
814                       PublicId::TextClass entityType,
815                       const StringC &effectiveSystemId,
816                       const Location &);
817   void handle(EventHandler &);
818   const PublicId &publicId() const;
819   PublicId::TextClass entityType() const;
820   const StringC &effectiveSystemId() const;
821 private:
822   SgmlDeclEntityEvent(const SgmlDeclEntityEvent &); // undefined
823   void operator=(const SgmlDeclEntityEvent &);      // undefined
824   PublicId publicId_;
825   PublicId::TextClass entityType_;
826   StringC effectiveSystemId_;
827 };
828
829 class SP_API EventHandler {
830 public:
831   virtual ~EventHandler();
832   virtual void message(MessageEvent *) = 0;
833   virtual void data(DataEvent *);
834   virtual void startElement(StartElementEvent *);
835   virtual void endElement(EndElementEvent *);
836   virtual void pi(PiEvent *);
837   virtual void sdataEntity(SdataEntityEvent *);
838   virtual void externalDataEntity(ExternalDataEntityEvent *);
839   virtual void subdocEntity(SubdocEntityEvent *);
840   virtual void appinfo(AppinfoEvent *);
841   virtual void uselink(UselinkEvent *);
842   virtual void usemap(UsemapEvent *);
843   virtual void startDtd(StartDtdEvent *);
844   virtual void endDtd(EndDtdEvent *);
845   virtual void startLpd(StartLpdEvent *);
846   virtual void endLpd(EndLpdEvent *);
847   virtual void endProlog(EndPrologEvent *);
848   virtual void sgmlDecl(SgmlDeclEvent *);
849   virtual void commentDecl(CommentDeclEvent *);
850   virtual void sSep(SSepEvent *);
851   virtual void ignoredRs(IgnoredRsEvent *);
852   virtual void ignoredRe(IgnoredReEvent *);
853   virtual void reOrigin(ReOriginEvent *);
854   virtual void ignoredChars(IgnoredCharsEvent *);
855   virtual void markedSectionStart(MarkedSectionStartEvent *);
856   virtual void markedSectionEnd(MarkedSectionEndEvent *);
857   virtual void entityStart(EntityStartEvent *);
858   virtual void entityEnd(EntityEndEvent *);
859   virtual void notationDecl(NotationDeclEvent *);
860   virtual void entityDecl(EntityDeclEvent *);
861   virtual void elementDecl(ElementDeclEvent *);
862   virtual void attlistDecl(AttlistDeclEvent *);
863   virtual void linkAttlistDecl(LinkAttlistDeclEvent *);
864   virtual void attlistNotationDecl(AttlistNotationDeclEvent *);
865   virtual void linkDecl(LinkDeclEvent *);
866   virtual void idLinkDecl(IdLinkDeclEvent *);
867   virtual void shortrefDecl(ShortrefDeclEvent *);
868   virtual void ignoredMarkup(IgnoredMarkupEvent *);
869   virtual void entityDefaulted(EntityDefaultedEvent *);
870   virtual void sgmlDeclEntity(SgmlDeclEntityEvent *);
871 };
872
873 inline
874 Event::Event(Type type)
875 : type_(type)
876 {
877 }
878
879 inline
880 Event::Type Event::type() const
881 {
882   return type_;
883 }
884
885 inline
886 const Location &LocatedEvent::location() const
887 {
888   return location_;
889 }
890
891 inline
892 const Markup &MarkupEvent::markup() const
893 {
894   return markup_;
895 }
896
897 inline
898 const Message &MessageEvent::message() const
899 {
900   return message_;
901 }
902
903 inline
904 const ElementType *StartElementEvent::elementType() const
905 {
906   return elementType_;
907 }
908
909 inline
910 const StringC &StartElementEvent::name() const
911 {
912   return elementType_->name();
913 }
914
915 inline
916 void StartElementEvent::setIncluded()
917 {
918   included_ = 1;
919 }
920
921 inline
922 Boolean StartElementEvent::included() const
923 {
924   return included_;
925 }
926
927 inline
928 const Markup *StartElementEvent::markupPtr() const
929 {
930   return markup_;
931 }
932
933 inline
934 const AttributeList &StartElementEvent::attributes() const
935 {
936   return *attributes_;
937 }
938
939 inline
940 Boolean StartElementEvent::mustOmitEnd() const
941 {
942   return ((elementType()->definition()->declaredContent()
943            == ElementDefinition::empty)
944           ||  attributes_->conref());
945 }
946
947 inline
948 const ElementType *EndElementEvent::elementType() const
949 {
950   return elementType_;
951 }
952
953 inline
954 const StringC &EndElementEvent::name() const
955 {
956   return elementType_->name();
957 }
958
959 inline
960 void EndElementEvent::setIncluded()
961 {
962   included_ = 1;
963 }
964
965 inline
966 Boolean EndElementEvent::included() const
967 {
968   return included_;
969 }
970
971 inline
972 const Markup *EndElementEvent::markupPtr() const
973 {
974   return markup_;
975 }
976
977 inline
978 const Char *DataEvent::data() const
979 {
980   return p_;
981 }
982
983 inline
984 size_t DataEvent::dataLength() const
985 {
986   return length_;
987 }
988
989 inline
990 const Char *PiEvent::data() const
991 {
992   return data_;
993 }
994
995 inline
996 size_t PiEvent::dataLength() const
997 {
998   return dataLength_;
999 }
1000
1001 inline
1002 const ConstPtr<EntityOrigin> &
1003 ExternalEntityEvent::entityOrigin() const
1004 {
1005   return origin_;
1006 }
1007
1008 inline
1009 const Location &ExternalEntityEvent::location() const
1010 {
1011   return origin_->parent();
1012 }
1013
1014 inline
1015 const ExternalDataEntity *ExternalDataEntityEvent::entity() const
1016 {
1017   return dataEntity_;
1018 }
1019
1020 inline
1021 const SubdocEntity *SubdocEntityEvent::entity() const
1022 {
1023   return subdocEntity_;
1024 }
1025
1026 inline
1027 Boolean AppinfoEvent::literal(const StringC *&p) const
1028 {
1029   int retVal;
1030
1031   if (appinfoNone_)
1032     retVal =  0;
1033   else {
1034     p = &appinfo_.string();
1035     retVal = 1;
1036   }
1037   return retVal;
1038 }
1039
1040 inline
1041 const ConstPtr<Lpd> &UselinkEvent::lpd() const
1042 {
1043   return lpd_;
1044 }
1045
1046 inline
1047 const LinkSet *UselinkEvent::linkSet() const
1048 {
1049   return linkSet_;
1050 }
1051
1052 inline
1053 Boolean UselinkEvent::restore() const
1054 {
1055   return restore_;
1056 }
1057
1058 inline
1059 const ShortReferenceMap *UsemapEvent::map() const
1060 {
1061   return map_;
1062 }
1063
1064 inline
1065 const StringC &StartSubsetEvent::name() const
1066 {
1067   return name_;
1068 }
1069
1070 inline
1071 const ConstPtr<Entity> &StartSubsetEvent::entity() const
1072 {
1073   return entity_;
1074 }
1075
1076 inline
1077 Boolean StartSubsetEvent::hasInternalSubset() const
1078 {
1079   return hasInternalSubset_;
1080 }
1081
1082 inline
1083 Boolean StartLpdEvent::active() const
1084 {
1085   return active_;
1086 }
1087
1088 inline
1089 const Dtd &EndDtdEvent::dtd() const
1090 {
1091   return *dtd_;
1092 }
1093
1094 inline
1095 const ConstPtr<Dtd> &EndDtdEvent::dtdPointer() const
1096 {
1097   return dtd_;
1098 }
1099
1100 inline
1101 const Lpd &EndLpdEvent::lpd() const
1102 {
1103   return *lpd_;
1104 }
1105
1106 inline
1107 const ConstPtr<Lpd> &EndLpdEvent::lpdPointer() const
1108 {
1109   return lpd_;
1110 }
1111
1112 inline
1113 const Dtd &EndPrologEvent::dtd() const
1114 {
1115   return *dtd_;
1116 }
1117
1118 inline
1119 const ConstPtr<Dtd> &EndPrologEvent::dtdPointer() const
1120 {
1121   return dtd_;
1122 }
1123
1124 inline
1125 const ConstPtr<ComplexLpd> &EndPrologEvent::lpdPointer() const
1126 {
1127   return lpd_;
1128 }
1129
1130 inline
1131 const Vector<StringC> &EndPrologEvent::simpleLinkNames() const
1132 {
1133   return simpleLinkNames_;
1134 }
1135
1136 inline
1137 const Vector<AttributeList> &EndPrologEvent::simpleLinkAttributes() const
1138 {
1139   return simpleLinkAttributes_;
1140 }
1141
1142 inline
1143 const Sd &SgmlDeclEvent::sd() const
1144 {
1145   return *sd_;
1146 }
1147
1148 inline
1149 const ConstPtr<Sd> &SgmlDeclEvent::sdPointer() const
1150 {
1151   return sd_;
1152 }
1153
1154 inline
1155 const ConstPtr<Sd> &SgmlDeclEvent::refSdPointer() const
1156 {
1157   return refSd_;
1158 }
1159
1160 inline
1161 const Syntax &SgmlDeclEvent::prologSyntax() const
1162 {
1163   return *prologSyntax_;
1164 }
1165
1166 inline
1167 const ConstPtr<Syntax> &SgmlDeclEvent::prologSyntaxPointer() const
1168 {
1169   return prologSyntax_;
1170 }
1171
1172 inline
1173 const Syntax &SgmlDeclEvent::instanceSyntax() const
1174 {
1175   return *instanceSyntax_;
1176 }
1177
1178 inline
1179 const ConstPtr<Syntax> &SgmlDeclEvent::instanceSyntaxPointer() const
1180 {
1181   return instanceSyntax_;
1182 }
1183
1184 inline
1185 const ConstPtr<Syntax> &SgmlDeclEvent::refSyntaxPointer() const
1186 {
1187   return refSyntax_;
1188 }
1189
1190 inline
1191 const StringC &SgmlDeclEvent::implySystemId() const
1192 {
1193   return implySystemId_;
1194 }
1195
1196 inline
1197 Char IgnoredRsEvent::rs() const
1198 {
1199   return c_;
1200 }
1201
1202 inline
1203 Char IgnoredReEvent::re() const
1204 {
1205   return c_;
1206 }
1207
1208 inline
1209 unsigned long IgnoredReEvent::serial() const
1210 {
1211   return serial_;
1212 }
1213
1214 inline
1215 Char ReOriginEvent::re() const
1216 {
1217   return c_;
1218 }
1219
1220 inline
1221 unsigned long ReOriginEvent::serial() const
1222 {
1223   return serial_;
1224 }
1225
1226 inline
1227 MarkedSectionEvent::Status MarkedSectionEvent::status() const
1228 {
1229   return status_;
1230 }
1231
1232 inline
1233 const Entity *EntityStartEvent::entity() const
1234 {
1235   return origin_->entity().pointer();
1236 }
1237
1238 inline
1239 const ConstPtr<EntityOrigin> &
1240 EntityStartEvent::entityOrigin() const
1241 {
1242   return origin_;
1243 }
1244
1245 inline
1246 const ConstPtr<Entity> &EntityDeclEvent::entityPointer() const
1247 {
1248   return entity_;
1249 }
1250
1251 inline
1252 const Entity &EntityDeclEvent::entity() const
1253 {
1254   return *entity_;
1255 }
1256
1257 inline
1258 Boolean EntityDeclEvent::ignored() const
1259 {
1260   return ignored_;
1261 }
1262
1263 inline
1264 const Notation &NotationDeclEvent::notation() const
1265 {
1266   return *notation_;
1267 }
1268
1269 inline
1270 const ConstPtr<Notation> &NotationDeclEvent::notationPointer() const
1271 {
1272   return notation_;
1273 }
1274
1275 inline
1276 const Vector<const ElementType *> &ElementDeclEvent::elements() const
1277 {
1278   return elements_;
1279 }
1280
1281 inline
1282 const Vector<const ElementType *> &AttlistDeclEvent::elements() const
1283 {
1284   return elements_;
1285 }
1286
1287 inline
1288 const Vector<const ElementType *> &LinkAttlistDeclEvent::elements() const
1289 {
1290   return elements_;
1291 }
1292
1293 inline
1294 const Lpd &LinkAttlistDeclEvent::lpd() const
1295 {
1296   return *lpd_;
1297 }
1298
1299 inline
1300 const LinkSet *LinkDeclEvent::linkSet() const
1301 {
1302   return linkSet_;
1303 }
1304
1305 inline
1306 const ComplexLpd &LinkDeclEvent::lpd() const
1307 {
1308   return *lpd_;
1309 }
1310
1311 inline
1312 const ComplexLpd &IdLinkDeclEvent::lpd() const
1313 {
1314   return *lpd_;
1315 }
1316
1317 inline
1318 const Vector<ConstPtr<Notation> > &
1319 AttlistNotationDeclEvent::notations() const
1320 {
1321   return notations_;
1322 }
1323
1324 inline
1325 const ShortReferenceMap *ShortrefDeclEvent::map() const
1326 {
1327   return map_;
1328 }
1329
1330 inline
1331 const Entity &EntityDefaultedEvent::entity() const
1332 {
1333   return *entity_;
1334 }
1335
1336 inline
1337 const ConstPtr<Entity> &EntityDefaultedEvent::entityPointer()
1338      const
1339 {
1340   return entity_;
1341 }
1342
1343 inline
1344 const PublicId &SgmlDeclEntityEvent::publicId() const
1345 {
1346   return publicId_;
1347 }
1348
1349 inline
1350 PublicId::TextClass SgmlDeclEntityEvent::entityType() const
1351 {
1352   return entityType_;
1353 }
1354
1355 inline
1356 const StringC &SgmlDeclEntityEvent::effectiveSystemId() const
1357 {
1358   return effectiveSystemId_;
1359 }
1360
1361 #ifdef SP_NAMESPACE
1362 }
1363 #endif
1364
1365 #endif /* not Event_INCLUDED */