ZenLib
InfoMap.h
Go to the documentation of this file.
1 // ZenLib::InfoMap - Helper for InfoMap
2 // Copyright (C) 2007-2011 MediaArea.net SARL, Info@MediaArea.net
3 //
4 // This software is provided 'as-is', without any express or implied
5 // warranty. In no event will the authors be held liable for any damages
6 // arising from the use of this software.
7 //
8 // Permission is granted to anyone to use this software for any purpose,
9 // including commercial applications, and to alter it and redistribute it
10 // freely, subject to the following restrictions:
11 //
12 // 1. The origin of this software must not be misrepresented; you must not
13 // claim that you wrote the original software. If you use this software
14 // in a product, an acknowledgment in the product documentation would be
15 // appreciated but is not required.
16 // 2. Altered source versions must be plainly marked as such, and must not be
17 // misrepresented as being the original software.
18 // 3. This notice may not be removed or altered from any source distribution.
19 //
20 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 //
22 //
23 //
24 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
25 
26 //---------------------------------------------------------------------------
27 #ifndef ZenLib_InfoMapH
28 #define ZenLib_InfoMapH
29 //---------------------------------------------------------------------------
30 
31 //---------------------------------------------------------------------------
32 #include "ZenLib/ZtringList.h"
33 #include <map>
34 //---------------------------------------------------------------------------
35 
36 namespace ZenLib
37 {
38 
39 //***************************************************************************
40 /// @brief Helper for InfoMap
41 //***************************************************************************
42 
43 class InfoMap : public std::multimap<Ztring, ZtringList>
44 {
45 public :
46  //Constructors/Destructor
47  InfoMap ();
48  InfoMap (const Ztring &Source);
49  InfoMap (const Char *Source);
50  #ifdef _UNICODE
51  InfoMap (const char *Source); //convert a UTF-8 string into Unicode
52  #endif
53 
54  //In/Out
55  const Ztring &Get (const Ztring &Value, size_t Pos) const;
56  const Ztring &Get (const Ztring &Value, size_t Pos, const Ztring &WithValue, size_t WithValue_Pos) const;
57  void Write (const Ztring &NewLanguage);
58 
59  //Configuration
60  /// @brief Set the Separator character
61  void Separator_Set (size_type Level, const Ztring &NewSeparator);
62  /// @brief Set the Quote character
63  /// During Read() or Write() method, if Separator is in the sequence, we must quote it
64  void Quote_Set (const Ztring &NewQuote);
65  /// @brief Set the Maximum number of element to read
66  /// During Read() or Write() method, if there is more elements, merge them with the last element
67  void Max_Set (size_type Level, size_type Max);
68 
69 protected :
72  size_type Max[2];
73 };
74 
75 } //namespace
76 #endif
77