## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# iutil/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 "csutil/scf_interface.h"
    00029
    00030
    00032 struct iString : public virtual iBase
    00033 {
    00034   SCF_INTERFACE(iString, 2,0,0);
    00043   virtual void SetCapacity (size_t NewSize) = 0;
    00045   virtual size_t GetCapacity () const = 0;
    00046
    00059   virtual void SetGrowsBy(size_t) = 0;
    00065   virtual size_t GetGrowsBy() const = 0;
    00066
    00076   virtual void Truncate (size_t Len) = 0;
    00077
    00086   virtual void ShrinkBestFit () = 0;
    00087
    00097   CS_DEPRECATED_METHOD virtual void Reclaim () = 0;
    00098
    00104   virtual void Empty () = 0;
    00105
    00112   /* CS_DEPRECATED_METHOD */ virtual void Clear () = 0;
    00113
    00115   virtual csRef<iString> Clone () const = 0;
    00116
    00122   virtual char const* GetData () const = 0;
    00123
    00131   /*CS_DEPRECATED_METHOD*/
    00132   // @@@ GCC and VC always seem to prefer this GetData() and barf "deprecated".
    00133   virtual char* GetData () = 0;
    00134
    00140   virtual size_t Length () const = 0;
    00141
    00147   virtual bool IsEmpty () const = 0;
    00148
    00150   virtual char& operator [] (size_t n) = 0;
    00151
    00153   virtual char operator [] (size_t n) const = 0;
    00154
    00161   virtual void SetAt (size_t n, char iChar) = 0;
    00162
    00164   virtual char GetAt (size_t n) const = 0;
    00165
    00171   virtual void Insert (size_t Pos, iString const* Str) = 0;
    00172
    00180   virtual void Overwrite (size_t Pos, iString const* Str) = 0;
    00181
    00188   virtual void Append (const char* Str, size_t Count = (size_t)-1) = 0;
    00189
    00196   virtual void Append (const iString* Str, size_t Count = (size_t)-1) = 0;
    00197
    00204   virtual csRef<iString> Slice (size_t start, size_t len) const = 0;
    00205
    00216   virtual void SubString (iString* sub, size_t start, size_t len) const = 0;
    00217
    00224   virtual size_t FindFirst (const char c, size_t p = (size_t)-1) const = 0;
    00225
    00233   virtual size_t FindLast (const char c, size_t p = (size_t)-1) const = 0;
    00234
    00241   virtual size_t Find (const char* search, size_t pos = 0) const = 0;
    00242
    00247   virtual void ReplaceAll (const char* search, const char* replacement) = 0;
    00248
    00255   virtual void Format (const char* format, ...) CS_GNUC_PRINTF (2, 3) = 0;
    00256
    00264   virtual void FormatV (const char* format, va_list args) = 0;
    00265
    00272   virtual void Replace (const iString* str, size_t count = (size_t)-1) = 0;
    00273
    00280   virtual void Replace (const char* str, size_t count = (size_t)-1) = 0;
    00281
    00288   virtual bool Compare (const iString* Str) const = 0;
    00289
    00296   virtual bool CompareNoCase (const iString* Str) const = 0;
    00297
    00299   virtual void operator += (const iString& iStr) = 0;
    00300
    00302   virtual void operator += (const char* iStr) = 0;
    00303
    00305   virtual csRef<iString> operator + (const iString& iStr) const = 0;
    00306
    00312   virtual operator char const* () const = 0;
    00313
    00320   virtual bool operator == (const iString& Str) const = 0;
    00321
    00328   virtual bool operator != (const iString& Str) const = 0;
    00329
    00331   virtual void Downcase() = 0;
    00332
    00334   virtual void Upcase() = 0;
    00335 };
    00336
    00339 #endif // __CS_IUTIL_STRING_H__