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.0.1 00026 // ------------- 00027 // 00028 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00029 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00030 // 00031 // 00032 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00033 00034 //--------------------------------------------------------------------------- 00035 #ifndef CChaine_Tableau1H 00036 #define CChaine_Tableau1H 00037 //--------------------------------------------------------------------------- 00038 00039 //--------------------------------------------------------------------------- 00040 #include <ZenLib/Ztring.h> 00041 #ifdef __BORLANDC__ //Warnings in Borland 00042 #pragma warn -8059 // 00043 #endif // 00044 #include <vector> 00045 #ifdef __BORLANDC__ //Warnings in Borland 00046 #pragma warn .8059 // 00047 #endif // 00048 //--------------------------------------------------------------------------- 00049 00050 //--------------------------------------------------------------------------- 00051 #define CCHAINE_TABLEAU1_CASSE 1 //Active la sensibilite a la casse (min/maj) 00052 #define CCHAINE_TABLEAU1_DESC 2 //Tri descendant au lieu d'ascendant 00053 //--------------------------------------------------------------------------- 00054 00055 //*************************************************************************** 00056 // Classe ZtringList 00057 //*************************************************************************** 00058 namespace ZenLib 00059 { 00060 00061 class ZtringList : public std::vector<Ztring> 00062 { 00063 public : 00064 //Gestion de la classe 00065 void CChaine_Tableau1_Commun (int n=0, const Ztring &Separateur=";", const Ztring &Source=""); 00066 ZtringList (int n=0, const Ztring &Separateur=";", const Ztring &Source=""); 00067 ZtringList (const ZtringList &Source); 00068 ZtringList (const Ztring &Source); 00069 ZtringList (const char* Source); 00070 ~ZtringList (); 00071 00072 //Operateurs 00073 ZtringList &operator = (const ZtringList &Source); 00074 ZtringList &operator += (const Ztring &Source); 00075 ZtringList operator + (const ZtringList &Source) const; 00076 bool operator == (const ZtringList &Source) const; 00077 bool operator != (const ZtringList &Source) const; 00078 Ztring &operator () (size_t Pos); //Lecture ecriture 00079 //Ztring &operator () (size_t Pos) const; //Lecture seulement 00080 00081 00082 //Edition 00083 Ztring Lire () const; //Lecture de tout 00084 Ztring Lire (size_t Pos) const; //Lecture d'un champs 00085 int Ecrire (const Ztring &AEcrire); //Ecriture de tout 00086 int Ecrire (const Ztring &AEcrire, size_t Pos); //Ecriture d'un champs 00087 /* 00088 int EcrireEx (const CChaine &AEcrire, int Pos); //Ecriture d'un champs avec options (Espace = Ne pas ecrire) 00089 int Ajouter (const CChaine &AAjouter); //Ajout d'un champs a la fin 00090 int Inserer (const CChaine &AInserer, int Pos); // Insertion d'un champs et decalage des champs suivants 00091 int Permuter (int Pos_A, int Pos_B); // Permutation de deux champs 00092 int Supprimer (); //Suppression de tout 00093 int Supprimer (int Pos); //Suppression d'un champs et decalage des champs suivants 00094 int Trier (int Options=0); //tri 00095 */ 00096 size_t Rechercher (const Ztring &ARechercher, size_t PosDebut=0, const Ztring &Comparaison="==", int Options=0) const; //recherche un champs contenant Proprietes 00097 /* 00098 00099 //Informations 00100 int Taille_Get () const; //Nombre de champs 00101 int Taille_Max_Get (); //Nombre d'endroits reserves pour les champs 00102 int Taille_Max_Set (int Taille_Max_Nouveau); //Modification de la taille maximum d'un tableau (a titre indicatif) 00103 CChaine Separateur_Get () const; 00104 */ 00105 int Separateur_Set (const Ztring &Separateur_Nouveau); 00106 /// @brief Return the length of the longest string in the list. 00107 int MaxStringLength (); 00108 00109 00110 protected : 00111 //CChaine** Chaine; 00112 Ztring Separateur; 00113 //int Taille; 00114 //int Taille_Max; 00115 //int Nettoyer(); //Rendu necessaire par operateur () et [] 00116 00117 }; 00118 00119 } //namespace 00120 #endif 00121