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 #if !defined(ATTDEF_HPP)
00080 #define ATTDEF_HPP
00081
00082 #include <util/XMLString.hpp>
00083
00084 class XMLAttr;
00085
00104 class XMLAttDef
00105 {
00106 public:
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118 enum AttTypes
00119 {
00120 CData = 0
00121 , ID = 1
00122 , IDRef = 2
00123 , IDRefs = 3
00124 , Entity = 4
00125 , Entities = 5
00126 , NmToken = 6
00127 , NmTokens = 7
00128 , Notation = 8
00129 , Enumeration = 9
00130
00131 , AttTypes_Count
00132 , AttTypes_Min = 0
00133 , AttTypes_Max = 9
00134 , AttTypes_Unknown = -1
00135 };
00136
00137 enum DefAttTypes
00138 {
00139 Default = 0
00140 , Required = 1
00141 , Implied = 2
00142 , Fixed = 3
00143
00144 , DefAttTypes_Count
00145 , DefAttTypes_Min = 0
00146 , DefAttTypes_Max = 3
00147 , DefAttTypes_Unknown = -1
00148 };
00149
00150
00151
00152
00153
00154 static const unsigned int fgInvalidAttrId;
00155
00156
00157
00158
00159
00160
00162
00163
00174 static const XMLCh* getAttTypeString(const AttTypes attrType);
00175
00186 static const XMLCh* getDefAttTypeString(const DefAttTypes attrType);
00187
00188
00189
00190
00191
00192
00193
00194
00196
00197
00201 virtual ~XMLAttDef();
00202
00203
00204
00205
00206
00207
00208
00210
00211
00220 virtual const XMLCh* getFullName() const = 0;
00221
00222
00223
00224
00225
00226
00227
00228
00230
00231
00240 DefAttTypes getDefaultType() const;
00241
00251 const XMLCh* getEnumeration() const;
00252
00261 unsigned int getId() const;
00262
00273 const XMLCh* getKey() const;
00274
00288 bool getProvided() const;
00289
00299 AttTypes getType() const;
00300
00310 const XMLCh* getValue() const;
00311
00312
00313
00314
00315
00316
00317
00318
00320
00321
00330 void setDefaultType(const XMLAttDef::DefAttTypes newValue);
00331
00340 void setId(const unsigned int newId);
00341
00350 void setProvided(const bool newValue);
00351
00359 void setType(const XMLAttDef::AttTypes newValue);
00360
00371 void setValue(const XMLCh* const newValue);
00372
00383 void setEnumeration(const XMLCh* const newValue);
00384
00385
00386
00387 protected :
00388
00389
00390
00391 XMLAttDef
00392 (
00393 const AttTypes type = CData
00394 , const DefAttTypes defType = Implied
00395 );
00396 XMLAttDef
00397 (
00398 const XMLCh* const attValue
00399 , const AttTypes type
00400 , const DefAttTypes defType
00401 , const XMLCh* const enumValues = 0
00402 );
00403
00404
00405 private :
00406
00407
00408
00409 XMLAttDef(const XMLAttDef&);
00410 void operator=(const XMLAttDef&);
00411
00412
00413
00414
00415
00416 void cleanUp();
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447 DefAttTypes fDefaultType;
00448 XMLCh* fEnumeration;
00449 unsigned int fId;
00450 bool fProvided;
00451 AttTypes fType;
00452 XMLCh* fValue;
00453 };
00454
00455
00456
00457
00458
00459 inline const XMLCh* XMLAttDef::getKey() const
00460 {
00461
00462
00463
00464
00465 return getFullName();
00466 }
00467
00468
00469
00470
00471
00472 inline XMLAttDef::DefAttTypes XMLAttDef::getDefaultType() const
00473 {
00474 return fDefaultType;
00475 }
00476
00477 inline const XMLCh* XMLAttDef::getEnumeration() const
00478 {
00479 return fEnumeration;
00480 }
00481
00482 inline unsigned int XMLAttDef::getId() const
00483 {
00484 return fId;
00485 }
00486
00487 inline bool XMLAttDef::getProvided() const
00488 {
00489 return fProvided;
00490 }
00491
00492 inline XMLAttDef::AttTypes XMLAttDef::getType() const
00493 {
00494 return fType;
00495 }
00496
00497 inline const XMLCh* XMLAttDef::getValue() const
00498 {
00499 return fValue;
00500 }
00501
00502
00503
00504
00505
00506 inline void XMLAttDef::setDefaultType(const XMLAttDef::DefAttTypes newValue)
00507 {
00508 fDefaultType = newValue;
00509 }
00510
00511 inline void XMLAttDef::setEnumeration(const XMLCh* const newValue)
00512 {
00513 delete [] fEnumeration;
00514 fEnumeration = XMLString::replicate(newValue);
00515 }
00516
00517 inline void XMLAttDef::setId(const unsigned int newId)
00518 {
00519 fId = newId;
00520 }
00521
00522 inline void XMLAttDef::setProvided(const bool newValue)
00523 {
00524 fProvided = newValue;
00525 }
00526
00527 inline void XMLAttDef::setType(const XMLAttDef::AttTypes newValue)
00528 {
00529 fType = newValue;
00530 }
00531
00532 inline void XMLAttDef::setValue(const XMLCh* const newValue)
00533 {
00534 delete [] fValue;
00535 fValue = XMLString::replicate(newValue);
00536 }
00537
00538 #endif