00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 #if !defined(XMLELEMENTDECL_HPP)
00022 #define XMLELEMENTDECL_HPP
00023 
00024 #include <xercesc/framework/XMLAttr.hpp>
00025 #include <xercesc/framework/XMLAttDefList.hpp>
00026 #include <xercesc/util/XMLString.hpp>
00027 #include <xercesc/util/PlatformUtils.hpp>
00028 #include <xercesc/internal/XSerializable.hpp>
00029 
00030 XERCES_CPP_NAMESPACE_BEGIN
00031 
00032 class ContentSpecNode;
00033 class XMLContentModel;
00034 
00050 class  XMLElementDecl : public XSerializable, public XMemory
00051 {
00052  public:
00053     
00054     
00055     
00056     
00057     
00058     
00059     
00060     
00061     
00062     
00063     
00064     
00065     
00066     
00067     
00068     enum CreateReasons
00069     {
00070         NoReason
00071         , Declared
00072         , AttList
00073         , InContentModel
00074         , AsRootElem
00075         , JustFaultIn
00076     };
00077 
00082     enum LookupOpts
00083     {
00084         AddIfNotFound
00085         , FailIfNotFound
00086     };
00087 
00088     enum CharDataOpts
00089     {
00090         NoCharData
00091         , SpacesOk
00092         , AllCharData
00093     };
00094 
00095 
00096     
00097     
00098     
00099     
00100     
00101     
00102     
00103     
00104     
00105     
00106     
00107     
00108     
00109     
00110     static const unsigned int   fgInvalidElemId;
00111     static const unsigned int   fgPCDataElemId;
00112     static const XMLCh          fgPCDataElemName[];
00113 
00114 
00115 
00116     
00117     
00118     
00121     virtual ~XMLElementDecl();
00123 
00124 
00125     
00126     
00127     
00128 
00131 
00162     virtual XMLAttDef* findAttr
00163     (
00164         const   XMLCh* const    qName
00165         , const unsigned int    uriId
00166         , const XMLCh* const    baseName
00167         , const XMLCh* const    prefix
00168         , const LookupOpts      options
00169         ,       bool&           wasAdded
00170     )   const = 0;
00171 
00183     virtual XMLAttDefList& getAttDefList() const = 0;
00184 
00192     virtual CharDataOpts getCharDataOpts() const = 0;
00193 
00200     virtual bool hasAttDefs() const = 0;
00201 
00209     virtual bool resetDefs() = 0;
00210 
00218     virtual const ContentSpecNode* getContentSpec() const = 0;
00219 
00225     virtual ContentSpecNode* getContentSpec() = 0;
00226 
00236     virtual void setContentSpec(ContentSpecNode* toAdopt) = 0;
00237 
00249     virtual XMLContentModel* getContentModel() = 0;
00250 
00262     virtual void setContentModel(XMLContentModel* const newModelToAdopt) = 0;
00263 
00276     virtual const XMLCh* getFormattedContentModel ()   const = 0;
00277 
00279 
00280 
00281     
00282     
00283     
00284 
00287 
00295     const XMLCh* getBaseName() const;
00296     XMLCh* getBaseName();
00297 
00304     unsigned int getURI() const;
00305 
00313     const QName* getElementName() const;
00314     QName* getElementName();
00315 
00324     const XMLCh* getFullName() const;
00325 
00337     CreateReasons getCreateReason() const;
00338 
00348     unsigned int getId() const;
00349 
00350 
00355     virtual const XMLCh* getDOMTypeInfoUri() const = 0;
00356 
00361     virtual const XMLCh* getDOMTypeInfoName() const = 0;
00362 
00363 
00373     bool isDeclared() const;
00374 
00383     bool isExternal() const;
00384 
00392     MemoryManager* getMemoryManager() const;
00393 
00395 
00396 
00397     
00398     
00399     
00400 
00403 
00414       void setElementName(const XMLCh* const       prefix
00415                         , const XMLCh* const       localPart
00416                         , const int                uriId );
00417 
00427       void setElementName(const XMLCh* const    rawName
00428                         , const int             uriId );
00429 
00438       void setElementName(const QName* const    elementName);
00439 
00450     void setCreateReason(const CreateReasons newReason);
00451 
00458     void setId(const unsigned int newId);
00459 
00460 
00464     void setExternalElemDeclaration(const bool aValue);
00465 
00467 
00468 
00469     
00470     
00471     
00472 
00475 
00477 
00478     
00479 
00480 
00481     DECL_XSERIALIZABLE(XMLElementDecl)
00482 
00483     enum objectType
00484     {
00485         Schema
00486       , DTD
00487       , UnKnown
00488     };
00489 
00490     virtual XMLElementDecl::objectType  getObjectType() const = 0;
00491 
00492     static void            storeElementDecl(XSerializeEngine&        serEng
00493                                           , XMLElementDecl*    const element);
00494 
00495     static XMLElementDecl* loadElementDecl(XSerializeEngine& serEng);
00496 
00497 protected :
00498     
00499     
00500     
00501     XMLElementDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00502 
00503 private :
00504     
00505     
00506     
00507     XMLElementDecl(const XMLElementDecl&);
00508     XMLElementDecl& operator=(const XMLElementDecl&);
00509 
00510 
00511     
00512     
00513     
00514     
00515     
00516     
00517     
00518     
00519     
00520     
00521     
00522     
00523     
00524     
00525     
00526     
00527     
00528     
00529     
00530     
00531     
00532     
00533     
00534     MemoryManager*      fMemoryManager;
00535     QName*              fElementName;
00536     CreateReasons       fCreateReason;
00537     unsigned int        fId;
00538     bool                fExternalElement;
00539 };
00540 
00541 
00542 
00543 
00544 
00545 inline const XMLCh* XMLElementDecl::getBaseName() const
00546 {
00547     return fElementName->getLocalPart();
00548 }
00549 
00550 inline XMLCh* XMLElementDecl::getBaseName()
00551 {
00552     return fElementName->getLocalPart();
00553 }
00554 
00555 inline unsigned int XMLElementDecl::getURI() const
00556 {
00557     return fElementName->getURI();
00558 }
00559 
00560 inline const QName* XMLElementDecl::getElementName() const
00561 {
00562     return fElementName;
00563 }
00564 
00565 inline QName* XMLElementDecl::getElementName()
00566 {
00567     return fElementName;
00568 }
00569 
00570 inline const XMLCh* XMLElementDecl::getFullName() const
00571 {
00572     return fElementName->getRawName();
00573 }
00574 
00575 inline XMLElementDecl::CreateReasons XMLElementDecl::getCreateReason() const
00576 {
00577     return fCreateReason;
00578 }
00579 
00580 inline unsigned int XMLElementDecl::getId() const
00581 {
00582     return fId;
00583 }
00584 
00585 inline bool XMLElementDecl::isDeclared() const
00586 {
00587     return (fCreateReason == Declared);
00588 }
00589 
00590 
00591 inline bool XMLElementDecl::isExternal() const
00592 {
00593     return fExternalElement;
00594 }
00595 
00596 inline MemoryManager* XMLElementDecl::getMemoryManager() const
00597 {
00598     return fMemoryManager;
00599 }
00600 
00601 
00602 
00603 
00604 
00605 inline void
00606 XMLElementDecl::setCreateReason(const XMLElementDecl::CreateReasons newReason)
00607 {
00608     fCreateReason = newReason;
00609 }
00610 
00611 inline void XMLElementDecl::setId(const unsigned int newId)
00612 {
00613     fId = newId;
00614 }
00615 
00616 
00617 inline void XMLElementDecl::setExternalElemDeclaration(const bool aValue)
00618 {
00619     fExternalElement = aValue;
00620 }
00621 
00622 XERCES_CPP_NAMESPACE_END
00623 
00624 #endif