00001 // ZenLib::ZtringList - vector<std::string> is better 00002 // Copyright (C) 2002-2003 Jérôme Martinez, Zen@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 // ZtringList 00023 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00024 // 00025 // Version 0.1.0 00026 // ------------- 00027 // 00028 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00029 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00030 // 00031 // 00032 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00033 00034 //--------------------------------------------------------------------------- 00035 #ifndef ZenLib_ZtringListH 00036 #define ZenLib_ZtringListH 00037 //--------------------------------------------------------------------------- 00038 00039 //--------------------------------------------------------------------------- 00040 #include <ZenLib/Ztring.h> 00041 #include <vector> 00042 //--------------------------------------------------------------------------- 00043 00044 //*************************************************************************** 00045 // Classe ZtringList 00046 //*************************************************************************** 00047 namespace ZenLib 00048 { 00049 00050 class ZtringList : public std::vector<Ztring> 00051 { 00052 public : 00053 //Gestion de la classe 00054 void ZtringList_Common (int n=0, const Ztring &Separateur=_T(";"), const Ztring &Source=_T("")); 00055 ZtringList (int n=0, const Ztring &Separateur=_T(";"), const Ztring &Source=_T("")); 00056 ZtringList (const ZtringList &Source); 00057 ZtringList (const Ztring &Source); 00058 ZtringList (const Char *Source); 00059 ~ZtringList (); 00060 00061 //Operateurs 00062 ZtringList operator + (const ZtringList &Source) const; 00063 ZtringList &operator += (const Ztring &Source); 00064 ZtringList &operator = (const ZtringList &Source); 00065 bool operator == (const ZtringList &Source) const; 00066 bool operator != (const ZtringList &Source) const; 00067 Ztring &operator () (size_t Pos); ///< Same as [], but write a empty string if Pos doesn't exist yet 00068 00069 //Edition 00070 Ztring Lire () const; //Lecture de tout 00071 Ztring Lire (size_t Pos) const; //Lecture d'un champs 00072 int Ecrire (const Ztring &AEcrire); //Ecriture de tout 00073 int Ecrire (const Ztring &AEcrire, size_t Pos); //Ecriture d'un champs 00074 /* 00075 int EcrireEx (const CChaine &AEcrire, int Pos); //Ecriture d'un champs avec options (Espace = Ne pas ecrire) 00076 int Ajouter (const CChaine &AAjouter); //Ajout d'un champs a la fin 00077 int Inserer (const CChaine &AInserer, int Pos); // Insertion d'un champs et decalage des champs suivants 00078 int Permuter (int Pos_A, int Pos_B); // Permutation de deux champs 00079 int Supprimer (); //Suppression de tout 00080 int Supprimer (int Pos); //Suppression d'un champs et decalage des champs suivants 00081 int Trier (int Options=0); //tri 00082 */ 00083 intu Rechercher (const Ztring &ARechercher, intu PosDebut=0, const Ztring &Comparaison=_T("=="), int Options=0) const; //recherche un champs contenant Proprietes 00084 /* 00085 00086 //Informations 00087 int Taille_Get () const; //Nombre de champs 00088 int Taille_Max_Get (); //Nombre d'endroits reserves pour les champs 00089 int Taille_Max_Set (int Taille_Max_Nouveau); //Modification de la taille maximum d'un tableau (a titre indicatif) 00090 CChaine Separateur_Get () const; 00091 */ 00092 int Separateur_Set (const Ztring &Separateur_Nouveau); 00093 /// @brief Return the length of the longest string in the list. 00094 int MaxStringLength (); 00095 00096 00097 protected : 00098 //CChaine** Chaine; 00099 Ztring Separateur; 00100 //int Taille; 00101 //int Taille_Max; 00102 //int Nettoyer(); //Rendu necessaire par operateur () et [] 00103 00104 }; 00105 00106 } //namespace 00107 #endif 00108