1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef INCLUDED_XPATH_LOGGER_HXX
24 #define INCLUDED_XPATH_LOGGER_HXX
25 
26 #include <hash_map>
27 #include <stack>
28 #include <string>
29 #include <vector>
30 #include <boost/shared_ptr.hpp>
31 #include <WriterFilterDllApi.hxx>
32 
33 namespace writerfilter
34 {
35 using ::std::hash_map;
36 using ::std::stack;
37 using ::std::string;
38 using ::std::vector;
39 
40 class WRITERFILTER_DLLPUBLIC XPathLogger
41 {
42     typedef hash_map<string, unsigned int> TokenMap_t;
43     typedef boost::shared_ptr<TokenMap_t> TokenMapPointer_t;
44 
45     TokenMapPointer_t mp_tokenMap;
46     stack<TokenMapPointer_t> m_tokenMapStack;
47     vector<string> m_path;
48     string m_currentPath;
49 
50     void updateCurrentPath();
51 
52 public:
53     explicit XPathLogger();
54     virtual ~XPathLogger();
55 
56     string getXPath() const;
57     void startElement(string _token);
58     void endElement();
59 };
60 }
61 #endif // INCLUDED_XPATH_LOGGER_HXX
62