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:44:28 UTC

cvs commit: xml-xerces/c/src/util QName.cpp QName.hpp Makefile.in

tng         01/02/26 11:44:26

  Modified:    c/Projects/OS2/VACPP40 xerces_util.icc
               c/Projects/Win32/VC6/xerces-all/XercesLib XercesLib.dsp
               c/src/internal VecAttributesImpl.cpp VecAttributesImpl.hpp
               c/src/sax2 Attributes.hpp
               c/src/util Makefile.in
  Added:       c/src/util QName.cpp QName.hpp
  Log:
  Schema: add utility class QName, by Pei Yong Zhang.
  
  Revision  Changes    Path
  1.3       +1 -0      xml-xerces/c/Projects/OS2/VACPP40/xerces_util.icc
  
  Index: xerces_util.icc
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/Projects/OS2/VACPP40/xerces_util.icc,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- xerces_util.icc	2000/09/21 00:54:15	1.2
  +++ xerces_util.icc	2001/02/26 19:44:02	1.3
  @@ -9,6 +9,7 @@
       BASE_DIR "\\src\\util\\KVStringPair.cpp",
       BASE_DIR "\\src\\util\\Mutexes.cpp",
       BASE_DIR "\\src\\util\\PlatformUtils.cpp",
  +    BASE_DIR "\\src\\util\\QName.cpp",
       BASE_DIR "\\src\\util\\StringPool.cpp",
       BASE_DIR "\\src\\util\\TransService.cpp",
       BASE_DIR "\\src\\util\\XML256TableTranscoder.cpp",
  
  
  
  1.48      +15 -7     xml-xerces/c/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp
  
  Index: XercesLib.dsp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- XercesLib.dsp	2001/02/16 14:58:53	1.47
  +++ XercesLib.dsp	2001/02/26 19:44:10	1.48
  @@ -7,19 +7,19 @@
   CFG=XercesLib - Win32 Debug
   !MESSAGE This is not a valid makefile. To build this project using NMAKE,
   !MESSAGE use the Export Makefile command and run
  -!MESSAGE 
  +!MESSAGE
   !MESSAGE NMAKE /f "XercesLib.mak".
  -!MESSAGE 
  +!MESSAGE
   !MESSAGE You can specify a configuration when running NMAKE
   !MESSAGE by defining the macro CFG on the command line. For example:
  -!MESSAGE 
  +!MESSAGE
   !MESSAGE NMAKE /f "XercesLib.mak" CFG="XercesLib - Win32 Debug"
  -!MESSAGE 
  +!MESSAGE
   !MESSAGE Possible choices for configuration are:
  -!MESSAGE 
  +!MESSAGE
   !MESSAGE "XercesLib - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
   !MESSAGE "XercesLib - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
  -!MESSAGE 
  +!MESSAGE
   
   # Begin Project
   # PROP AllowPerConfigDependencies 0
  @@ -84,7 +84,7 @@
   # ADD LINK32 kernel32.lib user32.lib advapi32.lib ws2_32.lib /nologo /base:"0x12000000" /version:1.4 /subsystem:windows /dll /debug /machine:I386 /out:"..\..\..\..\..\Build\Win32\VC6\Debug/xerces-c_1_4D.dll" /implib:"..\..\..\..\..\Build\Win32\VC6\Debug/xerces-c_1D.lib" /pdbtype:sept
   # SUBTRACT LINK32 /pdb:none
   
  -!ENDIF 
  +!ENDIF
   
   # Begin Target
   
  @@ -305,6 +305,14 @@
   # Begin Source File
   
   SOURCE=..\..\..\..\..\src\util\PlatformUtils.hpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\..\src\util\QName.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\..\src\util\QName.hpp
   # End Source File
   # Begin Source File
   
  
  
  
  1.4       +10 -6     xml-xerces/c/src/internal/VecAttributesImpl.cpp
  
  Index: VecAttributesImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/internal/VecAttributesImpl.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- VecAttributesImpl.cpp	2000/11/02 01:14:07	1.3
  +++ VecAttributesImpl.cpp	2001/02/26 19:44:14	1.4
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: VecAttributesImpl.cpp,v $
  + * Revision 1.4  2001/02/26 19:44:14  tng
  + * Schema: add utility class QName, by Pei Yong Zhang.
  + *
    * Revision 1.3  2000/11/02 01:14:07  andyh
    * SAX bug fix:  Attribute lists were throwing exceptions rather than returning
    * null when an attribute could not be found by name.  Fixed by Tinny Ng.
  @@ -180,7 +183,7 @@
       return -1; 
   }
   
  -int VecAttributesImpl::getIndex(const XMLCh* const QName ) const 
  +int VecAttributesImpl::getIndex(const XMLCh* const qName ) const 
   {
       //
       //  Search the vector for the attribute with the given name and return
  @@ -190,7 +193,7 @@
       {
           const XMLAttr* curElem = fVector->elementAt(index);
   
  -        if (!XMLString::compareString(curElem->getQName(), QName))
  +        if (!XMLString::compareString(curElem->getQName(), qName))
               return index ;
       }
       return -1; 
  @@ -201,9 +204,9 @@
       return getType(getIndex(uri, localPart)) ;
   }
   
  -const XMLCh* VecAttributesImpl::getType(const XMLCh* const QName) const 
  +const XMLCh* VecAttributesImpl::getType(const XMLCh* const qName) const 
   {
  -    return getType(getIndex(QName)) ;
  +    return getType(getIndex(qName)) ;
   }
   
   const XMLCh* VecAttributesImpl::getValue(const XMLCh* const uri, const XMLCh* const localPart ) const 
  @@ -211,9 +214,9 @@
       return getValue(getIndex(uri, localPart)) ;
   }
   
  -const XMLCh* VecAttributesImpl::getValue(const XMLCh* const QName) const 
  +const XMLCh* VecAttributesImpl::getValue(const XMLCh* const qName) const 
   {
  -    return getValue(getIndex(QName)) ;
  +    return getValue(getIndex(qName)) ;
   }
   
   // ---------------------------------------------------------------------------
  
  
  
  1.3       +7 -3      xml-xerces/c/src/internal/VecAttributesImpl.hpp
  
  Index: VecAttributesImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/internal/VecAttributesImpl.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- VecAttributesImpl.hpp	2000/08/09 22:11:17	1.2
  +++ VecAttributesImpl.hpp	2001/02/26 19:44:15	1.3
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: VecAttributesImpl.hpp,v $
  + * Revision 1.3  2001/02/26 19:44:15  tng
  + * Schema: add utility class QName, by Pei Yong Zhang.
  + *
    * Revision 1.2  2000/08/09 22:11:17  jpolast
    * changes to allow const instances of the sax2
    * Attributes class.
  @@ -99,12 +102,12 @@
       virtual const XMLCh* getValue(const unsigned int index) const ;
   
   	virtual int getIndex(const XMLCh* const uri, const XMLCh* const localPart ) const  ;
  -	virtual int getIndex(const XMLCh* const QName ) const  ;
  +	virtual int getIndex(const XMLCh* const qName ) const  ;
   
   	virtual const XMLCh* getType(const XMLCh* const uri, const XMLCh* const localPart ) const  ;
  -    virtual const XMLCh* getType(const XMLCh* const QName) const ;
  +    virtual const XMLCh* getType(const XMLCh* const qName) const ;
   
  -    virtual const XMLCh* getValue(const XMLCh* const QName) const;
  +    virtual const XMLCh* getValue(const XMLCh* const qName) const;
   	virtual const XMLCh* getValue(const XMLCh* const uri, const XMLCh* const localPart ) const  ;
   
   
  
  
  
  1.4       +20 -7     xml-xerces/c/src/sax2/Attributes.hpp
  
  Index: Attributes.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/sax2/Attributes.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Attributes.hpp	2000/08/09 22:19:28	1.3
  +++ Attributes.hpp	2001/02/26 19:44:19	1.4
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: Attributes.hpp,v $
  + * Revision 1.4  2001/02/26 19:44:19  tng
  + * Schema: add utility class QName, by Pei Yong Zhang.
  + *
    * Revision 1.3  2000/08/09 22:19:28  jpolast
    * many conformance & stability changes:
    *   - ContentHandler::resetDocument() removed
  @@ -105,7 +108,7 @@
     * list:
     *
     * <pre>
  -  * public void startElement (String uri, String localpart, String QName, Attributes atts) {
  +  * public void startElement (String uri, String localpart, String qName, Attributes atts) {
     *   for (int i = 0; i < atts.getLength(); i++) {
     *     String Qname = atts.getQName(i);
     *		String URI   = atts.getURI(i)
  @@ -124,7 +127,7 @@
     * type of specific attributes:
     *
     * <pre>
  -  * public void startElement (String uri, String localpart, String QName, Attributes atts) {
  +  * public void startElement (String uri, String localpart, String qName, Attributes atts) {
     *   String identifier = atts.getValue("id");
     *   String label = atts.getValue("label");
     *   [...]
  @@ -202,7 +205,7 @@
       virtual const XMLCh* getLocalName(const unsigned int index) const = 0;
   
     /**
  -    * Return the QName of an attribute in this list (by position).
  +    * Return the qName of an attribute in this list (by position).
       *
       * The QNames must be unique: the SAX parser shall not include the
       * same attribute twice.  Attributes without values (those declared
  @@ -210,7 +213,7 @@
       * omitted from the list.
       *
       * @param index The index of the attribute in the list (starting at 0).
  -    * @return The QName of the indexed attribute, or null
  +    * @return The qName of the indexed attribute, or null
       *         if the index is out of range.
       * @see #getLength 
       */
  @@ -276,7 +279,7 @@
        * @return The index of the attribute, or -1 if it does not
        *         appear in the list.
        */
  -	virtual int getIndex(const XMLCh* const QName ) const = 0 ;
  +	virtual int getIndex(const XMLCh* const qName ) const = 0 ;
   
      /**
        * Look up an attribute's type by Namespace name.
  @@ -302,7 +305,7 @@
        *         attribute is not in the list or if qualified names
        *         are not available.
        */
  -    virtual const XMLCh* getType(const XMLCh* const QName) const = 0;
  +    virtual const XMLCh* getType(const XMLCh* const qName) const = 0;
   
      /**
        * Look up an attribute's value by Namespace name.
  @@ -327,7 +330,7 @@
        *         attribute is not in the list or if qualified names
        *         are not available.
        */
  -    virtual const XMLCh* getValue(const XMLCh* const QName) const = 0;
  +    virtual const XMLCh* getValue(const XMLCh* const qName) const = 0;
   
       //@}
   
  
  
  
  1.27      +7 -0      xml-xerces/c/src/util/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/Makefile.in,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- Makefile.in	2001/02/15 18:41:41	1.26
  +++ Makefile.in	2001/02/26 19:44:23	1.27
  @@ -55,6 +55,9 @@
   #
   #
   # $Log: Makefile.in,v $
  +# Revision 1.27  2001/02/26 19:44:23  tng
  +# Schema: add utility class QName, by Pei Yong Zhang.
  +#
   # Revision 1.26  2001/02/15 18:41:41  tng
   # Schema: Exception Handling added by Pei Yong Zhang.  Add NumberFormatException, ParseException,
   # InvalidDatatypeFacetException, and InvalidDatatypeValueException.  The associated
  @@ -234,6 +237,7 @@
       NumberFormatException.hpp \
       ParseException.hpp \
       PlatformUtils.hpp \
  +    QName.hpp \
       RefArrayOf.hpp \
       RefHashTableOf.hpp \
       RefStackOf.hpp \
  @@ -300,6 +304,7 @@
       KVStringPair.$(TO) \
       Mutexes.$(TO) \
       PlatformUtils.$(TO) \
  +    QName.$(TO) \
       StringPool.$(TO) \
       XMLURL.$(TO) \
       TransService.$(TO) \
  
  
  
  1.1                  xml-xerces/c/src/util/QName.cpp
  
  Index: QName.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xerces" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache\@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation, and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com .  For more information
   * on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  /*
   * $Log: QName.cpp,v $
   * Revision 1.1  2001/02/26 19:44:25  tng
   * Schema: add utility class QName, by Pei Yong Zhang.
   *
    */
  
  #include <util/QName.hpp>
  
  // ---------------------------------------------------------------------------
  //  QName: Constructors and Destructor
  // ---------------------------------------------------------------------------
  QName::QName() :
        fPrefix(0)
      , fPrefixBufSz(0)
      , fLocalPart(0)
      , fLocalPartBufSz(0)
      , fRawName(0)
      , fRawNameBufSz(0)
      , fURIId(0)
  {
  }
  
  QName::QName(
                   const XMLCh* const        prefix
                 , const XMLCh* const        localPart
                 , const int                 uriId
              ) :
        fPrefix(0)
      , fPrefixBufSz(0)
      , fLocalPart(0)
      , fLocalPartBufSz(0)
      , fRawName(0)
      , fRawNameBufSz(0)
      , fURIId(0)
  {
      try
      {
          //
          //  Just call the local setters to set up everything. Too much
          //  work is required to replicate that functionality here.
          //
          setName(prefix, localPart, uriId);
      }
  
      catch(...)
      {
          cleanUp();
      }
  }
  
  QName::~QName()
  {
  	cleanUp();
  }
  
  // ---------------------------------------------------------------------------
  //  QName: Copy Constructors
  // ---------------------------------------------------------------------------
  QName::QName(const QName& qname)
  {
      unsigned int newLen;
  
      newLen = XMLString::stringLen(qname.getLocalPart());
      fLocalPartBufSz = newLen + 8;
      fLocalPart = new XMLCh[fLocalPartBufSz + 1];
      XMLString::moveChars(fLocalPart, qname.getLocalPart(), newLen + 1);
  
      newLen = XMLString::stringLen(qname.getPrefix());
      fPrefixBufSz = newLen + 8;
      fPrefix = new XMLCh[fPrefixBufSz + 1];
      XMLString::moveChars(fPrefix, qname.getPrefix(), newLen + 1);
  
      *fRawName = 0;
  
      fURIId = qname.getURI();
  }
  
  // ---------------------------------------------------------------------------
  //  QName: Getter methods
  // ---------------------------------------------------------------------------
  inline const XMLCh* QName::getPrefix() const
  {
  	return fPrefix;
  }
  
  inline const XMLCh* QName::getLocalPart() const
  {
  	return fLocalPart;
  }
  
  inline const int QName::getURI() const
  {
  	return fURIId;
  }
  
  const XMLCh* QName::getRawName() const
  {
      //
      //  If there is no buffer, or if there is but we've not faulted in the
      //  value yet, then we have to do that now.
      //
      if (!fRawName || !*fRawName)
      {
          //
          //  Calculate the worst case size buffer we will need. We use the
          //  current high water marks of the prefix and name buffers, so it
          //  might be a little wasteful of memory but we don't have to do
          //  string len operations on the two strings.
          //
          const unsigned int neededLen = fPrefixBufSz + fLocalPartBufSz + 1;
  
          //
          //  If no buffer, or the current one is too small, then allocate one
          //  and get rid of any old one.
          //
          if (!fRawName || (neededLen > fRawNameBufSz))
          {
              delete [] fRawName;
  
              // We have to cast off the const'ness to do this
              ((QName*)this)->fRawNameBufSz = neededLen;
              ((QName*)this)->fRawName = new XMLCh[neededLen + 1];
  
              // Make sure its initially empty
              *fRawName = 0;
          }
  
          //
          //  If we have a prefix, then do the prefix:name version. Else, its
          //  just the name.
          //
          if (*fPrefix)
          {
              const XMLCh colonStr[] = { chColon, chNull };
              XMLString::copyString(fRawName, fPrefix);
              XMLString::catString(fRawName, colonStr);
              XMLString::catString(fRawName, fLocalPart);
          }
           else
          {
              XMLString::copyString(fRawName, fLocalPart);
          }
      }
      return fRawName;
  }
  
  // ---------------------------------------------------------------------------
  //  QName: Setter methods
  // ---------------------------------------------------------------------------
  void QName::setName(      const XMLCh* const    localPart
                          , const XMLCh* const    prefix
  						, const int             uriId)
  {
      unsigned int newLen;
  
      newLen = XMLString::stringLen(localPart);
      if (!fLocalPartBufSz || (newLen > fLocalPartBufSz))
      {
          delete [] fLocalPart;
          fLocalPartBufSz = newLen + 8;
          fLocalPart = new XMLCh[fLocalPartBufSz + 1];
      }
      XMLString::moveChars(fLocalPart, localPart, newLen + 1);
  
      newLen = XMLString::stringLen(prefix);
      if (!fPrefixBufSz || (newLen > fPrefixBufSz))
      {
          delete [] fPrefix;
          fPrefixBufSz = newLen + 8;
          fPrefix = new XMLCh[fPrefixBufSz + 1];
      }
      XMLString::moveChars(fPrefix, prefix, newLen + 1);
  
      // And clean up any QName and leave it undone until/if asked for again
      if (fRawName)
          *fRawName = 0;
  
      // And finally store the URI id parameter
      fURIId = uriId;
  }
  
  void QName::setPrefix(const XMLCh* prefix)
  {
      unsigned int newLen;
  
      newLen = XMLString::stringLen(prefix);
      if (!fPrefixBufSz || (newLen > fPrefixBufSz))
      {
          delete [] fPrefix;
          fPrefixBufSz = newLen + 8;
          fPrefix = new XMLCh[fPrefixBufSz + 1];
      }
      XMLString::moveChars(fPrefix, prefix, newLen + 1);
  }
  
  void QName::setLocalPart(const XMLCh* localPart)
  {
      unsigned int newLen;
  
      newLen = XMLString::stringLen(localPart);
      if (!fLocalPartBufSz || (newLen > fLocalPartBufSz))
      {
          delete [] fLocalPart;
          fLocalPartBufSz = newLen + 8;
          fLocalPart = new XMLCh[fLocalPartBufSz + 1];
      }
      XMLString::moveChars(fLocalPart, localPart, newLen + 1);
  }
  
  inline void QName::setURI(const int uriId)
  {
      fURIId = uriId;
  }
  
  // -----------------------------------------------------------------------
  //  comparison
  // -----------------------------------------------------------------------
  bool QName::operator==(const QName& qname)
  {
  return (XMLString::compareString(fPrefix, qname.getPrefix())==0) &&
         (XMLString::compareString(fLocalPart, qname.getLocalPart())==0) &&
         (fURIId == qname.getURI());
  }
  
  // -----------------------------------------------------------------------
  //  Misc
  // -----------------------------------------------------------------------
  
  
  // ---------------------------------------------------------------------------
  //  QName: Private, helper methods
  // ---------------------------------------------------------------------------
  void QName::cleanUp()
  {
      delete [] fLocalPart;
      delete [] fPrefix;
      delete [] fRawName;
  }
  
  
  
  
  1.1                  xml-xerces/c/src/util/QName.hpp
  
  Index: QName.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xerces" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache\@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation, and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com .  For more information
   * on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  /*
   * $Log: QName.hpp,v $
   * Revision 1.1  2001/02/26 19:44:25  tng
   * Schema: add utility class QName, by Pei Yong Zhang.
   *
   */
  
  #if !defined(QNAME_HPP)
  #define QNAME_HPP
  
  #include <util/XMLString.hpp>
  #include <util/XMLUniDefs.hpp>
  #include <util/XMLUni.hpp>
  
  class XMLUTIL_EXPORT QName
  {
  public :
      // -----------------------------------------------------------------------
      //  Contructors and Destructor
      // -----------------------------------------------------------------------
      /** Default constructor. */
      QName();
  
      /** Constructs a specified qname. */
      QName
      (   const XMLCh* const        prefix
         ,const XMLCh* const        localPart
  	   ,const int                 uriId = -1
      );
  
      /** Copy constructor. */
      QName(const QName& qname);
  
      ~QName();
  
      // -----------------------------------------------------------------------
      //  Getters
      // -----------------------------------------------------------------------
      const XMLCh* getPrefix() const;
  
  	const XMLCh* getLocalPart() const;
  
  	const int getURI() const;
  
  	const XMLCh* getRawName() const;
  
      // -----------------------------------------------------------------------
      //  Setters
      // -----------------------------------------------------------------------
      void setName
      (
          const XMLCh* const        prefix
         ,const XMLCh* const        localPart
  	   ,const int                 uriId = -1
      );
  
      void setPrefix(const XMLCh*) ;
  
  	void setLocalPart(const XMLCh*) ;
  
  	void setURI(const int) ;
  
      // -----------------------------------------------------------------------
      //  comparison
      // -----------------------------------------------------------------------
  	bool operator==(const QName&);
  
      // -----------------------------------------------------------------------
      //  Misc
      // -----------------------------------------------------------------------
  	void cleanUp();
  
  private :
  
      // -----------------------------------------------------------------------
      //  Private instance variables
      //
      //  We copy the followings from XMLAttr.hpp, but stick to Java version's
  	//  naming convention
      //
      //  fPrefix
      //  fPrefixBufSz
      //      The prefix that was applied to this attribute's name, and the
      //      current size of the buffer (minus one for the null.) Prefixes
      //      really don't matter technically but it might be required for
      //      pratical reasons, to recreate the original document for instance.
  	//
      //  fLocalPart
      //  fLocalPartBufSz
      //      The base part of the name of the attribute, and the current size
      //      of the buffer (minus one, where the null is.)
      //
      //  fRawName
      //  fRawNameBufSz
      //      This is the QName form of the name, which is faulted in (from the
      //      prefix and name) upon request. The size field indicates the
      //      current size of the buffer (minus one for the null.) It will be
      //      zero until fauled in.
      //
      //  fURIId
      //      The id of the URI that this attribute belongs to.
      // -----------------------------------------------------------------------
      XMLCh*              fPrefix;
      unsigned int        fPrefixBufSz;
      XMLCh*              fLocalPart;
      unsigned int        fLocalPartBufSz;
      XMLCh*              fRawName;
      unsigned int        fRawNameBufSz;
      int                 fURIId;
  
  };
  
  #endif