IWORKLanguageManager.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 IWORKLANGUAGEMANAGER_H_INCLUDED
11 #define IWORKLANGUAGEMANAGER_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 libetonyek
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  const std::string addLocale(const std::string &locale);
33 
34  const std::string getLanguage(const std::string &tag) const;
35 
36  void writeProperties(const std::string &tag, librevenge::RVNGPropertyList &props) const;
37 
38 private:
39  const LangDB &getLangDB() const;
40 
41  void addProperties(const std::string &tag);
42 
43 private:
44  std::unordered_map<std::string, std::string> m_tagMap;
45  std::unordered_set<std::string> m_invalidTags;
46  std::unordered_map<std::string, std::string> m_langMap;
47  std::unordered_set<std::string> m_invalidLangs;
48  std::unordered_map<std::string, std::string> m_localeMap;
49  std::unordered_set<std::string> m_invalidLocales;
50  std::unordered_map<std::string, librevenge::RVNGPropertyList> m_propsMap;
51  mutable std::shared_ptr<LangDB> m_langDB;
52 };
53 
54 }
55 
56 #endif // IWORKLANGUAGEMANAGER_H_INCLUDED
57 
58 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
std::shared_ptr< LangDB > m_langDB
Definition: IWORKLanguageManager.h:51
Definition: IWORKLanguageManager.cpp:68
IWORKLanguageManager()
Definition: IWORKLanguageManager.cpp:92
std::unordered_map< std::string, librevenge::RVNGPropertyList > m_propsMap
Definition: IWORKLanguageManager.h:50
std::unordered_map< std::string, std::string > m_tagMap
Definition: IWORKLanguageManager.h:44
std::unordered_map< std::string, std::string > m_localeMap
Definition: IWORKLanguageManager.h:48
std::unordered_set< std::string > m_invalidLangs
Definition: IWORKLanguageManager.h:47
const std::string addLocale(const std::string &locale)
Definition: IWORKLanguageManager.cpp:167
std::unordered_map< std::string, std::string > m_langMap
Definition: IWORKLanguageManager.h:46
Definition: IWORKLanguageManager.h:23
const std::string getLanguage(const std::string &tag) const
Definition: IWORKLanguageManager.cpp:199
Definition: IWORKToken.h:418
const std::string addLanguage(const std::string &lang)
Definition: IWORKLanguageManager.cpp:133
std::unordered_set< std::string > m_invalidLocales
Definition: IWORKLanguageManager.h:49
const std::string addTag(const std::string &tag)
Definition: IWORKLanguageManager.cpp:104
const LangDB & getLangDB() const
Definition: IWORKLanguageManager.cpp:212
std::unordered_set< std::string > m_invalidTags
Definition: IWORKLanguageManager.h:45
void writeProperties(const std::string &tag, librevenge::RVNGPropertyList &props) const
Definition: IWORKLanguageManager.cpp:243
void addProperties(const std::string &tag)
Definition: IWORKLanguageManager.cpp:219

Generated for libetonyek by doxygen 1.8.6