Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

XercesToXalanNodeMap.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #if !defined(XERCESTOXALANNODEMAP_HEADER_GUARD_1357924680)
17 #define XERCESTOXALANNODEMAP_HEADER_GUARD_1357924680
18 
19 
20 
22 
23 
24 
25 #include <map>
26 
27 
28 
29 #if XERCES_VERSION_MAJOR >= 2
30 #include <xercesc/dom/deprecated/DOM_Node.hpp>
31 #else
32 #include <xercesc/dom/DOM_Node.hpp>
33 #endif
34 
35 
36 
38 
39 
40 
41 XALAN_DECLARE_XERCES_CLASS(NodeImpl)
42 
43 
44 
45 XALAN_CPP_NAMESPACE_BEGIN
46 
47 
48 
49 class XalanNode;
50 
51 
58 {
59 public:
60 
61  typedef XERCES_CPP_NAMESPACE_QUALIFIER DOM_Node DOM_NodeType;
62  typedef XERCES_CPP_NAMESPACE_QUALIFIER NodeImpl NodeImplType;
63 
64 #if defined(XALAN_NO_STD_NAMESPACE)
65  typedef map<XalanNode*, NodeImplType*, less<XalanNode*> > XalanNodeMapType;
66 
67  typedef map<NodeImplType*, XalanNode*, less<NodeImplType*> > XercesNodeMapType;
68 #else
69  typedef std::map<XalanNode*, NodeImplType*> XalanNodeMapType;
70 
71  typedef std::map<NodeImplType*, XalanNode*> XercesNodeMapType;
72 #endif
73 
74  XercesToXalanNodeMap();
75 
76  ~XercesToXalanNodeMap();
77 
78  void
79  addAssociation(
80  const DOM_NodeType& theXercesNode,
81  XalanNode* theXalanNode);
82 
83  void
84  clear();
85 
86  XalanNode*
87  getNode(const DOM_NodeType& theXercesNode) const
88  {
89  return getNode(XercesDOM_NodeHack::getImpl(theXercesNode));
90  }
91 
92  XalanNode*
93  getNode(NodeImplType* theXercesNodeImpl) const
94  {
95  const XercesNodeMapType::const_iterator i =
96  m_xercesMap.find(theXercesNodeImpl);
97 
98  if (i == m_xercesMap.end())
99  {
100  return 0;
101  }
102  else
103  {
104  return (*i).second;
105  }
106  }
107 
108  DOM_NodeType
109  getNode(const XalanNode* theXalanNode) const
110  {
111  return XercesDOM_NodeHack(getNodeImpl(theXalanNode));
112  }
113 
114  NodeImplType*
115  getNodeImpl(const XalanNode* theXalanNode) const;
116 
118  {
119  public:
120 
121  NameMapEqualsFunctor(const XalanNode* theXalanNode) :
122  m_value(theXalanNode)
123  {
124  }
125 
126  bool
127  operator()(const XercesNodeMapType::value_type& thePair) const
128  {
129  return m_value == thePair.second;
130  }
131 
132  private:
133 
134  const XalanNode* m_value;
135  };
136 
137  NodeImplType*
138  getNodeImpl(const DOM_NodeType& theXercesNode) const
139  {
140  return XercesDOM_NodeHack::getImpl(theXercesNode);
141  }
142 
143 private:
144 
145  XalanNodeMapType m_xalanMap;
146 
147  XercesNodeMapType m_xercesMap;
148 };
149 
150 
151 
152 XALAN_CPP_NAMESPACE_END
153 
154 
155 
156 #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.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo