## Public API Reference

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

- 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     : scfImplementationType (this)
    00044   { }
    00045
    00047   scfString (size_t iLength)
    00048     : scfImplementationType (this), s(iLength)
    00049   { }
    00050
    00052   scfString (const iString &copy)
    00053     : iBase(), scfImplementationType (this), s(copy.GetData())
    00054   { }
    00055
    00057   scfString (const char *copy)
    00058     : scfImplementationType (this), s(copy)
    00059   { }
    00060
    00062   virtual ~scfString ()
    00063   { }
    00064
    00066   const csString& GetCsString () const { return s; }
    00067
    00069   csString& GetCsString () { return s; }
    00070
    00072   virtual void SetCapacity (size_t NewSize);
    00074   virtual size_t GetCapacity() const;
    00076   virtual void SetGrowsBy(size_t);
    00078   virtual size_t GetGrowsBy() const;
    00079
    00081   virtual void Truncate (size_t iPos);
    00082
    00084   virtual void ShrinkBestFit ();
    00085
    00090   CS_DEPRECATED_METHOD virtual void Reclaim ()
    00091   { ShrinkBestFit(); }
    00092
    00094   virtual void Empty ();
    00095
    00100   /* CS_DEPRECATED_METHOD */ virtual void Clear ()
    00101   { Empty(); }
    00102
    00104   virtual csRef<iString> Clone () const;
    00105
    00107   virtual char const* GetData () const;
    00108
    00110   /*CS_DEPRECATED_METHOD*/
    00111   // @@@ GCC and VC always seem to prefer this GetData() and barf "deprecated".
    00112   virtual char* GetData ();
    00113
    00115   virtual size_t Length () const;
    00116
    00118   virtual bool IsEmpty () const;
    00119
    00121   virtual char& operator [] (size_t iPos);
    00122
    00124   virtual char operator [] (size_t iPos) const;
    00125
    00127   virtual void SetAt (size_t iPos, char iChar);
    00128
    00130   virtual char GetAt (size_t iPos) const;
    00131
    00133   virtual void Insert (size_t iPos, iString const* iStr);
    00134
    00136   virtual void Overwrite (size_t iPos, iString const* iStr);
    00137
    00139   virtual void Append (const char* iStr, size_t iCount = (size_t)-1);
    00140
    00142   virtual void Append (iString const* iStr, size_t iCount = (size_t)-1);
    00143
    00145   virtual void Append (char c);
    00146
    00153   virtual csRef<iString> Slice (size_t start=0, size_t len=(size_t)-1) const;
    00154
    00162   virtual csRef<iString> ReverseSlice (size_t start,
    00163         size_t len=(size_t)-1) const;
    00164
    00171   virtual void SubString (iString* sub, size_t start,
    00172         size_t len=(size_t)-1) const;
    00173
    00183   virtual void ReverseSubString (iString* sub, size_t start=0,
    00184         size_t len=(size_t)-1) const;
    00185
    00190   virtual size_t FindFirst (const char c, size_t p = (size_t)-1) const;
    00196   virtual size_t FindLast (const char c, size_t p = (size_t)-1) const;
    00197
    00204   virtual size_t Find (const char* search, size_t pos = 0) const;
    00205
    00210   virtual void ReplaceAll (const char* search, const char* replacement);
    00211
    00216   virtual void Format (const char* format, ...) CS_GNUC_PRINTF (2, 3);
    00221   virtual void FormatV (const char* format, va_list args);
    00222
    00224   virtual void Replace (const iString* iStr, size_t iCount = (size_t)-1);
    00225
    00227   virtual void Replace (const char* iStr, size_t iCount = (size_t)-1);
    00228
    00230   virtual bool Compare (const iString* iStr) const;
    00231
    00233   virtual bool CompareNoCase (const iString* iStr) const;
    00234
    00236   virtual void operator += (const iString& iStr);
    00237
    00239   virtual void operator += (const char* iStr);
    00240
    00242   virtual void operator += (char c);
    00243
    00245   virtual csRef<iString> operator + (const iString &iStr) const;
    00246
    00248   virtual operator char const* () const;
    00249
    00251   virtual bool operator == (const iString &iStr) const;
    00252
    00254   virtual bool operator != (const iString &iStr) const;
    00255
    00257   virtual void Downcase();
    00258
    00260   virtual void Upcase();
    00261 };
    00262
    00263 #endif // __CS_SCFSTR_H__