00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 00002 /* 00003 * This file is part of the libe-book project. 00004 * 00005 * This Source Code Form is subject to the terms of the Mozilla Public 00006 * License, v. 2.0. If a copy of the MPL was not distributed with this 00007 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 00008 */ 00009 00010 #ifndef IWORKLANGUAGEMANAGER_H_INCLUDED 00011 #define IWORKLANGUAGEMANAGER_H_INCLUDED 00012 00013 #include <string> 00014 00015 #include <boost/shared_ptr.hpp> 00016 #include <boost/unordered_map.hpp> 00017 #include <boost/unordered_set.hpp> 00018 00019 #include <librevenge/librevenge.h> 00020 00021 namespace libetonyek 00022 { 00023 00024 class IWORKLanguageManager 00025 { 00026 struct LangDB; 00027 00028 public: 00029 IWORKLanguageManager(); 00030 00031 const std::string addTag(const std::string &tag); 00032 const std::string addLanguage(const std::string &lang); 00033 const std::string addLocale(const std::string &locale); 00034 00035 const std::string getLanguage(const std::string &tag) const; 00036 00037 void writeProperties(const std::string &tag, librevenge::RVNGPropertyList &props) const; 00038 00039 private: 00040 const LangDB &getLangDB() const; 00041 00042 void addProperties(const std::string &tag); 00043 00044 private: 00045 boost::unordered_map<std::string, std::string> m_tagMap; 00046 boost::unordered_set<std::string> m_invalidTags; 00047 boost::unordered_map<std::string, std::string> m_langMap; 00048 boost::unordered_set<std::string> m_invalidLangs; 00049 boost::unordered_map<std::string, std::string> m_localeMap; 00050 boost::unordered_set<std::string> m_invalidLocales; 00051 boost::unordered_map<std::string, librevenge::RVNGPropertyList> m_propsMap; 00052 mutable boost::shared_ptr<LangDB> m_langDB; 00053 }; 00054 00055 } 00056 00057 #endif // IWORKLANGUAGEMANAGER_H_INCLUDED 00058 00059 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */