Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

XObjectFactory.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #if !defined(XOBJECTFACTORY_HEADER_GUARD_1357924680)
17 #define XOBJECTFACTORY_HEADER_GUARD_1357924680
18 
19 
20 
21 // Base include file. Must be first.
23 
24 
25 
26 #include <algorithm>
27 #include <cassert>
28 
29 
30 #include <xalanc/XPath/XObject.hpp>
32 
33 
34 
35 XALAN_CPP_NAMESPACE_BEGIN
36 
37 
38 
39 class XalanNode;
40 class MutableNodeRefList;
41 class NodeRefListBase;
42 class XObject;
43 class XObjectPtr;
44 class XToken;
45 
46 
47 
52 {
53 public:
54 
57 
58 
59  XObjectFactory(MemoryManagerType& theManager);
60 
61  virtual
62  ~XObjectFactory();
63 
64 
67  {
68  return m_memoryManager;
69  }
70 
77  bool
78  returnObject(XObject* theXObject)
79  {
80  return doReturnObject(theXObject);
81  }
82 
87  virtual void
88  reset() = 0;
89 
96  virtual const XObjectPtr
97  createBoolean(bool theValue) = 0;
98 
105  virtual const XObjectPtr
106  createNodeSet(BorrowReturnMutableNodeRefList& theValue) = 0;
107 
114  virtual const XObjectPtr
115  createNodeSet(XalanNode* theValue) = 0;
116 
123  virtual const XObjectPtr
124  createNull() = 0;
125 
132  virtual const XObjectPtr
133  createNumber(double theValue) = 0;
134 
143  virtual const XObjectPtr
144  createNumber(const XToken& theValue) = 0;
145 
152  virtual const XObjectPtr
153  createString(const XalanDOMString& theValue) = 0;
154 
161  virtual const XObjectPtr
162  createString(const XalanDOMChar* theValue) = 0;
163 
171  virtual const XObjectPtr
172  createString(
173  const XalanDOMChar* theValue,
174  unsigned int theLength) = 0;
175 
184  virtual const XObjectPtr
185  createString(const XToken& theValue) = 0;
186 
196  virtual const XObjectPtr
197  createStringReference(const XalanDOMString& theValue) = 0;
198 
207  virtual const XObjectPtr
208  createStringAdapter(const XObjectPtr& theValue) = 0;
209 
216  virtual const XObjectPtr
217  createString(GetAndReleaseCachedString& theValue) = 0;
218 
225  virtual const XObjectPtr
226  createUnknown(const XalanDOMString& theValue) = 0;
227 
233 #if defined(XALAN_NO_STD_NAMESPACE)
234  struct DeleteXObjectFunctor : public unary_function<XObject*, void>
235 #else
236  struct DeleteXObjectFunctor : public std::unary_function<XObject*, void>
237 #endif
238  {
239  public:
240 
242  XObjectFactory& theFactoryInstance,
243  bool fInReset = false) :
244  m_factoryInstance(theFactoryInstance),
245  m_fInReset(fInReset)
246  {
247  }
248 
249  result_type
250  operator()(argument_type theXObject) const
251  {
252  if (m_fInReset == true)
253  {
254  m_factoryInstance.doReturnObject(
255  theXObject,
256  true);
257  }
258  else
259  {
260  m_factoryInstance.returnObject(theXObject);
261  }
262  }
263 
264  private:
265 
266  XObjectFactory& m_factoryInstance;
267 
268  const bool m_fInReset;
269  };
270 
271  friend struct DeleteXObjectFunctor;
272 
273 protected:
274 
281  getRealType(const XObject& theXObject) const
282  {
283  return theXObject.getRealType();
284  }
285 
291  void
292  deleteObject(const XObject* theXObject) const
293  {
294  if( theXObject!= 0)
295  {
296  XObject* theTmpXObject = const_cast<XObject*>(theXObject);
297  MemoryManagerType& theManager = const_cast<MemoryManagerType&>(m_memoryManager);
298 
299  theTmpXObject->~XObject();
300 
301  theManager.deallocate((void*)theTmpXObject);
302  }
303 
304  }
305 
313  virtual bool
314  doReturnObject(
315  XObject* theXObject,
316  bool fInReset = false) = 0;
317 
318 private:
319 
320  // Not implemented...
322 
324  operator=(const XObjectFactory&);
325 
326  bool
327  operator==(const XObjectFactory&) const;
328 
329  MemoryManagerType& m_memoryManager;
330 };
331 
332 
333 
334 XALAN_CPP_NAMESPACE_END
335 
336 
337 
338 #endif // XOBJECTFACTORY_HEADER_GUARD_1357924680
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
Definition: XalanVector.hpp:1111
void deleteObject(const XObject *theXObject) const
Delete a FactoryObject instance.
Definition: XObjectFactory.hpp:292
Definition: XToken.hpp:35
Definition: XalanNode.hpp:44
Local implementation of MutableNodeRefList.
Definition: MutableNodeRefList.hpp:44
XALAN_CPP_NAMESPACE_BEGIN typedef XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager MemoryManagerType
Definition: XalanMemoryManagement.hpp:39
result_type operator()(argument_type theXObject) const
Definition: XObjectFactory.hpp:250
eObjectType
Enumeration of possible object types.
Definition: XObject.hpp:70
XObject::eObjectType getRealType(const XObject &theXObject) const
Return the actual implementation type of an XObject.
Definition: XObjectFactory.hpp:281
Class to hold XObjectPtr return types.
Definition: XObject.hpp:584
bool returnObject(XObject *theXObject)
Return an XObject to the factory.
Definition: XObjectFactory.hpp:78
Local implementation of NodeRefList.
Definition: NodeRefListBase.hpp:42
virtual eObjectType getRealType() const
Tell what kind of class this is.
A public functor for use with stl algorithms.
Definition: XObjectFactory.hpp:236
DeleteXObjectFunctor(XObjectFactory &theFactoryInstance, bool fInReset=false)
Definition: XObjectFactory.hpp:241
Class to hold XPath return types.
Definition: XObject.hpp:61
virtual ~XObject()
Definition: XPathExecutionContext.hpp:430
Definition: XPathExecutionContext.hpp:319
Definition: XalanDOMString.hpp:42
XPathExecutionContext::GetAndReleaseCachedString GetAndReleaseCachedString
Definition: XObjectFactory.hpp:56
#define XALAN_XPATH_EXPORT
Definition: XPathDefinitions.hpp:33
This class handles the creation of XObjects and manages their lifetime.
Definition: XObjectFactory.hpp:51
XPathExecutionContext::BorrowReturnMutableNodeRefList BorrowReturnMutableNodeRefList
Definition: XObjectFactory.hpp:55
MemoryManagerType & getMemoryManager()
Definition: XObjectFactory.hpp:66

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo