CrystalSpace

Public API Reference

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

string.h

Go to the documentation of this file.
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 __CS_IUTIL_STRING_H__
00021 #define __CS_IUTIL_STRING_H__
00022 
00028 #include <stdarg.h>
00029 #include "csutil/scf.h"
00030 
00031 SCF_VERSION (iString, 0, 1, 0);
00032 
00034 struct iString : public iBase
00035 {
00043   virtual void SetCapacity (size_t NewSize) = 0;
00045   virtual size_t GetCapacity () const = 0;
00046 
00053   virtual void SetGrowsBy(size_t) = 0;
00055   virtual size_t GetGrowsBy() const = 0;
00056 
00061   virtual void SetGrowsExponentially(bool) = 0;
00062 
00064   virtual bool GetGrowsExponentially() const = 0;
00065 
00067   virtual void Truncate (size_t iPos) = 0;
00068 
00070   virtual void Reclaim () = 0;
00071 
00073   inline void Clear ()
00074   { Truncate (0); }
00075 
00077   virtual iString *Clone () const = 0;
00078 
00080   virtual char *GetData () const = 0;
00081 
00083   virtual size_t Length () const = 0;
00084 
00086   inline bool IsEmpty () const
00087   { return !Length (); }
00088 
00090   virtual inline char& operator [] (size_t iPos) = 0;
00091 
00093   virtual void SetAt (size_t iPos, char iChar) = 0;
00094 
00096   virtual char GetAt (size_t iPos) const = 0;
00097 
00099   virtual void Insert (size_t iPos, iString *iStr) = 0;
00100 
00102   virtual void Overwrite (size_t iPos, iString *iStr) = 0;
00103 
00105   virtual iString &Append (const char *iStr, size_t iCount = (size_t)-1) = 0;
00106 
00108   virtual iString &Append (const iString *iStr, size_t iCount = (size_t)-1)=0;
00109 
00115   virtual void Format (const char *format, ...) CS_GNUC_PRINTF (2, 3) = 0;
00116 
00122   virtual void FormatV (const char *format, va_list args) = 0;
00123 
00125   virtual void Replace (const iString *iStr, size_t iCount = (size_t)-1) = 0;
00126 
00128   virtual bool Compare (const iString *iStr) const = 0;
00129 
00131   virtual bool CompareNoCase (const iString *iStr) const = 0;
00132 
00134   iString &operator += (const iString &iStr)
00135   { return Append (&iStr); }
00136 
00138   iString &operator += (const char *iStr)
00139   { return Append (iStr); }
00140 
00142   iString &operator + (const iString &iStr) const
00143   { return Clone ()->Append (&iStr); }
00144 
00146   operator const char * () const
00147   { return GetData (); }
00148 
00150   bool operator == (const iString &iStr) const
00151   { return Compare (&iStr); }
00152 };
00153 
00156 #endif // __CS_IUTIL_STRING_H__

Generated for Crystal Space by doxygen 1.2.14