00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if !defined(ATTDEF_HPP)
00023 #define ATTDEF_HPP
00024
00025 #include <xercesc/util/PlatformUtils.hpp>
00026 #include <xercesc/util/XMLString.hpp>
00027 #include <xercesc/util/XMemory.hpp>
00028 #include <xercesc/internal/XSerializable.hpp>
00029
00030 XERCES_CPP_NAMESPACE_BEGIN
00031
00032 class XMLAttr;
00033
00052 class XMLAttDef : public XSerializable, public XMemory
00053 {
00054 public:
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 enum AttTypes
00072 {
00073 CData = 0
00074 , ID = 1
00075 , IDRef = 2
00076 , IDRefs = 3
00077 , Entity = 4
00078 , Entities = 5
00079 , NmToken = 6
00080 , NmTokens = 7
00081 , Notation = 8
00082 , Enumeration = 9
00083 , Simple = 10
00084 , Any_Any = 11
00085 , Any_Other = 12
00086 , Any_List = 13
00087
00088 , AttTypes_Count
00089 , AttTypes_Min = 0
00090 , AttTypes_Max = 13
00091 , AttTypes_Unknown = -1
00092 };
00093
00094 enum DefAttTypes
00095 {
00096 Default = 0
00097 , Fixed = 1
00098 , Required = 2
00099 , Required_And_Fixed = 3
00100 , Implied = 4
00101 , ProcessContents_Skip = 5
00102 , ProcessContents_Lax = 6
00103 , ProcessContents_Strict = 7
00104 , Prohibited = 8
00105
00106 , DefAttTypes_Count
00107 , DefAttTypes_Min = 0
00108 , DefAttTypes_Max = 8
00109 , DefAttTypes_Unknown = -1
00110 };
00111
00112 enum CreateReasons
00113 {
00114 NoReason
00115 , JustFaultIn
00116 };
00117
00118
00119
00120
00121 static const unsigned int fgInvalidAttrId;
00122
00123
00124
00125
00126
00127
00130
00141 static const XMLCh* getAttTypeString(const AttTypes attrType
00142 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00143
00154 static const XMLCh* getDefAttTypeString(const DefAttTypes attrType
00155 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00156
00158
00159
00160
00161
00162
00163
00166
00170 virtual ~XMLAttDef();
00172
00173
00174
00175
00176
00177
00180
00189 virtual const XMLCh* getFullName() const = 0;
00190
00195 virtual void reset() = 0;
00196
00198
00199
00200
00201
00202
00203
00206
00215 DefAttTypes getDefaultType() const;
00216
00226 const XMLCh* getEnumeration() const;
00227
00236 unsigned int getId() const;
00237
00252 bool getProvided() const;
00253
00263 AttTypes getType() const;
00264
00274 const XMLCh* getValue() const;
00275
00284 CreateReasons getCreateReason() const;
00285
00293 bool isExternal() const;
00294
00302 MemoryManager* getMemoryManager() const;
00303
00304
00309 virtual const XMLCh* getDOMTypeInfoUri() const = 0;
00310
00315 virtual const XMLCh* getDOMTypeInfoName() const = 0;
00316
00318
00319
00320
00321
00322
00323
00326
00335 void setDefaultType(const XMLAttDef::DefAttTypes newValue);
00336
00345 void setId(const unsigned int newId);
00346
00356 void setProvided(const bool newValue);
00357
00365 void setType(const XMLAttDef::AttTypes newValue);
00366
00377 void setValue(const XMLCh* const newValue);
00378
00389 void setEnumeration(const XMLCh* const newValue);
00390
00398 void setCreateReason(const CreateReasons newReason);
00399
00405 void setExternalAttDeclaration(const bool aValue);
00406
00408
00409
00410
00411
00412 DECL_XSERIALIZABLE(XMLAttDef)
00413
00414 protected :
00415
00416
00417
00418 XMLAttDef
00419 (
00420 const AttTypes type = CData
00421 , const DefAttTypes defType= Implied
00422 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00423 );
00424 XMLAttDef
00425 (
00426 const XMLCh* const attValue
00427 , const AttTypes type
00428 , const DefAttTypes defType
00429 , const XMLCh* const enumValues = 0
00430 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00431 );
00432
00433
00434 private :
00435
00436
00437
00438 XMLAttDef(const XMLAttDef&);
00439 XMLAttDef& operator=(const XMLAttDef&);
00440
00441
00442
00443
00444
00445 void cleanUp();
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484 DefAttTypes fDefaultType;
00485 AttTypes fType;
00486 CreateReasons fCreateReason;
00487 bool fProvided;
00488 bool fExternalAttribute;
00489 unsigned int fId;
00490 XMLCh* fValue;
00491 XMLCh* fEnumeration;
00492 MemoryManager* fMemoryManager;
00493 };
00494
00495
00496
00497
00498
00499 inline XMLAttDef::DefAttTypes XMLAttDef::getDefaultType() const
00500 {
00501 return fDefaultType;
00502 }
00503
00504 inline const XMLCh* XMLAttDef::getEnumeration() const
00505 {
00506 return fEnumeration;
00507 }
00508
00509 inline unsigned int XMLAttDef::getId() const
00510 {
00511 return fId;
00512 }
00513
00514 inline bool XMLAttDef::getProvided() const
00515 {
00516 return fProvided;
00517 }
00518
00519 inline XMLAttDef::AttTypes XMLAttDef::getType() const
00520 {
00521 return fType;
00522 }
00523
00524 inline const XMLCh* XMLAttDef::getValue() const
00525 {
00526 return fValue;
00527 }
00528
00529 inline XMLAttDef::CreateReasons XMLAttDef::getCreateReason() const
00530 {
00531 return fCreateReason;
00532 }
00533
00534 inline bool XMLAttDef::isExternal() const
00535 {
00536 return fExternalAttribute;
00537 }
00538
00539 inline MemoryManager* XMLAttDef::getMemoryManager() const
00540 {
00541 return fMemoryManager;
00542 }
00543
00544
00545
00546
00547 inline void XMLAttDef::setDefaultType(const XMLAttDef::DefAttTypes newValue)
00548 {
00549 fDefaultType = newValue;
00550 }
00551
00552 inline void XMLAttDef::setEnumeration(const XMLCh* const newValue)
00553 {
00554 if (fEnumeration)
00555 fMemoryManager->deallocate(fEnumeration);
00556
00557 fEnumeration = XMLString::replicate(newValue, fMemoryManager);
00558 }
00559
00560 inline void XMLAttDef::setId(const unsigned int newId)
00561 {
00562 fId = newId;
00563 }
00564
00565 inline void XMLAttDef::setProvided(const bool newValue)
00566 {
00567 fProvided = newValue;
00568 }
00569
00570 inline void XMLAttDef::setType(const XMLAttDef::AttTypes newValue)
00571 {
00572 fType = newValue;
00573 }
00574
00575 inline void XMLAttDef::setValue(const XMLCh* const newValue)
00576 {
00577 if (fValue)
00578 fMemoryManager->deallocate(fValue);
00579
00580 fValue = XMLString::replicate(newValue, fMemoryManager);
00581 }
00582
00583 inline void
00584 XMLAttDef::setCreateReason(const XMLAttDef::CreateReasons newReason)
00585 {
00586 fCreateReason = newReason;
00587 }
00588
00589 inline void XMLAttDef::setExternalAttDeclaration(const bool aValue)
00590 {
00591 fExternalAttribute = aValue;
00592 }
00593
00594 XERCES_CPP_NAMESPACE_END
00595
00596 #endif