csutil/scfstr.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

csutil/scfstr.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_SCFSTR_H__
    00021 #define __CS_SCFSTR_H__
    00022
    00027 #include "csextern.h"
    00028
    00029 #include "csutil/csstring.h"
    00030 #include "csutil/scf_implementation.h"
    00031 #include "iutil/string.h"
    00032
    00034 class CS_CRYSTALSPACE_EXPORT scfString :
    00035   public scfImplementation1<scfString, iString>
    00036 {
    00037   csString s;
    00038
    00039 public:
    00040
    00042   scfString ();
    00043
    00045   scfString (size_t iLength);
    00046
    00048   scfString (const iString &copy);
    00049
    00051   scfString (const char *copy);
    00052
    00054   virtual ~scfString ();
    00055
    00057   const csString& GetCsString () const { return s; }
    00058
    00060   csString& GetCsString () { return s; }
    00061
    00063   virtual void SetCapacity (size_t NewSize);
    00065   virtual size_t GetCapacity() const;
    00067   virtual void SetGrowsBy(size_t);
    00069   virtual size_t GetGrowsBy() const;
    00070
    00072   virtual void Truncate (size_t iPos);
    00073
    00075   virtual void ShrinkBestFit ();
    00076
    00077
    00079   virtual void Empty ();
    00080
    00082   virtual csRef<iString> Clone () const;
    00083
    00085   virtual char const* GetData () const;
    00086
    00088   virtual size_t Length () const;
    00089
    00091   virtual bool IsEmpty () const;
    00092
    00094   virtual char& operator [] (size_t iPos);
    00095
    00097   virtual char operator [] (size_t iPos) const;
    00098
    00100   virtual void SetAt (size_t iPos, char iChar);
    00101
    00103   virtual char GetAt (size_t iPos) const;
    00104
    00106   virtual void DeleteAt (size_t iPos, size_t iCount);
    00107
    00109   virtual void Insert (size_t iPos, iString const* iStr);
    00110
    00112   virtual void Overwrite (size_t iPos, iString const* iStr);
    00113
    00115   virtual void Append (const char* iStr, size_t iCount = (size_t)-1);
    00116
    00118   virtual void Append (iString const* iStr, size_t iCount = (size_t)-1);
    00119
    00121   virtual void Append (char c);
    00122
    00129   virtual csRef<iString> Slice (size_t start=0, size_t len=(size_t)-1) const;
    00130
    00138   virtual csRef<iString> ReverseSlice (size_t start,
    00139         size_t len=(size_t)-1) const;
    00140
    00147   virtual void SubString (iString* sub, size_t start,
    00148         size_t len=(size_t)-1) const;
    00149
    00159   virtual void ReverseSubString (iString* sub, size_t start=0,
    00160         size_t len=(size_t)-1) const;
    00161
    00166   virtual size_t FindFirst (const char c, size_t p = (size_t)-1) const;
    00172   virtual size_t FindLast (const char c, size_t p = (size_t)-1) const;
    00173
    00180   virtual size_t Find (const char* search, size_t pos = 0) const;
    00181
    00186   virtual void ReplaceAll (const char* search, const char* replacement);
    00187
    00192   virtual void Format (const char* format, ...) CS_GNUC_PRINTF (2, 3);
    00197   virtual void FormatV (const char* format, va_list args);
    00198
    00200   virtual void Replace (const iString* iStr, size_t iCount = (size_t)-1);
    00201
    00203   virtual void Replace (const char* iStr, size_t iCount = (size_t)-1);
    00204
    00206   virtual bool Compare (const iString* iStr) const;
    00207
    00209   virtual bool CompareNoCase (const iString* iStr) const;
    00210
    00212   virtual bool Compare (const char* iStr) const;
    00213
    00215   virtual bool CompareNoCase (const char* iStr) const;
    00216
    00218   virtual bool StartsWith (const iString* iStr, bool ignore_case = false) const;
    00219
    00221   virtual bool StartsWith (const char* iStr, bool ignore_case = false) const;
    00222
    00224   virtual void operator += (const iString& iStr);
    00225
    00227   virtual void operator += (const char* iStr);
    00228
    00230   virtual void operator += (char c);
    00231
    00233   virtual csRef<iString> operator + (const iString &iStr) const;
    00234
    00236   virtual operator char const* () const;
    00237
    00239   virtual bool operator == (const iString &iStr) const;
    00240
    00242   virtual bool operator != (const iString &iStr) const;
    00243
    00245   virtual void Downcase();
    00246
    00248   virtual void Upcase();
    00249 };
    00250
    00251 #endif // __CS_SCFSTR_H__