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 
36 namespace XALAN_CPP_NAMESPACE {
37 
38 
39 
40 /**
41  * Local implementation of NodeRefList. This class is for internal use only.
42  */
44 {
45 public:
46 
47  explicit
48  NodeRefList(MemoryManager& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR);
49 
50  /**
51  * Construct a node list from another
52  *
53  * @param theSource source node list
54  */
56  const NodeRefList& theSource,
57  MemoryManager& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR);
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
72  const NodeRefListBase& theSource,
73  MemoryManager& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR);
74 
75  virtual
76  ~NodeRefList();
77 
79  operator=(const NodeRefListBase& theRHS);
80 
82  operator=(const NodeRefList& theRHS);
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
110  swap(NodeRefList& theOther)
111  {
112  m_nodeList.swap(theOther.m_nodeList);
113  }
114 
115 protected:
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 
138 private:
139 #if defined (XALAN_DEVELOPMENT)
140  // not defined
141  NodeRefList();
142  NodeRefList(const NodeRefList& theSource);
143 #endif
144 };
145 
146 
147 
148 }
149 
150 
151 
152 #endif // NODEREFLIST_HEADER_GUARD_1357924680
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition: XalanVersion.hpp:76
xalanc::XalanNode
Definition: XalanNode.hpp:38
xalanc::NodeRefList::ensureAllocation
void ensureAllocation(NodeListVectorType::size_type theSize=0)
Ensure that an allocation is either the default allocation amount, or the amount specified in the par...
Definition: NodeRefList.hpp:132
xalanc::NodeRefList::m_nodeList
NodeListVectorType m_nodeList
Definition: NodeRefList.hpp:137
xalanc::XalanVector< XalanNode * >
xalanc::indexOf
XalanDOMString::size_type indexOf(const XalanDOMChar *theString, XalanDOMChar theChar)
Simulates the java String method indexOf().
Definition: DOMStringHelper.hpp:308
xalanc::NodeRefList
Local implementation of NodeRefList.
Definition: NodeRefList.hpp:43
xalanc::size_type
size_t size_type
Definition: XalanMap.hpp:46
XalanVector.hpp
XALAN_XPATH_EXPORT
#define XALAN_XPATH_EXPORT
Definition: XPathDefinitions.hpp:35
xalanc::NodeRefList::swap
void swap(NodeRefList &theOther)
Definition: NodeRefList.hpp:110
xalanc::NodeRefList::getMemoryManager
MemoryManager & getMemoryManager()
Definition: NodeRefList.hpp:60
xalanc::NodeRefList::empty
bool empty() const
Definition: NodeRefList.hpp:85
NodeRefListBase.hpp
xalanc::NodeRefListBase
Local implementation of NodeRefList.
Definition: NodeRefListBase.hpp:44
xalanc::NodeRefList::NodeListVectorType
XalanVector< XalanNode * > NodeListVectorType
Definition: NodeRefList.hpp:107
xalanc::XalanVector< XalanNode * >::size_type
size_t size_type
Definition: XalanVector.hpp:68
XALAN_DEFAULT_CONSTRUCTOR_MEMMGR
#define XALAN_DEFAULT_CONSTRUCTOR_MEMMGR
Definition: XalanMemoryManagement.hpp:515
XPathDefinitions.hpp