| API Docs for SAX and DOM |
| Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages # PSVIAttributeList.hpp Go to the documentation of this file.
    00001 /*
    00002  * Copyright 2003,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: PSVIAttributeList.hpp 191054 2005-06-17 02:56:35Z jberry $
    00019  */
    00020
    00021 #if !defined(PSVIATTRIBUTEDERIVATION_LIST_HPP)
    00022 #define PSVIATTRIBUTEDERIVATION_LIST_HPP
    00023
    00024 #include <xercesc/util/PlatformUtils.hpp>
    00025 #include <xercesc/framework/psvi/PSVIAttribute.hpp>
    00026 #include <xercesc/util/ValueVectorOf.hpp>
    00027
    00028 XERCES_CPP_NAMESPACE_BEGIN
    00029
    00039 class  PSVIAttributeList : public XMemory
    00040 {
    00041 public:
    00042
    00043     //  Constructors and Destructor
    00044     // -----------------------------------------------------------------------
    00047
    00053     PSVIAttributeList( MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
    00054
    00056
    00059     ~PSVIAttributeList();
    00061
    00062     //---------------------
    00066
    00067     /*
    00068      * Get the number of attributes whose PSVI contributions
    00069      * are contained in this list.
    00070      */
    00071     unsigned int getLength() const;
    00072
    00073     /*
    00074      * Get the PSVI contribution of attribute at position i
    00075      * in this list.  Indeces start from 0.
    00076      * @param index index from which the attribute PSVI contribution
    00077      * is to come.
    00078      * @return PSVIAttribute containing the attributes PSVI contributions;
    00079      * null is returned if the index is out of range.
    00080      */
    00081     PSVIAttribute *getAttributePSVIAtIndex(const unsigned int index);
    00082
    00083     /*
    00084      * Get local part of attribute name at position index in the list.
    00085      * Indeces start from 0.
    00086      * @param index index from which the attribute name
    00087      * is to come.
    00088      * @return local part of the attribute's name; null is returned if the index
    00089      * is out of range.
    00090      */
    00091     const XMLCh *getAttributeNameAtIndex(const unsigned int index);
    00092
    00093     /*
    00094      * Get namespace of attribute at position index in the list.
    00095      * Indeces start from 0.
    00096      * @param index index from which the attribute namespace
    00097      * is to come.
    00098      * @return namespace of the attribute;
    00099      * null is returned if the index is out of range.
    00100      */
    00101     const XMLCh *getAttributeNamespaceAtIndex(const unsigned int index);
    00102
    00103     /*
    00104      * Get the PSVI contribution of attribute with given
    00105      * local name and namespace.
    00106      * @param attrName  local part of the attribute's name
    00107      * @param attrNamespace  namespace of the attribute
    00108      * @return null if the attribute PSVI does not exist
    00109      */
    00110     PSVIAttribute *getAttributePSVIByName(const XMLCh *attrName
    00111                     , const XMLCh * attrNamespace);
    00112
    00114
    00115     //----------------------------------
    00119
    00128     PSVIAttribute *getPSVIAttributeToFill(
    00129             const XMLCh * attrName
    00130             , const XMLCh * attrNS);
    00131
    00135     void reset();
    00136
    00138
    00139 private:
    00140
    00141     // -----------------------------------------------------------------------
    00142     //  Unimplemented constructors and operators
    00143     // -----------------------------------------------------------------------
    00144     PSVIAttributeList(const PSVIAttributeList&);
    00145     PSVIAttributeList & operator=(const PSVIAttributeList &);
    00146
    00147
    00148     // -----------------------------------------------------------------------
    00149     //  data members
    00150     // -----------------------------------------------------------------------
    00151     // fMemoryManager
    00152     //  handler to provide dynamically-need memory
    00153     // fAttrList
    00154     //  list of PSVIAttributes contained by this object
    00155     // fAttrNameList
    00156     //  list of the names of the initialized PSVIAttribute objects contained
    00157     //  in this listing
    00158     // fAttrNSList
    00159     //  list of the namespaces of the initialized PSVIAttribute objects contained
    00160     //  in this listing
    00161     // fAttrPos
    00162     //  current number of initialized PSVIAttributes in fAttrList
    00163     MemoryManager*                  fMemoryManager;
    00164     RefVectorOf<PSVIAttribute>*     fAttrList;
    00165     RefArrayVectorOf<XMLCh>*        fAttrNameList;
    00166     RefArrayVectorOf<XMLCh>*        fAttrNSList;
    00167     unsigned int                    fAttrPos;
    00168 };
    00169 inline PSVIAttributeList::~PSVIAttributeList()
    00170 {
    00171     delete fAttrList;
    00172     delete fAttrNameList;
    00173     delete fAttrNSList;
    00174 }
    00175
    00176 inline PSVIAttribute *PSVIAttributeList::getPSVIAttributeToFill(
    00177             const XMLCh *attrName
    00178             , const XMLCh * attrNS)
    00179 {
    00180     PSVIAttribute *retAttr = 0;
    00181     if(fAttrPos == fAttrList->size())
    00182     {
    00183         retAttr = new (fMemoryManager)PSVIAttribute(fMemoryManager);
    00184         fAttrList->addElement(retAttr);
    00185         fAttrNameList->addElement((XMLCh *)attrName);
    00186         fAttrNSList->addElement((XMLCh *)attrNS);
    00187     }
    00188     else
    00189     {
    00190         retAttr = fAttrList->elementAt(fAttrPos);
    00191         fAttrNameList->setElementAt((XMLCh *)attrName, fAttrPos);
    00192         fAttrNSList->setElementAt((XMLCh *)attrNS, fAttrPos);
    00193     }
    00194     fAttrPos++;
    00195     return retAttr;
    00196 }
    00197
    00198 inline void PSVIAttributeList::reset()
    00199 {
    00200     fAttrPos = 0;
    00201 }
    00202
    00203 XERCES_CPP_NAMESPACE_END
    00204
    00205 #endif

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