Xalan-C++ API Reference 1.12.0
NodeRefList.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18#if !defined(NODEREFLIST_HEADER_GUARD_1357924680)
19#define NODEREFLIST_HEADER_GUARD_1357924680
20
21
22
23// Base include file. Must be first.
25
26
27
29
30
31
33
34
35
36namespace XALAN_CPP_NAMESPACE {
37
38
39
40/**
41 * Local implementation of NodeRefList. This class is for internal use only.
42 */
44{
45public:
46
47 explicit
49
50 /**
51 * Construct a node list from another
52 *
53 * @param theSource source node list
54 */
58
59 MemoryManager&
61 {
62 return m_nodeList.getMemoryManager();
63 }
64
65 /**
66 * Construct a node list from another
67 *
68 * @param theSource source node list
69 */
70 explicit
74
75 virtual
77
80
83
84 bool
85 empty() const
86 {
87 return m_nodeList.empty();
88 }
89
90
91 // These methods are inherited from NodeRefListBase ...
92
93 virtual XalanNode*
94 item(size_type index) const;
95
96 virtual size_type
97 getLength() const;
98
99 virtual size_type
100 indexOf(const XalanNode* theNode) const;
101
102#if !defined(NDEBUG)
103 bool
104 checkForDuplicates(MemoryManager& theManager) const;
105#endif
106
108
109 void
111 {
112 m_nodeList.swap(theOther.m_nodeList);
113 }
114
115protected:
116
117 // Default vector allocation size. It seems high, but
118 // it's really worth it...
119 enum
120 {
121 eDefaultVectorSize = 100
122 };
123
124 /**
125 * Ensure that an allocation is either the default allocation
126 * amount, or the amount specified in the parameter, whichever
127 * is larger.
128 *
129 * @param theSize The requested size.
130 */
131 void
133 {
134 m_nodeList.reserve(eDefaultVectorSize > theSize ? eDefaultVectorSize : theSize);
135 }
136
138private:
139#if defined (XALAN_DEVELOPMENT)
140 // not defined
141 NodeRefList();
143#endif
144};
145
146
147
148}
149
150
151
152#endif // NODEREFLIST_HEADER_GUARD_1357924680
#define XALAN_XPATH_EXPORT
#define XALAN_DEFAULT_CONSTRUCTOR_MEMMGR
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Local implementation of NodeRefList.
Local implementation of NodeRefList.
virtual size_type indexOf(const XalanNode *theNode) const
Retrieve the zero based index of the node in the list.
NodeRefList(const NodeRefList &theSource, MemoryManager &theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR)
Construct a node list from another.
virtual ~NodeRefList()
void ensureAllocation(NodeListVectorType::size_type theSize=0)
Ensure that an allocation is either the default allocation amount, or the amount specified in the par...
NodeListVectorType m_nodeList
XalanVector< XalanNode * > NodeListVectorType
virtual size_type getLength() const
Determine the number of nodes in the list.
bool checkForDuplicates(MemoryManager &theManager) const
NodeRefList & operator=(const NodeRefList &theRHS)
MemoryManager & getMemoryManager()
NodeRefList(const NodeRefListBase &theSource, MemoryManager &theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR)
Construct a node list from another.
NodeRefList(MemoryManager &theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR)
void swap(NodeRefList &theOther)
NodeRefList & operator=(const NodeRefListBase &theRHS)
virtual XalanNode * item(size_type index) const
Returns the indexth item in the collection.