Xalan-C++ API Reference  1.12.0
XercesToXalanNodeMap.hpp
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #if !defined(XERCESTOXALANNODEMAP_HEADER_GUARD_1357924680)
19 #define XERCESTOXALANNODEMAP_HEADER_GUARD_1357924680
20 
21 
22 
24 
25 
26 
27 #include <map>
28 
29 
30 
31 #if XERCES_VERSION_MAJOR >= 2
32 #include <xercesc/dom/deprecated/DOM_Node.hpp>
33 #else
34 #include <xercesc/dom/DOM_Node.hpp>
35 #endif
36 
37 
38 
40 
41 
42 
43 namespace XERCES_CPP_NAMESPACE
44 {
45  class NodeImpl;
46 }
47 
48 
49 
50 namespace XALAN_CPP_NAMESPACE {
51 
52 
53 
54 class XalanNode;
55 
56 
57 /**
58  * This class is deprecated.
59  *
60  * @deprecated This class works with the deprecated Xerces DOM bridge.
61  */
63 {
64 public:
65 
66  typedef xercesc::DOM_Node DOM_NodeType;
67  typedef xercesc::NodeImpl NodeImplType;
68 
69  typedef std::map<XalanNode*, NodeImplType*> XalanNodeMapType;
70 
71  typedef std::map<NodeImplType*, XalanNode*> XercesNodeMapType;
72 
74 
76 
77  void
78  addAssociation(
79  const DOM_NodeType& theXercesNode,
80  XalanNode* theXalanNode);
81 
82  void
83  clear();
84 
85  XalanNode*
86  getNode(const DOM_NodeType& theXercesNode) const
87  {
88  return getNode(XercesDOM_NodeHack::getImpl(theXercesNode));
89  }
90 
91  XalanNode*
92  getNode(NodeImplType* theXercesNodeImpl) const
93  {
94  const XercesNodeMapType::const_iterator i =
95  m_xercesMap.find(theXercesNodeImpl);
96 
97  if (i == m_xercesMap.end())
98  {
99  return 0;
100  }
101  else
102  {
103  return (*i).second;
104  }
105  }
106 
108  getNode(const XalanNode* theXalanNode) const
109  {
110  return XercesDOM_NodeHack(getNodeImpl(theXalanNode));
111  }
112 
113  NodeImplType*
114  getNodeImpl(const XalanNode* theXalanNode) const;
115 
117  {
118  public:
119 
120  NameMapEqualsFunctor(const XalanNode* theXalanNode) :
121  m_value(theXalanNode)
122  {
123  }
124 
125  bool
126  operator()(const XercesNodeMapType::value_type& thePair) const
127  {
128  return m_value == thePair.second;
129  }
130 
131  private:
132 
133  const XalanNode* m_value;
134  };
135 
136  NodeImplType*
137  getNodeImpl(const DOM_NodeType& theXercesNode) const
138  {
139  return XercesDOM_NodeHack::getImpl(theXercesNode);
140  }
141 
142 private:
143 
144  XalanNodeMapType m_xalanMap;
145 
146  XercesNodeMapType m_xercesMap;
147 };
148 
149 
150 
151 }
152 
153 
154 
155 #endif // !defined(XERCESTOXALANNODEMAP_HEADER_GUARD_1357924680)
xalanc::XercesToXalanNodeMap::NameMapEqualsFunctor
Definition: XercesToXalanNodeMap.hpp:116
xalanc::XercesToXalanNodeMap::DOM_NodeType
xercesc::DOM_Node DOM_NodeType
Definition: XercesToXalanNodeMap.hpp:66
xalanc::XercesToXalanNodeMap::getNode
XalanNode * getNode(const DOM_NodeType &theXercesNode) const
Definition: XercesToXalanNodeMap.hpp:86
xalanc::XercesToXalanNodeMap::NameMapEqualsFunctor::NameMapEqualsFunctor
NameMapEqualsFunctor(const XalanNode *theXalanNode)
Definition: XercesToXalanNodeMap.hpp:120
xalanc::XercesDOM_NodeHack
This class is deprecated.
Definition: XercesDOM_NodeHack.hpp:57
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition: XalanVersion.hpp:76
xalanc::clear
void clear(XalanDOMString &theString)
Remove all elements from target string.
Definition: DOMStringHelper.hpp:2475
xalanc::XalanNode
Definition: XalanNode.hpp:38
xalanc::XercesToXalanNodeMap::XercesNodeMapType
std::map< NodeImplType *, XalanNode * > XercesNodeMapType
Definition: XercesToXalanNodeMap.hpp:71
xalanc::XercesToXalanNodeMap::getNode
DOM_NodeType getNode(const XalanNode *theXalanNode) const
Definition: XercesToXalanNodeMap.hpp:108
xalanc::XercesToXalanNodeMap::getNode
XalanNode * getNode(NodeImplType *theXercesNodeImpl) const
Definition: XercesToXalanNodeMap.hpp:92
xalanc::NodeImplType
xercesc::NodeImpl NodeImplType
Definition: XercesBridgeTypes.hpp:84
xalanc::XercesToXalanNodeMap::getNodeImpl
NodeImplType * getNodeImpl(const DOM_NodeType &theXercesNode) const
Definition: XercesToXalanNodeMap.hpp:137
xalanc::XercesToXalanNodeMap::XalanNodeMapType
std::map< XalanNode *, NodeImplType * > XalanNodeMapType
Definition: XercesToXalanNodeMap.hpp:69
xalanc::DOM_NodeType
xercesc::DOM_Node DOM_NodeType
Definition: XercesBridgeTypes.hpp:74
xalanc::XercesToXalanNodeMap
This class is deprecated.
Definition: XercesToXalanNodeMap.hpp:62
xalanc::XercesToXalanNodeMap::NodeImplType
xercesc::NodeImpl NodeImplType
Definition: XercesToXalanNodeMap.hpp:67
XercesParserLiaisonDefinitions.hpp
XALAN_XERCESPARSERLIAISON_EXPORT
#define XALAN_XERCESPARSERLIAISON_EXPORT
Definition: XercesParserLiaisonDefinitions.hpp:39
xalanc::XercesToXalanNodeMap::NameMapEqualsFunctor::operator()
bool operator()(const XercesNodeMapType::value_type &thePair) const
Definition: XercesToXalanNodeMap.hpp:126
XercesDOM_NodeHack.hpp