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 #if !defined(ATTDEF_HPP)
00105 #define ATTDEF_HPP
00106
00107 #include <util/XMLString.hpp>
00108
00109 class XMLAttr;
00110
00129 class XMLAttDef
00130 {
00131 public:
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148 enum AttTypes
00149 {
00150 CData = 0
00151 , ID = 1
00152 , IDRef = 2
00153 , IDRefs = 3
00154 , Entity = 4
00155 , Entities = 5
00156 , NmToken = 6
00157 , NmTokens = 7
00158 , Notation = 8
00159 , Enumeration = 9
00160 , Simple = 10
00161 , Any_Any = 11
00162 , Any_Other = 12
00163 , Any_List = 13
00164
00165 , AttTypes_Count
00166 , AttTypes_Min = 0
00167 , AttTypes_Max = 13
00168 , AttTypes_Unknown = -1
00169 };
00170
00171 enum DefAttTypes
00172 {
00173 Default = 0
00174 , Fixed = 1
00175 , Required = 2
00176 , Required_And_Fixed = 3
00177 , Implied = 4
00178 , ProcessContents_Strict = 5
00179 , ProcessContents_Lax = 6
00180 , ProcessContents_Skip = 7
00181 , Prohibited = 8
00182
00183 , DefAttTypes_Count
00184 , DefAttTypes_Min = 0
00185 , DefAttTypes_Max = 8
00186 , DefAttTypes_Unknown = -1
00187 };
00188
00189 enum CreateReasons
00190 {
00191 NoReason
00192 , JustFaultIn
00193 };
00194
00195
00196
00197
00198 static const unsigned int fgInvalidAttrId;
00199
00200
00201
00202
00203
00204
00207
00218 static const XMLCh* getAttTypeString(const AttTypes attrType);
00219
00230 static const XMLCh* getDefAttTypeString(const DefAttTypes attrType);
00231
00233
00234
00235
00236
00237
00238
00241
00245 virtual ~XMLAttDef();
00247
00248
00249
00250
00251
00252
00255
00264 virtual const XMLCh* getFullName() const = 0;
00265
00267
00268
00269
00270
00271
00272
00275
00284 DefAttTypes getDefaultType() const;
00285
00295 const XMLCh* getEnumeration() const;
00296
00305 unsigned int getId() const;
00306
00320 bool getProvided() const;
00321
00331 AttTypes getType() const;
00332
00342 const XMLCh* getValue() const;
00343
00352 CreateReasons getCreateReason() const;
00353
00361 bool isExternal() const;
00362
00364
00365
00366
00367
00368
00369
00372
00381 void setDefaultType(const XMLAttDef::DefAttTypes newValue);
00382
00391 void setId(const unsigned int newId);
00392
00401 void setProvided(const bool newValue);
00402
00410 void setType(const XMLAttDef::AttTypes newValue);
00411
00422 void setValue(const XMLCh* const newValue);
00423
00434 void setEnumeration(const XMLCh* const newValue);
00435
00441 void setCreateReason(const CreateReasons newReason);
00442
00446 void setExternalAttDeclaration(const bool aValue);
00447
00449
00450 protected :
00451
00452
00453
00454 XMLAttDef
00455 (
00456 const AttTypes type = CData
00457 , const DefAttTypes defType = Implied
00458 );
00459 XMLAttDef
00460 (
00461 const XMLCh* const attValue
00462 , const AttTypes type
00463 , const DefAttTypes defType
00464 , const XMLCh* const enumValues = 0
00465 );
00466
00467
00468 private :
00469
00470
00471
00472 XMLAttDef(const XMLAttDef&);
00473 void operator=(const XMLAttDef&);
00474
00475
00476
00477
00478
00479 void cleanUp();
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
00514
00515
00516
00517
00518 DefAttTypes fDefaultType;
00519 XMLCh* fEnumeration;
00520 unsigned int fId;
00521 bool fProvided;
00522 AttTypes fType;
00523 XMLCh* fValue;
00524 CreateReasons fCreateReason;
00525 bool fExternalAttribute;
00526 };
00527
00528
00529
00530
00531
00532
00533 inline XMLAttDef::DefAttTypes XMLAttDef::getDefaultType() const
00534 {
00535 return fDefaultType;
00536 }
00537
00538 inline const XMLCh* XMLAttDef::getEnumeration() const
00539 {
00540 return fEnumeration;
00541 }
00542
00543 inline unsigned int XMLAttDef::getId() const
00544 {
00545 return fId;
00546 }
00547
00548 inline bool XMLAttDef::getProvided() const
00549 {
00550 return fProvided;
00551 }
00552
00553 inline XMLAttDef::AttTypes XMLAttDef::getType() const
00554 {
00555 return fType;
00556 }
00557
00558 inline const XMLCh* XMLAttDef::getValue() const
00559 {
00560 return fValue;
00561 }
00562
00563 inline XMLAttDef::CreateReasons XMLAttDef::getCreateReason() const
00564 {
00565 return fCreateReason;
00566 }
00567
00568 inline bool XMLAttDef::isExternal() const
00569 {
00570 return fExternalAttribute;
00571 }
00572
00573
00574
00575
00576
00577 inline void XMLAttDef::setDefaultType(const XMLAttDef::DefAttTypes newValue)
00578 {
00579 fDefaultType = newValue;
00580 }
00581
00582 inline void XMLAttDef::setEnumeration(const XMLCh* const newValue)
00583 {
00584 delete [] fEnumeration;
00585
00586 if (newValue) {
00587 fEnumeration = XMLString::replicate(newValue);
00588 }
00589 else {
00590 fEnumeration = 0;
00591 }
00592 }
00593
00594 inline void XMLAttDef::setId(const unsigned int newId)
00595 {
00596 fId = newId;
00597 }
00598
00599 inline void XMLAttDef::setProvided(const bool newValue)
00600 {
00601 fProvided = newValue;
00602 }
00603
00604 inline void XMLAttDef::setType(const XMLAttDef::AttTypes newValue)
00605 {
00606 fType = newValue;
00607 }
00608
00609 inline void XMLAttDef::setValue(const XMLCh* const newValue)
00610 {
00611 delete [] fValue;
00612 fValue = XMLString::replicate(newValue);
00613 }
00614
00615 inline void
00616 XMLAttDef::setCreateReason(const XMLAttDef::CreateReasons newReason)
00617 {
00618 fCreateReason = newReason;
00619 }
00620
00621 inline void XMLAttDef::setExternalAttDeclaration(const bool aValue)
00622 {
00623 fExternalAttribute = aValue;
00624 }
00625
00626 #endif