/usr/include/OpenSP/Lpd.h is in libosp-dev 1.5.2-10.
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 | // Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef Lpd_INCLUDED
#define Lpd_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "Attribute.h"
#include "StringC.h"
#include "Ptr.h"
#include "Resource.h"
#include "Boolean.h"
#include "Named.h"
#include "NamedTable.h"
#include "Syntax.h"
#include "Location.h"
#include "Dtd.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class ElementType;
struct SP_API ResultElementSpec {
ResultElementSpec();
const ElementType *elementType;
AttributeList attributeList;
void swap(ResultElementSpec &);
};
class SP_API Lpd : public Resource {
public:
enum Type { simpleLink, implicitLink, explicitLink };
Lpd(const StringC &, Type, const Location &,
const Ptr<Dtd> &sourceDtd);
virtual ~Lpd();
Type type() const;
const Location &location() const;
const Ptr<Dtd> &sourceDtd();
ConstPtr<Dtd> sourceDtd() const;
Boolean active() const;
void activate();
const ConstPtr<StringResource<Char> > &namePointer() const;
const StringC &name() const;
private:
Lpd(const Lpd &); // undefined
void operator=(const Lpd &); // undefined
Type type_;
Location location_;
Boolean active_;
Ptr<Dtd> sourceDtd_;
ConstPtr<StringResource<Char> > name_;
};
class SP_API SimpleLpd : public Lpd, public Attributed {
public:
SimpleLpd(const StringC &, const Location &,
const Ptr<Dtd> &sourceDtd);
private:
SimpleLpd(const SimpleLpd &); // undefined
void operator=(const SimpleLpd &); // undefined
};
class LinkSet;
// A link rule whose source element specification is not implied.
class SP_API SourceLinkRule {
public:
SourceLinkRule();
void setLinkAttributes(AttributeList &);
void setResult(const ElementType *, AttributeList &);
void setUselink(const LinkSet *);
void setPostlink(const LinkSet *);
void setPostlinkRestore();
void swap(SourceLinkRule &);
const AttributeList &attributes() const;
const ResultElementSpec &resultElementSpec() const;
const LinkSet *uselink() const;
const LinkSet *postlink() const;
Boolean postlinkRestore() const;
private:
const LinkSet *uselink_;
const LinkSet *postlink_;
Boolean postlinkRestore_;
AttributeList linkAttributes_;
ResultElementSpec resultElementSpec_;
};
class SP_API SourceLinkRuleResource : public Resource, public SourceLinkRule {
public:
SourceLinkRuleResource();
inline ~SourceLinkRuleResource() {}
};
class SP_API LinkSet : public Named {
public:
LinkSet(const StringC &, const Dtd *);
virtual ~LinkSet();
void setDefined();
Boolean defined() const;
void addImplied(const ElementType *, AttributeList &);
size_t nLinkRules(const ElementType *) const;
const SourceLinkRule &linkRule(const ElementType *, size_t) const;
void addLinkRule(const ElementType *,
const ConstPtr<SourceLinkRuleResource> &);
size_t nImpliedLinkRules() const;
const ResultElementSpec &impliedLinkRule(size_t) const;
Boolean impliedResultAttributes(const ElementType *,
const AttributeList *&);
private:
LinkSet(const LinkSet &); // undefined
void operator=(const LinkSet &); // undefined
Boolean defined_;
// indexed by typeIndex of source elements
Vector<Vector<ConstPtr<SourceLinkRuleResource> > >
linkRules_;
Vector<ResultElementSpec> impliedSourceLinkRules_;
};
class SP_API IdLinkRule : public SourceLinkRule {
public:
IdLinkRule();
Boolean isAssociatedWith(const ElementType *) const;
void setAssocElementTypes(Vector<const ElementType *> &);
void swap(IdLinkRule &);
private:
Vector<const ElementType *> assocElementTypes_;
};
// A collection of link rules in a ID link set that are
// assocated with the same name (unique identifier).
class SP_API IdLinkRuleGroup : public Named {
public:
IdLinkRuleGroup(const StringC &);
size_t nLinkRules() const;
const IdLinkRule &linkRule(size_t) const;
void addLinkRule(IdLinkRule &);
private:
IdLinkRuleGroup(const IdLinkRuleGroup &); // undefined
void operator=(const IdLinkRuleGroup &); // undefined
Vector<IdLinkRule> linkRules_;
};
// An implicit or explicit LPD.
class SP_API ComplexLpd : public Lpd {
public:
typedef ConstNamedTableIter<LinkSet> ConstLinkSetIter;
ComplexLpd(const StringC &, Type,
const Location &,
const Syntax &syntax,
const Ptr<Dtd> &sourceDtd,
const Ptr<Dtd> &resultDtd);
virtual ~ComplexLpd();
size_t allocAttributeDefinitionListIndex();
size_t nAttributeDefinitionList() const;
LinkSet *initialLinkSet();
const LinkSet *initialLinkSet() const;
const LinkSet *emptyLinkSet() const;
const LinkSet *lookupLinkSet(const StringC &) const;
const IdLinkRuleGroup *lookupIdLink(const StringC &) const;
IdLinkRuleGroup *lookupCreateIdLink(const StringC &);
void insertIdLink(IdLinkRuleGroup *);
ConstLinkSetIter linkSetIter() const;
Boolean hadIdLinkSet() const;
void setHadIdLinkSet();
LinkSet *lookupLinkSet(const StringC &);
LinkSet *insertLinkSet(LinkSet *);
const Ptr<Dtd> &resultDtd();
ConstPtr<Dtd> resultDtd() const;
const ConstPtr<AttributeDefinitionList> &
attributeDef(const ElementType *) const;
void setAttributeDef(const ElementType *,
const ConstPtr<AttributeDefinitionList> &);
private:
ComplexLpd(const ComplexLpd &); // undefined
void operator=(const ComplexLpd &); // undefined
Ptr<Dtd> resultDtd_;
Vector<ConstPtr<AttributeDefinitionList> > linkAttributeDefs_;
NamedTable<LinkSet> linkSetTable_;
LinkSet initialLinkSet_;
LinkSet emptyLinkSet_;
Boolean hadIdLinkSet_;
NamedTable<IdLinkRuleGroup> idLinkTable_;
size_t nAttributeDefinitionList_;
};
inline
Lpd::Type Lpd::type() const
{
return type_;
}
inline
const Location &Lpd::location() const
{
return location_;
}
inline
Boolean Lpd::active() const
{
return active_;
}
inline
void Lpd::activate()
{
active_ = 1;
}
inline
ConstPtr<Dtd> Lpd::sourceDtd() const
{
return sourceDtd_;
}
inline
const Ptr<Dtd> &Lpd::sourceDtd()
{
return sourceDtd_;
}
inline
const ConstPtr<StringResource<Char> > &Lpd::namePointer() const
{
return name_;
}
inline
const StringC &Lpd::name() const
{
return *name_;
}
inline
void SourceLinkRule::setLinkAttributes(AttributeList &attributes)
{
attributes.swap(linkAttributes_);
}
inline
const AttributeList &SourceLinkRule::attributes() const
{
return linkAttributes_;
}
inline
void SourceLinkRule::setResult(const ElementType *element,
AttributeList &attributes)
{
resultElementSpec_.elementType = element;
attributes.swap(resultElementSpec_.attributeList);
}
inline
const ResultElementSpec &SourceLinkRule::resultElementSpec() const
{
return resultElementSpec_;
}
inline
void SourceLinkRule::setUselink(const LinkSet *linkSet)
{
uselink_ = linkSet;
}
inline
void SourceLinkRule::setPostlink(const LinkSet *linkSet)
{
postlink_ = linkSet;
}
inline
void SourceLinkRule::setPostlinkRestore()
{
postlinkRestore_ = 1;
}
inline
const LinkSet *SourceLinkRule::uselink() const
{
return uselink_;
}
inline
const LinkSet *SourceLinkRule::postlink() const
{
return postlink_;
}
inline
Boolean SourceLinkRule::postlinkRestore() const
{
return postlinkRestore_;
}
inline
Boolean LinkSet::defined() const
{
return defined_;
}
inline
void LinkSet::setDefined()
{
defined_ = 1;
}
inline
const SourceLinkRule &LinkSet::linkRule(const ElementType *e, size_t i) const
{
return *linkRules_[e->index()][i];
}
inline
size_t LinkSet::nImpliedLinkRules() const
{
return impliedSourceLinkRules_.size();
}
inline
const ResultElementSpec &LinkSet::impliedLinkRule(size_t i) const
{
return impliedSourceLinkRules_[i];
}
inline
const Ptr<Dtd> &ComplexLpd::resultDtd()
{
return resultDtd_;
}
inline
ConstPtr<Dtd> ComplexLpd::resultDtd() const
{
return resultDtd_;
}
inline
LinkSet *ComplexLpd::initialLinkSet()
{
return &initialLinkSet_;
}
inline
const LinkSet *ComplexLpd::initialLinkSet() const
{
return &initialLinkSet_;
}
inline
const LinkSet *ComplexLpd::emptyLinkSet() const
{
return &emptyLinkSet_;
}
inline
const LinkSet *ComplexLpd::lookupLinkSet(const StringC &name) const
{
return linkSetTable_.lookup(name);
}
inline
LinkSet *ComplexLpd::lookupLinkSet(const StringC &name)
{
return linkSetTable_.lookup(name);
}
inline
LinkSet *ComplexLpd::insertLinkSet(LinkSet *e)
{
return linkSetTable_.insert(e);
}
inline
size_t ComplexLpd::nAttributeDefinitionList() const
{
return nAttributeDefinitionList_;
}
inline
size_t ComplexLpd::allocAttributeDefinitionListIndex()
{
return nAttributeDefinitionList_++;
}
inline
ComplexLpd::ConstLinkSetIter ComplexLpd::linkSetIter() const
{
// Avoid use of typedef to work around MSVC 2.0 bug.
return ConstNamedTableIter<LinkSet>(linkSetTable_);
}
inline
const ConstPtr<AttributeDefinitionList> &
ComplexLpd::attributeDef(const ElementType *e) const
{
return linkAttributeDefs_[e->index()];
}
inline
void ComplexLpd::setAttributeDef(const ElementType *e,
const ConstPtr<AttributeDefinitionList> &attdef)
{
linkAttributeDefs_[e->index()] = attdef;
}
inline
Boolean ComplexLpd::hadIdLinkSet() const
{
return hadIdLinkSet_;
}
inline
void ComplexLpd::setHadIdLinkSet()
{
hadIdLinkSet_ = 1;
}
inline
const IdLinkRuleGroup *ComplexLpd::lookupIdLink(const StringC &id) const
{
return idLinkTable_.lookup(id);
}
inline
size_t IdLinkRuleGroup::nLinkRules() const
{
return linkRules_.size();
}
inline
const IdLinkRule &IdLinkRuleGroup::linkRule(size_t i) const
{
return linkRules_[i];
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not Lpd_INCLUDED */
|