/usr/include/OpenSP/Attribute.h is in libosp-dev 1.5.2-13ubuntu1.
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 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 | // Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef Attribute_INCLUDED
#define Attribute_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include <stddef.h>
#include "Resource.h"
#include "Owner.h"
#include "StringC.h"
#include "Vector.h"
#include "CopyOwner.h"
#include "Boolean.h"
#include "Text.h"
#include "Ptr.h"
#include "Message.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class Entity;
class Notation;
class DeclaredValue;
class AttributeValue;
class TokenizedAttributeValue;
class AttributeSemantics;
class AttributeContext;
class Syntax;
class SP_API AttributeValue : public Resource {
public:
enum Type {
implied,
cdata,
tokenized
};
AttributeValue();
virtual ~AttributeValue();
virtual AttributeSemantics *makeSemantics(const DeclaredValue *,
AttributeContext &,
const StringC &,
unsigned &,
unsigned &) const;
virtual Type info(const Text *&, const StringC *&) const = 0;
virtual const Text *text() const;
virtual Boolean recoverUnquoted(const StringC &, const Location &,
AttributeContext &, const StringC &);
static Boolean handleAsUnterminated(const Text &, AttributeContext &);
};
class SP_API AttributeDefinitionDesc {
public:
AttributeDefinitionDesc() { }
enum DeclaredValue {
cdata,
name,
number,
nmtoken,
nutoken,
entity,
idref,
names,
numbers,
nmtokens,
nutokens,
entities,
idrefs,
id,
notation,
nameTokenGroup
};
DeclaredValue declaredValue;
enum DefaultValueType {
required,
current,
implied,
conref,
defaulted,
fixed
};
DefaultValueType defaultValueType;
ConstPtr<AttributeValue> defaultValue;
Vector<StringC> allowedValues;
Vector<StringC> origAllowedValues;
// Attribute definitions whose default value type is current and
// which have the same currentIndex share current values.
size_t currentIndex;
private:
AttributeDefinitionDesc(const AttributeDefinitionDesc &); // undefined
void operator=(const AttributeDefinitionDesc &); // undefined
};
class DeclaredValue {
public:
DeclaredValue();
virtual ~DeclaredValue();
// This performs syntactic checking on the value.
virtual AttributeValue *makeValue(Text &, AttributeContext &,
const StringC &name,
unsigned &specLength) const = 0;
// This is used to avoid unnecessary syntactic checking in the
// case where the attribute name and vi have been omitted.
virtual AttributeValue *makeValueFromToken(Text &,
AttributeContext &,
const StringC &name,
unsigned &specLength) const;
// This performs semantic checking on the value.
virtual AttributeSemantics *makeSemantics(const TokenizedAttributeValue &,
AttributeContext &,
const StringC &,
unsigned &nIdrefs,
unsigned &nEntityNames) const;
virtual Boolean containsToken(const StringC &) const;
virtual Boolean tokenized() const = 0;
virtual Boolean isNotation() const;
virtual Boolean isEntity() const;
virtual Boolean isId() const;
virtual Boolean isIdref() const;
virtual const Vector<StringC> *getTokens() const;
virtual const Vector<StringC> *getOrigTokens() const;
virtual void buildDesc(AttributeDefinitionDesc &) const = 0;
virtual DeclaredValue *copy() const = 0;
};
class CdataDeclaredValue : public DeclaredValue {
public:
CdataDeclaredValue();
Boolean tokenized() const;
AttributeValue *makeValue(Text &, AttributeContext &, const StringC &,
unsigned &) const;
void buildDesc(AttributeDefinitionDesc &) const;
DeclaredValue *copy() const;
protected:
void checkNormalizedLength(Text &, AttributeContext &, unsigned &) const;
};
class TokenizedDeclaredValue : public DeclaredValue {
public:
// must be in same order as AttributeDefinitionDesc
enum TokenType {
name,
number,
nameToken,
numberToken,
entityName
};
TokenizedDeclaredValue(TokenType type, Boolean isList);
AttributeValue *makeValue(Text &, AttributeContext &, const StringC &,
unsigned &) const;
TokenizedAttributeValue *makeTokenizedValue(Text &, AttributeContext &,
const StringC &, unsigned &) const;
Boolean tokenized() const;
void buildDesc(AttributeDefinitionDesc &) const;
DeclaredValue *copy() const;
private:
TokenType type_;
Boolean isList_;
unsigned initialCategories_;
unsigned subsequentCategories_;
};
class GroupDeclaredValue : public TokenizedDeclaredValue {
public:
GroupDeclaredValue(TokenType, Vector<StringC> &);
Boolean containsToken(const StringC &) const;
AttributeValue *makeValue(Text &, AttributeContext &, const StringC &,
unsigned &) const;
AttributeValue *makeValueFromToken(Text &,
AttributeContext &,
const StringC &name,
unsigned &) const;
const Vector<StringC> *getTokens() const;
const Vector<StringC> *getOrigTokens() const;
void buildDesc(AttributeDefinitionDesc &) const;
DeclaredValue *copy() const;
void setOrigAllowedValues(Vector<StringC> &origAllowedValues);
private:
Vector<StringC> allowedValues_;
Vector<StringC> origAllowedValues_;
};
class NameTokenGroupDeclaredValue : public GroupDeclaredValue {
public:
NameTokenGroupDeclaredValue(Vector<StringC> &);
void buildDesc(AttributeDefinitionDesc &) const;
DeclaredValue *copy() const;
};
class NotationDeclaredValue : public GroupDeclaredValue {
public:
NotationDeclaredValue(Vector<StringC> &);
AttributeSemantics *makeSemantics(const TokenizedAttributeValue &,
AttributeContext &,
const StringC &,
unsigned &nIdrefs,
unsigned &nEntityNames) const;
Boolean isNotation() const;
void buildDesc(AttributeDefinitionDesc &) const;
DeclaredValue *copy() const;
};
class EntityDeclaredValue : public TokenizedDeclaredValue {
public:
EntityDeclaredValue(Boolean isList);
AttributeSemantics *makeSemantics(const TokenizedAttributeValue &,
AttributeContext &,
const StringC &,
unsigned &nIdrefs,
unsigned &nEntityNames) const;
Boolean isEntity() const;
DeclaredValue *copy() const;
};
class IdDeclaredValue : public TokenizedDeclaredValue {
public:
IdDeclaredValue();
AttributeSemantics *makeSemantics(const TokenizedAttributeValue &,
AttributeContext &,
const StringC &,
unsigned &nIdrefs,
unsigned &nEntityNames) const;
Boolean isId() const;
void buildDesc(AttributeDefinitionDesc &) const;
DeclaredValue *copy() const;
};
class IdrefDeclaredValue : public TokenizedDeclaredValue {
public:
IdrefDeclaredValue(Boolean isList);
AttributeSemantics *makeSemantics(const TokenizedAttributeValue &,
AttributeContext &,
const StringC &,
unsigned &nIdrefs,
unsigned &nEntityNames) const;
Boolean isIdref() const;
void buildDesc(AttributeDefinitionDesc &) const;
DeclaredValue *copy() const;
};
class SP_API AttributeDefinition {
public:
AttributeDefinition(const StringC &, DeclaredValue *);
virtual ~AttributeDefinition();
virtual ConstPtr<AttributeValue>
makeMissingValue(AttributeContext &) const = 0;
virtual Boolean missingValueWouldMatch(const Text &,
const AttributeContext &) const;
virtual const AttributeValue *
defaultValue(const AttributeValue *impliedValue) const;
AttributeValue *makeValue(Text &, AttributeContext &, unsigned &) const;
AttributeValue *makeValueFromToken(Text &,
AttributeContext &,
unsigned &) const;
virtual Boolean isConref() const;
virtual Boolean isCurrent() const;
virtual Boolean isFixed() const;
AttributeSemantics *makeSemantics(const AttributeValue *,
AttributeContext &,
unsigned &nIdrefs,
unsigned &nEntityNames) const;
Boolean tokenized() const;
const StringC &name() const;
const StringC &origName() const;
Boolean containsToken(const StringC &) const;
Boolean isNotation() const;
Boolean isEntity() const;
Boolean isId() const;
Boolean isIdref() const;
void getDesc(AttributeDefinitionDesc &) const;
const Vector<StringC> *getTokens() const;
const Vector<StringC> *getOrigTokens() const;
virtual AttributeDefinition *copy() const = 0;
void setDeclaredValue(DeclaredValue *);
void setSpecified(Boolean implicit);
Boolean isSpecified(Boolean &implicit);
void setOrigName(StringC &origName);
private:
virtual void buildDesc(AttributeDefinitionDesc &) const = 0;
virtual AttributeValue *checkValue(AttributeValue *, AttributeContext &) const;
PackedBoolean implicit_;
PackedBoolean all_;
StringC name_;
StringC origName_;
CopyOwner<DeclaredValue> declaredValue_;
};
class RequiredAttributeDefinition : public AttributeDefinition {
public:
RequiredAttributeDefinition(const StringC &, DeclaredValue *);
ConstPtr<AttributeValue> makeMissingValue(AttributeContext &) const;
void buildDesc(AttributeDefinitionDesc &) const;
AttributeDefinition *copy() const;
};
class CurrentAttributeDefinition : public AttributeDefinition {
public:
CurrentAttributeDefinition(const StringC &, DeclaredValue *, size_t index);
ConstPtr<AttributeValue> makeMissingValue(AttributeContext &) const;
Boolean missingValueWouldMatch(const Text &, const AttributeContext &) const;
AttributeValue *checkValue(AttributeValue *, AttributeContext &) const;
void buildDesc(AttributeDefinitionDesc &) const;
Boolean isCurrent() const;
AttributeDefinition *copy() const;
private:
size_t currentIndex_;
};
class ImpliedAttributeDefinition : public AttributeDefinition {
public:
ImpliedAttributeDefinition(const StringC &, DeclaredValue *);
ConstPtr<AttributeValue> makeMissingValue(AttributeContext &) const;
const AttributeValue *defaultValue(const AttributeValue *) const;
void buildDesc(AttributeDefinitionDesc &) const;
AttributeDefinition *copy() const;
};
class ConrefAttributeDefinition : public ImpliedAttributeDefinition {
public:
ConrefAttributeDefinition(const StringC &, DeclaredValue *);
Boolean isConref() const;
void buildDesc(AttributeDefinitionDesc &) const;
AttributeDefinition *copy() const;
};
class DefaultAttributeDefinition : public AttributeDefinition {
public:
DefaultAttributeDefinition(const StringC &, DeclaredValue *,
AttributeValue *);
ConstPtr<AttributeValue> makeMissingValue(AttributeContext &) const;
Boolean missingValueWouldMatch(const Text &, const AttributeContext &) const;
void buildDesc(AttributeDefinitionDesc &) const;
AttributeDefinition *copy() const;
const AttributeValue *defaultValue(const AttributeValue *) const;
private:
ConstPtr<AttributeValue> value_;
};
class FixedAttributeDefinition : public DefaultAttributeDefinition {
public:
FixedAttributeDefinition(const StringC &, DeclaredValue *,
AttributeValue *);
// check that it's equal to the default
AttributeValue *checkValue(AttributeValue *, AttributeContext &) const;
void buildDesc(AttributeDefinitionDesc &) const;
Boolean isFixed() const;
AttributeDefinition *copy() const;
};
class SP_API AttributeDefinitionList : public Resource {
public:
AttributeDefinitionList(Vector<CopyOwner<AttributeDefinition> > &,
size_t listIndex,
Boolean anyCurrent = 0,
size_t idIndex = size_t(-1),
size_t notationIndex = size_t(-1));
AttributeDefinitionList(const ConstPtr<AttributeDefinitionList> &);
~AttributeDefinitionList();
size_t size() const;
AttributeDefinition *def(size_t);
const AttributeDefinition *def(size_t) const;
Boolean tokenIndex(const StringC &, unsigned &) const;
Boolean tokenIndexUnique(const StringC &, unsigned) const;
Boolean attributeIndex(const StringC &, unsigned &) const;
size_t index() const;
size_t idIndex() const;
size_t notationIndex() const;
Boolean anyCurrent() const;
void setIndex(size_t);
void append(AttributeDefinition *);
private:
Vector<CopyOwner<AttributeDefinition> > defs_;
size_t index_;
size_t idIndex_; // -1 if no ID attribute
size_t notationIndex_; // -1 if no notation attribute
Boolean anyCurrent_;
ConstPtr<AttributeDefinitionList> prev_;
};
class AttributeSemantics {
public:
AttributeSemantics();
virtual ~AttributeSemantics();
virtual size_t nEntities() const;
virtual ConstPtr<Entity> entity(size_t) const;
virtual ConstPtr<Notation> notation() const;
virtual AttributeSemantics *copy() const = 0;
};
class EntityAttributeSemantics : public AttributeSemantics {
public:
EntityAttributeSemantics(Vector<ConstPtr<Entity> > &);
size_t nEntities() const;
ConstPtr<Entity> entity(size_t) const;
AttributeSemantics *copy() const;
private:
Vector<ConstPtr<Entity> > entity_;
};
class NotationAttributeSemantics : public AttributeSemantics {
public:
NotationAttributeSemantics(const ConstPtr<Notation> &);
ConstPtr<Notation> notation() const;
AttributeSemantics *copy() const;
private:
ConstPtr<Notation> notation_;
};
class SP_API ImpliedAttributeValue : public AttributeValue {
public:
ImpliedAttributeValue();
Type info(const Text *&, const StringC *&) const;
};
class CdataAttributeValue : public AttributeValue {
public:
CdataAttributeValue(Text &);
Type info(const Text *&, const StringC *&) const;
const Text *text() const;
Boolean recoverUnquoted(const StringC &, const Location &,
AttributeContext &, const StringC &);
virtual const Notation *notation() const;
private:
Text text_;
};
class TokenizedAttributeValue : public AttributeValue {
public:
TokenizedAttributeValue(Text &, const Vector<size_t> &);
size_t nTokens() const;
AttributeSemantics *makeSemantics(const DeclaredValue *,
AttributeContext &,
const StringC &,
unsigned &,
unsigned &) const;
Type info(const Text *&, const StringC *&) const;
const Text *text() const;
const StringC &string() const;
StringC token(size_t) const;
void token(size_t, const Char *&, size_t &) const;
Location tokenLocation(size_t) const;
Boolean tokenLocation(size_t, const ConstPtr<Origin> *&, Index &) const;
Boolean recoverUnquoted(const StringC &, const Location &,
AttributeContext &, const StringC &);
private:
TokenizedAttributeValue(const TokenizedAttributeValue &); // undefined
void operator=(const TokenizedAttributeValue &); // undefined
Text text_;
// index into value of each space
// length is number of tokens - 1
Vector<size_t> spaceIndex_;
};
class SP_API Attribute {
public:
Attribute();
Attribute(const Attribute&);
~Attribute();
Attribute& operator=(const Attribute&);
Boolean specified() const;
size_t specIndex() const;
const AttributeValue *value() const;
const ConstPtr<AttributeValue> &valuePointer() const;
const AttributeSemantics *semantics() const;
void setSpec(size_t);
void setValue(const ConstPtr<AttributeValue> &);
void setSemantics(AttributeSemantics *);
void clear();
private:
size_t specIndexPlus_;
ConstPtr<AttributeValue> value_;
CopyOwner<AttributeSemantics> semantics_;
};
class SP_API AttributeList {
public:
AttributeList();
AttributeList(const ConstPtr<AttributeDefinitionList> &);
inline ~AttributeList() {}
void init(const ConstPtr<AttributeDefinitionList> &);
// was a conref attribute specified?
Boolean conref() const;
size_t size() const;
const StringC &name(unsigned) const;
const AttributeValue *value(unsigned) const;
size_t specIndex(size_t) const;
const ConstPtr<AttributeValue> &valuePointer(unsigned) const;
const AttributeSemantics *semantics(unsigned) const;
Boolean tokenized(unsigned index) const;
Boolean tokenIndex(const StringC &, unsigned &) const;
Boolean tokenIndexUnique(const StringC &, unsigned) const;
Boolean attributeIndex(const StringC &, unsigned &) const;
void finish(AttributeContext &);
Boolean setValue(unsigned index, Text &, AttributeContext &,
unsigned &specLength);
void setValueToken(unsigned index, Text &, AttributeContext &,
unsigned &specLength);
void setSpec(unsigned index, AttributeContext &);
Boolean recoverUnquoted(const StringC &, const Location &,
AttributeContext &);
Boolean handleAsUnterminated(AttributeContext &context);
void swap(AttributeList &);
size_t nSpec() const;
size_t defIndex() const;
// is the attribute #current
Boolean current(unsigned) const;
Boolean anyCurrent() const;
Boolean specified(unsigned) const;
Boolean id(unsigned) const;
Boolean idref(unsigned) const;
const Vector<StringC> *getAllowedTokens(unsigned) const;
const StringC *getId() const; // null if none
Boolean idIndex(unsigned &) const;
void noteInvalidSpec();
void changeDef(const ConstPtr<AttributeDefinitionList> &);
const ConstPtr<AttributeDefinitionList> &def() const;
private:
const AttributeDefinition *def(size_t) const;
PackedBoolean conref_;
unsigned nIdrefs_;
unsigned nEntityNames_;
size_t nSpec_;
Vector<Attribute> vec_;
ConstPtr<AttributeDefinitionList> def_;
};
class DataDeclaredValue : public CdataDeclaredValue {
public:
DataDeclaredValue(const ConstPtr<Notation> &, AttributeList &);
AttributeValue *makeValue(Text &, AttributeContext &, const StringC &,
unsigned &) const;
DeclaredValue *copy() const;
private:
ConstPtr<Notation> notation_;
AttributeList attributes_;
};
class SP_API DataAttributeValue : public CdataAttributeValue {
public:
DataAttributeValue(Text &, const ConstPtr<Notation> &, const AttributeList &);
const AttributeList &attributes() const;
const Notation *notation() const;
private:
const ConstPtr<Notation> notation_;
const AttributeList *attributes_;
};
class SP_API AttributeContext : public Messenger {
public:
AttributeContext();
virtual ~AttributeContext();
virtual Boolean defineId(const StringC &, const Location &, Location &);
virtual void noteIdref(const StringC &, const Location &);
virtual void noteCurrentAttribute(size_t, AttributeValue *);
virtual ConstPtr<AttributeValue> getCurrentAttribute(size_t) const;
virtual ConstPtr<Entity> getAttributeEntity(const StringC &,
const Location &);
virtual ConstPtr<Notation> getAttributeNotation(const StringC &,
const Location &);
virtual const Syntax &attributeSyntax() const = 0;
ConstPtr<AttributeValue> makeImpliedAttributeValue();
Boolean mayDefaultAttribute() const;
Boolean validate() const;
protected:
Boolean mayDefaultAttribute_;
Boolean validate_;
private:
ConstPtr<AttributeValue> impliedAttributeValue_;
};
inline
Boolean AttributeDefinition::tokenized() const
{
return declaredValue_->tokenized();
}
inline
Boolean AttributeDefinition::isNotation() const
{
return declaredValue_->isNotation();
}
inline
Boolean AttributeDefinition::isEntity() const
{
return declaredValue_->isEntity();
}
inline
Boolean AttributeDefinition::isId() const
{
return declaredValue_->isId();
}
inline
Boolean AttributeDefinition::isIdref() const
{
return declaredValue_->isIdref();
}
inline
const Vector<StringC> *AttributeDefinition::getTokens() const
{
return declaredValue_->getTokens();
}
inline
const Vector<StringC> *AttributeDefinition::getOrigTokens() const
{
return declaredValue_->getOrigTokens();
}
inline
AttributeSemantics *
AttributeDefinition::makeSemantics(const AttributeValue *value,
AttributeContext &context,
unsigned &nIdrefs,
unsigned &nEntityNames) const
{
return value->makeSemantics(declaredValue_.pointer(), context, name_,
nIdrefs, nEntityNames);
}
inline
AttributeValue *AttributeDefinition::makeValue(Text &text,
AttributeContext &context,
unsigned &specLength) const
{
return checkValue(declaredValue_->makeValue(text, context, name_,
specLength),
context);
}
inline
AttributeValue *
AttributeDefinition::makeValueFromToken(Text &text,
AttributeContext &context,
unsigned &specLength) const
{
return checkValue(declaredValue_->makeValueFromToken(text, context,
name_, specLength),
context);
}
inline
Boolean AttributeDefinition::containsToken(const StringC &token) const
{
return declaredValue_->containsToken(token);
}
inline
const StringC &AttributeDefinition::name() const
{
return name_;
}
inline
const StringC &AttributeDefinition::origName() const
{
return origName_;
}
inline
void AttributeDefinition::setDeclaredValue(DeclaredValue *declaredValue)
{
declaredValue_ = declaredValue;
}
inline
size_t AttributeDefinitionList::size() const
{
return defs_.size();
}
inline
size_t AttributeDefinitionList::index() const
{
return index_;
}
inline
void AttributeDefinitionList::setIndex(size_t index)
{
index_ = index;
}
inline
size_t AttributeDefinitionList::idIndex() const
{
return idIndex_;
}
inline
size_t AttributeDefinitionList::notationIndex() const
{
return notationIndex_;
}
inline
Boolean AttributeDefinitionList::anyCurrent() const
{
return anyCurrent_;
}
inline
AttributeDefinition *AttributeDefinitionList::def(size_t i)
{
return defs_[i].pointer();
}
inline
const AttributeDefinition *AttributeDefinitionList::def(size_t i) const
{
return defs_[i].pointer();
}
inline
size_t TokenizedAttributeValue::nTokens() const
{
return spaceIndex_.size() + 1;
}
inline
const StringC &TokenizedAttributeValue::string() const
{
return text_.string();
}
inline
void TokenizedAttributeValue::token(size_t i,
const Char *&ptr, size_t &len) const
{
size_t startIndex = i == 0 ? 0 : spaceIndex_[i - 1] + 1;
ptr = text_.string().data() + startIndex;
len = (i == spaceIndex_.size() ? text_.size() : spaceIndex_[i]) - startIndex;
}
inline
StringC TokenizedAttributeValue::token(size_t i) const
{
const Char *ptr;
size_t len;
token(i, ptr, len);
return StringC(ptr, len);
}
inline
Location TokenizedAttributeValue::tokenLocation(size_t i) const
{
return text_.charLocation(i == 0 ? 0 : spaceIndex_[i - 1] + 1);
}
inline
Boolean TokenizedAttributeValue::tokenLocation(size_t i,
const ConstPtr<Origin> *&origin,
Index &index) const
{
return text_.charLocation(i == 0 ? 0 : spaceIndex_[i - 1] + 1, origin, index);
}
inline
size_t Attribute::specIndex() const
{
return specIndexPlus_ - 1;
}
inline
Boolean Attribute::specified() const
{
return specIndexPlus_ != 0;
}
inline
const AttributeValue *Attribute::value() const
{
return value_.pointer();
}
inline
const ConstPtr<AttributeValue> &Attribute::valuePointer() const
{
return value_;
}
inline
const AttributeSemantics *Attribute::semantics() const
{
return semantics_.pointer();
}
inline
void Attribute::setSpec(size_t index)
{
specIndexPlus_ = index + 1;
}
inline
void Attribute::setValue(const ConstPtr<AttributeValue> &value)
{
value_ = value;
}
inline
void Attribute::setSemantics(AttributeSemantics *semantics)
{
semantics_ = semantics;
}
inline
size_t AttributeList::size() const
{
return vec_.size();
}
inline
const AttributeDefinition *AttributeList::def(size_t i) const
{
return def_->def(i);
}
inline
const ConstPtr<AttributeDefinitionList> &AttributeList::def() const
{
return def_;
}
inline
Boolean AttributeList::tokenized(unsigned i) const
{
return def(i)->tokenized();
}
inline
Boolean AttributeList::tokenIndex(const StringC &name, unsigned &index) const
{
return !def_.isNull() && def_->tokenIndex(name, index);
}
inline
Boolean AttributeList::tokenIndexUnique(const StringC &name, unsigned index) const
{
return def_->tokenIndexUnique(name, index);
}
inline
Boolean AttributeList::attributeIndex(const StringC &name, unsigned &index) const
{
return !def_.isNull() && def_->attributeIndex(name, index);
}
inline
const StringC &AttributeList::name(unsigned i) const
{
return def(i)->name();
}
inline
const Vector<StringC> *AttributeList::getAllowedTokens(unsigned i) const
{
return def(i)->getTokens();
}
inline
const AttributeValue *AttributeList::value(unsigned i) const
{
return vec_[i].value();
}
inline
const ConstPtr<AttributeValue> &AttributeList::valuePointer(unsigned i)
const
{
return vec_[i].valuePointer();
}
inline
const AttributeSemantics *AttributeList::semantics(unsigned i) const
{
return vec_[i].semantics();
}
inline
size_t AttributeList::specIndex(size_t i) const
{
return vec_[i].specIndex();
}
inline
size_t AttributeList::nSpec() const
{
return nSpec_;
}
inline
Boolean AttributeList::conref() const
{
return conref_;
}
inline
size_t AttributeList::defIndex() const
{
return def_.isNull() ? size_t(-1) : def_->index();
}
inline
Boolean AttributeList::current(unsigned i) const
{
return def(i)->isCurrent();
}
inline
Boolean AttributeList::anyCurrent() const
{
return !def_.isNull() && def_->anyCurrent();
}
inline
const AttributeValue *
DefaultAttributeDefinition::defaultValue(const AttributeValue *)
const
{
return value_.pointer();
}
inline
Boolean AttributeList::idIndex(unsigned &ind) const
{
if (def_.isNull() || def_->idIndex() == size_t(-1))
return 0;
else {
ind = def_->idIndex();
return 1;
}
}
inline
Boolean AttributeList::id(unsigned i) const
{
return def(i)->isId();
}
inline
Boolean AttributeList::idref(unsigned i) const
{
return def(i)->isIdref();
}
inline
Boolean AttributeList::specified(unsigned i) const
{
return vec_[i].specified();
}
inline
Boolean AttributeContext::mayDefaultAttribute() const
{
return mayDefaultAttribute_;
}
inline
Boolean AttributeContext::validate() const
{
return validate_;
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not Attribute_INCLUDED */
|