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

PsString.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of openMask © INRIA, CNRS, Universite de Rennes 1 1993-2002, thereinafter the Software
00003  * 
00004  * The Software has been developped within the Siames Project. 
00005  * INRIA, the University of Rennes 1 and CNRS jointly hold intellectual property rights
00006  * 
00007  * The Software has been registered with the Agence pour la Protection des
00008  * Programmes (APP) under registration number IDDN.FR.001.510008.00.S.P.2001.000.41200
00009  *
00010  * This file may be distributed under the terms of the Q Public License
00011  * version 1.0 as defined by Trolltech AS of Norway and appearing in the file
00012  * LICENSE.QPL included in the packaging of this file.
00013  *
00014  * Licensees holding valid specific licenses issued by INRIA, CNRS or Université de Rennes 1 
00015  * for the software may use this file in accordance with that specific license
00016  *
00017  */
00018 #ifndef PsStringHEADER
00019 #define PsStringHEADER
00020 
00021 
00022 #include <string>
00023 #include <iostream>
00024 
00025 #ifdef _HASHMAPNOTSTD
00026 #include <ext/hash_map>
00027 using namespace __gnu_cxx ; 
00028 #else
00029 #include <hash_map>
00030 #endif
00031 
00032 
00033 #include <stdlib.h>
00034 #include <PsType.h>
00035 
00036 
00048 class PsString : public PsType
00049 {
00050  public:
00051 
00057    PsString (const string & aString);
00058    
00061    PsString (const char * CStyleString = "");
00062    
00063    
00066    PsString (const PsString & originalString);
00067    
00068    
00071    PsString (const char caracter);
00072    
00074    virtual ~PsString ();
00076 
00077  
00089    PsString operator ++ ( int );
00090    
00092    PsString & operator ++ ( void );
00093 
00104    PsString& operator -- (void);
00106 
00115   int getSubString (const int startAt, 
00116                     const int nbCaracters,
00117                     PsString & subString) const;
00118    
00124    int getSubStringIndex (const PsString & subString) const;
00125    
00131    int findCaracter (char Carac) const;
00133 
00141   char operator[] (const int i) const;
00142 
00147   PsString & operator = (const PsString& Source);
00148 
00149 
00154    //PsString & operator = (const string & Source);
00155 
00156 
00161   PsString& operator + (const PsType & source) ;
00162    
00167   PsString & operator + (const string & source) ;
00169 
00170 
00174    virtual void insertInStream (ostream& out = cout) const ;
00175 
00181    virtual void extract (istream& in = cin) ;
00182 
00186    virtual void pack (ostream& out) const ;
00187 
00191    virtual void unpack (istream& in = cin) ;
00192   
00193 
00197    virtual void pack (PsOutgoingSynchronisationMessage & out) const ;
00198 
00202    virtual void unpack (PsIncomingSynchronisationMessage & in) ;
00203   
00204 
00208 
00209    typedef PsString & (* separator) (PsString &);
00210    
00212    PsString & operator <<(separator f);
00213 
00216    friend PsString & sep(PsString & oChaine);
00217 
00220    PsString & operator << (const char * f);
00221 
00224    PsString & operator << (const PsFlowable & f);
00225 
00229    PsString & operator >> (PsFlowable & f);
00231 
00237    int getStringLength () const;
00238 
00239 
00243   const char * getCString () const;
00245 
00253    friend bool operator != (const PsString & source1, const PsString & source2);
00254    
00260    friend bool operator == (const PsString & source1, const PsString & source2);
00261    
00267    friend bool operator > (const PsString & source1, const PsString & source2);
00268    
00274    friend bool operator < (const PsString & source1, const PsString & source2);
00275    
00281    friend bool operator >= (const PsString & source1, const PsString & source2);
00282    
00288    friend bool operator <= (const PsString & source1, const PsString & source2);
00289    
00291 
00293    virtual PsPolatorNT * createPolator(void)   ;
00294 
00295  protected:
00296 
00298    static const int LG_MAX_BUFFER=64;
00299    
00301    char* _CString;
00302    
00304    int _nbCarac;
00305    
00307    int _tailleMem;
00308    
00315   int getCapacity () const;
00316 
00320   void alloue(const int capacity);
00322 };
00323 
00327 struct PsString_hash {
00328    size_t operator ()(const PsString & ch) const
00329    {
00330       static hash<const char *> H;
00331       return H(ch.getCString());
00332    }
00333 };
00334 
00335 #endif
00336 
00337 

logo OpenMask

Documentation generated on Mon Nov 25 15:25:02 2002

Generated with doxygen 1.2.12 by Dimitri van Heesch ,   1997-2001