ZenLib
ZtringListListF.h
Go to the documentation of this file.
1 // ZenLib::ZtringListListF - ZtringListList with files
2 // Copyright (C) 2002-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 // ZtringListList with file load/save
23 //
24 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
25 
26 //---------------------------------------------------------------------------
27 #ifndef ZtringListListFH
28 #define ZtringListListFH
29 //---------------------------------------------------------------------------
30 
31 //---------------------------------------------------------------------------
32 #include "ZenLib/ZtringListList.h"
33 //---------------------------------------------------------------------------
34 
35 namespace ZenLib
36 {
37 
38 //***************************************************************************
39 /// @brief ZtringListList with file management
40 //***************************************************************************
41 
43 {
44 public :
45  //Constructors/Destructor
46  ZtringListListF ();
47  ZtringListListF (const ZtringListList &Source);
48  ZtringListListF (const Ztring &Source);
49  ZtringListListF (const Char *Source);
50  #ifdef _UNICODE
51  ZtringListListF (const char *Source); //convert a UTF-8 string into Unicode
52  #endif
53 
54  //File management
55  bool Load (const Ztring &FileName=Ztring());
56  bool Save (const Ztring &FileName=Ztring());
57  bool Cancel ();
58 
59  //Configuration
60  // @brief enable or disable backup creation
61  void Backup_Set (bool Save);
62  // @brief Set the count of versions to save
63  void Backup_Count_Set (int8u Count);
64  // @brief Set if the content of file is a localized (=not UTF8) file
65  void Local_Set (bool Local);
66 
67 protected :
68  Ztring Name; //Nom du fichier
69  bool Sauvegarde; //Indicateur si on a le droit de sauvegarder (par defaut)
70  int8u Backup_Nb_Max; //Nombre maxi de sauvegardes
71  int8u Backup_Nb; //Nombre actuel de backups pour cette session
72  bool Local; //if true, this is a local charset, else this is a UTF8 charset
73 
74  //File management
75  bool CSV_Charger ();
76  bool CFG_Charger ();
77  bool CSV_Sauvegarder ();
78  bool CFG_Sauvegarder ();
79  bool File_Load ();
80 
81  //Divers
82  bool NettoyerEspaces (Ztring &ANettoyer); //Enlever les espaces avant et apres
83 
84 private:
85  void ZtringListListF_Common();
86 };
87 
88 } //Namespace
89 
90 #endif
91