⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dtd.h

📁 SP是一个基于GNU C++编译器
💻 H
字号:
// Copyright (c) 1994 James Clark// See the file COPYING for copying permission.#ifndef Dtd_INCLUDED#define Dtd_INCLUDED 1#ifdef __GNUG__#pragma interface#endif#include "NamedTable.h"#include "NamedResourceTable.h"#include "ElementType.h"#include "Notation.h"#include "Entity.h"#include "ShortReferenceMap.h"#include "Resource.h"#include "StringC.h"#include "StringResource.h"#include "Boolean.h"#include "Vector.h"#include "HashTable.h"#ifdef SP_NAMESPACEnamespace SP_NAMESPACE {#endifclass Syntax;class ParserState;class SP_API Dtd : public Resource {public:  typedef NamedTableIter<ElementType> ElementTypeIter;  typedef ConstNamedTableIter<ElementType> ConstElementTypeIter;  typedef NamedTableIter<ShortReferenceMap> ShortReferenceMapIter;  typedef ConstNamedResourceTableIter<Notation> ConstNotationIter;  typedef NamedResourceTableIter<Notation> NotationIter;  typedef ConstNamedResourceTableIter<Entity> ConstEntityIter;  typedef NamedResourceTableIter<Entity> EntityIter;  Dtd(const StringC &name, Boolean isBase);  ConstPtr<Entity> lookupEntity(Boolean isParameter, const StringC &) const;  const Entity *lookupEntityTemp(Boolean isParameter, const StringC &) const;  Ptr<Entity> lookupEntity(Boolean isParameter, const StringC &);  Ptr<Entity> insertEntity(const Ptr<Entity> &, Boolean replace = 0);  Ptr<Entity> removeEntity(Boolean isParameter, const StringC &);  ConstEntityIter generalEntityIter() const;  EntityIter generalEntityIter();  ConstEntityIter parameterEntityIter() const;  EntityIter parameterEntityIter();  ConstPtr<Entity> defaultEntity() const;  const Entity *defaultEntityTemp() const;  void setDefaultEntity(const Ptr<Entity> &, ParserState &);  const ConstPtr<StringResource<Char> > &namePointer() const;  const StringC &name() const;  const ElementType *lookupElementType(const StringC &) const;  ElementType *lookupElementType(const StringC &);  ElementType *removeElementType(const StringC &);  ElementType *insertElementType(ElementType *);  ElementType *insertUndefinedElementType(ElementType *);  size_t nElementTypeIndex() const;  size_t allocElementTypeIndex();  ConstElementTypeIter elementTypeIter() const;  ElementTypeIter elementTypeIter();  const RankStem *lookupRankStem(const StringC &) const;  RankStem *lookupRankStem(const StringC &);  RankStem *insertRankStem(RankStem *);  size_t nRankStem() const;  const ShortReferenceMap *lookupShortReferenceMap(const StringC &) const;  ShortReferenceMap *lookupShortReferenceMap(const StringC &);  ShortReferenceMap *insertShortReferenceMap(ShortReferenceMap *);  ShortReferenceMapIter shortReferenceMapIter();  Boolean shortrefIndex(const StringC &, const Syntax &, size_t &index);  size_t nShortref() const;  const StringC &shortref(size_t i) const;  void addNeededShortref(const StringC &);  ConstPtr<Notation> lookupNotation(const StringC &) const;  const Notation *lookupNotationTemp(const StringC &) const;  Ptr<Notation> lookupNotation(const StringC &);  Ptr<Notation> insertNotation(const Ptr<Notation> &);  Ptr<Notation> removeNotation(const StringC &);  ConstNotationIter notationIter() const;  NotationIter notationIter();  size_t allocCurrentAttributeIndex();  size_t nCurrentAttribute() const;  size_t allocElementDefinitionIndex();  size_t nElementDefinition() const;  size_t allocAttributeDefinitionListIndex();  size_t nAttributeDefinitionList() const;  const ElementType *documentElementType() const;  Boolean isBase() const;  Ptr<AttributeDefinitionList> &implicitElementAttributeDef();  void setImplicitElementAttributeDef(const Ptr<AttributeDefinitionList> &);  Ptr<AttributeDefinitionList> &implicitNotationAttributeDef();  void setImplicitNotationAttributeDef(const Ptr<AttributeDefinitionList> &);private:  Dtd(const Dtd &);		// undefined  void operator=(const Dtd &);	// undefined  NamedResourceTable<Entity> generalEntityTable_;  NamedResourceTable<Entity> parameterEntityTable_;  ConstPtr<Entity> defaultEntity_;  ConstPtr<StringResource<Char> > name_;  NamedTable<ElementType> elementTypeTable_;  NamedTable<ElementType> undefinedElementTypeTable_;  NamedTable<RankStem> rankStemTable_;  NamedTable<ShortReferenceMap> shortReferenceMapTable_;  NamedResourceTable<Notation> notationTable_;  size_t nCurrentAttribute_;  size_t nElementDefinition_;  size_t nAttributeDefinitionList_;  size_t nElementType_;  ElementType *documentElementType_;  Vector<StringC> shortrefs_;  HashTable<StringC,int> shortrefTable_;  Boolean isBase_;  Ptr<AttributeDefinitionList> implicitElementAttributeDef_;  Ptr<AttributeDefinitionList> implicitNotationAttributeDef_;};inlineConstPtr<Entity> Dtd::lookupEntity(Boolean isParameter, const StringC &name)  const{  return (isParameter	  ? &parameterEntityTable_	  : &generalEntityTable_)->lookupConst(name);}inlineconst Entity *Dtd::lookupEntityTemp(Boolean isParameter, const StringC &name)  const{  return (isParameter	  ? &parameterEntityTable_	  : &generalEntityTable_)->lookupTemp(name);}inlinePtr<Entity> Dtd::lookupEntity(Boolean isParameter, const StringC &name){  return (isParameter	  ? &parameterEntityTable_	  : &generalEntityTable_)->lookup(name);}inlinePtr<Entity>Dtd::insertEntity(const Ptr<Entity> &entity, Boolean replace){  return (entity->declType() == Entity::parameterEntity	  ? &parameterEntityTable_	  : &generalEntityTable_)->insert(entity, replace);}inlinePtr<Entity> Dtd::removeEntity(Boolean isParameter, const StringC &name){  return (isParameter	  ? &parameterEntityTable_	  : &generalEntityTable_)->remove(name);}inlineDtd::ConstEntityIter Dtd::generalEntityIter() const{  // Avoid use of typedef to work around MSVC 2.0 bug.  return ConstNamedResourceTableIter<Entity>(generalEntityTable_);}inlineDtd::EntityIter Dtd::generalEntityIter(){  // Avoid use of typedef to work around MSVC 2.0 bug.  return NamedResourceTableIter<Entity>(generalEntityTable_);}inlineDtd::ConstEntityIter Dtd::parameterEntityIter() const{  // Avoid use of typedef to work around MSVC 2.0 bug.  return ConstNamedResourceTableIter<Entity>(parameterEntityTable_);}inlineDtd::EntityIter Dtd::parameterEntityIter(){  // Avoid use of typedef to work around MSVC 2.0 bug.  return NamedResourceTableIter<Entity>(parameterEntityTable_);}inlineConstPtr<Entity> Dtd::defaultEntity() const{  return defaultEntity_;}inlineconst Entity *Dtd::defaultEntityTemp() const{  return defaultEntity_.pointer();}inlineconst ConstPtr<StringResource<Char> > &Dtd::namePointer() const{  return name_;}inlineconst StringC &Dtd::name() const{  return *name_;}inlinesize_t Dtd::allocCurrentAttributeIndex(){  return nCurrentAttribute_++;}inlinesize_t Dtd::nCurrentAttribute() const{  return nCurrentAttribute_;}inlinesize_t Dtd::allocElementDefinitionIndex(){  return nElementDefinition_++;}inlinesize_t Dtd::nElementDefinition() const{  return nElementDefinition_;}inlinesize_t Dtd::allocAttributeDefinitionListIndex(){  return nAttributeDefinitionList_++;}inlinesize_t Dtd::nAttributeDefinitionList() const{  return nAttributeDefinitionList_;}inlineconst ElementType *Dtd::lookupElementType(const StringC &name) const{  const ElementType *e = elementTypeTable_.lookup(name);  if (e)    return e;  else    return undefinedElementTypeTable_.lookup(name);}inlineElementType *Dtd::lookupElementType(const StringC &name){  ElementType *e = elementTypeTable_.lookup(name);  if (e)    return e;  else    return undefinedElementTypeTable_.lookup(name);}inlineElementType *Dtd::insertElementType(ElementType *e){  return elementTypeTable_.insert(e);}inlineElementType *Dtd::insertUndefinedElementType(ElementType *e){  return undefinedElementTypeTable_.insert(e);}inlineDtd::ElementTypeIter Dtd::elementTypeIter(){  // Avoid use of typedef to work around MSVC 2.0 bug.  return NamedTableIter<ElementType>(elementTypeTable_);}inlineDtd::ConstElementTypeIter Dtd::elementTypeIter() const{  // Avoid use of typedef to work around MSVC 2.0 bug.  return ConstNamedTableIter<ElementType>(elementTypeTable_);}inlineElementType *Dtd::removeElementType(const StringC &name){  return elementTypeTable_.remove(name);}inlinesize_t Dtd::nElementTypeIndex() const{  // index 0 is reserved for #pcdata  return 1 + nElementType_;}inlinesize_t Dtd::allocElementTypeIndex(){  return 1 + nElementType_++;}inlineconst RankStem *Dtd::lookupRankStem(const StringC &name) const{  return rankStemTable_.lookup(name);}inlineRankStem *Dtd::lookupRankStem(const StringC &name){  return rankStemTable_.lookup(name);}inlineRankStem *Dtd::insertRankStem(RankStem *e){  return rankStemTable_.insert(e);}inlinesize_t Dtd::nRankStem() const{  return rankStemTable_.count();}inlineConstPtr<Notation> Dtd::lookupNotation(const StringC &name) const{  return notationTable_.lookupConst(name);}inlineconst Notation *Dtd::lookupNotationTemp(const StringC &name) const{  return notationTable_.lookupTemp(name);}inlinePtr<Notation> Dtd::lookupNotation(const StringC &name){  return notationTable_.lookup(name);}inlinePtr<Notation> Dtd::insertNotation(const Ptr<Notation> &nt){  return notationTable_.insert(nt);}inlineDtd::ConstNotationIter Dtd::notationIter() const{  // Avoid use of typedef to work around MSVC 2.0 bug.  return ConstNamedResourceTableIter<Notation>(notationTable_);}inlineDtd::NotationIter Dtd::notationIter(){  // Avoid use of typedef to work around MSVC 2.0 bug.  return NamedResourceTableIter<Notation>(notationTable_);}inlinePtr<Notation> Dtd::removeNotation(const StringC &name){  return notationTable_.remove(name);}inlineconst ElementType *Dtd::documentElementType() const{  return documentElementType_;}inlineconst ShortReferenceMap *Dtd::lookupShortReferenceMap(const StringC &name) const{  return shortReferenceMapTable_.lookup(name);}inlineShortReferenceMap *Dtd::lookupShortReferenceMap(const StringC &name){  return shortReferenceMapTable_.lookup(name);}inlineShortReferenceMap *Dtd::insertShortReferenceMap(ShortReferenceMap *map){  return shortReferenceMapTable_.insert(map);}inlineDtd::ShortReferenceMapIter Dtd::shortReferenceMapIter(){  // Avoid use of typedef to work around MSVC 2.0 bug.  return NamedTableIter<ShortReferenceMap>(shortReferenceMapTable_);}inlineBoolean Dtd::isBase() const{  return isBase_;}inlinesize_t Dtd::nShortref() const{  return shortrefs_.size();}inlineconst StringC &Dtd::shortref(size_t i) const{  return shortrefs_[i];}inlinePtr<AttributeDefinitionList> &Dtd::implicitElementAttributeDef(){  return implicitElementAttributeDef_;}inlinevoid Dtd::setImplicitElementAttributeDef(const Ptr<AttributeDefinitionList> &def){  implicitElementAttributeDef_ = def;}inlinePtr<AttributeDefinitionList> &Dtd::implicitNotationAttributeDef(){  return implicitNotationAttributeDef_;}inlinevoid Dtd::setImplicitNotationAttributeDef(const Ptr<AttributeDefinitionList> &def){  implicitNotationAttributeDef_ = def;}#ifdef SP_NAMESPACE}#endif#endif /* not Dtd_INCLUDED */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -