Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.8

Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

XObjectFactory.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 1999-2004 The Apache Software Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #if !defined(XOBJECTFACTORY_HEADER_GUARD_1357924680)
00017 #define XOBJECTFACTORY_HEADER_GUARD_1357924680
00018 
00019 
00020 
00021 // Base include file.  Must be first.
00022 #include <xalanc/XPath/XPathDefinitions.hpp>
00023 
00024 
00025 
00026 #include <algorithm>
00027 #include <cassert>
00028 #include <set>
00029 
00030 
00031 
00032 #include <xalanc/XPath/XObject.hpp>
00033 #include <xalanc/XPath/XPathExecutionContext.hpp>
00034 
00035 
00036 
00037 XALAN_CPP_NAMESPACE_BEGIN
00038 
00039 
00040 
00041 class XalanNode;
00042 class MutableNodeRefList;
00043 class NodeRefListBase;
00044 class XObject;
00045 class XObjectPtr;
00046 class XToken;
00047 
00048 
00049 
00053 class XALAN_XPATH_EXPORT XObjectFactory
00054 {
00055 public:
00056 
00057     typedef XPathExecutionContext::BorrowReturnMutableNodeRefList   BorrowReturnMutableNodeRefList;
00058     typedef XPathExecutionContext::GetAndReleaseCachedString        GetAndReleaseCachedString;
00059 
00060 
00061     XObjectFactory();
00062 
00063     virtual
00064     ~XObjectFactory();
00065 
00066 
00073     bool
00074     returnObject(XObject*   theXObject)
00075     {
00076         return doReturnObject(theXObject);
00077     }
00078 
00083     virtual void
00084     reset() = 0;
00085 
00092     virtual const XObjectPtr
00093     createBoolean(bool  theValue) = 0;
00094 
00101     virtual const XObjectPtr
00102     createNodeSet(BorrowReturnMutableNodeRefList&   theValue) = 0;
00103 
00110     virtual const XObjectPtr
00111     createNodeSet(XalanNode*    theValue) = 0;
00112 
00119     virtual const XObjectPtr
00120     createNull() = 0;
00121 
00128     virtual const XObjectPtr
00129     createNumber(double     theValue) = 0;
00130 
00139     virtual const XObjectPtr
00140     createNumber(const XToken&  theValue) = 0;
00141 
00148     virtual const XObjectPtr
00149     createString(const XalanDOMString&  theValue) = 0;
00150 
00157     virtual const XObjectPtr
00158     createString(const XalanDOMChar*    theValue) = 0;
00159 
00167     virtual const XObjectPtr
00168     createString(
00169             const XalanDOMChar*     theValue,
00170             unsigned int            theLength) = 0;
00171 
00180     virtual const XObjectPtr
00181     createString(const XToken&  theValue) = 0;
00182 
00192     virtual const XObjectPtr
00193     createStringReference(const XalanDOMString&     theValue) = 0;
00194 
00203     virtual const XObjectPtr
00204     createStringAdapter(const XObjectPtr&   theValue) = 0;
00205 
00212     virtual const XObjectPtr
00213     createString(GetAndReleaseCachedString&     theValue) = 0;
00214 
00221     virtual const XObjectPtr
00222     createUnknown(const XalanDOMString&     theValue) = 0;
00223 
00229 #if defined(XALAN_NO_STD_NAMESPACE)
00230     struct DeleteXObjectFunctor : public unary_function<XObject*, void>
00231 #else
00232     struct DeleteXObjectFunctor : public std::unary_function<XObject*, void>
00233 #endif
00234     {
00235     public:
00236 
00237         DeleteXObjectFunctor(
00238             XObjectFactory&     theFactoryInstance,
00239             bool                fInReset = false) :
00240             m_factoryInstance(theFactoryInstance),
00241             m_fInReset(fInReset)
00242         {
00243         }
00244 
00245         result_type
00246         operator()(argument_type    theXObject) const
00247         {
00248             if (m_fInReset == true)
00249             {
00250                 m_factoryInstance.doReturnObject(
00251                     theXObject,
00252                     true);
00253             }
00254             else
00255             {
00256                 m_factoryInstance.returnObject(theXObject);
00257             }
00258         }
00259 
00260     private:
00261 
00262         XObjectFactory&     m_factoryInstance;
00263 
00264         const bool          m_fInReset;
00265     };
00266 
00267     friend struct DeleteXObjectFunctor;
00268 
00269 protected:
00270 
00276     XObject::eObjectType
00277     getRealType(const XObject&  theXObject) const
00278     {
00279         return theXObject.getRealType();
00280     }
00281 
00287     void
00288     deleteObject(const XObject*     theXObject) const
00289     {
00290 #if defined(XALAN_CANNOT_DELETE_CONST)
00291         delete (XObject*)theXObject;
00292 #else
00293         delete theXObject;
00294 #endif
00295     }
00296 
00304     virtual bool
00305     doReturnObject(
00306             XObject*    theXObject,
00307             bool        fInReset = false) = 0;
00308 
00309 private:
00310 
00311     // Not implemented...
00312     XObjectFactory(const XObjectFactory&);
00313 
00314     XObjectFactory&
00315     operator=(const XObjectFactory&);
00316 
00317     bool
00318     operator==(const XObjectFactory&) const;
00319 };
00320 
00321 
00322 
00323 XALAN_CPP_NAMESPACE_END
00324 
00325 
00326 
00327 #endif  // XOBJECTFACTORY_HEADER_GUARD_1357924680

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.8
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.