Main Page   Class Hierarchy   Compound List   File List   Compound Members  

skString.h

00001 /*
00002   Copyright 1996-2000
00003   Simon Whiteside
00004 
00005 * $Id: skString.h-source.html,v 1.1 2001/03/05 16:22:45 sdw Exp $
00006 */
00007 
00008 
00009 #ifndef skSTRING_H
00010 #define skSTRING_H
00011 #include "skGeneral.h"
00012 
00013 class P_String;
00014 
00015 #include <iostream.h>
00016 
00021 class skString 
00022 {
00023  public:
00027   skString();
00031   skString(const char *);
00035   skString(const unsigned char *);
00039   skString(const skString&);
00045   skString(const unsigned char * buffer, USize len);
00051   skString(const unsigned char repeatChar, USize len);
00055   virtual ~skString();
00059   skString& operator=(const skString&);
00063   skString& operator=(const unsigned char *);
00067   skString& operator=(const char *);
00072   bool operator<(const skString&) const;
00077   bool operator==(const skString&) const;
00082   bool operator==(const unsigned char *) const;
00087   bool operator==(const char *) const;
00092   bool operator!=(const skString&) const;
00097   bool operator!=(const char *) const;
00102   bool operator!=(const unsigned char *) const;
00107   operator const unsigned char * () const;
00112   operator const char * () const;
00116   USize hash() const;
00122   unsigned char at(USize index) const;
00129   skString substr(USize start,USize length) const;
00135   skString substr(USize start) const;
00140   skString operator+(const skString&) const ;
00145   skString& operator+=(const skString&);
00150   USize length() const;
00155   int indexOf(char c);
00159   int to() const;
00163   float toFloat() const;
00167   static skString literal(const char *);
00171   static skString from(int);
00175   static skString from(USize);
00179   static skString from(float);
00183   static skString from(unsigned char ch);
00187   static skString fromBuffer(unsigned char * buffer);
00188  protected:
00192   skString(P_String *);
00196   skString(const unsigned char * s,int);
00200   void assign(const unsigned char *,int len=0);                         
00204   void deRef();
00208   P_String * pimp;
00209 };
00210 /*
00211  * A hashKey function for HashTables
00212  */
00213 inline USize hashKey(skString * s)
00214 {
00215     return s->hash();
00216 }
00217 /*
00218  * A streaming operator to write a string to an output stream
00219  */
00220 ostream& operator<<(ostream&,const skString&s);
00221 
00222 /*
00223  * Some helper macros for declaring literal strings, and references to literal strings
00224  */
00225 #define LITERAL(s) skString s_##s=skString::literal(#s)
00226 #define xLITERAL(s) extern skString s_##s
00227 
00228 #include "skString.inl"
00229 
00230 #endif
00231 
00232 
00233 

Generated at Mon Mar 5 16:00:30 2001 for Simkin by doxygen1.2.0 written by Dimitri van Heesch, © 1997-2000