Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.11


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 
51 XALAN_CPP_NAMESPACE_BEGIN
52 
53 
54 
55 /**
56  * This class handles the creation of XObjects and manages their lifetime.
57  */
59 {
60 public:
61 
62  // Default block size for strings.
63  enum
64  {
65  eDefaultXStringBlockSize = 10,
66  eDefaultXNumberBlockSize = 10,
67  eDefaultXNodeSetBlockSize = 10,
68  eDefaultXNodeSetNodeProxyBlockSize = 5,
69  eXNumberCacheMax = 40,
70  eXNodeSetCacheMax = 40,
71  eXStringCacheMax = 40,
72  eXResultTreeFragCacheMax = 40
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 
92  static XObjectFactoryDefault*
93  create(
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
112  reset();
113 
114  virtual const XObjectPtr
115  createBoolean(bool theValue);
116 
117  virtual const XObjectPtr
119 
120  virtual const XObjectPtr
121  createNodeSet(XalanNode* theValue);
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
136  createString(
137  const XalanDOMChar* theValue,
138  XalanSize_t theLength);
139 
140  virtual const XObjectPtr
141  createString(const XToken& theValue);
142 
143  virtual const XObjectPtr
144  createStringReference(const XalanDOMString& theValue);
145 
146  virtual const XObjectPtr
148  const XObjectPtr& theValue,
149  XPathExecutionContext& theExecutionContext);
150 
151  virtual const XObjectPtr
152  createString(GetCachedString& theValue);
153 
154  virtual const XObjectPtr
155  createUnknown(const XalanDOMString& theValue);
156 
157  virtual void
158  holdReference(XObjectPtr theValue);
159 
164 
165 protected:
166 
167  virtual bool
169  XObject* theXObject,
170  bool fInReset = false);
171 
172 private:
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 XALAN_CPP_NAMESPACE_END
224 
225 
226 
227 #endif // XOBJECTFACTORYDEFAULT_HEADER_GUARD_1357924680
MemoryManager & getMemoryManager()
XalanVector< XNumber * > XNumberCacheType
virtual const XObjectPtr createNodeSet(BorrowReturnMutableNodeRefList &theValue)=0
Create a node set XObject from a node list.
ArenaAllocatorType::size_type size_type
Class to hold XObjectPtr return types.
Definition: XObject.hpp:883
#define XALAN_DEFAULT_MEMMGR
virtual void reset()=0
Reset the instance.
virtual const XObjectPtr createStringReference(const XalanDOMString &theValue)=0
Create a string XObject from a string.
virtual void holdReference(XObjectPtr theValue)=0
Hold a reference to an XObject instance until the factory is reset.
XalanVector< XObject * > XObjectCollectionType
XalanVector< XString * > XStringCacheType
XalanVector< XNodeSet * > XNodeSetCacheType
This class handles the creation of XObjects and manages their lifetime.
Class to hold XPath return types.
Definition: XObject.hpp:63
XNodeSetAllocator::size_type size_type
virtual const XObjectPtr createString(const XalanDOMString &theValue)=0
Create a string XObject from a string.
virtual bool doReturnObject(XObject *theXObject, bool fInReset=false)=0
Return an XObject to the factory.
virtual const XObjectPtr createUnknown(const XalanDOMString &theValue)=0
Create an "unknown" XObject from a string.
bool operator==(const ElemAttributeSet &theLHS, const ElemAttributeSet &theRHS)
virtual const XObjectPtr createStringAdapter(const XObjectPtr &theValue, XPathExecutionContext &theExecutionContext)=0
Create a string XObject that will adapt another XObject to behave like a string.
virtual const XObjectPtr createNumber(double theValue)=0
Create a numeric XObject from a number.
virtual const XObjectPtr createBoolean(bool theValue)=0
Create a boolean XObject from a boolean value.
#define XALAN_XPATH_EXPORT
This class handles the creation of XObjects and manages their lifetime.

Interpreting class diagrams

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

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

Apache Logo