00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140 #if !defined(ATTDEF_HPP)
00141 #define ATTDEF_HPP
00142
00143 #include <xercesc/util/PlatformUtils.hpp>
00144 #include <xercesc/util/XMLString.hpp>
00145 #include <xercesc/util/XMemory.hpp>
00146 #include <xercesc/internal/XSerializable.hpp>
00147
00148 XERCES_CPP_NAMESPACE_BEGIN
00149
00150 class XMLAttr;
00151
00170 class XMLAttDef : public XSerializable, public XMemory
00171 {
00172 public:
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189 enum AttTypes
00190 {
00191 CData = 0
00192 , ID = 1
00193 , IDRef = 2
00194 , IDRefs = 3
00195 , Entity = 4
00196 , Entities = 5
00197 , NmToken = 6
00198 , NmTokens = 7
00199 , Notation = 8
00200 , Enumeration = 9
00201 , Simple = 10
00202 , Any_Any = 11
00203 , Any_Other = 12
00204 , Any_List = 13
00205
00206 , AttTypes_Count
00207 , AttTypes_Min = 0
00208 , AttTypes_Max = 13
00209 , AttTypes_Unknown = -1
00210 };
00211
00212 enum DefAttTypes
00213 {
00214 Default = 0
00215 , Fixed = 1
00216 , Required = 2
00217 , Required_And_Fixed = 3
00218 , Implied = 4
00219 , ProcessContents_Skip = 5
00220 , ProcessContents_Lax = 6
00221 , ProcessContents_Strict = 7
00222 , Prohibited = 8
00223
00224 , DefAttTypes_Count
00225 , DefAttTypes_Min = 0
00226 , DefAttTypes_Max = 8
00227 , DefAttTypes_Unknown = -1
00228 };
00229
00230 enum CreateReasons
00231 {
00232 NoReason
00233 , JustFaultIn
00234 };
00235
00236
00237
00238
00239 static const unsigned int fgInvalidAttrId;
00240
00241
00242
00243
00244
00245
00248
00259 static const XMLCh* getAttTypeString(const AttTypes attrType
00260 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00261
00272 static const XMLCh* getDefAttTypeString(const DefAttTypes attrType
00273 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00274
00276
00277
00278
00279
00280
00281
00284
00288 virtual ~XMLAttDef();
00290
00291
00292
00293
00294
00295
00298
00307 virtual const XMLCh* getFullName() const = 0;
00308
00313 virtual void reset() = 0;
00314
00316
00317
00318
00319
00320
00321
00324
00333 DefAttTypes getDefaultType() const;
00334
00344 const XMLCh* getEnumeration() const;
00345
00354 unsigned int getId() const;
00355
00370 bool getProvided() const;
00371
00381 AttTypes getType() const;
00382
00392 const XMLCh* getValue() const;
00393
00402 CreateReasons getCreateReason() const;
00403
00411 bool isExternal() const;
00412
00420 MemoryManager* getMemoryManager() const;
00421
00422
00427 virtual const XMLCh* getDOMTypeInfoUri() const = 0;
00428
00433 virtual const XMLCh* getDOMTypeInfoName() const = 0;
00434
00436
00437
00438
00439
00440
00441
00444
00453 void setDefaultType(const XMLAttDef::DefAttTypes newValue);
00454
00463 void setId(const unsigned int newId);
00464
00474 void setProvided(const bool newValue);
00475
00483 void setType(const XMLAttDef::AttTypes newValue);
00484
00495 void setValue(const XMLCh* const newValue);
00496
00507 void setEnumeration(const XMLCh* const newValue);
00508
00516 void setCreateReason(const CreateReasons newReason);
00517
00523 void setExternalAttDeclaration(const bool aValue);
00524
00526
00527
00528
00529
00530 DECL_XSERIALIZABLE(XMLAttDef)
00531
00532 protected :
00533
00534
00535
00536 XMLAttDef
00537 (
00538 const AttTypes type = CData
00539 , const DefAttTypes defType= Implied
00540 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00541 );
00542 XMLAttDef
00543 (
00544 const XMLCh* const attValue
00545 , const AttTypes type
00546 , const DefAttTypes defType
00547 , const XMLCh* const enumValues = 0
00548 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00549 );
00550
00551
00552 private :
00553
00554
00555
00556 XMLAttDef(const XMLAttDef&);
00557 XMLAttDef& operator=(const XMLAttDef&);
00558
00559
00560
00561
00562
00563 void cleanUp();
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602 DefAttTypes fDefaultType;
00603 AttTypes fType;
00604 CreateReasons fCreateReason;
00605 bool fProvided;
00606 bool fExternalAttribute;
00607 unsigned int fId;
00608 XMLCh* fValue;
00609 XMLCh* fEnumeration;
00610 MemoryManager* fMemoryManager;
00611 };
00612
00613
00614
00615
00616
00617 inline XMLAttDef::DefAttTypes XMLAttDef::getDefaultType() const
00618 {
00619 return fDefaultType;
00620 }
00621
00622 inline const XMLCh* XMLAttDef::getEnumeration() const
00623 {
00624 return fEnumeration;
00625 }
00626
00627 inline unsigned int XMLAttDef::getId() const
00628 {
00629 return fId;
00630 }
00631
00632 inline bool XMLAttDef::getProvided() const
00633 {
00634 return fProvided;
00635 }
00636
00637 inline XMLAttDef::AttTypes XMLAttDef::getType() const
00638 {
00639 return fType;
00640 }
00641
00642 inline const XMLCh* XMLAttDef::getValue() const
00643 {
00644 return fValue;
00645 }
00646
00647 inline XMLAttDef::CreateReasons XMLAttDef::getCreateReason() const
00648 {
00649 return fCreateReason;
00650 }
00651
00652 inline bool XMLAttDef::isExternal() const
00653 {
00654 return fExternalAttribute;
00655 }
00656
00657 inline MemoryManager* XMLAttDef::getMemoryManager() const
00658 {
00659 return fMemoryManager;
00660 }
00661
00662
00663
00664
00665 inline void XMLAttDef::setDefaultType(const XMLAttDef::DefAttTypes newValue)
00666 {
00667 fDefaultType = newValue;
00668 }
00669
00670 inline void XMLAttDef::setEnumeration(const XMLCh* const newValue)
00671 {
00672 if (fEnumeration)
00673 fMemoryManager->deallocate(fEnumeration);
00674
00675 fEnumeration = XMLString::replicate(newValue, fMemoryManager);
00676 }
00677
00678 inline void XMLAttDef::setId(const unsigned int newId)
00679 {
00680 fId = newId;
00681 }
00682
00683 inline void XMLAttDef::setProvided(const bool newValue)
00684 {
00685 fProvided = newValue;
00686 }
00687
00688 inline void XMLAttDef::setType(const XMLAttDef::AttTypes newValue)
00689 {
00690 fType = newValue;
00691 }
00692
00693 inline void XMLAttDef::setValue(const XMLCh* const newValue)
00694 {
00695 if (fValue)
00696 fMemoryManager->deallocate(fValue);
00697
00698 fValue = XMLString::replicate(newValue, fMemoryManager);
00699 }
00700
00701 inline void
00702 XMLAttDef::setCreateReason(const XMLAttDef::CreateReasons newReason)
00703 {
00704 fCreateReason = newReason;
00705 }
00706
00707 inline void XMLAttDef::setExternalAttDeclaration(const bool aValue)
00708 {
00709 fExternalAttribute = aValue;
00710 }
00711
00712 XERCES_CPP_NAMESPACE_END
00713
00714 #endif