Crystal Space: iutil/string.h Source File (Crystal Space Public API Reference)

| ## 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_MSG("Use ShrinkBestFit() instead")
    00098   virtual void Reclaim () = 0;
    00099
    00105   virtual void Empty () = 0;
    00106
    00113   CS_DEPRECATED_METHOD_MSG("Use Empty() instead")
    00114   virtual void Clear () = 0;
    00115
    00117   virtual csRef<iString> Clone () const = 0;
    00118
    00124   virtual char const* GetData () const = 0;
    00125
    00133   /*CS_DEPRECATED_METHOD*/
    00134   // @@@ GCC and VC always seem to prefer this GetData() and barf "deprecated".
    00135   virtual char* GetData () = 0;
    00136
    00142   virtual size_t Length () const = 0;
    00143
    00149   virtual bool IsEmpty () const = 0;
    00150
    00152   virtual char& operator [] (size_t n) = 0;
    00153
    00155   virtual char operator [] (size_t n) const = 0;
    00156
    00163   virtual void SetAt (size_t n, char iChar) = 0;
    00164
    00166   virtual char GetAt (size_t n) const = 0;
    00167
    00173   virtual void Insert (size_t Pos, iString const* Str) = 0;
    00174
    00182   virtual void Overwrite (size_t Pos, iString const* Str) = 0;
    00183
    00190   virtual void Append (const char* Str, size_t Count = (size_t)-1) = 0;
    00191
    00198   virtual void Append (const iString* Str, size_t Count = (size_t)-1) = 0;
    00199
    00206   virtual csRef<iString> Slice (size_t start, size_t len) const = 0;
    00207
    00218   virtual void SubString (iString* sub, size_t start, size_t len) const = 0;
    00219
    00226   virtual size_t FindFirst (const char c, size_t p = (size_t)-1) const = 0;
    00227
    00235   virtual size_t FindLast (const char c, size_t p = (size_t)-1) const = 0;
    00236
    00243   virtual size_t Find (const char* search, size_t pos = 0) const = 0;
    00244
    00249   virtual void ReplaceAll (const char* search, const char* replacement) = 0;
    00250
    00257   virtual void Format (const char* format, ...) CS_GNUC_PRINTF (2, 3) = 0;
    00258
    00266   virtual void FormatV (const char* format, va_list args) = 0;
    00267
    00274   virtual void Replace (const iString* str, size_t count = (size_t)-1) = 0;
    00275
    00282   virtual void Replace (const char* str, size_t count = (size_t)-1) = 0;
    00283
    00290   virtual bool Compare (const iString* Str) const = 0;
    00291
    00298   virtual bool CompareNoCase (const iString* Str) const = 0;
    00299
    00301   virtual void operator += (const iString& iStr) = 0;
    00302
    00304   virtual void operator += (const char* iStr) = 0;
    00305
    00307   virtual csRef<iString> operator + (const iString& iStr) const = 0;
    00308
    00314   virtual operator char const* () const = 0;
    00315
    00322   virtual bool operator == (const iString& Str) const = 0;
    00323
    00330   virtual bool operator != (const iString& Str) const = 0;
    00331
    00333   virtual void Downcase() = 0;
    00334
    00336   virtual void Upcase() = 0;
    00337 };
    00338
    00341 #endif // __CS_IUTIL_STRING_H__