/usr/include/sp/Dtd.h is in libsp1-dev 1.3.4-1.2.1-47.3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | // 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_NAMESPACE
namespace SP_NAMESPACE {
#endif
class 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_;
};
inline
ConstPtr<Entity> Dtd::lookupEntity(Boolean isParameter, const StringC &name)
const
{
return (isParameter
? ¶meterEntityTable_
: &generalEntityTable_)->lookupConst(name);
}
inline
const Entity *Dtd::lookupEntityTemp(Boolean isParameter, const StringC &name)
const
{
return (isParameter
? ¶meterEntityTable_
: &generalEntityTable_)->lookupTemp(name);
}
inline
Ptr<Entity> Dtd::lookupEntity(Boolean isParameter, const StringC &name)
{
return (isParameter
? ¶meterEntityTable_
: &generalEntityTable_)->lookup(name);
}
inline
Ptr<Entity>
Dtd::insertEntity(const Ptr<Entity> &entity, Boolean replace)
{
return (entity->declType() == Entity::parameterEntity
? ¶meterEntityTable_
: &generalEntityTable_)->insert(entity, replace);
}
inline
Ptr<Entity> Dtd::removeEntity(Boolean isParameter, const StringC &name)
{
return (isParameter
? ¶meterEntityTable_
: &generalEntityTable_)->remove(name);
}
inline
Dtd::ConstEntityIter Dtd::generalEntityIter() const
{
// Avoid use of typedef to work around MSVC 2.0 bug.
return ConstNamedResourceTableIter<Entity>(generalEntityTable_);
}
inline
Dtd::EntityIter Dtd::generalEntityIter()
{
// Avoid use of typedef to work around MSVC 2.0 bug.
return NamedResourceTableIter<Entity>(generalEntityTable_);
}
inline
Dtd::ConstEntityIter Dtd::parameterEntityIter() const
{
// Avoid use of typedef to work around MSVC 2.0 bug.
return ConstNamedResourceTableIter<Entity>(parameterEntityTable_);
}
inline
Dtd::EntityIter Dtd::parameterEntityIter()
{
// Avoid use of typedef to work around MSVC 2.0 bug.
return NamedResourceTableIter<Entity>(parameterEntityTable_);
}
inline
ConstPtr<Entity> Dtd::defaultEntity() const
{
return defaultEntity_;
}
inline
const Entity *Dtd::defaultEntityTemp() const
{
return defaultEntity_.pointer();
}
inline
const ConstPtr<StringResource<Char> > &Dtd::namePointer() const
{
return name_;
}
inline
const StringC &Dtd::name() const
{
return *name_;
}
inline
size_t Dtd::allocCurrentAttributeIndex()
{
return nCurrentAttribute_++;
}
inline
size_t Dtd::nCurrentAttribute() const
{
return nCurrentAttribute_;
}
inline
size_t Dtd::allocElementDefinitionIndex()
{
return nElementDefinition_++;
}
inline
size_t Dtd::nElementDefinition() const
{
return nElementDefinition_;
}
inline
size_t Dtd::allocAttributeDefinitionListIndex()
{
return nAttributeDefinitionList_++;
}
inline
size_t Dtd::nAttributeDefinitionList() const
{
return nAttributeDefinitionList_;
}
inline
const ElementType *Dtd::lookupElementType(const StringC &name) const
{
const ElementType *e = elementTypeTable_.lookup(name);
if (e)
return e;
else
return undefinedElementTypeTable_.lookup(name);
}
inline
ElementType *Dtd::lookupElementType(const StringC &name)
{
ElementType *e = elementTypeTable_.lookup(name);
if (e)
return e;
else
return undefinedElementTypeTable_.lookup(name);
}
inline
ElementType *Dtd::insertElementType(ElementType *e)
{
return elementTypeTable_.insert(e);
}
inline
ElementType *Dtd::insertUndefinedElementType(ElementType *e)
{
return undefinedElementTypeTable_.insert(e);
}
inline
Dtd::ElementTypeIter Dtd::elementTypeIter()
{
// Avoid use of typedef to work around MSVC 2.0 bug.
return NamedTableIter<ElementType>(elementTypeTable_);
}
inline
Dtd::ConstElementTypeIter Dtd::elementTypeIter() const
{
// Avoid use of typedef to work around MSVC 2.0 bug.
return ConstNamedTableIter<ElementType>(elementTypeTable_);
}
inline
ElementType *Dtd::removeElementType(const StringC &name)
{
return elementTypeTable_.remove(name);
}
inline
size_t Dtd::nElementTypeIndex() const
{
// index 0 is reserved for #pcdata
return 1 + nElementType_;
}
inline
size_t Dtd::allocElementTypeIndex()
{
return 1 + nElementType_++;
}
inline
const RankStem *Dtd::lookupRankStem(const StringC &name) const
{
return rankStemTable_.lookup(name);
}
inline
RankStem *Dtd::lookupRankStem(const StringC &name)
{
return rankStemTable_.lookup(name);
}
inline
RankStem *Dtd::insertRankStem(RankStem *e)
{
return rankStemTable_.insert(e);
}
inline
size_t Dtd::nRankStem() const
{
return rankStemTable_.count();
}
inline
ConstPtr<Notation> Dtd::lookupNotation(const StringC &name) const
{
return notationTable_.lookupConst(name);
}
inline
const Notation *Dtd::lookupNotationTemp(const StringC &name) const
{
return notationTable_.lookupTemp(name);
}
inline
Ptr<Notation> Dtd::lookupNotation(const StringC &name)
{
return notationTable_.lookup(name);
}
inline
Ptr<Notation> Dtd::insertNotation(const Ptr<Notation> &nt)
{
return notationTable_.insert(nt);
}
inline
Dtd::ConstNotationIter Dtd::notationIter() const
{
// Avoid use of typedef to work around MSVC 2.0 bug.
return ConstNamedResourceTableIter<Notation>(notationTable_);
}
inline
Dtd::NotationIter Dtd::notationIter()
{
// Avoid use of typedef to work around MSVC 2.0 bug.
return NamedResourceTableIter<Notation>(notationTable_);
}
inline
Ptr<Notation> Dtd::removeNotation(const StringC &name)
{
return notationTable_.remove(name);
}
inline
const ElementType *Dtd::documentElementType() const
{
return documentElementType_;
}
inline
const ShortReferenceMap *Dtd::lookupShortReferenceMap(const StringC &name) const
{
return shortReferenceMapTable_.lookup(name);
}
inline
ShortReferenceMap *Dtd::lookupShortReferenceMap(const StringC &name)
{
return shortReferenceMapTable_.lookup(name);
}
inline
ShortReferenceMap *Dtd::insertShortReferenceMap(ShortReferenceMap *map)
{
return shortReferenceMapTable_.insert(map);
}
inline
Dtd::ShortReferenceMapIter Dtd::shortReferenceMapIter()
{
// Avoid use of typedef to work around MSVC 2.0 bug.
return NamedTableIter<ShortReferenceMap>(shortReferenceMapTable_);
}
inline
Boolean Dtd::isBase() const
{
return isBase_;
}
inline
size_t Dtd::nShortref() const
{
return shortrefs_.size();
}
inline
const StringC &Dtd::shortref(size_t i) const
{
return shortrefs_[i];
}
inline
Ptr<AttributeDefinitionList> &Dtd::implicitElementAttributeDef()
{
return implicitElementAttributeDef_;
}
inline
void Dtd::setImplicitElementAttributeDef(const Ptr<AttributeDefinitionList> &def)
{
implicitElementAttributeDef_ = def;
}
inline
Ptr<AttributeDefinitionList> &Dtd::implicitNotationAttributeDef()
{
return implicitNotationAttributeDef_;
}
inline
void Dtd::setImplicitNotationAttributeDef(const Ptr<AttributeDefinitionList> &def)
{
implicitNotationAttributeDef_ = def;
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not Dtd_INCLUDED */
|