http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Readme
Download
Installation
Build

API Docs
Samples
Schema

FAQs
Programming
Migration

Releases
Bug-Reporting
Feedback

Y2K Compliance
PDF Document

CVS Repository
Mail Archive

API Docs for SAX and DOM
 

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

QName.hpp

Go to the documentation of this file.
00001 /*
00002  * The Apache Software License, Version 1.1
00003  *
00004  * Copyright (c) 2001 The Apache Software Foundation.  All rights
00005  * reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  *
00014  * 2. Redistributions in binary form must reproduce the above copyright
00015  *    notice, this list of conditions and the following disclaimer in
00016  *    the documentation and/or other materials provided with the
00017  *    distribution.
00018  *
00019  * 3. The end-user documentation included with the redistribution,
00020  *    if any, must include the following acknowledgment:
00021  *       "This product includes software developed by the
00022  *        Apache Software Foundation (http://www.apache.org/)."
00023  *    Alternately, this acknowledgment may appear in the software itself,
00024  *    if and wherever such third-party acknowledgments normally appear.
00025  *
00026  * 4. The names "Xerces" and "Apache Software Foundation" must
00027  *    not be used to endorse or promote products derived from this
00028  *    software without prior written permission. For written
00029  *    permission, please contact apache\@apache.org.
00030  *
00031  * 5. Products derived from this software may not be called "Apache",
00032  *    nor may "Apache" appear in their name, without prior written
00033  *    permission of the Apache Software Foundation.
00034  *
00035  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
00036  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00037  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00038  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
00039  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00040  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00041  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
00042  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00043  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00044  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00045  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00046  * SUCH DAMAGE.
00047  * ====================================================================
00048  *
00049  * This software consists of voluntary contributions made by many
00050  * individuals on behalf of the Apache Software Foundation, and was
00051  * originally based on software copyright (c) 2001, International
00052  * Business Machines, Inc., http://www.ibm.com .  For more information
00053  * on the Apache Software Foundation, please see
00054  * <http://www.apache.org/>.
00055  */
00056 
00057 /*
00058  * $Log: QName.hpp,v $
00059  * Revision 1.7  2001/07/24 18:31:47  knoaman
00060  * Added support for <group> + extra constraint checking for complexType
00061  *
00062  * Revision 1.6  2001/05/11 13:26:28  tng
00063  * Copyright update.
00064  *
00065  * Revision 1.5  2001/04/19 18:17:10  tng
00066  * Schema: SchemaValidator update, and use QName in Content Model
00067  *
00068  * Revision 1.4  2001/03/21 21:56:12  tng
00069  * Schema: Add Schema Grammar, Schema Validator, and split the DTDValidator into DTDValidator, DTDScanner, and DTDGrammar.
00070  *
00071  * Revision 1.3  2001/02/27 14:48:39  tng
00072  * Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
00073  *
00074  * Revision 1.2  2001/02/26 21:56:16  tng
00075  * Schema: QName can also be constructed with rawName.
00076  *
00077  * Revision 1.1  2001/02/26 19:44:25  tng
00078  * Schema: add utility class QName, by Pei Yong Zhang.
00079  *
00080  */
00081 
00082 #if !defined(QNAME_HPP)
00083 #define QNAME_HPP
00084 
00085 #include <util/XMLString.hpp>
00086 #include <util/XMLUniDefs.hpp>
00087 #include <util/XMLUni.hpp>
00088 
00089 class  QName
00090 {
00091 public :
00092     // -----------------------------------------------------------------------
00093     //  Contructors and Destructor
00094     // -----------------------------------------------------------------------
00096     QName();
00097 
00099     QName
00100     (   const XMLCh* const        prefix
00101       , const XMLCh* const        localPart
00102        , const unsigned int        uriId
00103     );
00104 
00106     QName
00107     (   const XMLCh* const        rawName
00108        , const unsigned int        uriId
00109     );
00110 
00112     QName(const QName* const qname);
00113 
00114     ~QName();
00115 
00116     // -----------------------------------------------------------------------
00117     //  Getters
00118     // -----------------------------------------------------------------------
00119     const XMLCh* getPrefix() const;
00120     XMLCh* getPrefix();
00121 
00122     const XMLCh* getLocalPart() const;
00123     XMLCh* getLocalPart();
00124 
00125     const unsigned int getURI() const;
00126     unsigned int getURI();
00127 
00128     const XMLCh* getRawName() const;
00129     XMLCh* getRawName();
00130 
00131     // -----------------------------------------------------------------------
00132     //  Setters
00133     // -----------------------------------------------------------------------
00134     void setName
00135     (
00136         const XMLCh* const        prefix
00137       , const XMLCh* const        localPart
00138        , const unsigned int        uriId
00139     );
00140 
00141     void setName
00142     (
00143         const XMLCh* const        rawName
00144        , const unsigned int        uriId
00145     );
00146 
00147     void setPrefix(const XMLCh*) ;
00148     void setLocalPart(const XMLCh*) ;
00149     void setURI(const unsigned int) ;
00150 
00151     void setValues(const QName& qname);
00152 
00153     // -----------------------------------------------------------------------
00154     //  comparison
00155     // -----------------------------------------------------------------------
00156     bool operator==(const QName&);
00157 
00158     // -----------------------------------------------------------------------
00159     //  Misc
00160     // -----------------------------------------------------------------------
00161     void cleanUp();
00162 
00163 private :
00164 
00165     // -----------------------------------------------------------------------
00166     //  Private instance variables
00167     //
00168     //  We copy the followings from XMLAttr.hpp, but stick to Java version's
00169     //  naming convention
00170     //
00171     //  fPrefix
00172     //  fPrefixBufSz
00173     //      The prefix that was applied to this attribute's name, and the
00174     //      current size of the buffer (minus one for the null.) Prefixes
00175     //      really don't matter technically but it might be required for
00176     //      pratical reasons, to recreate the original document for instance.
00177     //
00178     //  fLocalPart
00179     //  fLocalPartBufSz
00180     //      The base part of the name of the attribute, and the current size
00181     //      of the buffer (minus one, where the null is.)
00182     //
00183     //  fRawName
00184     //  fRawNameBufSz
00185     //      This is the QName form of the name, which is faulted in (from the
00186     //      prefix and name) upon request. The size field indicates the
00187     //      current size of the buffer (minus one for the null.) It will be
00188     //      zero until fauled in.
00189     //
00190     //  fURIId
00191     //      The id of the URI that this attribute belongs to.
00192     // -----------------------------------------------------------------------
00193     XMLCh*              fPrefix;
00194     unsigned int        fPrefixBufSz;
00195     XMLCh*              fLocalPart;
00196     unsigned int        fLocalPartBufSz;
00197     XMLCh*              fRawName;
00198     unsigned int        fRawNameBufSz;
00199     unsigned int        fURIId;
00200 
00201 };
00202 
00203 // ---------------------------------------------------------------------------
00204 //  QName: Getter methods
00205 // ---------------------------------------------------------------------------
00206 inline const XMLCh* QName::getPrefix() const
00207 {
00208     return fPrefix;
00209 }
00210 
00211 inline XMLCh* QName::getPrefix()
00212 {
00213     return fPrefix;
00214 }
00215 
00216 inline const XMLCh* QName::getLocalPart() const
00217 {
00218     return fLocalPart;
00219 }
00220 
00221 inline XMLCh* QName::getLocalPart()
00222 {
00223     return fLocalPart;
00224 }
00225 
00226 inline const unsigned int QName::getURI() const
00227 {
00228     return fURIId;
00229 }
00230 
00231 inline unsigned int QName::getURI()
00232 {
00233     return fURIId;
00234 }
00235 
00236 // ---------------------------------------------------------------------------
00237 //  QName: Setter methods
00238 // ---------------------------------------------------------------------------
00239 inline void QName::setURI(const unsigned int uriId)
00240 {
00241     fURIId = uriId;
00242 }
00243 #endif


Copyright © 2000 The Apache Software Foundation. All Rights Reserved.