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 #if !defined(ATTDEF_HPP)
00099 #define ATTDEF_HPP
00100
00101 #include <util/XMLString.hpp>
00102
00103 class XMLAttr;
00104
00123 class XMLAttDef
00124 {
00125 public:
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142 enum AttTypes
00143 {
00144 CData = 0
00145 , ID = 1
00146 , IDRef = 2
00147 , IDRefs = 3
00148 , Entity = 4
00149 , Entities = 5
00150 , NmToken = 6
00151 , NmTokens = 7
00152 , Notation = 8
00153 , Enumeration = 9
00154 , Simple = 10
00155 , Any_Any = 11
00156 , Any_Other = 12
00157 , Any_Local = 13
00158 , Any_List = 14
00159
00160 , AttTypes_Count
00161 , AttTypes_Min = 0
00162 , AttTypes_Max = 14
00163 , AttTypes_Unknown = -1
00164 };
00165
00166 enum DefAttTypes
00167 {
00168 Default = 0
00169 , Required = 1
00170 , Implied = 2
00171 , Fixed = 3
00172 , Prohibited = 4
00173 , Required_And_Fixed = 5
00174 , ProcessContents_Strict = 6
00175 , ProcessContents_Lax = 7
00176 , ProcessContents_Skip = 8
00177
00178 , DefAttTypes_Count
00179 , DefAttTypes_Min = 0
00180 , DefAttTypes_Max = 8
00181 , DefAttTypes_Unknown = -1
00182 };
00183
00184 enum CreateReasons
00185 {
00186 NoReason
00187 , JustFaultIn
00188 };
00189
00190
00191
00192
00193 static const unsigned int fgInvalidAttrId;
00194
00195
00196
00197
00198
00199
00202
00213 static const XMLCh* getAttTypeString(const AttTypes attrType);
00214
00225 static const XMLCh* getDefAttTypeString(const DefAttTypes attrType);
00226
00228
00229
00230
00231
00232
00233
00236
00240 virtual ~XMLAttDef();
00242
00243
00244
00245
00246
00247
00250
00259 virtual const XMLCh* getFullName() const = 0;
00260
00262
00263
00264
00265
00266
00267
00270
00279 DefAttTypes getDefaultType() const;
00280
00290 const XMLCh* getEnumeration() const;
00291
00300 unsigned int getId() const;
00301
00315 bool getProvided() const;
00316
00326 AttTypes getType() const;
00327
00337 const XMLCh* getValue() const;
00338
00347 CreateReasons getCreateReason() const;
00348
00356 bool isExternal() const;
00357
00359
00360
00361
00362
00363
00364
00367
00376 void setDefaultType(const XMLAttDef::DefAttTypes newValue);
00377
00386 void setId(const unsigned int newId);
00387
00396 void setProvided(const bool newValue);
00397
00405 void setType(const XMLAttDef::AttTypes newValue);
00406
00417 void setValue(const XMLCh* const newValue);
00418
00429 void setEnumeration(const XMLCh* const newValue);
00430
00436 void setCreateReason(const CreateReasons newReason);
00437
00441 void setExternalAttDeclaration(const bool aValue);
00442
00444
00445 protected :
00446
00447
00448
00449 XMLAttDef
00450 (
00451 const AttTypes type = CData
00452 , const DefAttTypes defType = Implied
00453 );
00454 XMLAttDef
00455 (
00456 const XMLCh* const attValue
00457 , const AttTypes type
00458 , const DefAttTypes defType
00459 , const XMLCh* const enumValues = 0
00460 );
00461
00462
00463 private :
00464
00465
00466
00467 XMLAttDef(const XMLAttDef&);
00468 void operator=(const XMLAttDef&);
00469
00470
00471
00472
00473
00474 void cleanUp();
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513 DefAttTypes fDefaultType;
00514 XMLCh* fEnumeration;
00515 unsigned int fId;
00516 bool fProvided;
00517 AttTypes fType;
00518 XMLCh* fValue;
00519 CreateReasons fCreateReason;
00520 bool fExternalAttribute;
00521 };
00522
00523
00524
00525
00526
00527
00528 inline XMLAttDef::DefAttTypes XMLAttDef::getDefaultType() const
00529 {
00530 return fDefaultType;
00531 }
00532
00533 inline const XMLCh* XMLAttDef::getEnumeration() const
00534 {
00535 return fEnumeration;
00536 }
00537
00538 inline unsigned int XMLAttDef::getId() const
00539 {
00540 return fId;
00541 }
00542
00543 inline bool XMLAttDef::getProvided() const
00544 {
00545 return fProvided;
00546 }
00547
00548 inline XMLAttDef::AttTypes XMLAttDef::getType() const
00549 {
00550 return fType;
00551 }
00552
00553 inline const XMLCh* XMLAttDef::getValue() const
00554 {
00555 return fValue;
00556 }
00557
00558 inline XMLAttDef::CreateReasons XMLAttDef::getCreateReason() const
00559 {
00560 return fCreateReason;
00561 }
00562
00563 inline bool XMLAttDef::isExternal() const
00564 {
00565 return fExternalAttribute;
00566 }
00567
00568
00569
00570
00571
00572 inline void XMLAttDef::setDefaultType(const XMLAttDef::DefAttTypes newValue)
00573 {
00574 fDefaultType = newValue;
00575 }
00576
00577 inline void XMLAttDef::setEnumeration(const XMLCh* const newValue)
00578 {
00579 delete [] fEnumeration;
00580 fEnumeration = XMLString::replicate(newValue);
00581 }
00582
00583 inline void XMLAttDef::setId(const unsigned int newId)
00584 {
00585 fId = newId;
00586 }
00587
00588 inline void XMLAttDef::setProvided(const bool newValue)
00589 {
00590 fProvided = newValue;
00591 }
00592
00593 inline void XMLAttDef::setType(const XMLAttDef::AttTypes newValue)
00594 {
00595 fType = newValue;
00596 }
00597
00598 inline void XMLAttDef::setValue(const XMLCh* const newValue)
00599 {
00600 delete [] fValue;
00601 fValue = XMLString::replicate(newValue);
00602 }
00603
00604 inline void
00605 XMLAttDef::setCreateReason(const XMLAttDef::CreateReasons newReason)
00606 {
00607 fCreateReason = newReason;
00608 }
00609
00610 inline void XMLAttDef::setExternalAttDeclaration(const bool aValue)
00611 {
00612 fExternalAttribute = aValue;
00613 }
00614
00615 #endif