entityresolver.h
Go to the documentation of this file.
1 /*
2  * This library is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU Lesser General Public
4  * License as published by the Free Software Foundation; either
5  * version 2.1 of the License, or (at your option) any later version.
6  *
7  * As a special exception, you may use this file as part of a free
8  * software library without restriction. Specifically, if other files
9  * instantiate templates or use macros or inline functions from this
10  * file, or you compile this file and link it with other files to
11  * produce an executable, this file does not by itself cause the
12  * resulting executable to be covered by the GNU General Public
13  * License. This exception does not however invalidate any other
14  * reasons why the executable file might be covered by the GNU Library
15  * General Public License.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25  */
26 #ifndef cxxtools_xml_EntityResolver_h
27 #define cxxtools_xml_EntityResolver_h
28 
29 #include <cxxtools/string.h>
30 #include <map>
31 
32 namespace cxxtools
33 {
34 
35 namespace xml
36 {
37 
46 {
47 
48  public:
55  { }
56 
62  void clear()
63  { _entityMap.clear(); }
64 
73  void addEntity(const String& entity, const String& token)
74  { _entityMap.insert( std::pair<String, String>(entity, token) ); }
75 
76 
87  String resolveEntity(const String& entity) const;
88 
96  String getEntity(Char ch) const;
97 
105  void getEntity(std::basic_ostream<Char>& os, Char ch) const;
106 
107  private:
109  typedef std::map<String, String> EntityMap;
110  EntityMap _entityMap;
111 };
112 
113 }
114 
115 }
116 
117 #endif