Xalan-C++ API Documentation

The Xalan-C++ XSL Transformer Version 1.0

Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

XObject.hpp

Go to the documentation of this file.
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 <XPath/XPathException.hpp>
00072 
00073 
00074 
00075 class MutableNodeRefList;
00076 class NodeRefListBase;
00077 class ResultTreeFragBase;
00078 class XObjectTypeCallback;
00079 class XPathExecutionContext;
00080 
00081 
00082 
00086 class XALAN_XPATH_EXPORT XObject
00087 {
00088 public:
00089 
00093     enum    eObjectType { eTypeNull = 0,
00094                           eTypeUnknown = 1,
00095                           eTypeBoolean = 2,
00096                           eTypeNumber = 3,
00097                           eTypeString = 4,
00098                           eTypeNodeSet = 5,
00099                           eTypeResultTreeFrag = 6,
00100                           eTypeUserDefined = 7,
00101                           eUnknown
00102                         };
00103 
00109     XObject(eObjectType     theObjectType);
00110 
00111     XObject(const XObject&  source);
00112 
00119     virtual XObject*
00120     clone(void*     theAddress = 0) const = 0;
00121 
00128     virtual XalanDOMString
00129     getTypeString() const = 0;
00130 
00136     virtual double
00137     num() const;
00138 
00144     virtual bool
00145     boolean() const;
00146 
00152     virtual const XalanDOMString&
00153     str() const;
00154 
00161     virtual const ResultTreeFragBase&
00162     rtree(XPathExecutionContext&    executionContext) const;
00163 
00169     virtual const NodeRefListBase&
00170     nodeset() const;
00171 
00177     virtual void
00178     ProcessXObjectTypeCallback(XObjectTypeCallback&     theCallbackObject) = 0;
00179 
00185     virtual void
00186     ProcessXObjectTypeCallback(XObjectTypeCallback&     theCallbackObject) const = 0;
00187 
00195     bool
00196     equals(const XObject&   theRHS) const;
00197 
00205     bool
00206     notEquals(const XObject&    theRHS) const;
00207 
00214     bool
00215     lessThan(const XObject&     theRHS) const;
00216 
00224     bool
00225     lessThanOrEqual(const XObject&  theRHS) const;
00226 
00233     bool
00234     greaterThan(const XObject&  theRHS) const;
00235 
00243     bool
00244     greaterThanOrEqual(const XObject&   theRHS) const;
00245 
00251     eObjectType
00252     getType() const
00253     {
00254         return m_objectType;
00255     }
00256 
00257     // All XObject instances are controlled by an instance of an XObjectFactory.
00258     friend class XObjectFactory;
00259 
00260     // Base class for all XObject exceptions...
00261     class XObjectException : public XPathException
00262     {
00263     public:
00264 
00265         explicit
00266         XObjectException(
00267                 const XalanDOMString&   message = XalanDOMString(),
00268                 const XalanNode*        styleNode = 0);
00269 
00270         virtual
00271         ~XObjectException();
00272     };
00273 
00274     class XObjectInvalidCastException : public XObjectException
00275     {
00276     public:
00277 
00278         explicit
00279         XObjectInvalidCastException(
00280                 const XalanDOMString&   fromType,
00281                 const XalanDOMString&   toType);
00282 
00283         virtual
00284         ~XObjectInvalidCastException();
00285 
00286         const XalanDOMString&
00287         getFromType() const
00288         {
00289             return m_fromType;
00290         }
00291 
00292         const XalanDOMString&
00293         getToType() const
00294         {
00295             return m_toType;
00296         }
00297 
00298     private:
00299 
00300         static const XalanDOMString
00301         formatErrorString(
00302                 const XalanDOMString&   fromType,
00303                 const XalanDOMString&   toType);
00304 
00305         const XalanDOMString    m_fromType;
00306 
00307         const XalanDOMString    m_toType;
00308     };
00309 
00310 protected:
00311 
00312     virtual
00313     ~XObject();
00314 
00315     static const XalanDOMString     s_nullString;
00316 
00317 private:
00318 
00319     // Not implemented...
00320     XObject&
00321     operator=(const XObject&);
00322 
00323     const eObjectType   m_objectType;
00324 };
00325 
00326 
00327 
00328 inline bool
00329 operator==(
00330             const XObject&  theLHS,
00331             const XObject&  theRHS)
00332 {
00333     return theLHS.equals(theRHS);
00334 }
00335 
00336 
00337 
00338 inline bool
00339 operator!=(
00340             const XObject&  theLHS,
00341             const XObject&  theRHS)
00342 {
00343     return theLHS.notEquals(theRHS);
00344 }
00345 
00346 
00347 
00348 inline bool
00349 operator<(
00350             const XObject&  theLHS,
00351             const XObject&  theRHS)
00352 {
00353     return theLHS.lessThan(theRHS);
00354 }
00355 
00356 
00357 
00358 inline bool
00359 operator<=(
00360             const XObject&  theLHS,
00361             const XObject&  theRHS)
00362 {
00363     return theLHS.lessThanOrEqual(theRHS);
00364 }
00365 
00366 
00367 
00368 inline bool
00369 operator>(
00370             const XObject&  theLHS,
00371             const XObject&  theRHS)
00372 {
00373     return theLHS.greaterThan(theRHS);
00374 }
00375 
00376 
00377 
00378 inline bool
00379 operator>=(
00380             const XObject&  theLHS,
00381             const XObject&  theRHS)
00382 {
00383     return theLHS.greaterThanOrEqual(theRHS);
00384 }
00385 
00386 
00387 
00388 #endif  // XOBJECT_HEADER_GUARD_1357924680

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSL Transformer Version 1.0
Copyright © 2000 The Apache Software Foundation. All Rights Reserved.