Xalan-C++ API Reference 1.12.0
XObjectFactoryDefault.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(XOBJECTFACTORYDEFAULT_HEADER_GUARD_1357924680)
19#define XOBJECTFACTORYDEFAULT_HEADER_GUARD_1357924680
20
21
22
23// Base include file. Must be first.
25
26
27
29
30
31
32// Base class header file...
34
35
36
47
48
49
50
51namespace XALAN_CPP_NAMESPACE {
52
53
54
55/**
56 * This class handles the creation of XObjects and manages their lifetime.
57 */
59{
60public:
61
62 // Default block size for strings.
63 enum
64 {
73 };
74
76
77 /**
78 * Construct a factory for creating XObjects.
79 *
80 * @param theXStringBlockSize allocation block size
81 * @param theXNumberBlockSize allocation block size
82 * @param theXNodeSetBlockSize allocation block size
83 */
84 explicit
86 MemoryManager& theManager XALAN_DEFAULT_MEMMGR,
87 size_type theXStringBlockSize = eDefaultXStringBlockSize,
88 size_type theXNumberBlockSize = eDefaultXNumberBlockSize,
89 size_type theXNodeSetBlockSize = eDefaultXNodeSetBlockSize,
90 size_type theXNodeSetNodeProxyBlockSize = eDefaultXNodeSetNodeProxyBlockSize);
91
94 MemoryManager& theManager,
95 size_type theXStringBlockSize = eDefaultXStringBlockSize,
96 size_type theXNumberBlockSize = eDefaultXNumberBlockSize,
97 size_type theXNodeSetBlockSize = eDefaultXNodeSetBlockSize,
98 size_type theXNodeSetNodeProxyBlockSize = eDefaultXNodeSetNodeProxyBlockSize);
99
100
101 virtual
103
104 MemoryManager&
106 {
107 return m_xobjects.getMemoryManager();
108 }
109 // These methods are inherited from XObjectFactory ...
110
111 virtual void
113
114 virtual const XObjectPtr
115 createBoolean(bool theValue);
116
117 virtual const XObjectPtr
119
120 virtual const XObjectPtr
122
123 virtual const XObjectPtr
124 createNumber(double theValue);
125
126 virtual const XObjectPtr
127 createNumber(const XToken& theValue);
128
129 virtual const XObjectPtr
130 createString(const XalanDOMString& theValue);
131
132 virtual const XObjectPtr
133 createString(const XalanDOMChar* theValue);
134
135 virtual const XObjectPtr
137 const XalanDOMChar* theValue,
138 XalanSize_t theLength);
139
140 virtual const XObjectPtr
141 createString(const XToken& theValue);
142
143 virtual const XObjectPtr
145
146 virtual const XObjectPtr
148 const XObjectPtr& theValue,
149 XPathExecutionContext& theExecutionContext);
150
151 virtual const XObjectPtr
153
154 virtual const XObjectPtr
156
157 virtual void
159
164
165protected:
166
167 virtual bool
169 XObject* theXObject,
170 bool fInReset = false);
171
172private:
173
174 // Not implemented...
176
178 operator=(const XObjectFactoryDefault&);
179
180 bool
181 operator==(const XObjectFactoryDefault&) const;
182
183
184 // Data members...
185
186 // This one's first, since it may be be holding references
187 // to objects in other allocators.
188 XStringAdapterAllocator m_xstringAdapterAllocator;
189
190 XStringAllocator m_xstringAllocator;
191
192 XStringCachedAllocator m_xstringCachedAllocator;
193
194 XStringReferenceAllocator m_xstringReferenceAllocator;
195
196 XNumberAllocator m_xnumberAllocator;
197
198 XNodeSetAllocator m_xnodesetAllocator;
199
200 XNodeSetNodeProxyAllocator m_xnodesetNodeProxyAllocator;
201
202 XTokenNumberAdapterAllocator m_xtokenNumberAdapterAllocator;
203
204 XTokenStringAdapterAllocator m_xtokenStringAdapterAllocator;
205
206 XObjectCollectionType m_xobjects;
207
208 XNumberCacheType m_xnumberCache;
209
210 XNodeSetCacheType m_xnodesetCache;
211
212 XStringCacheType m_xstringCache;
213
214 XBoolean m_xbooleanFalse;
215
216 XBoolean m_xbooleanTrue;
217
218 XalanVector<XObjectPtr> m_references;
219};
220
221
222
223}
224
225
226
227#endif // XOBJECTFACTORYDEFAULT_HEADER_GUARD_1357924680
#define XALAN_CPP_NAMESPACE
#define XALAN_XPATH_EXPORT
#define XALAN_DEFAULT_MEMMGR
ArenaAllocatorType::size_type size_type
XNodeSetAllocator::size_type size_type
virtual const XObjectPtr createBoolean(bool theValue)
Create a boolean XObject from a boolean value.
XalanVector< XString * > XStringCacheType
virtual const XObjectPtr createString(const XalanDOMChar *theValue, XalanSize_t theLength)
Create a string XObject from an array of characters.
virtual const XObjectPtr createNodeSet(BorrowReturnMutableNodeRefList &theValue)
Create a node set XObject from a node list.
virtual const XObjectPtr createString(GetCachedString &theValue)
Create a string XObject from a cached XalanDOMString,.
XalanVector< XObject * > XObjectCollectionType
virtual void reset()
Reset the instance.
virtual const XObjectPtr createNumber(const XToken &theValue)
Create a numeric XObject from an XToken.
virtual const XObjectPtr createStringAdapter(const XObjectPtr &theValue, XPathExecutionContext &theExecutionContext)
Create a string XObject that will adapt another XObject to behave like a string.
XalanVector< XNodeSet * > XNodeSetCacheType
virtual const XObjectPtr createStringReference(const XalanDOMString &theValue)
Create a string XObject from a string.
virtual const XObjectPtr createNodeSet(XalanNode *theValue)
Create a node set XObject from a node.
XalanVector< XNumber * > XNumberCacheType
virtual void holdReference(XObjectPtr theValue)
Hold a reference to an XObject instance until the factory is reset.
virtual const XObjectPtr createUnknown(const XalanDOMString &theValue)
Create an "unknown" XObject from a string.
virtual const XObjectPtr createString(const XToken &theValue)
Create a string XObject from an XToken.
virtual const XObjectPtr createNumber(double theValue)
Create a numeric XObject from a number.
virtual const XObjectPtr createString(const XalanDOMChar *theValue)
Create a string XObject from a null-terminated array of characters.
virtual const XObjectPtr createString(const XalanDOMString &theValue)
Create a string XObject from a string.
XObjectFactoryDefault(MemoryManager &theManager XALAN_DEFAULT_MEMMGR, size_type theXStringBlockSize=eDefaultXStringBlockSize, size_type theXNumberBlockSize=eDefaultXNumberBlockSize, size_type theXNodeSetBlockSize=eDefaultXNodeSetBlockSize, size_type theXNodeSetNodeProxyBlockSize=eDefaultXNodeSetNodeProxyBlockSize)
Construct a factory for creating XObjects.
virtual bool doReturnObject(XObject *theXObject, bool fInReset=false)
Return an XObject to the factory.
static XObjectFactoryDefault * create(MemoryManager &theManager, size_type theXStringBlockSize=eDefaultXStringBlockSize, size_type theXNumberBlockSize=eDefaultXNumberBlockSize, size_type theXNodeSetBlockSize=eDefaultXNodeSetBlockSize, size_type theXNodeSetNodeProxyBlockSize=eDefaultXNodeSetNodeProxyBlockSize)
XPathExecutionContext::GetCachedString GetCachedString
XObjectFactory(MemoryManager &theManager)
XPathExecutionContext::BorrowReturnMutableNodeRefList BorrowReturnMutableNodeRefList
Class to hold XObjectPtr return types.
Definition XObject.hpp:884
Class to hold XPath return types.
Definition XObject.hpp:64