Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

string.h

00001 /*
00002     Crystal Space String interface
00003     Copyright (C) 1999 by Brandon Ehle (Azverkan)
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00020 #ifndef __IUTIL_STRING_H__
00021 #define __IUTIL_STRING_H__
00022 
00023 #include "csutil/scf.h"
00024 
00025 SCF_VERSION (iString, 0, 0, 1);
00026 
00028 struct iString : public iBase
00029 {
00031   virtual void SetCapacity (size_t NewSize) = 0;
00032 
00034   virtual void Truncate (size_t iPos) = 0;
00035 
00037   virtual void Reclaim () = 0;
00038 
00040   inline void Clear ()
00041   { Truncate (0); }
00042 
00044   virtual iString *Clone () const = 0;
00045 
00047   virtual char *GetData () const = 0;
00048 
00050   virtual size_t Length () const = 0;
00051 
00053   inline bool IsEmpty () const
00054   { return !Length (); }
00055 
00057   virtual inline char& operator [] (size_t iPos) = 0;
00058 
00060   virtual void SetAt (size_t iPos, char iChar) = 0;
00061 
00063   virtual char GetAt (size_t iPos) const = 0;
00064 
00066   virtual void Insert (size_t iPos, iString *iStr) = 0;
00067 
00069   virtual void Overwrite (size_t iPos, iString *iStr) = 0;
00070 
00072   virtual iString &Append (const char *iStr, size_t iCount = (size_t)-1) = 0;
00073 
00075   virtual iString &Append (const iString *iStr, size_t iCount = (size_t)-1)=0;
00076 
00078   virtual void Replace (const iString *iStr, size_t iCount = (size_t)-1) = 0;
00079 
00081   virtual bool Compare (const iString *iStr) const = 0;
00082 
00084   virtual bool CompareNoCase (const iString *iStr) const = 0;
00085 
00087   iString &operator += (const iString &iStr)
00088   { return Append (&iStr); }
00089 
00091   iString &operator += (const char *iStr)
00092   { return Append (iStr); }
00093 
00095   iString &operator + (const iString &iStr) const
00096   { return Clone ()->Append (&iStr); }
00097 
00099   operator const char * () const
00100   { return GetData (); }
00101 
00103   bool operator == (const iString &iStr) const
00104   { return Compare (&iStr); }
00105 };
00106 
00107 #endif // __IUTIL_STRING_H__

Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000