Main Page   Class Hierarchy   Compound List   File List   Compound Members  

XMLAttr.hpp

00001 /*
00002  * The Apache Software License, Version 1.1
00003  *
00004  * Copyright (c) 1999-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) 1999, 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: XMLAttr.hpp,v $
00059  * Revision 1.1  2002/05/11 20:00:52  bhavani
00060  * CR#CR062582# adding xercesc 1.7 file
00061  *
00062  * Revision 1.2  2002/02/20 18:17:01  tng
00063  * [Bug 5977] Warnings on generating apiDocs.
00064  *
00065  * Revision 1.1.1.1  2002/02/01 22:21:50  peiyongz
00066  * sane_include
00067  *
00068  * Revision 1.9  2001/11/02 14:21:18  knoaman
00069  * Add support for identity constraints.
00070  *
00071  * Revision 1.8  2001/05/11 13:25:31  tng
00072  * Copyright update.
00073  *
00074  * Revision 1.7  2001/02/27 18:33:55  tng
00075  * Schema: Use QName in XMLAttr.
00076  *
00077  * Revision 1.6  2000/04/10 22:42:53  roddey
00078  * Extended the buffer reuse to the QName field, to further increase
00079  * performance of attribute heavy applications.
00080  *
00081  * Revision 1.5  2000/03/02 19:54:24  roddey
00082  * This checkin includes many changes done while waiting for the
00083  * 1.1.0 code to be finished. I can't list them all here, but a list is
00084  * available elsewhere.
00085  *
00086  * Revision 1.4  2000/02/24 20:00:22  abagchi
00087  * Swat for removing Log from API docs
00088  *
00089  * Revision 1.3  2000/02/15 01:21:30  roddey
00090  * Some initial documentation improvements. More to come...
00091  *
00092  * Revision 1.2  2000/02/06 07:47:47  rahulj
00093  * Year 2K copyright swat.
00094  *
00095  * Revision 1.1.1.1  1999/11/09 01:08:28  twl
00096  * Initial checkin
00097  *
00098  * Revision 1.2  1999/11/08 20:44:35  rahul
00099  * Swat for adding in Product name and CVS comment log variable.
00100  *
00101  */
00102 
00103 #if !defined(XMLATTR_HPP)
00104 #define XMLATTR_HPP
00105 
00106 #include <xercesc/util/XMLString.hpp>
00107 #include <xercesc/util/QName.hpp>
00108 #include <xercesc/framework/XMLAttDef.hpp>
00109 
00110 
00132 class XMLPARSER_EXPORT XMLAttr
00133 {
00134 public:
00135     // -----------------------------------------------------------------------
00136     //  Constructors and Destructor
00137     // -----------------------------------------------------------------------
00140 
00146     XMLAttr();
00147 
00174     XMLAttr
00175     (
00176         const   unsigned int        uriId
00177         , const XMLCh* const        attrName
00178         , const XMLCh* const        attrPrefix
00179         , const XMLCh* const        attrValue
00180         , const XMLAttDef::AttTypes type = XMLAttDef::CData
00181         , const bool                specified = true
00182     );
00184 
00187     ~XMLAttr();
00189 
00190 
00191     // -----------------------------------------------------------------------
00192     //  Getter methods
00193     // -----------------------------------------------------------------------
00194 
00197 
00201     QName* getAttName() const;
00202 
00207     const XMLCh* getName() const;
00208 
00213     const XMLCh* getPrefix() const;
00214 
00220     const XMLCh* getQName() const;
00221 
00226     bool getSpecified() const;
00227 
00232     XMLAttDef::AttTypes getType() const;
00233 
00239     const XMLCh* getValue() const;
00240 
00245     unsigned int getURIId() const;
00246 
00248 
00249 
00250     // -----------------------------------------------------------------------
00251     //  Setter methods
00252     // -----------------------------------------------------------------------
00253 
00256 
00281     void set
00282     (
00283         const   unsigned int        uriId
00284         , const XMLCh* const        attrName
00285         , const XMLCh* const        attrPrefix
00286         , const XMLCh* const        attrValue
00287         , const XMLAttDef::AttTypes type = XMLAttDef::CData
00288     );
00289 
00304     void setName
00305     (
00306         const   unsigned int        uriId
00307         , const XMLCh* const        attrName
00308         , const XMLCh* const        attrPrefix
00309     );
00310 
00318     void setSpecified(const bool newValue);
00319 
00328     void setType(const XMLAttDef::AttTypes newType);
00329 
00337     void setValue(const XMLCh* const newValue);
00338 
00346     void setURIId(const unsigned int uriId);
00347 
00349 
00350 
00351 
00352 private :
00353     // -----------------------------------------------------------------------
00354     //  Unimplemented constructors and operators
00355     // -----------------------------------------------------------------------
00356     XMLAttr(const XMLAttr&);
00357     XMLAttr& operator=(const XMLAttr&);
00358 
00359 
00360     // -----------------------------------------------------------------------
00361     //  Private, helper methods
00362     // -----------------------------------------------------------------------
00363     void cleanUp();
00364 
00365 
00366     // -----------------------------------------------------------------------
00367     //  Private instance variables
00368     //
00369     //  fAttName
00370     //      The Attribute Name;
00371     //
00372     //  fSpecified
00373     //      True if this attribute appeared in the element; else, false if
00374     //      it was defaulted from an AttDef.
00375     //
00376     //  fType
00377     //      The attribute type enum value for this attribute. Indicates what
00378     //      type of attribute it was.
00379     //
00380     //  fValue
00381     //  fValueBufSz
00382     //      The attribute value that was given in the attribute instance, and
00383     //      its current buffer size (minus one, where the null is.)
00384     //
00385     // -----------------------------------------------------------------------
00386     bool                fSpecified;
00387     XMLAttDef::AttTypes fType;
00388     XMLCh*              fValue;
00389     unsigned int        fValueBufSz;
00390     QName*              fAttName;
00391 };
00392 
00393 // ---------------------------------------------------------------------------
00394 //  XMLAttr: Constructors and Destructor
00395 // ---------------------------------------------------------------------------
00396 inline XMLAttr::~XMLAttr()
00397 {
00398     cleanUp();
00399 }
00400 
00401 
00402 // ---------------------------------------------------------------------------
00403 //  XMLAttr: Getter methods
00404 // ---------------------------------------------------------------------------
00405 inline QName* XMLAttr::getAttName() const
00406 {
00407     return fAttName;
00408 }
00409 
00410 inline const XMLCh* XMLAttr::getName() const
00411 {
00412     return fAttName->getLocalPart();
00413 }
00414 
00415 inline const XMLCh* XMLAttr::getPrefix() const
00416 {
00417     return fAttName->getPrefix();
00418 }
00419 
00420 inline bool XMLAttr::getSpecified() const
00421 {
00422     return fSpecified;
00423 }
00424 
00425 inline XMLAttDef::AttTypes XMLAttr::getType() const
00426 {
00427     return fType;
00428 }
00429 
00430 inline const XMLCh* XMLAttr::getValue() const
00431 {
00432     return fValue;
00433 }
00434 
00435 inline unsigned int XMLAttr::getURIId() const
00436 {
00437     return fAttName->getURI();
00438 }
00439 
00440 
00441 // ---------------------------------------------------------------------------
00442 //  XMLAttr: Setter methods
00443 // ---------------------------------------------------------------------------
00444 inline void XMLAttr::set(const  unsigned int        uriId
00445                         , const XMLCh* const        attrName
00446                         , const XMLCh* const        attrPrefix
00447                         , const XMLCh* const        attrValue
00448                         , const XMLAttDef::AttTypes type)
00449 {
00450     // Set the name info and the value via their respective calls
00451     fAttName->setName(attrPrefix, attrName, uriId);
00452     setValue(attrValue);
00453 
00454     // And store the type
00455     fType = type;
00456 }
00457 
00458 inline void XMLAttr::setType(const XMLAttDef::AttTypes newValue)
00459 {
00460     fType = newValue;
00461 }
00462 
00463 inline void XMLAttr::setSpecified(const bool newValue)
00464 {
00465     fSpecified = newValue;
00466 }
00467 
00468 #endif

Generated on Tue Nov 19 09:36:34 2002 by doxygen1.3-rc1