CrystalSpace

Public API Reference

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 
00033 #include "csutil/win32/msvc_deprecated_warn_off.h"
00034 
00036 class CS_CRYSTALSPACE_EXPORT scfString : 
00037   public scfImplementation1<scfString, iString>
00038 {
00039   csString s;
00040 
00041 public:
00042 
00044   scfString ()
00045     : scfImplementationType (this)
00046   { }
00047 
00049   scfString (size_t iLength) 
00050     : scfImplementationType (this), s(iLength)
00051   { }
00052 
00054   scfString (const iString &copy) 
00055     : iBase(), scfImplementationType (this), s(copy.GetData())
00056   { }
00057 
00059   scfString (const char *copy) 
00060     : scfImplementationType (this), s(copy)
00061   { }
00062 
00064   virtual ~scfString ()
00065   { }
00066 
00068   const csString& GetCsString () const { return s; }
00069 
00071   csString& GetCsString () { return s; }
00072 
00074   virtual void SetCapacity (size_t NewSize);
00076   virtual size_t GetCapacity() const;
00078   virtual void SetGrowsBy(size_t);
00080   virtual size_t GetGrowsBy() const;
00081 
00083   virtual void Truncate (size_t iPos);
00084 
00086   virtual void ShrinkBestFit ();
00087 
00088 
00090   virtual void Empty ();
00091 
00096   /* CS_DEPRECATED_METHOD_MSG("Use Empty() instead.") */ 
00097   virtual void Clear ()
00098   { Empty(); }
00099 
00101   virtual csRef<iString> Clone () const;
00102 
00104   virtual char const* GetData () const;
00105 
00107   /*CS_DEPRECATED_METHOD*/ 
00108   // @@@ GCC and VC always seem to prefer this GetData() and barf "deprecated".
00109   virtual char* GetData ();
00110 
00112   virtual size_t Length () const;
00113 
00115   virtual bool IsEmpty () const;
00116 
00118   virtual char& operator [] (size_t iPos);
00119 
00121   virtual char operator [] (size_t iPos) const;
00122 
00124   virtual void SetAt (size_t iPos, char iChar);
00125 
00127   virtual char GetAt (size_t iPos) const;
00128 
00130   virtual void DeleteAt (size_t iPos, size_t iCount);
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 bool Compare (const char* iStr) const;
00237 
00239   virtual bool CompareNoCase (const char* iStr) const;
00240 
00242   virtual bool StartsWith (const iString* iStr, bool ignore_case = false) const;
00243 
00245   virtual bool StartsWith (const char* iStr, bool ignore_case = false) const;
00246 
00248   virtual void operator += (const iString& iStr);
00249 
00251   virtual void operator += (const char* iStr);
00252 
00254   virtual void operator += (char c);
00255 
00257   virtual csRef<iString> operator + (const iString &iStr) const;
00258 
00260   virtual operator char const* () const;
00261 
00263   virtual bool operator == (const iString &iStr) const;
00264 
00266   virtual bool operator != (const iString &iStr) const;
00267 
00269   virtual void Downcase();
00270 
00272   virtual void Upcase();
00273 };
00274 
00275 #include "csutil/win32/msvc_deprecated_warn_on.h"
00276 
00277 #endif // __CS_SCFSTR_H__

Generated for Crystal Space 1.2.1 by doxygen 1.5.3