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
20namespace libebook
21{
22
24{
25 struct LangDB;
26
27public:
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
37private:
38 const LangDB &getLangDB() const;
39
40 void addProperties(const std::string &tag);
41
42private:
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: */
qi::rule< Iterator, std::pair< int, Attributes_t >, qi::space_type > tag
Definition: TealDocParser.cpp:229
Definition: EBOOKLanguageManager.h:24
EBOOKLanguageManager()
Definition: EBOOKLanguageManager.cpp:92
void addProperties(const std::string &tag)
Definition: EBOOKLanguageManager.cpp:185
std::shared_ptr< LangDB > m_langDB
Definition: EBOOKLanguageManager.h:48
std::unordered_set< std::string > m_invalidTags
Definition: EBOOKLanguageManager.h:44
std::unordered_map< std::string, std::string > m_tagMap
Definition: EBOOKLanguageManager.h:43
std::unordered_map< std::string, std::string > m_langMap
Definition: EBOOKLanguageManager.h:45
const std::string getLanguage(const std::string &tag) const
Definition: EBOOKLanguageManager.cpp:165
void writeProperties(const std::string &tag, librevenge::RVNGPropertyList &props) const
Definition: EBOOKLanguageManager.cpp:209
const std::string addLanguage(const std::string &lang)
Definition: EBOOKLanguageManager.cpp:131
std::unordered_map< std::string, librevenge::RVNGPropertyList > m_propsMap
Definition: EBOOKLanguageManager.h:47
const std::string addTag(const std::string &tag)
Definition: EBOOKLanguageManager.cpp:102
std::unordered_set< std::string > m_invalidLangs
Definition: EBOOKLanguageManager.h:46
const LangDB & getLangDB() const
Definition: EBOOKLanguageManager.cpp:178
Definition: BBeBCollector.cpp:19
Definition: EBOOKLanguageManager.cpp:69

Generated for libe-book by doxygen 1.9.5