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 #if !defined(ATTDEF_HPP)
00107 #define ATTDEF_HPP
00108
00109 #include <xercesc/util/PlatformUtils.hpp>
00110 #include <xercesc/util/XMLString.hpp>
00111 #include <xercesc/util/XMemory.hpp>
00112 #include <xercesc/internal/XSerializable.hpp>
00113
00114 XERCES_CPP_NAMESPACE_BEGIN
00115
00116 class XMLAttr;
00117
00136 class XMLAttDef : public XSerializable, public XMemory
00137 {
00138 public:
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155 enum AttTypes
00156 {
00157 CData = 0
00158 , ID = 1
00159 , IDRef = 2
00160 , IDRefs = 3
00161 , Entity = 4
00162 , Entities = 5
00163 , NmToken = 6
00164 , NmTokens = 7
00165 , Notation = 8
00166 , Enumeration = 9
00167 , Simple = 10
00168 , Any_Any = 11
00169 , Any_Other = 12
00170 , Any_List = 13
00171
00172 , AttTypes_Count
00173 , AttTypes_Min = 0
00174 , AttTypes_Max = 13
00175 , AttTypes_Unknown = -1
00176 };
00177
00178 enum DefAttTypes
00179 {
00180 Default = 0
00181 , Fixed = 1
00182 , Required = 2
00183 , Required_And_Fixed = 3
00184 , Implied = 4
00185 , ProcessContents_Skip = 5
00186 , ProcessContents_Lax = 6
00187 , ProcessContents_Strict = 7
00188 , Prohibited = 8
00189
00190 , DefAttTypes_Count
00191 , DefAttTypes_Min = 0
00192 , DefAttTypes_Max = 8
00193 , DefAttTypes_Unknown = -1
00194 };
00195
00196 enum CreateReasons
00197 {
00198 NoReason
00199 , JustFaultIn
00200 };
00201
00202
00203
00204
00205 static const unsigned int fgInvalidAttrId;
00206
00207
00208
00209
00210
00211
00214
00225 static const XMLCh* getAttTypeString(const AttTypes attrType
00226 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00227
00238 static const XMLCh* getDefAttTypeString(const DefAttTypes attrType
00239 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00240
00242
00243
00244
00245
00246
00247
00250
00254 virtual ~XMLAttDef();
00256
00257
00258
00259
00260
00261
00264
00273 virtual const XMLCh* getFullName() const = 0;
00274
00279 virtual void reset() = 0;
00280
00282
00283
00284
00285
00286
00287
00290
00299 DefAttTypes getDefaultType() const;
00300
00310 const XMLCh* getEnumeration() const;
00311
00320 unsigned int getId() const;
00321
00336 bool getProvided() const;
00337
00347 AttTypes getType() const;
00348
00358 const XMLCh* getValue() const;
00359
00368 CreateReasons getCreateReason() const;
00369
00377 bool isExternal() const;
00378
00386 MemoryManager* getMemoryManager() const;
00387
00388
00393 virtual const XMLCh* getDOMTypeInfoUri() const = 0;
00394
00399 virtual const XMLCh* getDOMTypeInfoName() const = 0;
00400
00402
00403
00404
00405
00406
00407
00410
00419 void setDefaultType(const XMLAttDef::DefAttTypes newValue);
00420
00429 void setId(const unsigned int newId);
00430
00440 void setProvided(const bool newValue);
00441
00449 void setType(const XMLAttDef::AttTypes newValue);
00450
00461 void setValue(const XMLCh* const newValue);
00462
00473 void setEnumeration(const XMLCh* const newValue);
00474
00482 void setCreateReason(const CreateReasons newReason);
00483
00489 void setExternalAttDeclaration(const bool aValue);
00490
00492
00493
00494
00495
00496 DECL_XSERIALIZABLE(XMLAttDef)
00497
00498 protected :
00499
00500
00501
00502 XMLAttDef
00503 (
00504 const AttTypes type = CData
00505 , const DefAttTypes defType= Implied
00506 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00507 );
00508 XMLAttDef
00509 (
00510 const XMLCh* const attValue
00511 , const AttTypes type
00512 , const DefAttTypes defType
00513 , const XMLCh* const enumValues = 0
00514 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00515 );
00516
00517
00518 private :
00519
00520
00521
00522 XMLAttDef(const XMLAttDef&);
00523 XMLAttDef& operator=(const XMLAttDef&);
00524
00525
00526
00527
00528
00529 void cleanUp();
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
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 DefAttTypes fDefaultType;
00569 AttTypes fType;
00570 CreateReasons fCreateReason;
00571 bool fProvided;
00572 bool fExternalAttribute;
00573 unsigned int fId;
00574 XMLCh* fValue;
00575 XMLCh* fEnumeration;
00576 MemoryManager* fMemoryManager;
00577 };
00578
00579
00580
00581
00582
00583 inline XMLAttDef::DefAttTypes XMLAttDef::getDefaultType() const
00584 {
00585 return fDefaultType;
00586 }
00587
00588 inline const XMLCh* XMLAttDef::getEnumeration() const
00589 {
00590 return fEnumeration;
00591 }
00592
00593 inline unsigned int XMLAttDef::getId() const
00594 {
00595 return fId;
00596 }
00597
00598 inline bool XMLAttDef::getProvided() const
00599 {
00600 return fProvided;
00601 }
00602
00603 inline XMLAttDef::AttTypes XMLAttDef::getType() const
00604 {
00605 return fType;
00606 }
00607
00608 inline const XMLCh* XMLAttDef::getValue() const
00609 {
00610 return fValue;
00611 }
00612
00613 inline XMLAttDef::CreateReasons XMLAttDef::getCreateReason() const
00614 {
00615 return fCreateReason;
00616 }
00617
00618 inline bool XMLAttDef::isExternal() const
00619 {
00620 return fExternalAttribute;
00621 }
00622
00623 inline MemoryManager* XMLAttDef::getMemoryManager() const
00624 {
00625 return fMemoryManager;
00626 }
00627
00628
00629
00630
00631 inline void XMLAttDef::setDefaultType(const XMLAttDef::DefAttTypes newValue)
00632 {
00633 fDefaultType = newValue;
00634 }
00635
00636 inline void XMLAttDef::setEnumeration(const XMLCh* const newValue)
00637 {
00638 if (fEnumeration)
00639 fMemoryManager->deallocate(fEnumeration);
00640
00641 fEnumeration = XMLString::replicate(newValue, fMemoryManager);
00642 }
00643
00644 inline void XMLAttDef::setId(const unsigned int newId)
00645 {
00646 fId = newId;
00647 }
00648
00649 inline void XMLAttDef::setProvided(const bool newValue)
00650 {
00651 fProvided = newValue;
00652 }
00653
00654 inline void XMLAttDef::setType(const XMLAttDef::AttTypes newValue)
00655 {
00656 fType = newValue;
00657 }
00658
00659 inline void XMLAttDef::setValue(const XMLCh* const newValue)
00660 {
00661 if (fValue)
00662 fMemoryManager->deallocate(fValue);
00663
00664 fValue = XMLString::replicate(newValue, fMemoryManager);
00665 }
00666
00667 inline void
00668 XMLAttDef::setCreateReason(const XMLAttDef::CreateReasons newReason)
00669 {
00670 fCreateReason = newReason;
00671 }
00672
00673 inline void XMLAttDef::setExternalAttDeclaration(const bool aValue)
00674 {
00675 fExternalAttribute = aValue;
00676 }
00677
00678 XERCES_CPP_NAMESPACE_END
00679
00680 #endif