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
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115 #if !defined(XMLELEMENTDECL_HPP)
00116 #define XMLELEMENTDECL_HPP
00117
00118 #include <util/XMLString.hpp>
00119 #include <framework/XMLAttr.hpp>
00120 #include <framework/XMLAttDefList.hpp>
00121 #include <framework/XMLContentModel.hpp>
00122
00123 class ContentSpecNode;
00124
00140 class XMLElementDecl
00141 {
00142 public:
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158 enum CreateReasons
00159 {
00160 NoReason
00161 , Declared
00162 , AttList
00163 , InContentModel
00164 , AsRootElem
00165 , JustFaultIn
00166 };
00167
00168 enum LookupOpts
00169 {
00170 AddIfNotFound
00171 , FailIfNotFound
00172 };
00173
00174 enum CharDataOpts
00175 {
00176 NoCharData
00177 , SpacesOk
00178 , AllCharData
00179 };
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196 static const unsigned int fgInvalidElemId;
00197 static const unsigned int fgPCDataElemId;
00198 static const XMLCh fgPCDataElemName[];
00199
00200
00201
00202
00203
00204
00207
00209
00210
00211
00212
00213
00214
00217
00246 virtual XMLAttDef* findAttr
00247 (
00248 const XMLCh* const qName
00249 , const unsigned int uriId
00250 , const XMLCh* const baseName
00251 , const XMLCh* const prefix
00252 , const LookupOpts options
00253 , bool& wasAdded
00254 ) const = 0;
00255
00267 virtual XMLAttDefList& getAttDefList() const = 0;
00268
00276 virtual CharDataOpts getCharDataOpts() const = 0;
00277
00284 virtual bool hasAttDefs() const = 0;
00285
00293 virtual bool resetDefs() = 0;
00294
00302 virtual const ContentSpecNode* getContentSpec() const = 0;
00303
00309 virtual ContentSpecNode* getContentSpec() = 0;
00310
00320 virtual void setContentSpec(ContentSpecNode* toAdopt) = 0;
00321
00323
00324
00325
00326
00327
00328
00331
00339 const XMLCh* getBaseName() const;
00340 XMLCh* getBaseName();
00341
00348 const unsigned int getURI() const;
00349
00357 const QName* getElementName() const;
00358 QName* getElementName();
00359
00368 const XMLCh* getFullName() const;
00369
00381 XMLContentModel* getContentModel();
00382
00393
00394 CreateReasons getCreateReason() const;
00395
00405 unsigned int getId() const;
00406
00416 bool isDeclared() const;
00417
00425
00426 bool isExternal() const;
00427
00429
00430
00431
00432
00433
00434
00437
00448 void setElementName(const XMLCh* const prefix
00449 , const XMLCh* const localPart
00450 , const int uriId );
00451
00461 void setElementName(const XMLCh* const rawName
00462 , const int uriId );
00463
00472 void setElementName(QName* const elementName);
00473
00485 void setContentModel(XMLContentModel* const newModelToAdopt);
00486
00497 void setCreateReason(const CreateReasons newReason);
00498
00505 void setId(const unsigned int newId);
00506
00507
00511 void setExternalElemDeclaration(const bool aValue);
00512
00514
00515
00516
00517
00518
00519
00522
00535 const XMLCh* getFormattedContentModel () const;
00536
00538
00539
00540 protected :
00541
00542
00543
00544 XMLElementDecl();
00545
00546
00547
00548
00549
00550 virtual XMLContentModel* makeContentModel() = 0;
00551 virtual XMLCh* formatContentModel () const = 0;
00552
00553
00554 private :
00555
00556
00557
00558 XMLElementDecl(const XMLElementDecl&);
00559 void operator=(const XMLElementDecl&);
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594 QName* fElementName;
00595 XMLContentModel* fContentModel;
00596 CreateReasons fCreateReason;
00597 XMLCh* fFormattedModel;
00598 unsigned int fId;
00599 bool fExternalElement;
00600 };
00601
00602
00603
00604
00605
00606 inline const XMLCh* XMLElementDecl::getBaseName() const
00607 {
00608 return fElementName->getLocalPart();
00609 }
00610
00611 inline XMLCh* XMLElementDecl::getBaseName()
00612 {
00613 return fElementName->getLocalPart();
00614 }
00615
00616 inline const unsigned int XMLElementDecl::getURI() const
00617 {
00618 return fElementName->getURI();
00619 }
00620
00621 inline const QName* XMLElementDecl::getElementName() const
00622 {
00623 return fElementName;
00624 }
00625
00626 inline QName* XMLElementDecl::getElementName()
00627 {
00628 return fElementName;
00629 }
00630
00631 inline const XMLCh* XMLElementDecl::getFullName() const
00632 {
00633 return fElementName->getRawName();
00634 }
00635
00636 inline XMLContentModel* XMLElementDecl::getContentModel()
00637 {
00638 if (!fContentModel)
00639 fContentModel = makeContentModel();
00640 return fContentModel;
00641 }
00642
00643 inline XMLElementDecl::CreateReasons XMLElementDecl::getCreateReason() const
00644 {
00645 return fCreateReason;
00646 }
00647
00648 inline unsigned int XMLElementDecl::getId() const
00649 {
00650 return fId;
00651 }
00652
00653 inline bool XMLElementDecl::isDeclared() const
00654 {
00655 return (fCreateReason == Declared);
00656 }
00657
00658
00659 inline bool XMLElementDecl::isExternal() const
00660 {
00661 return fExternalElement;
00662 }
00663
00664
00665
00666
00667
00668 inline void
00669 XMLElementDecl::setContentModel(XMLContentModel* const newModelToAdopt)
00670 {
00671 delete fContentModel;
00672 fContentModel = newModelToAdopt;
00673 }
00674
00675 inline void
00676 XMLElementDecl::setCreateReason(const XMLElementDecl::CreateReasons newReason)
00677 {
00678 fCreateReason = newReason;
00679 }
00680
00681 inline void XMLElementDecl::setId(const unsigned int newId)
00682 {
00683 fId = newId;
00684 }
00685
00686
00687 inline void XMLElementDecl::setExternalElemDeclaration(const bool aValue)
00688 {
00689 fExternalElement = aValue;
00690 }
00691
00692 #endif