source: icXML/icXML-devel/src/xercesc/validators/common/ContentLeafNameTypeVector.cpp @ 2722

Last change on this file since 2722 was 2722, checked in by cameron, 6 years ago

Original Xerces files with import mods for icxercesc

File size: 3.7 KB
Line 
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: ContentLeafNameTypeVector.cpp 676911 2008-07-15 13:27:32Z amassari $
20 */
21
22
23// ---------------------------------------------------------------------------
24//  Includes
25// ---------------------------------------------------------------------------
26#include <xercesc/validators/common/ContentLeafNameTypeVector.hpp>
27
28XERCES_CPP_NAMESPACE_BEGIN
29
30// ---------------------------------------------------------------------------
31//  ContentLeafNameTypeVector: Constructors and Destructor
32// ---------------------------------------------------------------------------
33ContentLeafNameTypeVector::ContentLeafNameTypeVector
34(
35    MemoryManager* const manager
36)
37: fMemoryManager(manager)
38, fLeafNames(0)
39, fLeafTypes(0)
40, fLeafCount(0)
41{
42}
43
44ContentLeafNameTypeVector::ContentLeafNameTypeVector
45(
46      QName** const                     names
47    , ContentSpecNode::NodeTypes* const types
48    , const XMLSize_t                   count
49    , MemoryManager* const              manager
50)
51: fMemoryManager(manager)
52, fLeafNames(0)
53, fLeafTypes(0)
54, fLeafCount(0)
55{
56    setValues(names, types, count);
57}
58
59/***
60copy ctor
61***/
62ContentLeafNameTypeVector::ContentLeafNameTypeVector
63(
64    const ContentLeafNameTypeVector& toCopy
65)
66: XMemory(toCopy)
67, fMemoryManager(toCopy.fMemoryManager)
68, fLeafNames(0)
69, fLeafTypes(0)
70, fLeafCount(0)
71{
72    fLeafCount=toCopy.getLeafCount();
73    init(fLeafCount);
74
75    for (XMLSize_t i=0; i<this->fLeafCount; i++)
76    {
77        fLeafNames[i] = toCopy.getLeafNameAt(i);
78        fLeafTypes[i] = toCopy.getLeafTypeAt(i);
79    }
80}
81
82ContentLeafNameTypeVector::~ContentLeafNameTypeVector()
83{
84    cleanUp();
85}
86
87// ---------------------------------------------------------------------------
88//  ContentSpecType: Setter methods
89// ---------------------------------------------------------------------------
90void ContentLeafNameTypeVector::setValues
91    (
92         QName** const                      names
93       , ContentSpecNode::NodeTypes* const  types
94       , const XMLSize_t                    count
95    )
96{
97    cleanUp();
98    init(count);
99
100    for (XMLSize_t i=0; i<count; i++)
101    {
102        fLeafNames[i] = names[i];
103        fLeafTypes[i] = types[i];
104    }
105}
106
107// ---------------------------------------------------------------------------
108//  ContentLeafNameTypeVector: Getter methods
109// ---------------------------------------------------------------------------
110QName* ContentLeafNameTypeVector::getLeafNameAt(const XMLSize_t pos) const
111{
112    if (pos >= fLeafCount)
113        ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, fMemoryManager);
114
115    return fLeafNames[pos];
116}
117
118ContentSpecNode::NodeTypes ContentLeafNameTypeVector::getLeafTypeAt
119       (const XMLSize_t pos) const
120{
121    if (pos >= fLeafCount)
122        ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, fMemoryManager);
123
124        return fLeafTypes[pos];
125}
126
127XMLSize_t ContentLeafNameTypeVector::getLeafCount() const
128{
129        return fLeafCount;
130}
131
132XERCES_CPP_NAMESPACE_END
Note: See TracBrowser for help on using the repository browser.