EBOOKLanguageManager.h Source File documentation

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