📄 event.h
字号:
// Copyright (c) 1994 James Clark// See the file COPYING for copying permission.#ifndef Event_INCLUDED#define Event_INCLUDED 1#ifdef __GNUG__#pragma interface#endif#include "Link.h"#include "Allocator.h"#include "Location.h"#include "Vector.h"#include "Owner.h"#include "Boolean.h"#include "types.h"#include "Ptr.h"#include "StringC.h"#include "Notation.h"#include "Sd.h"#include "Syntax.h"#include "Dtd.h"#include "ElementType.h"#include "Text.h"#include "Lpd.h"#include "Message.h"#include "Markup.h"#include "ShortReferenceMap.h"#ifdef SP_NAMESPACEnamespace SP_NAMESPACE {#endifclass EventHandler;class SP_API Event : public Link {public: enum Type { message, characterData, startElement, endElement, pi, sdataEntity, externalDataEntity, subdocEntity, nonSgmlChar, appinfo, startDtd, endDtd, startLpd, endLpd, endProlog, sgmlDecl, uselink, usemap, commentDecl, sSep, ignoredRs, ignoredRe, reOrigin, ignoredChars, markedSectionStart, markedSectionEnd, entityStart, entityEnd, notationDecl, entityDecl, elementDecl, attlistDecl, // not #NOTATION and not in LPD attlistNotationDecl, linkAttlistDecl, linkDecl, idLinkDecl, shortrefDecl, ignoredMarkup, entityDefaulted, sgmlDeclEntity }; Event(Type); virtual void handle(EventHandler &) = 0; virtual void copyData(); void *operator new(size_t sz, Allocator &alloc) { return alloc.alloc(sz); } void *operator new(size_t sz) { return Allocator::allocSimple(sz); } void operator delete(void *p) { Allocator::free(p); }#ifdef SP_HAVE_PLACEMENT_OPERATOR_DELETE void operator delete(void *p, Allocator &) { Allocator::free(p); }#endif Type type() const;private: Event(const Event &); // undefined void operator=(const Event &); // undefined Type type_;};class LocatedEvent : public Event {public: LocatedEvent(Type type, const Location &); const Location &location() const;private: LocatedEvent(const LocatedEvent &); // undefined void operator=(const LocatedEvent &); // undefined Location location_;};class MarkupEvent : public LocatedEvent {public: MarkupEvent(Type type); MarkupEvent(Type type, const Location &, Markup *); const Markup &markup() const;private: MarkupEvent(const MarkupEvent &); // undefined void operator=(const MarkupEvent &); // undefined Markup markup_;};class SP_API MessageEvent : public Event {public: MessageEvent(Message &); MessageEvent(const Message &); const Message &message() const; void handle(EventHandler &);private: MessageEvent(const MessageEvent &); // undefined void operator=(const MessageEvent &); // undefined Message message_;};class AttributeList;class StartElementEvent : public LocatedEvent {public: StartElementEvent(const ElementType *, const ConstPtr<Dtd> &, AttributeList *, const Location &, Markup *); ~StartElementEvent(); void handle(EventHandler &); Boolean mustOmitEnd() const; void setIncluded(); Boolean included() const; const StringC &name() const; const ElementType *elementType() const; const Markup *markupPtr() const; const AttributeList &attributes() const; void copyData();private: StartElementEvent(const StartElementEvent &); // undefined void operator=(const StartElementEvent &); // undefined const ElementType *elementType_; ConstPtr<Dtd> dtd_; PackedBoolean included_; PackedBoolean copied_; // has copyData() been called Markup *markup_; AttributeList *attributes_;};class EndElementEvent : public LocatedEvent {public: EndElementEvent(const ElementType *, const ConstPtr<Dtd> &, const Location &, Markup *); ~EndElementEvent(); void handle(EventHandler &); void setIncluded(); Boolean included() const; const StringC &name() const; const ElementType *elementType() const; const Markup *markupPtr() const; void copyData();private: EndElementEvent(const EndElementEvent &); // undefined void operator=(const EndElementEvent &); // undefined const ElementType *elementType_; ConstPtr<Dtd> dtd_; PackedBoolean included_; PackedBoolean copied_; // has copyData() been called Markup *markup_;};class DataEvent : public LocatedEvent {public: DataEvent(Type, const Char *, size_t, const Location &); void handle(EventHandler &); const Char *data() const; size_t dataLength() const; virtual Boolean isRe(unsigned long &serial) const; virtual const Entity *entity() const;protected: const Char *p_; size_t length_;private: DataEvent(const DataEvent &); // undefined void operator=(const DataEvent &); // undefined};class ImmediateDataEvent : public DataEvent {public: ImmediateDataEvent(Type type, const Char *, size_t, const Location &, Boolean copy); ~ImmediateDataEvent(); void copyData();private: ImmediateDataEvent(const ImmediateDataEvent &); // undefined void operator=(const ImmediateDataEvent &); // undefined Char *alloc_;};class InternalDataEntity;class DataEntityEvent : public DataEvent {public: DataEntityEvent(Type type, const InternalEntity *, const ConstPtr<Origin> &); const Entity *entity() const;private: DataEntityEvent(const DataEntityEvent &); // undefined void operator=(const DataEntityEvent &); // undefined};class InternalCdataEntity;class CdataEntityEvent : public DataEntityEvent {public: CdataEntityEvent(const InternalEntity *, const ConstPtr<Origin> &);private: CdataEntityEvent(const CdataEntityEvent &); // undefined void operator=(const CdataEntityEvent &); // undefined};class InternalSdataEntity;class SdataEntityEvent : public DataEntityEvent {public: SdataEntityEvent(const InternalEntity *, const ConstPtr<Origin> &); void handle(EventHandler &);private: SdataEntityEvent(const SdataEntityEvent &); // undefined void operator=(const SdataEntityEvent &); // undefined};class PiEntity;class PiEvent : public LocatedEvent {public: PiEvent(const Char *, size_t, const Location &); const Char *data() const; size_t dataLength() const; virtual const Entity *entity() const; void handle(EventHandler &);private: PiEvent(const PiEvent &); // undefined void operator=(const PiEvent &); // undefined const Char *data_; size_t dataLength_;};class ImmediatePiEvent : public PiEvent {public: ImmediatePiEvent(StringC &, const Location &);private: ImmediatePiEvent(const ImmediatePiEvent &); // undefined void operator=(const ImmediatePiEvent &); // undefined StringC string_;};class PiEntityEvent : public PiEvent {public: PiEntityEvent(const PiEntity *entity, const ConstPtr<Origin> &origin); const Entity *entity() const;private: PiEntityEvent(const PiEntityEvent &); // undefined void operator=(const PiEntityEvent &); // undefined};class ExternalNonTextEntity;class ExternalDataEntity;class SubdocEntity;class ExternalEntityEvent : public Event {public: ExternalEntityEvent(Type type, const ConstPtr<EntityOrigin> &); const ConstPtr<EntityOrigin> &entityOrigin() const; const Location &location() const;private: ExternalEntityEvent(const ExternalEntityEvent &); // undefined void operator=(const ExternalEntityEvent &); // undefined ConstPtr<EntityOrigin> origin_;};class ExternalDataEntityEvent : public ExternalEntityEvent {public: ExternalDataEntityEvent(const ExternalDataEntity *, const ConstPtr<EntityOrigin> &); void handle(EventHandler &); const ExternalDataEntity *entity() const;private: ExternalDataEntityEvent(const ExternalDataEntityEvent &); // undefined void operator=(const ExternalDataEntityEvent &); // undefined const ExternalDataEntity *dataEntity_;};class SubdocEntityEvent : public ExternalEntityEvent {public: SubdocEntityEvent(const SubdocEntity *, const ConstPtr<EntityOrigin> &); void handle(EventHandler &); const SubdocEntity *entity() const;private: SubdocEntityEvent(const SubdocEntityEvent &); // undefined void operator=(const SubdocEntityEvent &); // undefined const SubdocEntity *subdocEntity_;};class NonSgmlCharEvent : public LocatedEvent {public: NonSgmlCharEvent(Char c, const Location &); Char character() const; void handle(EventHandler &);private: NonSgmlCharEvent(const NonSgmlCharEvent &); // undefined void operator=(const NonSgmlCharEvent &); // undefined Char c_;};class AppinfoEvent : public LocatedEvent {public: AppinfoEvent(const Location &); AppinfoEvent(const Text &, const Location &); void handle(EventHandler &); Boolean literal(const StringC *&) const;private: AppinfoEvent(const AppinfoEvent &); // undefined void operator=(const AppinfoEvent &); // undefined Boolean appinfoNone_; Text appinfo_;};class UselinkEvent : public MarkupEvent {public: UselinkEvent(const ConstPtr<Lpd> &, const LinkSet *, Boolean restore, const Location &, Markup *); void handle(EventHandler &); const ConstPtr<Lpd> &lpd() const; const LinkSet *linkSet() const; Boolean restore() const;private: UselinkEvent(const UselinkEvent &); // undefined void operator=(const UselinkEvent &); // undefined ConstPtr<Lpd> lpd_; const LinkSet *linkSet_; Boolean restore_;};class UsemapEvent : public MarkupEvent {public: UsemapEvent(const ShortReferenceMap *, Vector<const ElementType *> &, const ConstPtr<Dtd> &, const Location &, Markup *); void handle(EventHandler &); const ShortReferenceMap *map() const; const Vector<const ElementType *> &elements() const;private: UsemapEvent(const UsemapEvent &); // undefined void operator=(const UsemapEvent &); // undefined ConstPtr<Dtd> dtd_; Vector<const ElementType *> elements_; const ShortReferenceMap *map_;};class StartSubsetEvent : public MarkupEvent {public: StartSubsetEvent(Type, const StringC &, const ConstPtr<Entity> &entity, Boolean hasInternalSubset, const Location &, Markup *); const StringC &name() const; const ConstPtr<Entity> &entity() const; Boolean hasInternalSubset() const;private: StartSubsetEvent(const StartSubsetEvent &); // undefined void operator=(const StartSubsetEvent &); // undefined StringC name_; ConstPtr<Entity> entity_; Boolean hasInternalSubset_;};class StartDtdEvent : public StartSubsetEvent {public: StartDtdEvent(const StringC &, const ConstPtr<Entity> &entity, Boolean hasInternalSubset, const Location &, Markup *); void handle(EventHandler &);private: StartDtdEvent(const StartDtdEvent &); // undefined void operator=(const StartDtdEvent &); // undefined};class StartLpdEvent : public StartSubsetEvent {public: StartLpdEvent(Boolean active, const StringC &, const ConstPtr<Entity> &entity, Boolean hasInternalSubset, const Location &, Markup *); void handle(EventHandler &); Boolean active() const;private: StartLpdEvent(const StartLpdEvent &); // undefined void operator=(const StartLpdEvent &); // undefined Boolean active_;};class EndDtdEvent : public MarkupEvent {public: EndDtdEvent(const ConstPtr<Dtd> &, const Location &, Markup *); void handle(EventHandler &); const Dtd &dtd() const; const ConstPtr<Dtd> &dtdPointer() const;private: EndDtdEvent(const EndDtdEvent &); // undefined void operator=(const EndDtdEvent &); // undefined ConstPtr<Dtd> dtd_;};class EndLpdEvent : public MarkupEvent {public: EndLpdEvent(const ConstPtr<Lpd> &, const Location &, Markup *); void handle(EventHandler &); const Lpd &lpd() const; const ConstPtr<Lpd> &lpdPointer() const;private: EndLpdEvent(const EndLpdEvent &); // undefined void operator=(const EndLpdEvent &); // undefined ConstPtr<Lpd> lpd_;};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -