You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2001/02/26 20:29:25 UTC

cvs commit: xml-xerces/c/src/validators/DTD DTDElementDecl.cpp DTDElementDecl.hpp

tng         01/02/26 11:29:24

  Modified:    c/src/framework XMLElementDecl.hpp
               c/src/validators/DTD DTDElementDecl.cpp DTDElementDecl.hpp
  Log:
  Schema: add virtual method getURI(), getContentSpec and setContenSpec in XMLElementDecl, and DTDElementDecl.
  
  Revision  Changes    Path
  1.10      +42 -1     xml-xerces/c/src/framework/XMLElementDecl.hpp
  
  Index: XMLElementDecl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/framework/XMLElementDecl.hpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XMLElementDecl.hpp	2001/02/26 19:21:30	1.9
  +++ XMLElementDecl.hpp	2001/02/26 19:29:13	1.10
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: XMLElementDecl.hpp,v $
  + * Revision 1.10  2001/02/26 19:29:13  tng
  + * Schema: add virtual method getURI(), getContentSpec and setContenSpec in XMLElementDecl, and DTDElementDecl.
  + *
    * Revision 1.9  2001/02/26 19:21:30  tng
    * Schema: add parameter prefix in findElem and findAttr.
    *
  @@ -100,6 +103,7 @@
   #include <framework/XMLContentModel.hpp>
   
   class XMLValidator;
  +class ContentSpecNode;
   
   /**
    *  This class defines the core information of an element declaration. Each
  @@ -262,6 +266,14 @@
         */
       virtual const XMLCh* getBaseName() const = 0;
   
  +    /** Get the URI id of this element type.
  +      *
  +      * The derived class should return the URI Id of this element.
  +      *
  +      * @return The URI Id of the element decl, -1 is not applicable.
  +      */
  +    virtual const int getURI() const = 0;
  +
       /** The character data options for this element type
         *
         * The derived class should return an appropriate character data opts value
  @@ -298,6 +310,34 @@
         */
       virtual bool resetDefs() = 0;
   
  +
  +    /** Get a pointer to the content spec node
  +      *
  +      * This method will return a const pointer to the content spec node object
  +      * of this element.
  +      *
  +      * @return A const pointer to the element's content spec node
  +      */
  +    virtual const ContentSpecNode* getContentSpec() const = 0;
  +
  +    /** Get a pointer to the content spec node
  +      *
  +      * This method is identical to the previous one, except that it is non
  +      * const.
  +      */
  +    virtual ContentSpecNode* getContentSpec() = 0;
  +
  +    /** Set the content spec node object for this element type
  +      *
  +      * This method will adopt the based content spec node object. This is called
  +      * by the actual validator which is parsing its DTD or Schema or whatever
  +      * and store it on the element decl object via this method.
  +      *
  +      * @param  toAdopt This method will adopt the passed content node spec
  +      *         object. Any previous object is destroyed.
  +      */
  +    virtual void setContentSpec(ContentSpecNode* toAdopt) = 0;
  +
       //@}
   
   
  @@ -338,6 +378,7 @@
         * @return An enumerated value that indicates the reason why this element
         * was added to the element decl pool.
         */
  +
       CreateReasons getCreateReason() const;
   
       /** Get the element decl pool id for this element type
  @@ -390,7 +431,7 @@
         * content model type object and store it on the element decl object via
         * this method.
         *
  -      * @param  newModelToAdopt This method will adop the passed content model
  +      * @param  newModelToAdopt This method will adopt the passed content model
         *         object. Any previous object is destroyed.
         */
       void setContentModel(XMLContentModel* const newModelToAdopt);
  
  
  
  1.9       +11 -14    xml-xerces/c/src/validators/DTD/DTDElementDecl.cpp
  
  Index: DTDElementDecl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/validators/DTD/DTDElementDecl.cpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DTDElementDecl.cpp	2001/02/26 19:21:59	1.8
  +++ DTDElementDecl.cpp	2001/02/26 19:29:19	1.9
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: DTDElementDecl.cpp,v 1.8 2001/02/26 19:21:59 tng Exp $
  + * $Id: DTDElementDecl.cpp,v 1.9 2001/02/26 19:29:19 tng Exp $
    */
   
   
  @@ -66,12 +66,12 @@
   #include <util/XMLUniDefs.hpp>
   #include <util/XMLUni.hpp>
   #include <framework/XMLBuffer.hpp>
  -#include <validators/DTD/DTDAttDefList.hpp>
   #include <validators/common/DFAContentModel.hpp>
  -#include <validators/DTD/DTDElementDecl.hpp>
   #include <validators/common/ContentSpecNode.hpp>
   #include <validators/common/MixedContentModel.hpp>
   #include <validators/common/SimpleContentModel.hpp>
  +#include <validators/DTD/DTDAttDefList.hpp>
  +#include <validators/DTD/DTDElementDecl.hpp>
   
   
   
  @@ -83,8 +83,8 @@
   {
       delete fAttDefs;
       delete fAttList;
  -    delete [] fBaseName;
       delete fContentSpec;
  +    delete [] fBaseName;
       delete [] fQName;
   }
   
  @@ -215,7 +215,14 @@
       return true;
   }
   
  +void
  +DTDElementDecl::setContentSpec(ContentSpecNode* toAdopt)
  +{
  +    delete fContentSpec;
  +    fContentSpec = toAdopt;
  +}
   
  +
   // ---------------------------------------------------------------------------
   //  DTDElementDecl: Getter methods
   // ---------------------------------------------------------------------------
  @@ -236,16 +243,6 @@
           return 0;
   
       return fAttDefs->get(attName);
  -}
  -
  -
  -// ---------------------------------------------------------------------------
  -//  DTDElementDecl: Setter methods
  -// ---------------------------------------------------------------------------
  -void DTDElementDecl::setContentSpec(ContentSpecNode* toAdopt)
  -{
  -    delete fContentSpec;
  -    fContentSpec = toAdopt;
   }
   
   
  
  
  
  1.6       +17 -8     xml-xerces/c/src/validators/DTD/DTDElementDecl.hpp
  
  Index: DTDElementDecl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/validators/DTD/DTDElementDecl.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DTDElementDecl.hpp	2001/02/26 19:22:02	1.5
  +++ DTDElementDecl.hpp	2001/02/26 19:29:21	1.6
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: DTDElementDecl.hpp,v $
  + * Revision 1.6  2001/02/26 19:29:21  tng
  + * Schema: add virtual method getURI(), getContentSpec and setContenSpec in XMLElementDecl, and DTDElementDecl.
  + *
    * Revision 1.5  2001/02/26 19:22:02  tng
    * Schema: add parameter prefix in findElem and findAttr.
    *
  @@ -144,10 +147,14 @@
       )   const;
       virtual XMLAttDefList& getAttDefList() const;
       virtual const XMLCh* getBaseName() const;
  +    virtual const int getURI() const;
       virtual CharDataOpts getCharDataOpts() const;
       virtual const XMLCh* getFullName() const;
       virtual bool hasAttDefs() const;
       virtual bool resetDefs();
  +    virtual const ContentSpecNode* getContentSpec() const;
  +    virtual ContentSpecNode* getContentSpec();
  +    virtual void setContentSpec(ContentSpecNode* toAdopt);
   
   
       // -----------------------------------------------------------------------
  @@ -155,8 +162,6 @@
       // -----------------------------------------------------------------------
       const DTDAttDef* getAttDef(const XMLCh* const attName) const;
       DTDAttDef* getAttDef(const XMLCh* const attName);
  -    ContentSpecNode* getContentSpec();
  -    const ContentSpecNode* getContentSpec() const;
       ModelTypes getModelType() const;
   
   
  @@ -164,7 +169,6 @@
       //  Setter methods
       // -----------------------------------------------------------------------
       void addAttDef(DTDAttDef* const toAdd);
  -    void setContentSpec(ContentSpecNode* toAdopt);
       void setModelType(const DTDElementDecl::ModelTypes toSet);
       void setName(const XMLCh* const newName);
   
  @@ -224,8 +228,8 @@
       RefHashTableOf<DTDAttDef>*  fAttDefs;
       DTDAttDefList*              fAttList;
       XMLCh*                      fBaseName;
  -    ContentSpecNode*            fContentSpec;
       XMLCh*                      fQName;
  +    ContentSpecNode*            fContentSpec;
       ModelTypes                  fModelType;
   };
   
  @@ -260,16 +264,17 @@
   // ---------------------------------------------------------------------------
   //  DTDElementDecl: XMLElementDecl virtual interface implementation
   // ---------------------------------------------------------------------------
  +inline const int DTDElementDecl::getURI() const
  +{
  +   return -1;
  +}
  +
   inline const XMLCh* DTDElementDecl::getFullName() const
   {
       // Just return our QName
       return fQName;
   }
   
  -
  -// ---------------------------------------------------------------------------
  -//  DTDElementDecl: Getter methods
  -// ---------------------------------------------------------------------------
   inline ContentSpecNode* DTDElementDecl::getContentSpec()
   {
       return fContentSpec;
  @@ -280,6 +285,10 @@
       return fContentSpec;
   }
   
  +
  +// ---------------------------------------------------------------------------
  +//  DTDElementDecl: Getter methods
  +// ---------------------------------------------------------------------------
   inline DTDElementDecl::ModelTypes DTDElementDecl::getModelType() const
   {
       return fModelType;