Translation.h

Go to the documentation of this file.
00001 // ZenLib::Translation - Helper for translation
00002 // Copyright (C) 2007-2011 MediaArea.net SARL, Info@MediaArea.net
00003 //
00004 // This software is provided 'as-is', without any express or implied
00005 // warranty.  In no event will the authors be held liable for any damages
00006 // arising from the use of this software.
00007 //
00008 // Permission is granted to anyone to use this software for any purpose,
00009 // including commercial applications, and to alter it and redistribute it
00010 // freely, subject to the following restrictions:
00011 //
00012 // 1. The origin of this software must not be misrepresented; you must not
00013 //    claim that you wrote the original software. If you use this software
00014 //    in a product, an acknowledgment in the product documentation would be
00015 //    appreciated but is not required.
00016 // 2. Altered source versions must be plainly marked as such, and must not be
00017 //    misrepresented as being the original software.
00018 // 3. This notice may not be removed or altered from any source distribution.
00019 //
00020 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00021 //
00022 //
00023 //
00024 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00025 
00026 //---------------------------------------------------------------------------
00027 #ifndef ZenLib_TranslationH
00028 #define ZenLib_TranslationH
00029 //---------------------------------------------------------------------------
00030 
00031 //---------------------------------------------------------------------------
00032 #include "ZenLib/Ztring.h"
00033 #include <map>
00034 //---------------------------------------------------------------------------
00035 
00036 namespace ZenLib
00037 {
00038 
00039 //***************************************************************************
00040 /// @brief Helper for translation
00041 //***************************************************************************
00042 
00043 class Translation : public std::map<Ztring, Ztring>
00044 {
00045 public :
00046     //Constructors/Destructor
00047     Translation ();
00048     Translation (const Ztring &Source);
00049     Translation (const Char *Source);
00050     #ifdef _UNICODE
00051     Translation (const char *Source); //convert a UTF-8 string into Unicode
00052     #endif
00053 
00054     //In/Out
00055           Ztring    Get () const;
00056     const Ztring   &Get (const Ztring &Value);
00057           Ztring    Get (const Ztring &Count, const Ztring &Value);
00058           void      Write (const Ztring &NewLanguage); //All language in one
00059           void      Write (const Ztring &Value, const Ztring &NewLanguage); //Per item
00060 
00061     //Configuration
00062     /// @brief Set the Separator character
00063     void Separator_Set (size_type Level, const Ztring &NewSeparator);
00064     /// @brief Set the Quote character
00065     /// During Read() or Write() method, if Separator is in the sequence, we must quote it
00066     void Quote_Set (const Ztring &NewQuote);
00067     /// @brief Set the Maximum number of element to read
00068     /// During Read() or Write() method, if there is more elements, merge them with the last element
00069     void Max_Set (size_type Level, size_type Max);
00070 
00071 protected :
00072     Ztring Separator[2];
00073     Ztring Quote;
00074     size_type Max[2];
00075 };
00076 
00077 } //namespace
00078 #endif
00079 

Generated on Mon May 28 17:19:58 2012 for ZenLib by  doxygen 1.4.7