| API Docs for SAX and DOM |
| Main Page Classes Files Related Pages # PSVIAttributeList.hpp Go to the documentation of this file.
    00001 /*
    00002  * Licensed to the Apache Software Foundation (ASF) under one or more
    00003  * contributor license agreements.  See the NOTICE file distributed with
    00004  * this work for additional information regarding copyright ownership.
    00005  * The ASF licenses this file to You under the Apache License, Version 2.0
    00006  * (the "License"); you may not use this file except in compliance with
    00007  * the License.  You may obtain a copy of the License at
    00008  *
    00009  *      http://www.apache.org/licenses/LICENSE-2.0
    00010  *
    00011  * Unless required by applicable law or agreed to in writing, software
    00012  * distributed under the License is distributed on an "AS IS" BASIS,
    00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00014  * See the License for the specific language governing permissions and
    00015  * limitations under the License.
    00016  */
    00017
    00018 /*
    00019  * $Id: PSVIAttributeList.hpp 568078 2007-08-21 11:43:25Z amassari $
    00020  */
    00021
    00022 #if !defined(PSVIATTRIBUTEDERIVATION_LIST_HPP)
    00023 #define PSVIATTRIBUTEDERIVATION_LIST_HPP
    00024
    00025 #include <xercesc/util/PlatformUtils.hpp>
    00026 #include <xercesc/framework/psvi/PSVIAttribute.hpp>
    00027 #include <xercesc/util/ValueVectorOf.hpp>
    00028
    00029 XERCES_CPP_NAMESPACE_BEGIN
    00030
    00040 class  PSVIAttributeList : public XMemory
    00041 {
    00042 public:
    00043
    00044     //  Constructors and Destructor
    00045     // -----------------------------------------------------------------------
    00048
    00054     PSVIAttributeList( MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
    00055
    00057
    00060     ~PSVIAttributeList();
    00062
    00063     //---------------------
    00067
    00068     /*
    00069      * Get the number of attributes whose PSVI contributions
    00070      * are contained in this list.
    00071      */
    00072     unsigned int getLength() const;
    00073
    00074     /*
    00075      * Get the PSVI contribution of attribute at position i
    00076      * in this list.  Indeces start from 0.
    00077      * @param index index from which the attribute PSVI contribution
    00078      * is to come.
    00079      * @return PSVIAttribute containing the attributes PSVI contributions;
    00080      * null is returned if the index is out of range.
    00081      */
    00082     PSVIAttribute *getAttributePSVIAtIndex(const unsigned int index);
    00083
    00084     /*
    00085      * Get local part of attribute name at position index in the list.
    00086      * Indeces start from 0.
    00087      * @param index index from which the attribute name
    00088      * is to come.
    00089      * @return local part of the attribute's name; null is returned if the index
    00090      * is out of range.
    00091      */
    00092     const XMLCh *getAttributeNameAtIndex(const unsigned int index);
    00093
    00094     /*
    00095      * Get namespace of attribute at position index in the list.
    00096      * Indeces start from 0.
    00097      * @param index index from which the attribute namespace
    00098      * is to come.
    00099      * @return namespace of the attribute;
    00100      * null is returned if the index is out of range.
    00101      */
    00102     const XMLCh *getAttributeNamespaceAtIndex(const unsigned int index);
    00103
    00104     /*
    00105      * Get the PSVI contribution of attribute with given
    00106      * local name and namespace.
    00107      * @param attrName  local part of the attribute's name
    00108      * @param attrNamespace  namespace of the attribute
    00109      * @return null if the attribute PSVI does not exist
    00110      */
    00111     PSVIAttribute *getAttributePSVIByName(const XMLCh *attrName
    00112                     , const XMLCh * attrNamespace);
    00113
    00115
    00116     //----------------------------------
    00120
    00129     PSVIAttribute *getPSVIAttributeToFill(
    00130             const XMLCh * attrName
    00131             , const XMLCh * attrNS);
    00132
    00136     void reset();
    00137
    00139
    00140 private:
    00141
    00142     // -----------------------------------------------------------------------
    00143     //  Unimplemented constructors and operators
    00144     // -----------------------------------------------------------------------
    00145     PSVIAttributeList(const PSVIAttributeList&);
    00146     PSVIAttributeList & operator=(const PSVIAttributeList &);
    00147
    00148
    00149     // -----------------------------------------------------------------------
    00150     //  data members
    00151     // -----------------------------------------------------------------------
    00152     // fMemoryManager
    00153     //  handler to provide dynamically-need memory
    00154     // fAttrList
    00155     //  list of PSVIAttributes contained by this object
    00156     // fAttrNameList
    00157     //  list of the names of the initialized PSVIAttribute objects contained
    00158     //  in this listing
    00159     // fAttrNSList
    00160     //  list of the namespaces of the initialized PSVIAttribute objects contained
    00161     //  in this listing
    00162     // fAttrPos
    00163     //  current number of initialized PSVIAttributes in fAttrList
    00164     MemoryManager*                  fMemoryManager;
    00165     RefVectorOf<PSVIAttribute>*     fAttrList;
    00166     RefArrayVectorOf<XMLCh>*        fAttrNameList;
    00167     RefArrayVectorOf<XMLCh>*        fAttrNSList;
    00168     unsigned int                    fAttrPos;
    00169 };
    00170 inline PSVIAttributeList::~PSVIAttributeList()
    00171 {
    00172     delete fAttrList;
    00173     delete fAttrNameList;
    00174     delete fAttrNSList;
    00175 }
    00176
    00177 inline PSVIAttribute *PSVIAttributeList::getPSVIAttributeToFill(
    00178             const XMLCh *attrName
    00179             , const XMLCh * attrNS)
    00180 {
    00181     PSVIAttribute *retAttr = 0;
    00182     if(fAttrPos == fAttrList->size())
    00183     {
    00184         retAttr = new (fMemoryManager)PSVIAttribute(fMemoryManager);
    00185         fAttrList->addElement(retAttr);
    00186         fAttrNameList->addElement((XMLCh *)attrName);
    00187         fAttrNSList->addElement((XMLCh *)attrNS);
    00188     }
    00189     else
    00190     {
    00191         retAttr = fAttrList->elementAt(fAttrPos);
    00192         fAttrNameList->setElementAt((XMLCh *)attrName, fAttrPos);
    00193         fAttrNSList->setElementAt((XMLCh *)attrNS, fAttrPos);
    00194     }
    00195     fAttrPos++;
    00196     return retAttr;
    00197 }
    00198
    00199 inline void PSVIAttributeList::reset()
    00200 {
    00201     fAttrPos = 0;
    00202 }
    00203
    00204 XERCES_CPP_NAMESPACE_END
    00205
    00206 #endif

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