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 #if !defined(ATTDEF_HPP)
00083 #define ATTDEF_HPP
00084
00085 #include <util/XMLString.hpp>
00086
00087 class XMLAttr;
00088
00107 class XMLAttDef
00108 {
00109 public:
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121 enum AttTypes
00122 {
00123 CData = 0
00124 , ID = 1
00125 , IDRef = 2
00126 , IDRefs = 3
00127 , Entity = 4
00128 , Entities = 5
00129 , NmToken = 6
00130 , NmTokens = 7
00131 , Notation = 8
00132 , Enumeration = 9
00133
00134 , AttTypes_Count
00135 , AttTypes_Min = 0
00136 , AttTypes_Max = 9
00137 , AttTypes_Unknown = -1
00138 };
00139
00140 enum DefAttTypes
00141 {
00142 Default = 0
00143 , Required = 1
00144 , Implied = 2
00145 , Fixed = 3
00146
00147 , DefAttTypes_Count
00148 , DefAttTypes_Min = 0
00149 , DefAttTypes_Max = 3
00150 , DefAttTypes_Unknown = -1
00151 };
00152
00153
00154
00155
00156
00157 static const unsigned int fgInvalidAttrId;
00158
00159
00160
00161
00162
00163
00165
00166
00177 static const XMLCh* getAttTypeString(const AttTypes attrType);
00178
00189 static const XMLCh* getDefAttTypeString(const DefAttTypes attrType);
00190
00191
00192
00193
00194
00195
00196
00197
00199
00200
00204 virtual ~XMLAttDef();
00205
00206
00207
00208
00209
00210
00211
00213
00214
00223 virtual const XMLCh* getFullName() const = 0;
00224
00225
00226
00227
00228
00229
00230
00231
00233
00234
00243 DefAttTypes getDefaultType() const;
00244
00254 const XMLCh* getEnumeration() const;
00255
00264 unsigned int getId() const;
00265
00279 bool getProvided() const;
00280
00290 AttTypes getType() const;
00291
00301 const XMLCh* getValue() const;
00302
00303
00304
00305
00306
00307
00308
00309
00311
00312
00321 void setDefaultType(const XMLAttDef::DefAttTypes newValue);
00322
00331 void setId(const unsigned int newId);
00332
00341 void setProvided(const bool newValue);
00342
00350 void setType(const XMLAttDef::AttTypes newValue);
00351
00362 void setValue(const XMLCh* const newValue);
00363
00374 void setEnumeration(const XMLCh* const newValue);
00375
00376
00377
00378 protected :
00379
00380
00381
00382 XMLAttDef
00383 (
00384 const AttTypes type = CData
00385 , const DefAttTypes defType = Implied
00386 );
00387 XMLAttDef
00388 (
00389 const XMLCh* const attValue
00390 , const AttTypes type
00391 , const DefAttTypes defType
00392 , const XMLCh* const enumValues = 0
00393 );
00394
00395
00396 private :
00397
00398
00399
00400 XMLAttDef(const XMLAttDef&);
00401 void operator=(const XMLAttDef&);
00402
00403
00404
00405
00406
00407 void cleanUp();
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 XMLCh* fEnumeration;
00440 unsigned int fId;
00441 bool fProvided;
00442 AttTypes fType;
00443 XMLCh* fValue;
00444 };
00445
00446
00447
00448
00449
00450
00451 inline XMLAttDef::DefAttTypes XMLAttDef::getDefaultType() const
00452 {
00453 return fDefaultType;
00454 }
00455
00456 inline const XMLCh* XMLAttDef::getEnumeration() const
00457 {
00458 return fEnumeration;
00459 }
00460
00461 inline unsigned int XMLAttDef::getId() const
00462 {
00463 return fId;
00464 }
00465
00466 inline bool XMLAttDef::getProvided() const
00467 {
00468 return fProvided;
00469 }
00470
00471 inline XMLAttDef::AttTypes XMLAttDef::getType() const
00472 {
00473 return fType;
00474 }
00475
00476 inline const XMLCh* XMLAttDef::getValue() const
00477 {
00478 return fValue;
00479 }
00480
00481
00482
00483
00484
00485 inline void XMLAttDef::setDefaultType(const XMLAttDef::DefAttTypes newValue)
00486 {
00487 fDefaultType = newValue;
00488 }
00489
00490 inline void XMLAttDef::setEnumeration(const XMLCh* const newValue)
00491 {
00492 delete [] fEnumeration;
00493 fEnumeration = XMLString::replicate(newValue);
00494 }
00495
00496 inline void XMLAttDef::setId(const unsigned int newId)
00497 {
00498 fId = newId;
00499 }
00500
00501 inline void XMLAttDef::setProvided(const bool newValue)
00502 {
00503 fProvided = newValue;
00504 }
00505
00506 inline void XMLAttDef::setType(const XMLAttDef::AttTypes newValue)
00507 {
00508 fType = newValue;
00509 }
00510
00511 inline void XMLAttDef::setValue(const XMLCh* const newValue)
00512 {
00513 delete [] fValue;
00514 fValue = XMLString::replicate(newValue);
00515 }
00516
00517 #endif