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_InfoMapH 00009 #define ZenLib_InfoMapH 00010 //--------------------------------------------------------------------------- 00011 00012 //--------------------------------------------------------------------------- 00013 #include "ZenLib/ZtringList.h" 00014 #include <map> 00015 //--------------------------------------------------------------------------- 00016 00017 namespace ZenLib 00018 { 00019 00020 //*************************************************************************** 00021 /// @brief Helper for InfoMap 00022 //*************************************************************************** 00023 00024 class InfoMap : public std::multimap<Ztring, ZtringList> 00025 { 00026 public : 00027 //Constructors/Destructor 00028 InfoMap (); 00029 InfoMap (const Ztring &Source); 00030 InfoMap (const Char *Source); 00031 #ifdef _UNICODE 00032 InfoMap (const char *Source); //convert a UTF-8 string into Unicode 00033 #endif 00034 00035 //In/Out 00036 const Ztring &Get (const Ztring &Value, size_t Pos) const; 00037 const Ztring &Get (const Ztring &Value, size_t Pos, const Ztring &WithValue, size_t WithValue_Pos) const; 00038 void Write (const Ztring &NewLanguage); 00039 00040 //Configuration 00041 /// @brief Set the Separator character 00042 void Separator_Set (size_type Level, const Ztring &NewSeparator); 00043 /// @brief Set the Quote character 00044 /// During Read() or Write() method, if Separator is in the sequence, we must quote it 00045 void Quote_Set (const Ztring &NewQuote); 00046 /// @brief Set the Maximum number of element to read 00047 /// During Read() or Write() method, if there is more elements, merge them with the last element 00048 void Max_Set (size_type Level, size_type Max); 00049 00050 protected : 00051 Ztring Separator[2]; 00052 Ztring Quote; 00053 size_type Max[2]; 00054 }; 00055 00056 } //namespace 00057 #endif