GME
13
|
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: ContentLeafNameTypeVector.cpp 676911 2008-07-15 13:27:32Z amassari $ 00020 */ 00021 00022 00023 // --------------------------------------------------------------------------- 00024 // Includes 00025 // --------------------------------------------------------------------------- 00026 #include <xercesc/validators/common/ContentLeafNameTypeVector.hpp> 00027 00028 XERCES_CPP_NAMESPACE_BEGIN 00029 00030 // --------------------------------------------------------------------------- 00031 // ContentLeafNameTypeVector: Constructors and Destructor 00032 // --------------------------------------------------------------------------- 00033 ContentLeafNameTypeVector::ContentLeafNameTypeVector 00034 ( 00035 MemoryManager* const manager 00036 ) 00037 : fMemoryManager(manager) 00038 , fLeafNames(0) 00039 , fLeafTypes(0) 00040 , fLeafCount(0) 00041 { 00042 } 00043 00044 ContentLeafNameTypeVector::ContentLeafNameTypeVector 00045 ( 00046 QName** const names 00047 , ContentSpecNode::NodeTypes* const types 00048 , const XMLSize_t count 00049 , MemoryManager* const manager 00050 ) 00051 : fMemoryManager(manager) 00052 , fLeafNames(0) 00053 , fLeafTypes(0) 00054 , fLeafCount(0) 00055 { 00056 setValues(names, types, count); 00057 } 00058 00059 /*** 00060 copy ctor 00061 ***/ 00062 ContentLeafNameTypeVector::ContentLeafNameTypeVector 00063 ( 00064 const ContentLeafNameTypeVector& toCopy 00065 ) 00066 : XMemory(toCopy) 00067 , fMemoryManager(toCopy.fMemoryManager) 00068 , fLeafNames(0) 00069 , fLeafTypes(0) 00070 , fLeafCount(0) 00071 { 00072 fLeafCount=toCopy.getLeafCount(); 00073 init(fLeafCount); 00074 00075 for (XMLSize_t i=0; i<this->fLeafCount; i++) 00076 { 00077 fLeafNames[i] = toCopy.getLeafNameAt(i); 00078 fLeafTypes[i] = toCopy.getLeafTypeAt(i); 00079 } 00080 } 00081 00082 ContentLeafNameTypeVector::~ContentLeafNameTypeVector() 00083 { 00084 cleanUp(); 00085 } 00086 00087 // --------------------------------------------------------------------------- 00088 // ContentSpecType: Setter methods 00089 // --------------------------------------------------------------------------- 00090 void ContentLeafNameTypeVector::setValues 00091 ( 00092 QName** const names 00093 , ContentSpecNode::NodeTypes* const types 00094 , const XMLSize_t count 00095 ) 00096 { 00097 cleanUp(); 00098 init(count); 00099 00100 for (XMLSize_t i=0; i<count; i++) 00101 { 00102 fLeafNames[i] = names[i]; 00103 fLeafTypes[i] = types[i]; 00104 } 00105 } 00106 00107 // --------------------------------------------------------------------------- 00108 // ContentLeafNameTypeVector: Getter methods 00109 // --------------------------------------------------------------------------- 00110 QName* ContentLeafNameTypeVector::getLeafNameAt(const XMLSize_t pos) const 00111 { 00112 if (pos >= fLeafCount) 00113 ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, fMemoryManager); 00114 00115 return fLeafNames[pos]; 00116 } 00117 00118 ContentSpecNode::NodeTypes ContentLeafNameTypeVector::getLeafTypeAt 00119 (const XMLSize_t pos) const 00120 { 00121 if (pos >= fLeafCount) 00122 ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, fMemoryManager); 00123 00124 return fLeafTypes[pos]; 00125 } 00126 00127 XMLSize_t ContentLeafNameTypeVector::getLeafCount() const 00128 { 00129 return fLeafCount; 00130 } 00131 00132 XERCES_CPP_NAMESPACE_END