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 #if !defined(ATTDEF_HPP)
00102 #define ATTDEF_HPP
00103
00104 #include <util/XMLString.hpp>
00105
00106 class XMLAttr;
00107
00126 class XMLAttDef
00127 {
00128 public:
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145 enum AttTypes
00146 {
00147 CData = 0
00148 , ID = 1
00149 , IDRef = 2
00150 , IDRefs = 3
00151 , Entity = 4
00152 , Entities = 5
00153 , NmToken = 6
00154 , NmTokens = 7
00155 , Notation = 8
00156 , Enumeration = 9
00157 , Simple = 10
00158 , Any_Any = 11
00159 , Any_Other = 12
00160 , Any_List = 13
00161
00162 , AttTypes_Count
00163 , AttTypes_Min = 0
00164 , AttTypes_Max = 13
00165 , AttTypes_Unknown = -1
00166 };
00167
00168 enum DefAttTypes
00169 {
00170 Default = 0
00171 , Required = 1
00172 , Implied = 2
00173 , Prohibited = 3
00174 , Fixed = 4
00175 , Required_And_Fixed = 5
00176 , ProcessContents_Strict = 6
00177 , ProcessContents_Lax = 7
00178 , ProcessContents_Skip = 8
00179
00180 , DefAttTypes_Count
00181 , DefAttTypes_Min = 0
00182 , DefAttTypes_Max = 8
00183 , DefAttTypes_Unknown = -1
00184 };
00185
00186 enum CreateReasons
00187 {
00188 NoReason
00189 , JustFaultIn
00190 };
00191
00192
00193
00194
00195 static const unsigned int fgInvalidAttrId;
00196
00197
00198
00199
00200
00201
00204
00215 static const XMLCh* getAttTypeString(const AttTypes attrType);
00216
00227 static const XMLCh* getDefAttTypeString(const DefAttTypes attrType);
00228
00230
00231
00232
00233
00234
00235
00238
00242 virtual ~XMLAttDef();
00244
00245
00246
00247
00248
00249
00252
00261 virtual const XMLCh* getFullName() const = 0;
00262
00264
00265
00266
00267
00268
00269
00272
00281 DefAttTypes getDefaultType() const;
00282
00292 const XMLCh* getEnumeration() const;
00293
00302 unsigned int getId() const;
00303
00317 bool getProvided() const;
00318
00328 AttTypes getType() const;
00329
00339 const XMLCh* getValue() const;
00340
00349 CreateReasons getCreateReason() const;
00350
00358 bool isExternal() const;
00359
00361
00362
00363
00364
00365
00366
00369
00378 void setDefaultType(const XMLAttDef::DefAttTypes newValue);
00379
00388 void setId(const unsigned int newId);
00389
00398 void setProvided(const bool newValue);
00399
00407 void setType(const XMLAttDef::AttTypes newValue);
00408
00419 void setValue(const XMLCh* const newValue);
00420
00431 void setEnumeration(const XMLCh* const newValue);
00432
00438 void setCreateReason(const CreateReasons newReason);
00439
00443 void setExternalAttDeclaration(const bool aValue);
00444
00446
00447 protected :
00448
00449
00450
00451 XMLAttDef
00452 (
00453 const AttTypes type = CData
00454 , const DefAttTypes defType = Implied
00455 );
00456 XMLAttDef
00457 (
00458 const XMLCh* const attValue
00459 , const AttTypes type
00460 , const DefAttTypes defType
00461 , const XMLCh* const enumValues = 0
00462 );
00463
00464
00465 private :
00466
00467
00468
00469 XMLAttDef(const XMLAttDef&);
00470 void operator=(const XMLAttDef&);
00471
00472
00473
00474
00475
00476 void cleanUp();
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
00514
00515 DefAttTypes fDefaultType;
00516 XMLCh* fEnumeration;
00517 unsigned int fId;
00518 bool fProvided;
00519 AttTypes fType;
00520 XMLCh* fValue;
00521 CreateReasons fCreateReason;
00522 bool fExternalAttribute;
00523 };
00524
00525
00526
00527
00528
00529
00530 inline XMLAttDef::DefAttTypes XMLAttDef::getDefaultType() const
00531 {
00532 return fDefaultType;
00533 }
00534
00535 inline const XMLCh* XMLAttDef::getEnumeration() const
00536 {
00537 return fEnumeration;
00538 }
00539
00540 inline unsigned int XMLAttDef::getId() const
00541 {
00542 return fId;
00543 }
00544
00545 inline bool XMLAttDef::getProvided() const
00546 {
00547 return fProvided;
00548 }
00549
00550 inline XMLAttDef::AttTypes XMLAttDef::getType() const
00551 {
00552 return fType;
00553 }
00554
00555 inline const XMLCh* XMLAttDef::getValue() const
00556 {
00557 return fValue;
00558 }
00559
00560 inline XMLAttDef::CreateReasons XMLAttDef::getCreateReason() const
00561 {
00562 return fCreateReason;
00563 }
00564
00565 inline bool XMLAttDef::isExternal() const
00566 {
00567 return fExternalAttribute;
00568 }
00569
00570
00571
00572
00573
00574 inline void XMLAttDef::setDefaultType(const XMLAttDef::DefAttTypes newValue)
00575 {
00576 fDefaultType = newValue;
00577 }
00578
00579 inline void XMLAttDef::setEnumeration(const XMLCh* const newValue)
00580 {
00581 delete [] fEnumeration;
00582
00583 if (newValue) {
00584 fEnumeration = XMLString::replicate(newValue);
00585 }
00586 else {
00587 fEnumeration = 0;
00588 }
00589 }
00590
00591 inline void XMLAttDef::setId(const unsigned int newId)
00592 {
00593 fId = newId;
00594 }
00595
00596 inline void XMLAttDef::setProvided(const bool newValue)
00597 {
00598 fProvided = newValue;
00599 }
00600
00601 inline void XMLAttDef::setType(const XMLAttDef::AttTypes newValue)
00602 {
00603 fType = newValue;
00604 }
00605
00606 inline void XMLAttDef::setValue(const XMLCh* const newValue)
00607 {
00608 delete [] fValue;
00609 fValue = XMLString::replicate(newValue);
00610 }
00611
00612 inline void
00613 XMLAttDef::setCreateReason(const XMLAttDef::CreateReasons newReason)
00614 {
00615 fCreateReason = newReason;
00616 }
00617
00618 inline void XMLAttDef::setExternalAttDeclaration(const bool aValue)
00619 {
00620 fExternalAttribute = aValue;
00621 }
00622
00623 #endif