Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ZtringListList.h

Go to the documentation of this file.
00001 // ZenLib::ZtringListList - vector<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 // ZtringListList
00023 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00024 //
00025 // Version 0.0.1
00026 // -------------
00027 //
00028 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00029 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00030 //
00031 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00032 
00033 //---------------------------------------------------------------------------
00034 #ifndef ZenLib_ZtringListListH
00035 #define ZenLib_ZtringListListH
00036 //---------------------------------------------------------------------------
00037 
00038 //---------------------------------------------------------------------------
00039 #include <ZenLib/ZtringList.h>
00040 //---------------------------------------------------------------------------
00041 
00042 //***************************************************************************
00043 // Classe ZtringListList
00044 //***************************************************************************
00045 
00046 namespace ZenLib
00047 {
00048 
00049 class ZtringListList : public std::vector<ZtringList>
00050 {
00051 public :
00052     //Gestion de la classe
00053     void ZtringListList_Common (int Taille_Max2=0, int Taille_Max1=0, const Ztring &Separateur1=_T("\r\n"), const Ztring &Separateur2=_T(";"), const Char *Source=_T(""));
00054     ZtringListList (int Taille_Max2=0, int Taille_Max1=0, const Ztring &Separateur1=_T("\r\n"), const Ztring &Separateur2=_T(";"), const Ztring &Source=_T(""));
00055     ZtringListList (const ZtringListList &Source);
00056     ZtringListList (const Ztring &Source);
00057     ZtringListList (const Char *Source);
00058     ~ZtringListList ();
00059 
00060     //Operateurs
00061     ZtringListList operator + (const ZtringListList &Source) const;
00062     ZtringListList &operator += (const ZtringListList &Source);
00063     ZtringListList &operator = (const ZtringListList &Source);
00064     bool operator == (const ZtringListList &Source) const;
00065     bool operator != (const ZtringListList &Source) const;
00066     ZtringList &operator () (size_t Pos0); ///< Same as [], but write a empty string if Pos doesn't exist yet
00067     Ztring &operator () (size_t Pos0, size_t Pos1); //Lecture ecriture
00068 
00069     Ztring &operator () (const Ztring &Pos0, size_t Pos1=1); //Lecture ecriture
00070     Ztring &operator () (const Ztring &Pos0, size_t Pos1=1) const; //Lecture
00071     Ztring &operator () (const Ztring &Pos0, size_t Pos0_1, size_t Pos1); //Lecture ecriture
00072     Ztring &operator () (const Ztring &Pos0, size_t Pos0_1, size_t Pos1) const; //Lecture
00073 
00074     //Edition
00075     Ztring Lire () const; //Lecture de tout
00076     Ztring Lire (size_t Pos0) const; //Lecture d'une ligne
00077     Ztring Lire (size_t Pos0, size_t Pos1) const; //Lecture d'un champs
00078     Ztring Lire (const Ztring &Pos0, size_t Pos1=1) const; //Lecture d'un champs en position 0
00079     Ztring Lire (const Ztring &Pos0, Ztring Default, size_t Pos1=1) const; //Lecture d'un champs en position 0 avec une option par defaut
00080 //    CChaine Lire (const CChaine &Pos0, int Pos0_1, int Pos1) const; //Lecture d'un champs en position Pos0_1
00081 
00082     Ztring Lire1 (size_t Pos1) const; //Lecture d'une colonne
00083     int Ecrire (const Ztring &AEcrire); //Ecriture de tout
00084     int Ecrire (const Char *AEcrire, size_t Pos0); //Ecriture d'une ligne
00085     int Ecrire (const Ztring &AEcrire, size_t Pos0); //Ecriture d'une ligne
00086     int Ecrire (const ZtringList &AEcrire, size_t Pos0); //Ecriture d'une ligne
00087     int Ecrire (const Ztring &AEcrire, size_t Pos0, size_t Pos1); //Ecriture d'un champs
00088     void push_back (Char* ToAdd);
00089     void push_back (const ZtringList &ToAdd);
00090 
00091 /*
00092     int Ecrire (const CChaine &AEcrire, const CChaine &Pos0, int Pos1=1); //Ecriture d'un champs en recherchant Pos0T en position 0
00093     int Ecrire (const CChaine &AEcrire, const CChaine &Pos0, int Pos0_1, int Pos1); //Ecriture d'un champs en recherchant Pos0T en position Pos0_1
00094 /*
00095     int EcrireEx (const CChaine &AEcrire, int Pos0, int Pos1); //Remplir un champ avec options (Espace = Ne pas ecrire)
00096     int Ajouter (const CChaine_Tableau1 &AAjouter); //Ajout d'une ligne a la fin
00097     int Ajouter1 (const CChaine &AAjouter); //Ajout d'une nouvelle colonne
00098     int Inserer (const CChaine_Tableau1 &AInserer, int Pos0); // Insertion d'un champs et decalage des champs suivants
00099     int Inserer1 (const CChaine &AInserer, int Pos1); // Insertion d'une colonne
00100     int Permuter (int Pos0_A, int Pos0_B); // Permutation de deux ligne
00101     int Permuter1 (int Pos1_A, int Pos1_B); // Permutation de deux colonnes
00102     int Supprimer (); //Suppression de tout
00103     int Supprimer (int Pos0); //Suppression d'une ligne et decalage des champs suivants
00104     int Supprimer (const CChaine &ARechercher, int Pos1=0, const CChaine &Comparaison="=="); //Suppression de plusieurs lignes avec un selecteur au niveau d'une colonne
00105     int Supprimer1 (int Pos1); //Suppression d'une colonne
00106     int Trier (int Pos1=0, int Options=0); //Tri en fonction d'une colonne
00107 */
00108     int Rechercher (const Ztring &ARechercher, size_t Pos1=0, size_t Pos0Debut=0, const Ztring &Comparaison=_T("=="), int Options=0) const; //recherche une ligne contenant ARechercher dans une colonne
00109     Ztring RechercherValeur (const Ztring &ARechercher, size_t Pos1Valeur=1, size_t Pos1=0, size_t Pos0Debut=0, const Ztring &Comparaison=_T("=="), int Options=0) const; //retourne le champs Pos1Valeur correspondant a la ligne trouvee
00110 /*
00111     int Remplacer (const CChaine &ARechercher, const CChaine &ARemplacer, int Pos1=-1, const CChaine &Comparaison="==", int Options=0); //Remplace toutes les occurences
00112 
00113     //Informations
00114     int Taille_Get (int Rang=0) const; //Nombre de champs
00115     int Taille_Max_Set (int Taille_Max_Nouveau0, int Taille_Max_Nouveau1=-1);
00116 */
00117     int Separateur_Set (const Ztring &Separateur_Nouveau0, const Ztring &Separateur_Nouveau1=_T(";"));
00118     //size_t size() const;
00119 
00120     //Divers
00121     ZtringListList SousTableau (const Ztring &ARechercher, int Pos1=0, int Pos0Debut=0, const Ztring &Comparaison=_T("=="), int Options=0) const; //retourne tout
00122 
00123 protected :
00124    //CChaine_Tableau1** Chaine;
00125    //int Taille[2];
00126    //int Taille_Max[2];
00127    Ztring Separateur[2];
00128    int Nettoyer(); //Rendu necessaire par operateur () et []
00129    //size_t size_;
00130 
00131 };
00132 
00133 } //namespace
00134 #endif
00135 

Generated on Mon Aug 2 20:37:42 2004 for ZenLib by doxygen1.3-rc3