| 1 | /* | 
|---|
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more | 
|---|
| 3 | * contributor license agreements.  See the NOTICE file distributed with | 
|---|
| 4 | * this work for additional information regarding copyright ownership. | 
|---|
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 | 
|---|
| 6 | * (the "License"); you may not use this file except in compliance with | 
|---|
| 7 | * the License.  You may obtain a copy of the License at | 
|---|
| 8 | * | 
|---|
| 9 | *      http://www.apache.org/licenses/LICENSE-2.0 | 
|---|
| 10 | * | 
|---|
| 11 | * Unless required by applicable law or agreed to in writing, software | 
|---|
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, | 
|---|
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|---|
| 14 | * See the License for the specific language governing permissions and | 
|---|
| 15 | * limitations under the License. | 
|---|
| 16 | */ | 
|---|
| 17 |  | 
|---|
| 18 | /* | 
|---|
| 19 | * $Id: VecAttributesImpl.hpp 568078 2007-08-21 11:43:25Z amassari $ | 
|---|
| 20 | */ | 
|---|
| 21 |  | 
|---|
| 22 |  | 
|---|
| 23 | #if !defined(VECATTRIBUTESIMPL_HPP) | 
|---|
| 24 | #define VECATTRIBUTESIMPL_HPP | 
|---|
| 25 |  | 
|---|
| 26 | #include <xercesc/sax2/Attributes.hpp> | 
|---|
| 27 | #include <xercesc/framework/XMLAttr.hpp> | 
|---|
| 28 | #include <xercesc/util/RefVectorOf.hpp> | 
|---|
| 29 | #include <xercesc/internal/XMLScanner.hpp> | 
|---|
| 30 | #include <xercesc/framework/XMLBuffer.hpp> | 
|---|
| 31 |  | 
|---|
| 32 | XERCES_CPP_NAMESPACE_BEGIN | 
|---|
| 33 |  | 
|---|
| 34 | class XMLPARSER_EXPORT VecAttributesImpl : public Attributes | 
|---|
| 35 | { | 
|---|
| 36 | public : | 
|---|
| 37 | // ----------------------------------------------------------------------- | 
|---|
| 38 | //  Constructors and Destructor | 
|---|
| 39 | // ----------------------------------------------------------------------- | 
|---|
| 40 | VecAttributesImpl(); | 
|---|
| 41 | ~VecAttributesImpl(); | 
|---|
| 42 |  | 
|---|
| 43 |  | 
|---|
| 44 | // ----------------------------------------------------------------------- | 
|---|
| 45 | //  Implementation of the attributes interface | 
|---|
| 46 | // ----------------------------------------------------------------------- | 
|---|
| 47 | virtual unsigned int getLength() const ; | 
|---|
| 48 |  | 
|---|
| 49 | virtual const XMLCh* getURI(const unsigned int index) const; | 
|---|
| 50 | virtual const XMLCh* getLocalName(const unsigned int index) const ; | 
|---|
| 51 | virtual const XMLCh* getQName(const unsigned int index) const ; | 
|---|
| 52 | virtual const XMLCh* getType(const unsigned int index) const ; | 
|---|
| 53 | virtual const XMLCh* getValue(const unsigned int index) const ; | 
|---|
| 54 |  | 
|---|
| 55 | virtual int getIndex(const XMLCh* const uri, const XMLCh* const localPart ) const  ; | 
|---|
| 56 | virtual int getIndex(const XMLCh* const qName ) const  ; | 
|---|
| 57 |  | 
|---|
| 58 | virtual const XMLCh* getType(const XMLCh* const uri, const XMLCh* const localPart ) const  ; | 
|---|
| 59 | virtual const XMLCh* getType(const XMLCh* const qName) const ; | 
|---|
| 60 |  | 
|---|
| 61 | virtual const XMLCh* getValue(const XMLCh* const qName) const; | 
|---|
| 62 | virtual const XMLCh* getValue(const XMLCh* const uri, const XMLCh* const localPart ) const  ; | 
|---|
| 63 |  | 
|---|
| 64 |  | 
|---|
| 65 | // ----------------------------------------------------------------------- | 
|---|
| 66 | //  Setter methods | 
|---|
| 67 | // ----------------------------------------------------------------------- | 
|---|
| 68 | void setVector | 
|---|
| 69 | ( | 
|---|
| 70 | const   RefVectorOf<XMLAttr>* const srcVec | 
|---|
| 71 | , const unsigned int                count | 
|---|
| 72 | , const XMLScanner * const              scanner | 
|---|
| 73 | , const bool                        adopt = false | 
|---|
| 74 | ); | 
|---|
| 75 |  | 
|---|
| 76 | private : | 
|---|
| 77 | // ----------------------------------------------------------------------- | 
|---|
| 78 | //  Unimplemented constructors and operators | 
|---|
| 79 | // ----------------------------------------------------------------------- | 
|---|
| 80 | VecAttributesImpl(const VecAttributesImpl&); | 
|---|
| 81 | VecAttributesImpl& operator=(const VecAttributesImpl&); | 
|---|
| 82 |  | 
|---|
| 83 |  | 
|---|
| 84 | // ----------------------------------------------------------------------- | 
|---|
| 85 | //  Private data members | 
|---|
| 86 | // | 
|---|
| 87 | //  fAdopt | 
|---|
| 88 | //      Indicates whether the passed vector is to be adopted or not. If | 
|---|
| 89 | //      so, we destroy it when we are destroyed (and when a new vector is | 
|---|
| 90 | //      set!) | 
|---|
| 91 | // | 
|---|
| 92 | //  fCount | 
|---|
| 93 | //      The count of elements in the vector that should be considered | 
|---|
| 94 | //      valid. This is an optimization to allow vector elements to be | 
|---|
| 95 | //      reused over and over but a different count of them be valid for | 
|---|
| 96 | //      each use. | 
|---|
| 97 | // | 
|---|
| 98 | //  fVector | 
|---|
| 99 | //      The vector that provides the backing for the list. | 
|---|
| 100 | // | 
|---|
| 101 | //      fScanner | 
|---|
| 102 | //              This is a pointer to the in use Scanner, so that we can resolve | 
|---|
| 103 | //              namespace URIs from UriIds | 
|---|
| 104 | // | 
|---|
| 105 | //      fURIBuffer | 
|---|
| 106 | //              A temporary buffer which is re-used when getting namespace URI's | 
|---|
| 107 | // ----------------------------------------------------------------------- | 
|---|
| 108 | bool                        fAdopt; | 
|---|
| 109 | unsigned int                fCount; | 
|---|
| 110 | const RefVectorOf<XMLAttr>* fVector; | 
|---|
| 111 | const XMLScanner *              fScanner ; | 
|---|
| 112 | //XMLBuffer                                 fURIBuffer ; | 
|---|
| 113 | }; | 
|---|
| 114 |  | 
|---|
| 115 | XERCES_CPP_NAMESPACE_END | 
|---|
| 116 |  | 
|---|
| 117 | #endif // ! VECATTRIBUTESIMPL_HPP | 
|---|