📄 openelement.h
字号:
// Copyright (c) 1994 James Clark// See the file COPYING for copying permission.#ifndef OpenElement_INCLUDED#define OpenElement_INCLUDED 1#ifdef __GNUG__#pragma interface#endif#include "Boolean.h"#include "ContentToken.h"#include "ElementType.h"#include "Link.h"#include "Mode.h"#include "Allocator.h"#include "Location.h"#ifdef SP_NAMESPACEnamespace SP_NAMESPACE {#endifclass SP_API OpenElement : public Link {public: 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 OpenElement(const ElementType *, Boolean net, Boolean included, const ShortReferenceMap *currentMap, const Location &startLocation); Boolean isFinished() const; Boolean tryTransition(const ElementType *); const LeafContentToken *invalidExclusion(const ElementType *) const; // This doesn't handle declared content of EMPTY. // If this situation can arise must use declaredEmpty(). Boolean tryTransitionPcdata(); const LeafContentToken *impliedStartTag() const; void doRequiredTransition(); const ElementType *type() const; Boolean netEnabling() const; Boolean included() const; const MatchState &matchState() const; void setMatchState(const MatchState &); Mode mode(Boolean netEnabled) const; const ShortReferenceMap *map() const; void setMap(const ShortReferenceMap *); Boolean requiresSpecialParse() const; const Location &startLocation() const; const LeafContentToken *currentPosition() const; Boolean declaredEmpty() const; void setConref(); unsigned long index() const; void setIndex(unsigned long);private: OpenElement(const OpenElement &); // undefined void operator=(const OpenElement &); // undefined const ElementType *elementType_; PackedBoolean netEnabling_; // start-tag was net-enabling PackedBoolean included_; MatchState matchState_; ElementDefinition::DeclaredContent declaredContent_; const ShortReferenceMap *map_; Location startLocation_; unsigned long index_;};inlineconst ElementType *OpenElement::type() const{ return elementType_;}inline Boolean OpenElement::netEnabling() const{ return netEnabling_;}inlineBoolean OpenElement::included() const{ return included_;}inlineconst MatchState &OpenElement::matchState() const{ return matchState_;}inlinevoid OpenElement::setMatchState(const MatchState &state){ matchState_ = state;}inlineBoolean OpenElement::isFinished() const{ return (declaredContent_ != ElementDefinition::modelGroup || matchState_.isFinished());} inlineBoolean OpenElement::tryTransition(const ElementType *e){ return (declaredContent_ == ElementDefinition::modelGroup ? matchState_.tryTransition(e) : (declaredContent_ == ElementDefinition::any));}inlineBoolean OpenElement::tryTransitionPcdata(){ return (declaredContent_ == ElementDefinition::modelGroup ? matchState_.tryTransitionPcdata() : 1); // CDATA, RCDATA, ANY all ok}inlineconst LeafContentToken *OpenElement::invalidExclusion(const ElementType *e) const{ return (declaredContent_ == ElementDefinition::modelGroup ? matchState_.invalidExclusion(e) : 0);}inlinevoid OpenElement::doRequiredTransition(){ matchState_.doRequiredTransition();}inlineconst LeafContentToken *OpenElement::impliedStartTag() const{ return (declaredContent_ == ElementDefinition::modelGroup ? matchState_.impliedStartTag() : 0);}inlineconst ShortReferenceMap *OpenElement::map() const{ return map_;}inlinevoid OpenElement::setMap(const ShortReferenceMap *map){ map_ = map;}inlineBoolean OpenElement::requiresSpecialParse() const{ return (declaredContent_ == ElementDefinition::cdata || declaredContent_ == ElementDefinition::rcdata);}inlineMode OpenElement::mode(Boolean netEnabled) const{ return elementType_->definition()->mode(netEnabled);}inlineconst Location &OpenElement::startLocation() const{ return startLocation_;}inlineconst LeafContentToken *OpenElement::currentPosition() const{ return (declaredContent_ == ElementDefinition::modelGroup ? matchState_.currentPosition() : 0);}inlineBoolean OpenElement::declaredEmpty() const{ return declaredContent_ == ElementDefinition::empty;}inlinevoid OpenElement::setConref(){ declaredContent_ = ElementDefinition::empty;}inlineunsigned long OpenElement::index() const{ return index_;}inlinevoid OpenElement::setIndex(unsigned long index){ index_ = index;}#ifdef SP_NAMESPACE}#endif#endif /* not OpenElement_INCLUDED */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -