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/FormatterListener.hpp> 00072 #include <PlatformSupport/XalanReferenceCountedObject.hpp> 00073 00074 00075 00076 #include <XPath/XPathException.hpp> 00077 00078 00079 00080 class MutableNodeRefList; 00081 class NodeRefListBase; 00082 class ResultTreeFragBase; 00083 class XObjectFactory; 00084 class XObjectTypeCallback; 00085 class XPathExecutionContext; 00086 00087 00088 00092 class XALAN_XPATH_EXPORT XObject : protected XalanReferenceCountedObject 00093 { 00094 public: 00095 00096 friend class XObjectPtr; 00097 00101 enum eObjectType { eTypeNull = 0, 00102 eTypeUnknown = 1, 00103 eTypeBoolean = 2, 00104 eTypeNumber = 3, 00105 eTypeString = 4, 00106 eTypeNodeSet = 5, 00107 eTypeResultTreeFrag = 6, 00108 eTypeUserDefined = 7, 00109 // These next types are implementation-specific, and 00110 // are never returned by getType(). 00111 eTypeStringReference = 8, 00112 eTypeStringAdapter = 9, 00113 eTypeStringCached = 10, 00114 eTypeXTokenNumberAdapter = 11, 00115 eTypeXTokenStringAdapter = 12, 00116 eUnknown 00117 }; 00118 00124 XObject(eObjectType theObjectType); 00125 00126 XObject(const XObject& source); 00127 00134 virtual XObject* 00135 clone(void* theAddress = 0) const = 0; 00136 00143 virtual XalanDOMString 00144 getTypeString() const = 0; 00145 00151 virtual double 00152 num() const; 00153 00159 virtual bool 00160 boolean() const; 00161 00167 virtual const XalanDOMString& 00168 str() const; 00169 00170 typedef void (FormatterListener::*MemberFunctionPtr)(const XMLCh* const, const unsigned int); 00171 00179 virtual void 00180 str( 00181 FormatterListener& formatterListener, 00182 MemberFunctionPtr function) const = 0; 00183 00189 virtual void 00190 str(XalanDOMString& theBuffer) const; 00191 00198 virtual const ResultTreeFragBase& 00199 rtree(XPathExecutionContext& executionContext) const; 00200 00206 virtual const NodeRefListBase& 00207 nodeset() const; 00208 00214 virtual void 00215 ProcessXObjectTypeCallback(XObjectTypeCallback& theCallbackObject) = 0; 00216 00222 virtual void 00223 ProcessXObjectTypeCallback(XObjectTypeCallback& theCallbackObject) const = 0; 00224 00232 bool 00233 equals( 00234 const XObject& theRHS, 00235 XPathExecutionContext& executionContext) const; 00236 00244 bool 00245 notEquals( 00246 const XObject& theRHS, 00247 XPathExecutionContext& executionContext) const; 00248 00255 bool 00256 lessThan( 00257 const XObject& theRHS, 00258 XPathExecutionContext& executionContext) const; 00259 00267 bool 00268 lessThanOrEquals( 00269 const XObject& theRHS, 00270 XPathExecutionContext& executionContext) const; 00271 00278 bool 00279 greaterThan( 00280 const XObject& theRHS, 00281 XPathExecutionContext& executionContext) const; 00282 00290 bool 00291 greaterThanOrEquals( 00292 const XObject& theRHS, 00293 XPathExecutionContext& executionContext) const; 00294 00300 eObjectType 00301 getType() const 00302 { 00303 return m_objectType; 00304 } 00305 00306 // All XObject instances are controlled by an instance of an XObjectFactory. 00307 friend class XObjectFactory; 00308 00309 void 00310 setFactory(XObjectFactory* theFactory) 00311 { 00312 m_factory = theFactory; 00313 } 00314 00315 // Base class for all XObject exceptions... 00316 class XObjectException : public XPathException 00317 { 00318 public: 00319 00320 explicit 00321 XObjectException( 00322 const XalanDOMString& message = XalanDOMString(), 00323 const XalanNode* styleNode = 0, 00324 const XalanDOMString& theType = XalanDOMString(XALAN_STATIC_UCODE_STRING("XObjectException"))); 00325 00326 virtual 00327 ~XObjectException(); 00328 }; 00329 00330 class XObjectInvalidConversionException : public XObjectException 00331 { 00332 public: 00333 00334 XObjectInvalidConversionException( 00335 const XalanDOMString& fromType, 00336 const XalanDOMString& toType); 00337 00338 virtual 00339 ~XObjectInvalidConversionException(); 00340 00341 const XalanDOMString& 00342 getFromType() const 00343 { 00344 return m_fromType; 00345 } 00346 00347 const XalanDOMString& 00348 getToType() const 00349 { 00350 return m_toType; 00351 } 00352 00353 private: 00354 00355 static const XalanDOMString 00356 formatErrorString( 00357 const XalanDOMString& fromType, 00358 const XalanDOMString& toType); 00359 00360 const XalanDOMString m_fromType; 00361 00362 const XalanDOMString m_toType; 00363 }; 00364 00365 protected: 00366 00372 virtual eObjectType 00373 getRealType() const; 00374 00375 virtual void 00376 referenced(); 00377 00378 virtual void 00379 dereferenced(); 00380 00381 virtual 00382 ~XObject(); 00383 00384 static const XalanDOMString s_nullString; 00385 00386 private: 00387 00388 // Not implemented... 00389 XObject& 00390 operator=(const XObject&); 00391 00392 const eObjectType m_objectType; 00393 00394 XObjectFactory* m_factory; 00395 }; 00396 00397 00398 00402 class XALAN_XPATH_EXPORT XObjectPtr 00403 { 00404 public: 00405 00406 friend bool operator==(const XObjectPtr&, const XObjectPtr&); 00407 friend bool operator<(const XObjectPtr&, const XObjectPtr&); 00408 00412 explicit 00413 XObjectPtr(XObject* theXObject = 0) : 00414 m_xobjectPtr(theXObject) 00415 { 00416 XalanReferenceCountedObject::addReference(theXObject); 00417 } 00418 00419 XObjectPtr(const XObjectPtr& theSource) : 00420 m_xobjectPtr(theSource.m_xobjectPtr) 00421 { 00422 XalanReferenceCountedObject::addReference(m_xobjectPtr); 00423 }; 00424 00425 XObjectPtr& 00426 operator=(const XObjectPtr& theRHS) 00427 { 00428 if (m_xobjectPtr != theRHS.m_xobjectPtr) 00429 { 00430 XalanReferenceCountedObject::removeReference(m_xobjectPtr); 00431 00432 m_xobjectPtr = theRHS.m_xobjectPtr; 00433 00434 XalanReferenceCountedObject::addReference(m_xobjectPtr); 00435 } 00436 00437 return *this; 00438 } 00439 00440 ~XObjectPtr() 00441 { 00442 XalanReferenceCountedObject::removeReference(m_xobjectPtr); 00443 }; 00444 00445 bool 00446 null() const 00447 { 00448 return m_xobjectPtr == 0 ? true : false; 00449 } 00450 00451 const XObject& 00452 operator*() const 00453 { 00454 return *m_xobjectPtr; 00455 }; 00456 00457 XObject& 00458 operator*() 00459 { 00460 return *m_xobjectPtr; 00461 }; 00462 00463 const XObject* 00464 operator->() const 00465 { 00466 return m_xobjectPtr; 00467 }; 00468 00469 XObject* 00470 operator->() 00471 { 00472 return m_xobjectPtr; 00473 }; 00474 00475 const XObject* 00476 get() const 00477 { 00478 return m_xobjectPtr; 00479 }; 00480 00481 XObject* 00482 get() 00483 { 00484 return m_xobjectPtr; 00485 }; 00486 00487 private: 00488 00489 XObject* m_xobjectPtr; 00490 }; 00491 00492 00493 00494 inline bool 00495 operator==( 00496 const XObjectPtr& theLHS, 00497 const XObjectPtr& theRHS) 00498 { 00499 return theLHS.m_xobjectPtr == theRHS.m_xobjectPtr; 00500 } 00501 00502 00503 00504 inline bool 00505 operator!=( 00506 const XObjectPtr& theLHS, 00507 const XObjectPtr& theRHS) 00508 { 00509 return !(theLHS == theRHS); 00510 } 00511 00512 00513 00514 inline bool 00515 operator<( 00516 const XObjectPtr& theLHS, 00517 const XObjectPtr& theRHS) 00518 { 00519 return theLHS.m_xobjectPtr < theRHS.m_xobjectPtr; 00520 } 00521 00522 00523 00524 #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 |
|