OpenMW
components/translation/translation.hpp
Go to the documentation of this file.
00001 #ifndef COMPONENTS_TRANSLATION_DATA_H
00002 #define COMPONENTS_TRANSLATION_DATA_H
00003 
00004 #include <components/to_utf8/to_utf8.hpp>
00005 #include <components/files/collections.hpp>
00006 
00007 namespace Translation
00008 {
00009     class Storage
00010     {
00011     public:
00012 
00013         void loadTranslationData(const Files::Collections& dataFileCollections,
00014                                  const std::string& esmFileName);
00015 
00016         std::string translateCellName(const std::string& cellName) const;
00017         std::string topicID(const std::string& phrase) const;
00018 
00019         // Standard form usually means nominative case
00020         std::string topicStandardForm(const std::string& phrase) const;
00021 
00022         void setEncoder(ToUTF8::Utf8Encoder* encoder);
00023 
00024         bool hasTranslation() const;
00025 
00026     private:
00027         typedef std::map<std::string, std::string> ContainerType;
00028 
00029         void loadData(ContainerType& container,
00030                       const std::string& fileNameNoExtension,
00031                       const std::string& extension,
00032                       const Files::Collections& dataFileCollections);
00033 
00034         void loadDataFromStream(ContainerType& container, std::istream& stream);
00035 
00036 
00037         ToUTF8::Utf8Encoder* mEncoder;
00038         ContainerType mCellNamesTranslations, mTopicIDs, mPhraseForms;
00039     };
00040 }
00041 
00042 #endif