00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if !defined(XERCESC_INCLUDE_GUARD_XMLATTDEF_HPP)
00023 #define XERCESC_INCLUDE_GUARD_XMLATTDEF_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 XMLPARSER_EXPORT 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 XMLSize_t getId() const;
00237
00247 AttTypes getType() const;
00248
00258 const XMLCh* getValue() const;
00259
00268 CreateReasons getCreateReason() const;
00269
00277 bool isExternal() const;
00278
00286 MemoryManager* getMemoryManager() const;
00287
00289
00290
00291
00292
00293
00294
00297
00306 void setDefaultType(const XMLAttDef::DefAttTypes newValue);
00307
00316 void setId(const XMLSize_t newId);
00317
00325 void setType(const XMLAttDef::AttTypes newValue);
00326
00337 void setValue(const XMLCh* const newValue);
00338
00349 void setEnumeration(const XMLCh* const newValue);
00350
00358 void setCreateReason(const CreateReasons newReason);
00359
00365 void setExternalAttDeclaration(const bool aValue);
00366
00368
00369
00370
00371
00372 DECL_XSERIALIZABLE(XMLAttDef)
00373
00374 protected :
00375
00376
00377
00378 XMLAttDef
00379 (
00380 const AttTypes type = CData
00381 , const DefAttTypes defType= Implied
00382 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00383 );
00384 XMLAttDef
00385 (
00386 const XMLCh* const attValue
00387 , const AttTypes type
00388 , const DefAttTypes defType
00389 , const XMLCh* const enumValues = 0
00390 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00391 );
00392
00393
00394 private :
00395
00396
00397
00398 XMLAttDef(const XMLAttDef&);
00399 XMLAttDef& operator=(const XMLAttDef&);
00400
00401
00402
00403
00404
00405 void cleanUp();
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438 DefAttTypes fDefaultType;
00439 AttTypes fType;
00440 CreateReasons fCreateReason;
00441 bool fExternalAttribute;
00442 XMLSize_t fId;
00443 XMLCh* fValue;
00444 XMLCh* fEnumeration;
00445 MemoryManager* fMemoryManager;
00446 };
00447
00448
00449
00450
00451
00452 inline XMLAttDef::DefAttTypes XMLAttDef::getDefaultType() const
00453 {
00454 return fDefaultType;
00455 }
00456
00457 inline const XMLCh* XMLAttDef::getEnumeration() const
00458 {
00459 return fEnumeration;
00460 }
00461
00462 inline XMLSize_t XMLAttDef::getId() const
00463 {
00464 return fId;
00465 }
00466
00467 inline XMLAttDef::AttTypes XMLAttDef::getType() const
00468 {
00469 return fType;
00470 }
00471
00472 inline const XMLCh* XMLAttDef::getValue() const
00473 {
00474 return fValue;
00475 }
00476
00477 inline XMLAttDef::CreateReasons XMLAttDef::getCreateReason() const
00478 {
00479 return fCreateReason;
00480 }
00481
00482 inline bool XMLAttDef::isExternal() const
00483 {
00484 return fExternalAttribute;
00485 }
00486
00487 inline MemoryManager* XMLAttDef::getMemoryManager() const
00488 {
00489 return fMemoryManager;
00490 }
00491
00492
00493
00494
00495 inline void XMLAttDef::setDefaultType(const XMLAttDef::DefAttTypes newValue)
00496 {
00497 fDefaultType = newValue;
00498 }
00499
00500 inline void XMLAttDef::setEnumeration(const XMLCh* const newValue)
00501 {
00502 if (fEnumeration)
00503 fMemoryManager->deallocate(fEnumeration);
00504
00505 fEnumeration = XMLString::replicate(newValue, fMemoryManager);
00506 }
00507
00508 inline void XMLAttDef::setId(const XMLSize_t newId)
00509 {
00510 fId = newId;
00511 }
00512
00513 inline void XMLAttDef::setType(const XMLAttDef::AttTypes newValue)
00514 {
00515 fType = newValue;
00516 }
00517
00518 inline void XMLAttDef::setValue(const XMLCh* const newValue)
00519 {
00520 if (fValue)
00521 fMemoryManager->deallocate(fValue);
00522
00523 fValue = XMLString::replicate(newValue, fMemoryManager);
00524 }
00525
00526 inline void
00527 XMLAttDef::setCreateReason(const XMLAttDef::CreateReasons newReason)
00528 {
00529 fCreateReason = newReason;
00530 }
00531
00532 inline void XMLAttDef::setExternalAttDeclaration(const bool aValue)
00533 {
00534 fExternalAttribute = aValue;
00535 }
00536
00537 XERCES_CPP_NAMESPACE_END
00538
00539 #endif