GME  13
DOMStringListImpl.cpp
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: DOMStringListImpl.cpp 671894 2008-06-26 13:29:21Z borisk $
00020  */
00021 
00022 #include "DOMStringListImpl.hpp"
00023 #include <xercesc/util/XMLString.hpp>
00024 
00025 XERCES_CPP_NAMESPACE_BEGIN
00026 
00027 DOMStringListImpl::DOMStringListImpl(int nInitialSize, MemoryManager* manager)
00028 {
00029     fList=new (manager) RefVectorOf<XMLCh>(nInitialSize, false, manager);
00030 }
00031 
00032 DOMStringListImpl::~DOMStringListImpl()
00033 {
00034     delete fList;
00035 }
00036 
00037 
00038 void DOMStringListImpl::add(const XMLCh* str) {
00039     fList->addElement((XMLCh*)str);
00040 }
00041 
00042 XMLSize_t DOMStringListImpl::getLength() const{
00043     return fList->size();
00044 }
00045 
00046 
00047 const XMLCh* DOMStringListImpl::item(XMLSize_t index) const{
00048     if(index<fList->size())
00049         return fList->elementAt(index);
00050     return 0;
00051 }
00052 
00053 bool DOMStringListImpl::contains(const XMLCh* str) const{
00054     for(XMLSize_t i=0;i<fList->size();i++)
00055         if(XMLString::equals(fList->elementAt(i), str))
00056             return true;
00057     return false;
00058 }
00059 
00060 void DOMStringListImpl::release() {
00061     delete this;
00062 }
00063 
00064 XERCES_CPP_NAMESPACE_END