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 #if !defined(ATTDEF_HPP)
00132 #define ATTDEF_HPP
00133
00134 #include <xercesc/util/PlatformUtils.hpp>
00135 #include <xercesc/util/XMLString.hpp>
00136 #include <xercesc/util/XMemory.hpp>
00137
00138 XERCES_CPP_NAMESPACE_BEGIN
00139
00140 class XMLAttr;
00141
00160 class XMLAttDef : public XMemory
00161 {
00162 public:
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179 enum AttTypes
00180 {
00181 CData = 0
00182 , ID = 1
00183 , IDRef = 2
00184 , IDRefs = 3
00185 , Entity = 4
00186 , Entities = 5
00187 , NmToken = 6
00188 , NmTokens = 7
00189 , Notation = 8
00190 , Enumeration = 9
00191 , Simple = 10
00192 , Any_Any = 11
00193 , Any_Other = 12
00194 , Any_List = 13
00195
00196 , AttTypes_Count
00197 , AttTypes_Min = 0
00198 , AttTypes_Max = 13
00199 , AttTypes_Unknown = -1
00200 };
00201
00202 enum DefAttTypes
00203 {
00204 Default = 0
00205 , Fixed = 1
00206 , Required = 2
00207 , Required_And_Fixed = 3
00208 , Implied = 4
00209 , ProcessContents_Skip = 5
00210 , ProcessContents_Lax = 6
00211 , ProcessContents_Strict = 7
00212 , Prohibited = 8
00213
00214 , DefAttTypes_Count
00215 , DefAttTypes_Min = 0
00216 , DefAttTypes_Max = 8
00217 , DefAttTypes_Unknown = -1
00218 };
00219
00220 enum CreateReasons
00221 {
00222 NoReason
00223 , JustFaultIn
00224 };
00225
00226
00227
00228
00229 static const unsigned int fgInvalidAttrId;
00230
00231
00232
00233
00234
00235
00238
00249 static const XMLCh* getAttTypeString(const AttTypes attrType);
00250
00261 static const XMLCh* getDefAttTypeString(const DefAttTypes attrType);
00262
00264
00265
00266
00267
00268
00269
00272
00276 virtual ~XMLAttDef();
00278
00279
00280
00281
00282
00283
00286
00295 virtual const XMLCh* getFullName() const = 0;
00296
00301 virtual void reset() = 0;
00302
00304
00305
00306
00307
00308
00309
00312
00321 DefAttTypes getDefaultType() const;
00322
00332 const XMLCh* getEnumeration() const;
00333
00342 unsigned int getId() const;
00343
00357 bool getProvided() const;
00358
00368 AttTypes getType() const;
00369
00379 const XMLCh* getValue() const;
00380
00389 CreateReasons getCreateReason() const;
00390
00398 bool isExternal() const;
00399
00407 MemoryManager* getMemoryManager() const;
00408
00409
00413 virtual const XMLCh* getDOMTypeInfoUri() const = 0;
00414
00418 virtual const XMLCh* getDOMTypeInfoName() const = 0;
00419
00421
00422
00423
00424
00425
00426
00429
00438 void setDefaultType(const XMLAttDef::DefAttTypes newValue);
00439
00448 void setId(const unsigned int newId);
00449
00458 void setProvided(const bool newValue);
00459
00467 void setType(const XMLAttDef::AttTypes newValue);
00468
00479 void setValue(const XMLCh* const newValue);
00480
00491 void setEnumeration(const XMLCh* const newValue);
00492
00500 void setCreateReason(const CreateReasons newReason);
00501
00507 void setExternalAttDeclaration(const bool aValue);
00508
00510
00511 protected :
00512
00513
00514
00515 XMLAttDef
00516 (
00517 const AttTypes type = CData
00518 , const DefAttTypes defType= Implied
00519 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00520 );
00521 XMLAttDef
00522 (
00523 const XMLCh* const attValue
00524 , const AttTypes type
00525 , const DefAttTypes defType
00526 , const XMLCh* const enumValues = 0
00527 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00528 );
00529
00530
00531 private :
00532
00533
00534
00535 XMLAttDef(const XMLAttDef&);
00536 XMLAttDef& operator=(const XMLAttDef&);
00537
00538
00539
00540
00541
00542 void cleanUp();
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581 DefAttTypes fDefaultType;
00582 AttTypes fType;
00583 CreateReasons fCreateReason;
00584 bool fProvided;
00585 bool fExternalAttribute;
00586 unsigned int fId;
00587 XMLCh* fValue;
00588 XMLCh* fEnumeration;
00589 MemoryManager* fMemoryManager;
00590 };
00591
00592
00593
00594
00595
00596 inline XMLAttDef::DefAttTypes XMLAttDef::getDefaultType() const
00597 {
00598 return fDefaultType;
00599 }
00600
00601 inline const XMLCh* XMLAttDef::getEnumeration() const
00602 {
00603 return fEnumeration;
00604 }
00605
00606 inline unsigned int XMLAttDef::getId() const
00607 {
00608 return fId;
00609 }
00610
00611 inline bool XMLAttDef::getProvided() const
00612 {
00613 return fProvided;
00614 }
00615
00616 inline XMLAttDef::AttTypes XMLAttDef::getType() const
00617 {
00618 return fType;
00619 }
00620
00621 inline const XMLCh* XMLAttDef::getValue() const
00622 {
00623 return fValue;
00624 }
00625
00626 inline XMLAttDef::CreateReasons XMLAttDef::getCreateReason() const
00627 {
00628 return fCreateReason;
00629 }
00630
00631 inline bool XMLAttDef::isExternal() const
00632 {
00633 return fExternalAttribute;
00634 }
00635
00636 inline MemoryManager* XMLAttDef::getMemoryManager() const
00637 {
00638 return fMemoryManager;
00639 }
00640
00641
00642
00643
00644 inline void XMLAttDef::setDefaultType(const XMLAttDef::DefAttTypes newValue)
00645 {
00646 fDefaultType = newValue;
00647 }
00648
00649 inline void XMLAttDef::setEnumeration(const XMLCh* const newValue)
00650 {
00651 if (fEnumeration)
00652 fMemoryManager->deallocate(fEnumeration);
00653
00654 fEnumeration = XMLString::replicate(newValue, fMemoryManager);
00655 }
00656
00657 inline void XMLAttDef::setId(const unsigned int newId)
00658 {
00659 fId = newId;
00660 }
00661
00662 inline void XMLAttDef::setProvided(const bool newValue)
00663 {
00664 fProvided = newValue;
00665 }
00666
00667 inline void XMLAttDef::setType(const XMLAttDef::AttTypes newValue)
00668 {
00669 fType = newValue;
00670 }
00671
00672 inline void XMLAttDef::setValue(const XMLCh* const newValue)
00673 {
00674 if (fValue)
00675 fMemoryManager->deallocate(fValue);
00676
00677 fValue = XMLString::replicate(newValue, fMemoryManager);
00678 }
00679
00680 inline void
00681 XMLAttDef::setCreateReason(const XMLAttDef::CreateReasons newReason)
00682 {
00683 fCreateReason = newReason;
00684 }
00685
00686 inline void XMLAttDef::setExternalAttDeclaration(const bool aValue)
00687 {
00688 fExternalAttribute = aValue;
00689 }
00690
00691 XERCES_CPP_NAMESPACE_END
00692
00693 #endif