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  

DOMHelper.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(DOMHELPER_HEADER_GUARD_1357924680)
00058 #define DOMHELPER_HEADER_GUARD_1357924680
00059 
00060 
00061 #error This file is obsolete!!!!
00062 
00063 
00064 // STL header file for class unary_function.
00065 #include <functional>
00066 
00067 
00068 
00069 #include <dom/DOM_Node.hpp>
00070 #include <dom/DOM_NodeList.hpp>
00071 #include <dom/DOM_NamedNodeMap.hpp>
00072 #include <dom/DOM_Element.hpp>
00073 
00074 
00075 
00076 class DOM_NullPtr;
00077 class NodeImpl;
00078 
00079 
00080 
00089 inline bool
00090 operator==(
00091             int                 /* theAddress */,
00092             const DOM_Node&     theObject)
00093 {
00094     return theObject == static_cast<const DOM_NullPtr*>(0);
00095 }
00096 
00097 
00098 
00107 inline bool
00108 operator==(
00109             int                 /* theAddress */,
00110             const DOM_NamedNodeMap&     theObject)
00111 {
00112     return theObject == static_cast<const DOM_NullPtr*>(0);
00113 }
00114 
00115 
00124 inline bool
00125 operator==(
00126             int                 /* theAddress */,
00127             const DOM_NodeList&     theObject)
00128 {
00129     return theObject == static_cast<const DOM_NullPtr*>(0);
00130 }
00131 
00132 
00133 
00142 inline bool
00143 operator==(
00144             const DOM_Node&     theObject,
00145             int                 /* theAddress */)
00146 {
00147     return theObject == static_cast<const DOM_NullPtr*>(0);
00148 }
00149 
00150 
00151 
00160 inline bool
00161 operator==(
00162             const DOM_NamedNodeMap&     theObject,
00163             int                         /* theAddress */)
00164 {
00165     return theObject == static_cast<const DOM_NullPtr*>(0);
00166 }
00167 
00168 
00169 
00178 inline bool
00179 operator==(
00180             const DOM_NodeList&     theObject,
00181             int                     /* theAddress */)
00182 {
00183     return theObject == static_cast<const DOM_NullPtr*>(0);
00184 }
00185 
00186 
00187 
00196 inline bool
00197 operator!=(
00198             int                 /* theAddress */,
00199             const DOM_Node&     theObject)
00200 {
00201     return theObject != static_cast<const DOM_NullPtr*>(0);
00202 }
00203 
00204 
00205 
00214 inline bool
00215 operator!=(
00216             int                         /* theAddress */,
00217             const DOM_NamedNodeMap&     theObject)
00218 {
00219     return theObject != static_cast<const DOM_NullPtr*>(0);
00220 }
00221 
00222 
00223 
00232 inline bool
00233 operator!=(
00234             int                     /* theAddress */,
00235             const DOM_NodeList&     theObject)
00236 {
00237     return theObject != static_cast<const DOM_NullPtr*>(0);
00238 }
00239 
00240 
00241 
00250 inline bool
00251 operator!=(
00252             const DOM_Node&     theObject,
00253             int                 /* theAddress */)
00254 {
00255     return theObject != static_cast<const DOM_NullPtr*>(0);
00256 }
00257 
00258 
00259 
00268 inline bool
00269 operator!=(
00270             const DOM_NamedNodeMap&     theObject,
00271             int                         /* theAddress */)
00272 {
00273     return theObject != static_cast<const DOM_NullPtr*>(0);
00274 }
00275 
00276 
00277 
00286 inline bool
00287 operator!=(
00288             const DOM_NodeList&     theObject,
00289             int                     /* theAddress */)
00290 {
00291     return theObject != static_cast<const DOM_NullPtr*>(0);
00292 }
00293 
00294 
00295 
00296 // This class is a big hack, so we can get at the pointer to the
00297 // internal implementation of a DOM_Node, for the purposes of hashing
00298 // and implementing operator<().
00299 class XALAN_DOM_NodeHack : public DOM_Node
00300 {
00301 public:
00302 
00308     XALAN_DOM_NodeHack(const DOM_Node&      theOtherNode) :
00309         DOM_Node(theOtherNode)
00310     {
00311     }
00312 
00319     XALAN_DOM_NodeHack(NodeImpl*    theOtherNode) :
00320         DOM_Node(theOtherNode)
00321     {
00322     }
00323 
00324     ~XALAN_DOM_NodeHack()
00325     {
00326     }
00327 
00333     NodeImpl*
00334     getImplementationObject() const
00335     {
00336         return fImpl;
00337     }
00338 
00339     friend bool operator<(const XALAN_DOM_NodeHack&, const XALAN_DOM_NodeHack&);
00340     friend struct DOM_NodeHashFunction;
00341 };
00342 
00343 
00344 
00345 // $$$ ToDo:  This sort of address comparison, is undefined behavior
00346 // according to the C++ standard, but it should work on 99.99% of
00347 // architectures.  We're only using it until STL hash containers are
00348 // available.
00349 
00356 inline bool
00357 operator<(
00358             const XALAN_DOM_NodeHack&   theLHS,
00359             const XALAN_DOM_NodeHack&   theRHS)
00360 {
00361     return theLHS.fImpl < theRHS.fImpl ? true : false;
00362 }
00363 
00364 
00365 
00369 #if defined(XALAN_NO_NAMESPACES)
00370 struct DOM_NodeHashFunction : public unary_function<DOM_Node, size_t>
00371 #else
00372 struct DOM_NodeHashFunction : public std::unary_function<DOM_Node, size_t>
00373 #endif
00374 {
00381     result_type
00382     operator() (const argument_type&    theKey) const
00383     {
00384         return reinterpret_cast<result_type>(XALAN_DOM_NodeHack(theKey).fImpl);
00385     }
00386 };
00387 
00388 
00389 
00393 #if defined(XALAN_NO_NAMESPACES)
00394 struct DOM_ElementHashFunction : public unary_function<DOM_Element, size_t>
00395 #else
00396 struct DOM_ElementHashFunction : public std::unary_function<DOM_Element, size_t>
00397 #endif
00398 {
00405     result_type
00406     operator() (const argument_type&    theKey) const
00407     {
00408         return static_cast<result_type>(DOM_NodeHashFunction()(theKey));
00409     }
00410 };
00411 
00412 
00413 
00414 #endif  // DOMHELPER_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.