00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00024
00025 #ifndef SFML_STRING_HPP
00026 #define SFML_STRING_HPP
00027
00029
00031 #include <SFML/Config.hpp>
00032 #include <locale>
00033 #include <string>
00034
00035
00036 namespace sf
00037 {
00043 class SFML_API String
00044 {
00045 public :
00046
00048
00050 typedef std::basic_string<Uint32>::iterator Iterator;
00051 typedef std::basic_string<Uint32>::const_iterator ConstIterator;
00052
00054
00056 static const std::size_t InvalidPos;
00057
00064 String();
00065
00076 String(char ansiChar, const std::locale& locale = std::locale());
00077
00084 String(wchar_t wideChar);
00085
00092 String(Uint32 utf32Char);
00093
00104 String(const char* ansiString, const std::locale& locale = std::locale());
00105
00116 String(const std::string& ansiString, const std::locale& locale = std::locale());
00117
00124 String(const wchar_t* wideString);
00125
00132 String(const std::wstring& wideString);
00133
00140 String(const Uint32* utf32String);
00141
00148 String(const std::basic_string<Uint32>& utf32String);
00149
00156 String(const String& copy);
00157
00173 operator std::string() const;
00174
00188 operator std::wstring() const;
00189
00205 std::string ToAnsiString(const std::locale& locale = std::locale()) const;
00206
00218 std::wstring ToWideString() const;
00219
00228 String& operator =(const String& right);
00229
00238 String& operator +=(const String& right);
00239
00251 Uint32 operator [](std::size_t index) const;
00252
00264 Uint32& operator [](std::size_t index);
00265
00274 void Clear();
00275
00284 std::size_t GetSize() const;
00285
00294 bool IsEmpty() const;
00295
00306 void Erase(std::size_t position, std::size_t count = 1);
00307
00318 void Insert(std::size_t position, const String& str);
00319
00332 std::size_t Find(const String& str, std::size_t start = 0) const;
00333
00345 const Uint32* GetData() const;
00346
00355 Iterator Begin();
00356
00365 ConstIterator Begin() const;
00366
00379 Iterator End();
00380
00393 ConstIterator End() const;
00394
00395 private :
00396
00397 friend SFML_API bool operator ==(const String& left, const String& right);
00398 friend SFML_API bool operator <(const String& left, const String& right);
00399
00401
00403 std::basic_string<Uint32> myString;
00404 };
00405
00416 SFML_API bool operator ==(const String& left, const String& right);
00417
00428 SFML_API bool operator !=(const String& left, const String& right);
00429
00440 SFML_API bool operator <(const String& left, const String& right);
00441
00452 SFML_API bool operator >(const String& left, const String& right);
00453
00464 SFML_API bool operator <=(const String& left, const String& right);
00465
00476 SFML_API bool operator >=(const String& left, const String& right);
00477
00488 SFML_API String operator +(const String& left, const String& right);
00489
00490 }
00491
00492
00493 #endif // SFML_STRING_HPP
00494
00495