00001 /* 00002 * The Apache Software License, Version 1.1 00003 * 00004 * 00005 * Copyright (c) 1999-2004 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(XOBJECTFACTORY_HEADER_GUARD_1357924680) 00058 #define XOBJECTFACTORY_HEADER_GUARD_1357924680 00059 00060 00061 00062 // Base include file. Must be first. 00063 #include <xalanc/XPath/XPathDefinitions.hpp> 00064 00065 00066 00067 #include <algorithm> 00068 #include <cassert> 00069 #include <set> 00070 00071 00072 00073 #include <xalanc/XPath/XObject.hpp> 00074 #include <xalanc/XPath/XPathExecutionContext.hpp> 00075 00076 00077 00078 XALAN_CPP_NAMESPACE_BEGIN 00079 00080 00081 00082 class XalanNode; 00083 class MutableNodeRefList; 00084 class NodeRefListBase; 00085 class XObject; 00086 class XObjectPtr; 00087 class XToken; 00088 00089 00090 00094 class XALAN_XPATH_EXPORT XObjectFactory 00095 { 00096 public: 00097 00098 typedef XPathExecutionContext::BorrowReturnMutableNodeRefList BorrowReturnMutableNodeRefList; 00099 typedef XPathExecutionContext::GetAndReleaseCachedString GetAndReleaseCachedString; 00100 00101 00102 XObjectFactory(); 00103 00104 virtual 00105 ~XObjectFactory(); 00106 00107 00114 bool 00115 returnObject(XObject* theXObject) 00116 { 00117 return doReturnObject(theXObject); 00118 } 00119 00124 virtual void 00125 reset() = 0; 00126 00133 virtual const XObjectPtr 00134 createBoolean(bool theValue) = 0; 00135 00142 virtual const XObjectPtr 00143 createNodeSet(BorrowReturnMutableNodeRefList& theValue) = 0; 00144 00151 virtual const XObjectPtr 00152 createNodeSet(XalanNode* theValue) = 0; 00153 00160 virtual const XObjectPtr 00161 createNull() = 0; 00162 00169 virtual const XObjectPtr 00170 createNumber(double theValue) = 0; 00171 00180 virtual const XObjectPtr 00181 createNumber(const XToken& theValue) = 0; 00182 00189 virtual const XObjectPtr 00190 createString(const XalanDOMString& theValue) = 0; 00191 00198 virtual const XObjectPtr 00199 createString(const XalanDOMChar* theValue) = 0; 00200 00208 virtual const XObjectPtr 00209 createString( 00210 const XalanDOMChar* theValue, 00211 unsigned int theLength) = 0; 00212 00221 virtual const XObjectPtr 00222 createString(const XToken& theValue) = 0; 00223 00233 virtual const XObjectPtr 00234 createStringReference(const XalanDOMString& theValue) = 0; 00235 00244 virtual const XObjectPtr 00245 createStringAdapter(const XObjectPtr& theValue) = 0; 00246 00253 virtual const XObjectPtr 00254 createString(GetAndReleaseCachedString& theValue) = 0; 00255 00262 virtual const XObjectPtr 00263 createUnknown(const XalanDOMString& theValue) = 0; 00264 00270 #if defined(XALAN_NO_STD_NAMESPACE) 00271 struct DeleteXObjectFunctor : public unary_function<XObject*, void> 00272 #else 00273 struct DeleteXObjectFunctor : public std::unary_function<XObject*, void> 00274 #endif 00275 { 00276 public: 00277 00278 DeleteXObjectFunctor( 00279 XObjectFactory& theFactoryInstance, 00280 bool fInReset = false) : 00281 m_factoryInstance(theFactoryInstance), 00282 m_fInReset(fInReset) 00283 { 00284 } 00285 00286 result_type 00287 operator()(argument_type theXObject) const 00288 { 00289 if (m_fInReset == true) 00290 { 00291 m_factoryInstance.doReturnObject( 00292 theXObject, 00293 true); 00294 } 00295 else 00296 { 00297 m_factoryInstance.returnObject(theXObject); 00298 } 00299 } 00300 00301 private: 00302 00303 XObjectFactory& m_factoryInstance; 00304 00305 const bool m_fInReset; 00306 }; 00307 00308 friend struct DeleteXObjectFunctor; 00309 00310 protected: 00311 00317 XObject::eObjectType 00318 getRealType(const XObject& theXObject) const 00319 { 00320 return theXObject.getRealType(); 00321 } 00322 00328 void 00329 deleteObject(const XObject* theXObject) const 00330 { 00331 #if defined(XALAN_CANNOT_DELETE_CONST) 00332 delete (XObject*)theXObject; 00333 #else 00334 delete theXObject; 00335 #endif 00336 } 00337 00344 00345 virtual bool 00346 doReturnObject( 00347 XObject* theXObject, 00348 bool fInReset = false) = 0; 00349 00350 private: 00351 00352 // Not implemented... 00353 XObjectFactory(const XObjectFactory&); 00354 00355 XObjectFactory& 00356 operator=(const XObjectFactory&); 00357 00358 bool 00359 operator==(const XObjectFactory&) const; 00360 }; 00361 00362 00363 00364 XALAN_CPP_NAMESPACE_END 00365 00366 00367 00368 #endif // XOBJECTFACTORY_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.7 |
|