## Xalan-C++ API Documentation

### The Xalan C++ XSLT Processor Version 1.9

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

# XercesToXalanNodeMap.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(XERCESTOXALANNODEMAP_HEADER_GUARD_1357924680)
    00017 #define XERCESTOXALANNODEMAP_HEADER_GUARD_1357924680
    00018
    00019
    00020
    00021 #include <xalanc/XercesParserLiaison/XercesParserLiaisonDefinitions.hpp>
    00022
    00023
    00024
    00025 #include <map>
    00026
    00027
    00028
    00029 #if XERCES_VERSION_MAJOR >= 2
    00030 #include <xercesc/dom/deprecated/DOM_Node.hpp>
    00031 #else
    00032 #include <xercesc/dom/DOM_Node.hpp>
    00033 #endif
    00034
    00035
    00036
    00037 #include <xalanc/XercesParserLiaison/Deprecated/XercesDOM_NodeHack.hpp>
    00038
    00039
    00040
    00041 XALAN_DECLARE_XERCES_CLASS(NodeImpl)
    00042
    00043
    00044
    00045 XALAN_CPP_NAMESPACE_BEGIN
    00046
    00047
    00048
    00049 class XalanNode;
    00050
    00051
    00057 class XALAN_XERCESPARSERLIAISON_EXPORT XercesToXalanNodeMap
    00058 {
    00059 public:
    00060
    00061     typedef XERCES_CPP_NAMESPACE_QUALIFIER DOM_Node     DOM_NodeType;
    00062     typedef XERCES_CPP_NAMESPACE_QUALIFIER NodeImpl     NodeImplType;
    00063
    00064 #if defined(XALAN_NO_STD_NAMESPACE)
    00065     typedef map<XalanNode*, NodeImplType*, less<XalanNode*> >   XalanNodeMapType;
    00066
    00067     typedef map<NodeImplType*, XalanNode*, less<NodeImplType*> >    XercesNodeMapType;
    00068 #else
    00069     typedef std::map<XalanNode*, NodeImplType*>     XalanNodeMapType;
    00070
    00071     typedef std::map<NodeImplType*, XalanNode*>     XercesNodeMapType;
    00072 #endif
    00073
    00074     XercesToXalanNodeMap();
    00075
    00076     ~XercesToXalanNodeMap();
    00077
    00078     void
    00079     addAssociation(
    00080             const DOM_NodeType&     theXercesNode,
    00081             XalanNode*              theXalanNode);
    00082
    00083     void
    00084     clear();
    00085
    00086     XalanNode*
    00087     getNode(const DOM_NodeType&     theXercesNode) const
    00088     {
    00089         return getNode(XercesDOM_NodeHack::getImpl(theXercesNode));
    00090     }
    00091
    00092     XalanNode*
    00093     getNode(NodeImplType*   theXercesNodeImpl) const
    00094     {
    00095         const XercesNodeMapType::const_iterator     i =
    00096                 m_xercesMap.find(theXercesNodeImpl);
    00097
    00098         if (i == m_xercesMap.end())
    00099         {
    00100             return 0;
    00101         }
    00102         else
    00103         {
    00104             return (*i).second;
    00105         }
    00106     }
    00107
    00108     DOM_NodeType
    00109     getNode(const XalanNode*    theXalanNode) const
    00110     {
    00111         return XercesDOM_NodeHack(getNodeImpl(theXalanNode));
    00112     }
    00113
    00114     NodeImplType*
    00115     getNodeImpl(const XalanNode*    theXalanNode) const;
    00116
    00117     class NameMapEqualsFunctor
    00118     {
    00119     public:
    00120
    00121         NameMapEqualsFunctor(const XalanNode*   theXalanNode) :
    00122             m_value(theXalanNode)
    00123         {
    00124         }
    00125
    00126         bool
    00127         operator()(const XercesNodeMapType::value_type&     thePair) const
    00128         {
    00129             return m_value == thePair.second;
    00130         }
    00131
    00132     private:
    00133
    00134         const XalanNode*    m_value;
    00135     };
    00136
    00137     NodeImplType*
    00138     getNodeImpl(const DOM_NodeType&     theXercesNode) const
    00139     {
    00140         return XercesDOM_NodeHack::getImpl(theXercesNode);
    00141     }
    00142
    00143 private:
    00144
    00145     XalanNodeMapType    m_xalanMap;
    00146
    00147     XercesNodeMapType   m_xercesMap;
    00148 };
    00149
    00150
    00151
    00152 XALAN_CPP_NAMESPACE_END
    00153
    00154
    00155
    00156 #endif  // !defined(XERCESTOXALANNODEMAP_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.9 Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.