ZenLib

Translation.h
Go to the documentation of this file.
1/* Copyright (c) MediaArea.net SARL. All Rights Reserved.
2 *
3 * Use of this source code is governed by a zlib-style license that can
4 * be found in the License.txt file in the root of the source tree.
5 */
6
7//---------------------------------------------------------------------------
8#ifndef ZenLib_TranslationH
9#define ZenLib_TranslationH
10//---------------------------------------------------------------------------
11
12//---------------------------------------------------------------------------
13#include "ZenLib/Ztring.h"
14#include <map>
15//---------------------------------------------------------------------------
16
17 namespace ZenLib
18{
19
20//***************************************************************************
21/// @brief Helper for translation
22//***************************************************************************
23
24 class Translation : public std::map<Ztring, Ztring>
25{
26public :
27 //Constructors/Destructor
28 Translation ();
29 Translation (const Ztring &Source);
30 Translation (const Char *Source);
31 #ifdef _UNICODE
32 Translation (const char *Source); //convert a UTF-8 string into Unicode
33 #endif
34
35 //In/Out
36 Ztring Get () const;
37 const Ztring &Get (const Ztring &Value);
38 Ztring Get (const Ztring &Count, const Ztring &Value);
39 void Write (const Ztring &NewLanguage); //All language in one
40 void Write (const Ztring &Value, const Ztring &NewLanguage); //Per item
41
42 //Configuration
43 /// @brief Set the Separator character
44 void Separator_Set (size_type Level, const Ztring &NewSeparator);
45 /// @brief Set the Quote character
46 /// During Read() or Write() method, if Separator is in the sequence, we must quote it
47 void Quote_Set (const Ztring &NewQuote);
48 /// @brief Set the Maximum number of element to read
49 /// During Read() or Write() method, if there is more elements, merge them with the last element
50 void Max_Set (size_type Level, size_type Max);
51
52protected :
53 Ztring Separator[2];
54 Ztring Quote;
55 size_type Max[2];
56};
57
58} //namespace
59#endif
Ztring.h
ZenLib::Translation
Helper for translation.
Definition: Translation.h:25
ZenLib::Translation::Separator_Set
void Separator_Set(size_type Level, const Ztring &NewSeparator)
Set the Separator character.
ZenLib::Translation::Get
Ztring Get() const
ZenLib::Translation::Translation
Translation(const Ztring &Source)
ZenLib::Translation::Write
void Write(const Ztring &NewLanguage)
ZenLib::Translation::Translation
Translation()
ZenLib::Translation::Write
void Write(const Ztring &Value, const Ztring &NewLanguage)
ZenLib::Translation::Quote
Ztring Quote
Definition: Translation.h:54
ZenLib::Translation::Get
Ztring Get(const Ztring &Count, const Ztring &Value)
ZenLib::Translation::Separator
Ztring Separator[2]
Definition: Translation.h:53
ZenLib::Translation::Max
size_type Max[2]
Definition: Translation.h:55
ZenLib::Translation::Max_Set
void Max_Set(size_type Level, size_type Max)
Set the Maximum number of element to read During Read() or Write() method, if there is more elements,...
ZenLib::Translation::Get
const Ztring & Get(const Ztring &Value)
ZenLib::Translation::Translation
Translation(const Char *Source)
ZenLib::Translation::Quote_Set
void Quote_Set(const Ztring &NewQuote)
Set the Quote character During Read() or Write() method, if Separator is in the sequence,...
ZenLib::Ztring
String manipulation (based on std::(w)string)
Definition: Ztring.h:50
ZenLib
Definition: BitStream.h:24
ZenLib::Char
char Char
Definition: Conf.h:225