| API Docs for SAX and DOM |
| Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages # QName.hpp Go to the documentation of this file.
    00001 /*
    00002  * Copyright 2001,2004 The Apache Software Foundation.
    00003  *
    00004  * Licensed under the Apache License, Version 2.0 (the "License");
    00005  * you may not use this file except in compliance with the License.
    00006  * You may obtain a copy of the License at
    00007  *
    00008  *      http://www.apache.org/licenses/LICENSE-2.0
    00009  *
    00010  * Unless required by applicable law or agreed to in writing, software
    00011  * distributed under the License is distributed on an "AS IS" BASIS,
    00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00013  * See the License for the specific language governing permissions and
    00014  * limitations under the License.
    00015  */
    00016
    00017 /*
    00018  * $Id: QName.hpp 191054 2005-06-17 02:56:35Z jberry $
    00019  */
    00020
    00021 #if !defined(QNAME_HPP)
    00022 #define QNAME_HPP
    00023
    00024 #include <xercesc/util/XMLString.hpp>
    00025 #include <xercesc/util/XMLUniDefs.hpp>
    00026 #include <xercesc/util/XMemory.hpp>
    00027 #include <xercesc/util/PlatformUtils.hpp>
    00028
    00029 #include <xercesc/internal/XSerializable.hpp>
    00030
    00031 XERCES_CPP_NAMESPACE_BEGIN
    00032
    00033 class  QName : public XSerializable, public XMemory
    00034 {
    00035 public :
    00036     // -----------------------------------------------------------------------
    00037     //  Contructors and Destructor
    00038     // -----------------------------------------------------------------------
    00040     QName(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
    00041
    00043     QName
    00044     (
    00045           const XMLCh* const   prefix
    00046         , const XMLCh* const   localPart
    00047         , const unsigned int   uriId
    00048         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
    00049     );
    00050
    00052     QName
    00053     (
    00054           const XMLCh* const   rawName
    00055         , const unsigned int   uriId
    00056         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
    00057     );
    00058
    00060     QName(const QName& qname);
    00061
    00062     ~QName();
    00063
    00064     // -----------------------------------------------------------------------
    00065     //  Getters
    00066     // -----------------------------------------------------------------------
    00067     const XMLCh* getPrefix() const;
    00068     XMLCh* getPrefix();
    00069
    00070     const XMLCh* getLocalPart() const;
    00071     XMLCh* getLocalPart();
    00072
    00073     unsigned int getURI() const;
    00074
    00075     const XMLCh* getRawName() const;
    00076     XMLCh* getRawName();
    00077
    00078     MemoryManager* getMemoryManager() const;
    00079
    00080     // -----------------------------------------------------------------------
    00081     //  Setters
    00082     // -----------------------------------------------------------------------
    00083     void setName
    00084     (
    00085         const XMLCh* const        prefix
    00086       , const XMLCh* const        localPart
    00087        , const unsigned int        uriId
    00088     );
    00089
    00090     void setName
    00091     (
    00092         const XMLCh* const        rawName
    00093        , const unsigned int        uriId
    00094     );
    00095
    00096     void setPrefix(const XMLCh*) ;
    00097     void setLocalPart(const XMLCh*) ;
    00098     void setNPrefix(const XMLCh*, const unsigned int) ;
    00099     void setNLocalPart(const XMLCh*, const unsigned int) ;
    00100     void setURI(const unsigned int) ;
    00101
    00102     void setValues(const QName& qname);
    00103
    00104     // -----------------------------------------------------------------------
    00105     //  comparison
    00106     // -----------------------------------------------------------------------
    00107     bool operator==(const QName&) const;
    00108
    00109     // -----------------------------------------------------------------------
    00110     //  Misc
    00111     // -----------------------------------------------------------------------
    00112     void cleanUp();
    00113
    00114     /***
    00115      * Support for Serialization/De-serialization
    00116      ***/
    00117     DECL_XSERIALIZABLE(QName)
    00118
    00119 private :
    00120     // -----------------------------------------------------------------------
    00121     //  Unimplemented constructors and operators
    00122     // -----------------------------------------------------------------------
    00123     QName& operator=(const QName&);
    00124
    00125     // -----------------------------------------------------------------------
    00126     //  Private instance variables
    00127     //
    00128     //  We copy the followings from XMLAttr.hpp, but stick to Java version's
    00129     //  naming convention
    00130     //
    00131     //  fPrefix
    00132     //  fPrefixBufSz
    00133     //      The prefix that was applied to this attribute's name, and the
    00134     //      current size of the buffer (minus one for the null.) Prefixes
    00135     //      really don't matter technically but it might be required for
    00136     //      pratical reasons, to recreate the original document for instance.
    00137     //
    00138     //  fLocalPart
    00139     //  fLocalPartBufSz
    00140     //      The base part of the name of the attribute, and the current size
    00141     //      of the buffer (minus one, where the null is.)
    00142     //
    00143     //  fRawName
    00144     //  fRawNameBufSz
    00145     //      This is the QName form of the name, which is faulted in (from the
    00146     //      prefix and name) upon request. The size field indicates the
    00147     //      current size of the buffer (minus one for the null.) It will be
    00148     //      zero until fauled in.
    00149     //
    00150     //  fURIId
    00151     //      The id of the URI that this attribute belongs to.
    00152     // -----------------------------------------------------------------------
    00153     unsigned int        fPrefixBufSz;
    00154     unsigned int        fLocalPartBufSz;
    00155     unsigned int        fRawNameBufSz;
    00156     unsigned int        fURIId;
    00157     XMLCh*              fPrefix;
    00158     XMLCh*              fLocalPart;
    00159     XMLCh*              fRawName;
    00160     MemoryManager*      fMemoryManager;
    00161 };
    00162
    00163 // ---------------------------------------------------------------------------
    00164 //  QName: Getter methods
    00165 // ---------------------------------------------------------------------------
    00166 inline const XMLCh* QName::getPrefix() const
    00167 {
    00168     return fPrefix;
    00169 }
    00170
    00171 inline XMLCh* QName::getPrefix()
    00172 {
    00173     return fPrefix;
    00174 }
    00175
    00176 inline const XMLCh* QName::getLocalPart() const
    00177 {
    00178     return fLocalPart;
    00179 }
    00180
    00181 inline XMLCh* QName::getLocalPart()
    00182 {
    00183     return fLocalPart;
    00184 }
    00185
    00186 inline unsigned int QName::getURI() const
    00187 {
    00188     return fURIId;
    00189 }
    00190
    00191 inline MemoryManager* QName::getMemoryManager() const
    00192 {
    00193     return fMemoryManager;
    00194 }
    00195
    00196 // ---------------------------------------------------------------------------
    00197 //  QName: Setter methods
    00198 // ---------------------------------------------------------------------------
    00199 inline void QName::setURI(const unsigned int uriId)
    00200 {
    00201     fURIId = uriId;
    00202 }
    00203
    00204 XERCES_CPP_NAMESPACE_END
    00205
    00206 #endif

Copyright © 1994-2004 The Apache Software Foundation. All Rights Reserved.