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 #if !defined(ATTDEF_HPP)
00138 #define ATTDEF_HPP
00139
00140 #include <xercesc/util/PlatformUtils.hpp>
00141 #include <xercesc/util/XMLString.hpp>
00142 #include <xercesc/util/XMemory.hpp>
00143 #include <xercesc/internal/XSerializable.hpp>
00144
00145 XERCES_CPP_NAMESPACE_BEGIN
00146
00147 class XMLAttr;
00148
00167 class XMLAttDef : public XSerializable, public XMemory
00168 {
00169 public:
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186 enum AttTypes
00187 {
00188 CData = 0
00189 , ID = 1
00190 , IDRef = 2
00191 , IDRefs = 3
00192 , Entity = 4
00193 , Entities = 5
00194 , NmToken = 6
00195 , NmTokens = 7
00196 , Notation = 8
00197 , Enumeration = 9
00198 , Simple = 10
00199 , Any_Any = 11
00200 , Any_Other = 12
00201 , Any_List = 13
00202
00203 , AttTypes_Count
00204 , AttTypes_Min = 0
00205 , AttTypes_Max = 13
00206 , AttTypes_Unknown = -1
00207 };
00208
00209 enum DefAttTypes
00210 {
00211 Default = 0
00212 , Fixed = 1
00213 , Required = 2
00214 , Required_And_Fixed = 3
00215 , Implied = 4
00216 , ProcessContents_Skip = 5
00217 , ProcessContents_Lax = 6
00218 , ProcessContents_Strict = 7
00219 , Prohibited = 8
00220
00221 , DefAttTypes_Count
00222 , DefAttTypes_Min = 0
00223 , DefAttTypes_Max = 8
00224 , DefAttTypes_Unknown = -1
00225 };
00226
00227 enum CreateReasons
00228 {
00229 NoReason
00230 , JustFaultIn
00231 };
00232
00233
00234
00235
00236 static const unsigned int fgInvalidAttrId;
00237
00238
00239
00240
00241
00242
00245
00256 static const XMLCh* getAttTypeString(const AttTypes attrType);
00257
00268 static const XMLCh* getDefAttTypeString(const DefAttTypes attrType);
00269
00271
00272
00273
00274
00275
00276
00279
00283 virtual ~XMLAttDef();
00285
00286
00287
00288
00289
00290
00293
00302 virtual const XMLCh* getFullName() const = 0;
00303
00308 virtual void reset() = 0;
00309
00311
00312
00313
00314
00315
00316
00319
00328 DefAttTypes getDefaultType() const;
00329
00339 const XMLCh* getEnumeration() const;
00340
00349 unsigned int getId() const;
00350
00365 bool getProvided() const;
00366
00376 AttTypes getType() const;
00377
00387 const XMLCh* getValue() const;
00388
00397 CreateReasons getCreateReason() const;
00398
00406 bool isExternal() const;
00407
00415 MemoryManager* getMemoryManager() const;
00416
00417
00422 virtual const XMLCh* getDOMTypeInfoUri() const = 0;
00423
00428 virtual const XMLCh* getDOMTypeInfoName() const = 0;
00429
00431
00432
00433
00434
00435
00436
00439
00448 void setDefaultType(const XMLAttDef::DefAttTypes newValue);
00449
00458 void setId(const unsigned int newId);
00459
00469 void setProvided(const bool newValue);
00470
00478 void setType(const XMLAttDef::AttTypes newValue);
00479
00490 void setValue(const XMLCh* const newValue);
00491
00502 void setEnumeration(const XMLCh* const newValue);
00503
00511 void setCreateReason(const CreateReasons newReason);
00512
00518 void setExternalAttDeclaration(const bool aValue);
00519
00521
00522
00523
00524
00525 DECL_XSERIALIZABLE(XMLAttDef)
00526
00527 protected :
00528
00529
00530
00531 XMLAttDef
00532 (
00533 const AttTypes type = CData
00534 , const DefAttTypes defType= Implied
00535 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00536 );
00537 XMLAttDef
00538 (
00539 const XMLCh* const attValue
00540 , const AttTypes type
00541 , const DefAttTypes defType
00542 , const XMLCh* const enumValues = 0
00543 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00544 );
00545
00546
00547 private :
00548
00549
00550
00551 XMLAttDef(const XMLAttDef&);
00552 XMLAttDef& operator=(const XMLAttDef&);
00553
00554
00555
00556
00557
00558 void cleanUp();
00559
00560
00561
00562
00563
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 DefAttTypes fDefaultType;
00598 AttTypes fType;
00599 CreateReasons fCreateReason;
00600 bool fProvided;
00601 bool fExternalAttribute;
00602 unsigned int fId;
00603 XMLCh* fValue;
00604 XMLCh* fEnumeration;
00605 MemoryManager* fMemoryManager;
00606 };
00607
00608
00609
00610
00611
00612 inline XMLAttDef::DefAttTypes XMLAttDef::getDefaultType() const
00613 {
00614 return fDefaultType;
00615 }
00616
00617 inline const XMLCh* XMLAttDef::getEnumeration() const
00618 {
00619 return fEnumeration;
00620 }
00621
00622 inline unsigned int XMLAttDef::getId() const
00623 {
00624 return fId;
00625 }
00626
00627 inline bool XMLAttDef::getProvided() const
00628 {
00629 return fProvided;
00630 }
00631
00632 inline XMLAttDef::AttTypes XMLAttDef::getType() const
00633 {
00634 return fType;
00635 }
00636
00637 inline const XMLCh* XMLAttDef::getValue() const
00638 {
00639 return fValue;
00640 }
00641
00642 inline XMLAttDef::CreateReasons XMLAttDef::getCreateReason() const
00643 {
00644 return fCreateReason;
00645 }
00646
00647 inline bool XMLAttDef::isExternal() const
00648 {
00649 return fExternalAttribute;
00650 }
00651
00652 inline MemoryManager* XMLAttDef::getMemoryManager() const
00653 {
00654 return fMemoryManager;
00655 }
00656
00657
00658
00659
00660 inline void XMLAttDef::setDefaultType(const XMLAttDef::DefAttTypes newValue)
00661 {
00662 fDefaultType = newValue;
00663 }
00664
00665 inline void XMLAttDef::setEnumeration(const XMLCh* const newValue)
00666 {
00667 if (fEnumeration)
00668 fMemoryManager->deallocate(fEnumeration);
00669
00670 fEnumeration = XMLString::replicate(newValue, fMemoryManager);
00671 }
00672
00673 inline void XMLAttDef::setId(const unsigned int newId)
00674 {
00675 fId = newId;
00676 }
00677
00678 inline void XMLAttDef::setProvided(const bool newValue)
00679 {
00680 fProvided = newValue;
00681 }
00682
00683 inline void XMLAttDef::setType(const XMLAttDef::AttTypes newValue)
00684 {
00685 fType = newValue;
00686 }
00687
00688 inline void XMLAttDef::setValue(const XMLCh* const newValue)
00689 {
00690 if (fValue)
00691 fMemoryManager->deallocate(fValue);
00692
00693 fValue = XMLString::replicate(newValue, fMemoryManager);
00694 }
00695
00696 inline void
00697 XMLAttDef::setCreateReason(const XMLAttDef::CreateReasons newReason)
00698 {
00699 fCreateReason = newReason;
00700 }
00701
00702 inline void XMLAttDef::setExternalAttDeclaration(const bool aValue)
00703 {
00704 fExternalAttribute = aValue;
00705 }
00706
00707 XERCES_CPP_NAMESPACE_END
00708
00709 #endif