00001 /* 00002 * The Apache Software License, Version 1.1 00003 * 00004 * 00005 * Copyright (c) 1999-2002 The Apache Software Foundation. All rights 00006 * reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions 00010 * are met: 00011 * 00012 * 1. Redistributions of source code must retain the above copyright 00013 * notice, this list of conditions and the following disclaimer. 00014 * 00015 * 2. Redistributions in binary form must reproduce the above copyright 00016 * notice, this list of conditions and the following disclaimer in 00017 * the documentation and/or other materials provided with the 00018 * distribution. 00019 * 00020 * 3. The end-user documentation included with the redistribution, 00021 * if any, must include the following acknowledgment: 00022 * "This product includes software developed by the 00023 * Apache Software Foundation (http://www.apache.org/)." 00024 * Alternately, this acknowledgment may appear in the software itself, 00025 * if and wherever such third-party acknowledgments normally appear. 00026 * 00027 * 4. The names "Xalan" and "Apache Software Foundation" must 00028 * not be used to endorse or promote products derived from this 00029 * software without prior written permission. For written 00030 * permission, please contact apache@apache.org. 00031 * 00032 * 5. Products derived from this software may not be called "Apache", 00033 * nor may "Apache" appear in their name, without prior written 00034 * permission of the Apache Software Foundation. 00035 * 00036 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 00037 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00038 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00039 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 00040 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00041 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00042 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00043 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00044 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00045 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00046 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00047 * SUCH DAMAGE. 00048 * ==================================================================== 00049 * 00050 * This software consists of voluntary contributions made by many 00051 * individuals on behalf of the Apache Software Foundation and was 00052 * originally based on software copyright (c) 1999, International 00053 * Business Machines, Inc., http://www.ibm.com. For more 00054 * information on the Apache Software Foundation, please see 00055 * <http://www.apache.org/>. 00056 */ 00057 #if !defined(XOBJECTFACTORYDEFAULT_HEADER_GUARD_1357924680) 00058 #define XOBJECTFACTORYDEFAULT_HEADER_GUARD_1357924680 00059 00060 00061 00062 // Base include file. Must be first. 00063 #include <xalanc/XPath/XPathDefinitions.hpp> 00064 00065 00066 00067 #include <set> 00068 #include <vector> 00069 00070 00071 00072 // Base class header file... 00073 #include <xalanc/XPath/XObjectFactory.hpp> 00074 00075 00076 00077 #include <xalanc/XPath/XNodeSetAllocator.hpp> 00078 #include <xalanc/XPath/XNodeSetNodeProxyAllocator.hpp> 00079 #include <xalanc/XPath/XNumberAllocator.hpp> 00080 #include <xalanc/XPath/XStringAllocator.hpp> 00081 #include <xalanc/XPath/XStringAdapterAllocator.hpp> 00082 #include <xalanc/XPath/XStringCachedAllocator.hpp> 00083 #include <xalanc/XPath/XStringReferenceAllocator.hpp> 00084 #include <xalanc/XPath/XTokenNumberAdapterAllocator.hpp> 00085 #include <xalanc/XPath/XTokenStringAdapterAllocator.hpp> 00086 00087 00088 00089 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION) 00090 #include <xalanc/XPath/XNull.hpp> 00091 #include <xalanc/XPath/XBoolean.hpp> 00092 #endif 00093 00094 00095 00096 #include <xalanc/Include/XalanAutoPtr.hpp> 00097 00098 00099 00100 XALAN_CPP_NAMESPACE_BEGIN 00101 00102 00103 00104 class XBoolean; 00105 class XNull; 00106 class XNumber; 00107 00108 00109 00113 class XALAN_XPATH_EXPORT XObjectFactoryDefault : public XObjectFactory 00114 { 00115 public: 00116 00117 // Default block size for strings. 00118 enum 00119 { 00120 eDefaultXStringBlockSize = 10, 00121 eDefaultXNumberBlockSize = 10, 00122 eDefaultXNodeSetBlockSize = 10, 00123 eDefaultXNodeSetNodeProxyBlockSize = 5, 00124 eXNumberCacheMax = 40, 00125 eXNodeSetCacheMax = 40, 00126 eXStringCacheMax = 40, 00127 eXResultTreeFragCacheMax = 40 00128 }; 00129 00130 typedef unsigned long size_type; 00131 00139 explicit 00140 XObjectFactoryDefault( 00141 size_type theXStringBlockSize = eDefaultXStringBlockSize, 00142 size_type theXNumberBlockSize = eDefaultXNumberBlockSize, 00143 size_type theXNodeSetBlockSize = eDefaultXNodeSetBlockSize, 00144 size_type theXNodeSetNodeProxyBlockSize = eDefaultXNodeSetNodeProxyBlockSize); 00145 00146 virtual 00147 ~XObjectFactoryDefault(); 00148 00149 // These methods are inherited from XObjectFactory ... 00150 00151 virtual void 00152 reset(); 00153 00154 virtual const XObjectPtr 00155 createBoolean(bool theValue); 00156 00157 virtual const XObjectPtr 00158 createNodeSet(BorrowReturnMutableNodeRefList& theValue); 00159 00160 virtual const XObjectPtr 00161 createNodeSet(XalanNode* theValue); 00162 00163 virtual const XObjectPtr 00164 createNull(); 00165 00166 virtual const XObjectPtr 00167 createNumber(double theValue); 00168 00169 virtual const XObjectPtr 00170 createNumber(const XToken& theValue); 00171 00172 virtual const XObjectPtr 00173 createString(const XalanDOMString& theValue); 00174 00175 virtual const XObjectPtr 00176 createString(const XalanDOMChar* theValue); 00177 00178 virtual const XObjectPtr 00179 createString( 00180 const XalanDOMChar* theValue, 00181 unsigned int theLength); 00182 00183 virtual const XObjectPtr 00184 createString(const XToken& theValue); 00185 00186 virtual const XObjectPtr 00187 createStringReference(const XalanDOMString& theValue); 00188 00189 virtual const XObjectPtr 00190 createStringAdapter(const XObjectPtr& theValue); 00191 00192 virtual const XObjectPtr 00193 createString(GetAndReleaseCachedString& theValue); 00194 00195 virtual const XObjectPtr 00196 createUnknown( 00197 const XalanDOMString& theValue); 00198 00199 #if defined(XALAN_NO_STD_NAMESPACE) 00200 typedef vector<XObject*> XObjectCollectionType; 00201 typedef vector<XNumber*> XNumberCacheType; 00202 typedef vector<XNodeSet*> XNodeSetCacheType; 00203 typedef vector<XString*> XStringCacheType; 00204 #else 00205 typedef std::vector<XObject*> XObjectCollectionType; 00206 typedef std::vector<XNumber*> XNumberCacheType; 00207 typedef std::vector<XNodeSet*> XNodeSetCacheType; 00208 typedef std::vector<XString*> XStringCacheType; 00209 #endif 00210 00211 protected: 00212 00213 virtual bool 00214 doReturnObject( 00215 XObject* theXObject, 00216 bool fInReset = false); 00217 00218 private: 00219 00220 // Not implemented... 00221 XObjectFactoryDefault(const XObjectFactoryDefault&); 00222 00223 XObjectFactoryDefault& 00224 operator=(const XObjectFactoryDefault&); 00225 00226 bool 00227 operator==(const XObjectFactoryDefault&) const; 00228 00229 00230 // Data members... 00231 00232 // This one's first, since it may be be holding references 00233 // to objects in other allocators. 00234 XStringAdapterAllocator m_xstringAdapterAllocator; 00235 00236 XStringAllocator m_xstringAllocator; 00237 00238 XStringCachedAllocator m_xstringCachedAllocator; 00239 00240 XStringReferenceAllocator m_xstringReferenceAllocator; 00241 00242 XNumberAllocator m_xnumberAllocator; 00243 00244 XNodeSetAllocator m_xnodesetAllocator; 00245 00246 XNodeSetNodeProxyAllocator m_xnodesetNodeProxyAllocator; 00247 00248 XTokenNumberAdapterAllocator m_xtokenNumberAdapterAllocator; 00249 00250 XTokenStringAdapterAllocator m_xtokenStringAdapterAllocator; 00251 00252 XObjectCollectionType m_xobjects; 00253 00254 XNumberCacheType m_xnumberCache; 00255 00256 XNodeSetCacheType m_xnodesetCache; 00257 00258 XStringCacheType m_xstringCache; 00259 00260 const XalanAutoPtr<XNull> m_XNull; 00261 00262 const XalanAutoPtr<XBoolean> m_xbooleanFalse; 00263 00264 const XalanAutoPtr<XBoolean> m_xbooleanTrue; 00265 }; 00266 00267 00268 00269 XALAN_CPP_NAMESPACE_END 00270 00271 00272 00273 #endif // XOBJECTFACTORYDEFAULT_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
![]() |
Xalan-C++ XSLT Processor Version 1.6 |
|