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(XOBJECT_HEADER_GUARD_1357924680) 00058 #define XOBJECT_HEADER_GUARD_1357924680 00059 00060 00061 00062 // Base include file. Must be first. 00063 #include <XPath/XPathDefinitions.hpp> 00064 00065 00066 00067 #include <XalanDOM/XalanDOMString.hpp> 00068 00069 00070 00071 #include <PlatformSupport/XalanReferenceCountedObject.hpp> 00072 00073 00074 00075 #include <XPath/XPathException.hpp> 00076 00077 00078 00079 class MutableNodeRefList; 00080 class NodeRefListBase; 00081 class ResultTreeFragBase; 00082 class XObjectFactory; 00083 class XObjectTypeCallback; 00084 class XPathExecutionContext; 00085 00086 00087 00091 class XALAN_XPATH_EXPORT XObject : protected XalanReferenceCountedObject 00092 { 00093 public: 00094 00095 friend class XObjectPtr; 00096 00100 enum eObjectType { eTypeNull = 0, 00101 eTypeUnknown = 1, 00102 eTypeBoolean = 2, 00103 eTypeNumber = 3, 00104 eTypeString = 4, 00105 eTypeNodeSet = 5, 00106 eTypeResultTreeFrag = 6, 00107 eTypeUserDefined = 7, 00108 // These next types are implementation-specific, and 00109 // are never returned by getType(). 00110 eTypeStringReference = 8, 00111 eTypeStringAdapter = 9, 00112 eTypeStringCached = 10, 00113 eTypeXTokenNumberAdapter = 11, 00114 eTypeXTokenStringAdapter = 12, 00115 eUnknown 00116 }; 00117 00123 XObject(eObjectType theObjectType); 00124 00125 XObject(const XObject& source); 00126 00133 virtual XObject* 00134 clone(void* theAddress = 0) const = 0; 00135 00142 virtual XalanDOMString 00143 getTypeString() const = 0; 00144 00150 virtual double 00151 num() const; 00152 00158 virtual bool 00159 boolean() const; 00160 00166 virtual const XalanDOMString& 00167 str() const; 00168 00175 virtual const ResultTreeFragBase& 00176 rtree(XPathExecutionContext& executionContext) const; 00177 00183 virtual const NodeRefListBase& 00184 nodeset() const; 00185 00191 virtual void 00192 ProcessXObjectTypeCallback(XObjectTypeCallback& theCallbackObject) = 0; 00193 00199 virtual void 00200 ProcessXObjectTypeCallback(XObjectTypeCallback& theCallbackObject) const = 0; 00201 00209 bool 00210 equals( 00211 const XObject& theRHS, 00212 XPathExecutionContext& executionContext) const; 00213 00221 bool 00222 notEquals( 00223 const XObject& theRHS, 00224 XPathExecutionContext& executionContext) const; 00225 00232 bool 00233 lessThan( 00234 const XObject& theRHS, 00235 XPathExecutionContext& executionContext) const; 00236 00244 bool 00245 lessThanOrEquals( 00246 const XObject& theRHS, 00247 XPathExecutionContext& executionContext) const; 00248 00255 bool 00256 greaterThan( 00257 const XObject& theRHS, 00258 XPathExecutionContext& executionContext) const; 00259 00267 bool 00268 greaterThanOrEquals( 00269 const XObject& theRHS, 00270 XPathExecutionContext& executionContext) const; 00271 00277 eObjectType 00278 getType() const 00279 { 00280 return m_objectType; 00281 } 00282 00283 // All XObject instances are controlled by an instance of an XObjectFactory. 00284 friend class XObjectFactory; 00285 00286 void 00287 setFactory(XObjectFactory* theFactory) 00288 { 00289 m_factory = theFactory; 00290 } 00291 00292 // Base class for all XObject exceptions... 00293 class XObjectException : public XPathException 00294 { 00295 public: 00296 00297 explicit 00298 XObjectException( 00299 const XalanDOMString& message = XalanDOMString(), 00300 const XalanNode* styleNode = 0); 00301 00302 virtual 00303 ~XObjectException(); 00304 }; 00305 00306 class XObjectInvalidCastException : public XObjectException 00307 { 00308 public: 00309 00310 XObjectInvalidCastException( 00311 const XalanDOMString& fromType, 00312 const XalanDOMString& toType); 00313 00314 virtual 00315 ~XObjectInvalidCastException(); 00316 00317 const XalanDOMString& 00318 getFromType() const 00319 { 00320 return m_fromType; 00321 } 00322 00323 const XalanDOMString& 00324 getToType() const 00325 { 00326 return m_toType; 00327 } 00328 00329 private: 00330 00331 static const XalanDOMString 00332 formatErrorString( 00333 const XalanDOMString& fromType, 00334 const XalanDOMString& toType); 00335 00336 const XalanDOMString m_fromType; 00337 00338 const XalanDOMString m_toType; 00339 }; 00340 00341 protected: 00342 00348 virtual eObjectType 00349 getRealType() const; 00350 00351 virtual void 00352 referenced(); 00353 00354 virtual void 00355 dereferenced(); 00356 00357 virtual 00358 ~XObject(); 00359 00360 static const XalanDOMString s_nullString; 00361 00362 private: 00363 00364 // Not implemented... 00365 XObject& 00366 operator=(const XObject&); 00367 00368 const eObjectType m_objectType; 00369 00370 XObjectFactory* m_factory; 00371 }; 00372 00373 00374 00378 class XALAN_XPATH_EXPORT XObjectPtr 00379 { 00380 public: 00381 00382 friend bool operator==(const XObjectPtr&, const XObjectPtr&); 00383 00387 explicit 00388 XObjectPtr(XObject* theXObject = 0) : 00389 m_xobjectPtr(theXObject) 00390 { 00391 XalanReferenceCountedObject::addReference(theXObject); 00392 } 00393 00394 XObjectPtr(const XObjectPtr& theSource) : 00395 m_xobjectPtr(theSource.m_xobjectPtr) 00396 { 00397 XalanReferenceCountedObject::addReference(m_xobjectPtr); 00398 }; 00399 00400 XObjectPtr& 00401 operator=(const XObjectPtr& theRHS) 00402 { 00403 if (m_xobjectPtr != theRHS.m_xobjectPtr) 00404 { 00405 XalanReferenceCountedObject::removeReference(m_xobjectPtr); 00406 00407 m_xobjectPtr = theRHS.m_xobjectPtr; 00408 00409 XalanReferenceCountedObject::addReference(m_xobjectPtr); 00410 } 00411 00412 return *this; 00413 } 00414 00415 ~XObjectPtr() 00416 { 00417 XalanReferenceCountedObject::removeReference(m_xobjectPtr); 00418 }; 00419 00420 bool 00421 null() const 00422 { 00423 return m_xobjectPtr == 0 ? true : false; 00424 } 00425 00426 const XObject& 00427 operator*() const 00428 { 00429 return *m_xobjectPtr; 00430 }; 00431 00432 XObject& 00433 operator*() 00434 { 00435 return *m_xobjectPtr; 00436 }; 00437 00438 const XObject* 00439 operator->() const 00440 { 00441 return m_xobjectPtr; 00442 }; 00443 00444 XObject* 00445 operator->() 00446 { 00447 return m_xobjectPtr; 00448 }; 00449 00450 const XObject* 00451 get() const 00452 { 00453 return m_xobjectPtr; 00454 }; 00455 00456 XObject* 00457 get() 00458 { 00459 return m_xobjectPtr; 00460 }; 00461 00462 private: 00463 00464 XObject* m_xobjectPtr; 00465 }; 00466 00467 00468 00469 inline bool 00470 operator==( 00471 const XObjectPtr& theLHS, 00472 const XObjectPtr& theRHS) 00473 { 00474 return theLHS.m_xobjectPtr == theRHS.m_xobjectPtr; 00475 } 00476 00477 00478 00479 inline bool 00480 operator!=( 00481 const XObjectPtr& theLHS, 00482 const XObjectPtr& theRHS) 00483 { 00484 return !(theLHS == theRHS); 00485 } 00486 00487 00488 00489 #endif // XOBJECT_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
![]() |
Xalan-C++ XSL Transformer Version 1.1 |
|