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

| ## Public API Reference

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

- 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,1,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
    00093   virtual void Empty () = 0;
    00094
    00096   virtual csRef<iString> Clone () const = 0;
    00097
    00103   virtual char const* GetData () const = 0;
    00104
    00110   virtual size_t Length () const = 0;
    00111
    00117   virtual bool IsEmpty () const = 0;
    00118
    00120   virtual char& operator [] (size_t n) = 0;
    00121
    00123   virtual char operator [] (size_t n) const = 0;
    00124
    00131   virtual void SetAt (size_t n, char iChar) = 0;
    00132
    00134   virtual char GetAt (size_t n) const = 0;
    00135
    00141   virtual void DeleteAt (size_t Pos, size_t Count = 1) = 0;
    00142
    00148   virtual void Insert (size_t Pos, iString const* Str) = 0;
    00149
    00157   virtual void Overwrite (size_t Pos, iString const* Str) = 0;
    00158
    00165   virtual void Append (const char* Str, size_t Count = (size_t)-1) = 0;
    00166
    00173   virtual void Append (const iString* Str, size_t Count = (size_t)-1) = 0;
    00174
    00181   virtual csRef<iString> Slice (size_t start, size_t len) const = 0;
    00182
    00193   virtual void SubString (iString* sub, size_t start, size_t len) const = 0;
    00194
    00201   virtual size_t FindFirst (const char c, size_t p = (size_t)-1) const = 0;
    00202
    00210   virtual size_t FindLast (const char c, size_t p = (size_t)-1) const = 0;
    00211
    00218   virtual size_t Find (const char* search, size_t pos = 0) const = 0;
    00219
    00224   virtual void ReplaceAll (const char* search, const char* replacement) = 0;
    00225
    00232   virtual void Format (const char* format, ...) CS_GNUC_PRINTF (2, 3) = 0;
    00233
    00241   virtual void FormatV (const char* format, va_list args) = 0;
    00242
    00249   virtual void Replace (const iString* str, size_t count = (size_t)-1) = 0;
    00250
    00257   virtual void Replace (const char* str, size_t count = (size_t)-1) = 0;
    00258
    00265   virtual bool Compare (const iString* Str) const = 0;
    00266
    00273   virtual bool CompareNoCase (const iString* Str) const = 0;
    00274
    00281   virtual bool StartsWith (const iString* Str, bool ignore_case = false) const = 0;
    00282
    00289   virtual bool StartsWith (const char* Str, bool ignore_case = false) const = 0;
    00290
    00292   virtual void operator += (const iString& iStr) = 0;
    00293
    00295   virtual void operator += (const char* iStr) = 0;
    00296
    00298   virtual csRef<iString> operator + (const iString& iStr) const = 0;
    00299
    00305   virtual operator char const* () const = 0;
    00306
    00313   virtual bool operator == (const iString& Str) const = 0;
    00314
    00321   virtual bool operator != (const iString& Str) const = 0;
    00322
    00324   virtual void Downcase() = 0;
    00325
    00327   virtual void Upcase() = 0;
    00328 };
    00329
    00332 #endif // __CS_IUTIL_STRING_H__