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 
00092   CS_DEPRECATED_METHOD_MSG("Use ShrinkBestFit() instead.")
00093   virtual void Reclaim ()
00094   { ShrinkBestFit(); }
00095 
00097   virtual void Empty ();
00098 
00103   /* CS_DEPRECATED_METHOD_MSG("Use Empty() instead.") */ 
00104   virtual void Clear ()
00105   { Empty(); }
00106 
00108   virtual csRef<iString> Clone () const;
00109 
00111   virtual char const* GetData () const;
00112 
00114   /*CS_DEPRECATED_METHOD*/ 
00115   // @@@ GCC and VC always seem to prefer this GetData() and barf "deprecated".
00116   virtual char* GetData ();
00117 
00119   virtual size_t Length () const;
00120 
00122   virtual bool IsEmpty () const;
00123 
00125   virtual char& operator [] (size_t iPos);
00126 
00128   virtual char operator [] (size_t iPos) const;
00129 
00131   virtual void SetAt (size_t iPos, char iChar);
00132 
00134   virtual char GetAt (size_t iPos) const;
00135 
00137   virtual void Insert (size_t iPos, iString const* iStr);
00138 
00140   virtual void Overwrite (size_t iPos, iString const* iStr);
00141 
00143   virtual void Append (const char* iStr, size_t iCount = (size_t)-1);
00144 
00146   virtual void Append (iString const* iStr, size_t iCount = (size_t)-1);
00147 
00149   virtual void Append (char c);
00150 
00157   virtual csRef<iString> Slice (size_t start=0, size_t len=(size_t)-1) const;
00158 
00166   virtual csRef<iString> ReverseSlice (size_t start,
00167         size_t len=(size_t)-1) const;
00168 
00175   virtual void SubString (iString* sub, size_t start,
00176         size_t len=(size_t)-1) const;
00177 
00187   virtual void ReverseSubString (iString* sub, size_t start=0,
00188         size_t len=(size_t)-1) const;
00189 
00194   virtual size_t FindFirst (const char c, size_t p = (size_t)-1) const;
00200   virtual size_t FindLast (const char c, size_t p = (size_t)-1) const;
00201 
00208   virtual size_t Find (const char* search, size_t pos = 0) const;
00209 
00214   virtual void ReplaceAll (const char* search, const char* replacement);
00215 
00220   virtual void Format (const char* format, ...) CS_GNUC_PRINTF (2, 3);
00225   virtual void FormatV (const char* format, va_list args);
00226 
00228   virtual void Replace (const iString* iStr, size_t iCount = (size_t)-1);
00229 
00231   virtual void Replace (const char* iStr, size_t iCount = (size_t)-1);
00232 
00234   virtual bool Compare (const iString* iStr) const;
00235 
00237   virtual bool CompareNoCase (const iString* iStr) const;
00238 
00240   virtual void operator += (const iString& iStr);
00241 
00243   virtual void operator += (const char* iStr);
00244 
00246   virtual void operator += (char c);
00247 
00249   virtual csRef<iString> operator + (const iString &iStr) const;
00250 
00252   virtual operator char const* () const;
00253 
00255   virtual bool operator == (const iString &iStr) const;
00256 
00258   virtual bool operator != (const iString &iStr) const;
00259 
00261   virtual void Downcase();
00262 
00264   virtual void Upcase();
00265 };
00266 
00267 #include "csutil/win32/msvc_deprecated_warn_on.h"
00268 
00269 #endif // __CS_SCFSTR_H__

Generated for Crystal Space by doxygen 1.4.7