EBOOKLanguageManager.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3  * This file is part of the libe-book project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #ifndef EBOOKLANGUAGEMANAGER_H_INCLUDED
11 #define EBOOKLANGUAGEMANAGER_H_INCLUDED
12 
13 #include <memory>
14 #include <string>
15 #include <unordered_map>
16 #include <unordered_set>
17 
18 #include <librevenge/librevenge.h>
19 
20 namespace libebook
21 {
22 
24 {
25  struct LangDB;
26 
27 public:
29 
30  const std::string addTag(const std::string &tag);
31  const std::string addLanguage(const std::string &lang);
32 
33  const std::string getLanguage(const std::string &tag) const;
34 
35  void writeProperties(const std::string &tag, librevenge::RVNGPropertyList &props) const;
36 
37 private:
38  const LangDB &getLangDB() const;
39 
40  void addProperties(const std::string &tag);
41 
42 private:
43  std::unordered_map<std::string, std::string> m_tagMap;
44  std::unordered_set<std::string> m_invalidTags;
45  std::unordered_map<std::string, std::string> m_langMap;
46  std::unordered_set<std::string> m_invalidLangs;
47  std::unordered_map<std::string, librevenge::RVNGPropertyList> m_propsMap;
48  mutable std::shared_ptr<LangDB> m_langDB;
49 };
50 
51 }
52 
53 #endif // EBOOKLANGUAGEMANAGER_H_INCLUDED
54 
55 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
std::unordered_set< std::string > m_invalidLangs
Definition: EBOOKLanguageManager.h:46
std::unordered_map< std::string, std::string > m_tagMap
Definition: EBOOKLanguageManager.h:43
void addProperties(const std::string &tag)
Definition: EBOOKLanguageManager.cpp:185
qi::rule< Iterator, std::pair< int, Attributes_t >, qi::space_type > tag
Definition: TealDocParser.cpp:229
const LangDB & getLangDB() const
Definition: EBOOKLanguageManager.cpp:178
Definition: EBOOKLanguageManager.h:23
const std::string addLanguage(const std::string &lang)
Definition: EBOOKLanguageManager.cpp:131
EBOOKLanguageManager()
Definition: EBOOKLanguageManager.cpp:92
Definition: EBOOKHTMLToken.h:205
std::unordered_map< std::string, std::string > m_langMap
Definition: EBOOKLanguageManager.h:45
void writeProperties(const std::string &tag, librevenge::RVNGPropertyList &props) const
Definition: EBOOKLanguageManager.cpp:209
const std::string addTag(const std::string &tag)
Definition: EBOOKLanguageManager.cpp:102
std::unordered_map< std::string, librevenge::RVNGPropertyList > m_propsMap
Definition: EBOOKLanguageManager.h:47
std::unordered_set< std::string > m_invalidTags
Definition: EBOOKLanguageManager.h:44
Definition: BBeBCollector.cpp:18
const std::string getLanguage(const std::string &tag) const
Definition: EBOOKLanguageManager.cpp:165
std::shared_ptr< LangDB > m_langDB
Definition: EBOOKLanguageManager.h:48
Definition: EBOOKLanguageManager.cpp:68

Generated for libe-book by doxygen 1.8.14