00001 /* 00002 * The Apache Software License, Version 1.1 00003 * 00004 * 00005 * Copyright (c) 1999 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 <XPath/XPathDefinitions.hpp> 00064 00065 00066 00067 #include <algorithm> 00068 #include <cassert> 00069 #include <set> 00070 00071 00072 00073 #include <XPath/XObject.hpp> 00074 #include <XPath/XPathExecutionContext.hpp> 00075 00076 00077 00078 class XalanNode; 00079 class MutableNodeRefList; 00080 class NodeRefListBase; 00081 class XObject; 00082 class XObjectPtr; 00083 class XToken; 00084 00085 00086 00090 class XALAN_XPATH_EXPORT XObjectFactory 00091 { 00092 public: 00093 00094 typedef XPathExecutionContext::BorrowReturnMutableNodeRefList BorrowReturnMutableNodeRefList; 00095 typedef XPathExecutionContext::GetAndReleaseCachedString GetAndReleaseCachedString; 00096 00097 00098 XObjectFactory(); 00099 00100 virtual 00101 ~XObjectFactory(); 00102 00103 00110 bool 00111 returnObject(XObject* theXObject) 00112 { 00113 return doReturnObject(theXObject); 00114 } 00115 00120 virtual void 00121 reset() = 0; 00122 00129 virtual const XObjectPtr 00130 createBoolean(bool theValue) = 0; 00131 00138 virtual const XObjectPtr 00139 createNodeSet(BorrowReturnMutableNodeRefList& theValue) = 0; 00140 00147 virtual const XObjectPtr 00148 createNull() = 0; 00149 00156 virtual const XObjectPtr 00157 createNumber(double theValue) = 0; 00158 00167 virtual const XObjectPtr 00168 createNumber(const XToken& theValue) = 0; 00169 00176 virtual const XObjectPtr 00177 createString(const XalanDOMString& theValue) = 0; 00178 00185 virtual const XObjectPtr 00186 createString(const XalanDOMChar* theValue) = 0; 00187 00195 virtual const XObjectPtr 00196 createString( 00197 const XalanDOMChar* theValue, 00198 unsigned int theLength) = 0; 00199 00208 virtual const XObjectPtr 00209 createString(const XToken& theValue) = 0; 00210 00220 virtual const XObjectPtr 00221 createStringReference(const XalanDOMString& theValue) = 0; 00222 00231 virtual const XObjectPtr 00232 createStringAdapter(const XObjectPtr& theValue) = 0; 00233 00240 virtual const XObjectPtr 00241 createString(GetAndReleaseCachedString& theValue) = 0; 00242 00249 virtual const XObjectPtr 00250 createUnknown(const XalanDOMString& theValue) = 0; 00251 00257 #if defined(XALAN_NO_NAMESPACES) 00258 struct DeleteXObjectFunctor : public unary_function<XObject*, void> 00259 #else 00260 struct DeleteXObjectFunctor : public std::unary_function<XObject*, void> 00261 #endif 00262 { 00263 public: 00264 00265 DeleteXObjectFunctor( 00266 XObjectFactory& theFactoryInstance, 00267 bool fInReset = false) : 00268 m_factoryInstance(theFactoryInstance), 00269 m_fInReset(fInReset) 00270 { 00271 } 00272 00273 result_type 00274 operator()(argument_type theXObject) const 00275 { 00276 if (m_fInReset == true) 00277 { 00278 m_factoryInstance.doReturnObject( 00279 theXObject, 00280 true); 00281 } 00282 else 00283 { 00284 m_factoryInstance.returnObject(theXObject); 00285 } 00286 } 00287 00288 private: 00289 00290 XObjectFactory& m_factoryInstance; 00291 00292 const bool m_fInReset; 00293 }; 00294 00295 friend struct DeleteXObjectFunctor; 00296 00297 protected: 00298 00304 XObject::eObjectType 00305 getRealType(const XObject& theXObject) const 00306 { 00307 return theXObject.getRealType(); 00308 } 00309 00315 void 00316 deleteObject(const XObject* theXObject) const 00317 { 00318 #if defined(XALAN_CANNOT_DELETE_CONST) 00319 delete (XObject*)theXObject; 00320 #else 00321 delete theXObject; 00322 #endif 00323 } 00324 00331 00332 virtual bool 00333 doReturnObject( 00334 XObject* theXObject, 00335 bool fInReset = false) = 0; 00336 00337 private: 00338 00339 // Not implemented... 00340 XObjectFactory(const XObjectFactory&); 00341 00342 XObjectFactory& 00343 operator=(const XObjectFactory&); 00344 00345 bool 00346 operator==(const XObjectFactory&) const; 00347 }; 00348 00349 00350 00351 #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.4 |
|