00001 /* Copyright (c) MediaArea.net SARL. All Rights Reserved. 00002 * 00003 * Use of this source code is governed by a zlib-style license that can 00004 * be found in the License.txt file in the root of the source tree. 00005 */ 00006 00007 //--------------------------------------------------------------------------- 00008 #ifndef ZenLib_TranslationH 00009 #define ZenLib_TranslationH 00010 //--------------------------------------------------------------------------- 00011 00012 //--------------------------------------------------------------------------- 00013 #include "ZenLib/Ztring.h" 00014 #include <map> 00015 //--------------------------------------------------------------------------- 00016 00017 namespace ZenLib 00018 { 00019 00020 //*************************************************************************** 00021 /// @brief Helper for translation 00022 //*************************************************************************** 00023 00024 class Translation : public std::map<Ztring, Ztring> 00025 { 00026 public : 00027 //Constructors/Destructor 00028 Translation (); 00029 Translation (const Ztring &Source); 00030 Translation (const Char *Source); 00031 #ifdef _UNICODE 00032 Translation (const char *Source); //convert a UTF-8 string into Unicode 00033 #endif 00034 00035 //In/Out 00036 Ztring Get () const; 00037 const Ztring &Get (const Ztring &Value); 00038 Ztring Get (const Ztring &Count, const Ztring &Value); 00039 void Write (const Ztring &NewLanguage); //All language in one 00040 void Write (const Ztring &Value, const Ztring &NewLanguage); //Per item 00041 00042 //Configuration 00043 /// @brief Set the Separator character 00044 void Separator_Set (size_type Level, const Ztring &NewSeparator); 00045 /// @brief Set the Quote character 00046 /// During Read() or Write() method, if Separator is in the sequence, we must quote it 00047 void Quote_Set (const Ztring &NewQuote); 00048 /// @brief Set the Maximum number of element to read 00049 /// During Read() or Write() method, if there is more elements, merge them with the last element 00050 void Max_Set (size_type Level, size_type Max); 00051 00052 protected : 00053 Ztring Separator[2]; 00054 Ztring Quote; 00055 size_type Max[2]; 00056 }; 00057 00058 } //namespace 00059 #endif