25 #ifndef SFML_STRING_HPP
26 #define SFML_STRING_HPP
31 #include <SFML/System/Export.hpp>
32 #include <SFML/System/Utf.hpp>
51 typedef std::basic_string<Uint32>::iterator
Iterator;
77 String(
char ansiChar,
const std::locale& locale = std::locale());
105 String(
const char* ansiString,
const std::locale& locale = std::locale());
117 String(
const std::string& ansiString,
const std::locale& locale = std::locale());
125 String(
const wchar_t* wideString);
133 String(
const std::wstring& wideString);
141 String(
const Uint32* utf32String);
149 String(
const std::basic_string<Uint32>& utf32String);
170 template <
typename T>
171 static String fromUtf8(T begin, T end);
184 template <
typename T>
185 static String fromUtf16(T begin, T end);
202 template <
typename T>
203 static String fromUtf32(T begin, T end);
220 operator std::string()
const;
235 operator std::wstring()
const;
252 std::string toAnsiString(
const std::locale& locale = std::locale())
const;
265 std::wstring toWideString()
const;
275 std::basic_string<Uint8> toUtf8()
const;
285 std::basic_string<Uint16> toUtf16()
const;
298 std::basic_string<Uint32> toUtf32()
const;
331 Uint32 operator [](std::size_t index)
const;
344 Uint32& operator [](std::size_t index);
364 std::size_t getSize()
const;
374 bool isEmpty()
const;
386 void erase(std::size_t position, std::size_t count = 1);
398 void insert(std::size_t position,
const String& str);
412 std::size_t find(
const String& str, std::size_t start = 0)
const;
426 void replace(std::size_t position, std::size_t length,
const String& replaceWith);
438 void replace(
const String& searchFor,
const String& replaceWith);
455 String substring(std::size_t position, std::size_t length = InvalidPos)
const;
468 const Uint32* getData()
const;
488 ConstIterator begin()
const;
516 ConstIterator end()
const;
520 friend SFML_SYSTEM_API
bool operator ==(
const String& left,
const String& right);
521 friend SFML_SYSTEM_API
bool operator <(
const String& left,
const String& right);
526 std::basic_string<Uint32> m_string;
539 SFML_SYSTEM_API
bool operator ==(
const String& left,
const String& right);
551 SFML_SYSTEM_API
bool operator !=(
const String& left,
const String& right);
563 SFML_SYSTEM_API
bool operator <(
const String& left,
const String& right);
575 SFML_SYSTEM_API
bool operator >(
const String& left,
const String& right);
587 SFML_SYSTEM_API
bool operator <=(
const String& left,
const String& right);
599 SFML_SYSTEM_API
bool operator >=(
const String& left,
const String& right);
613 #include <SFML/System/String.inl>
618 #endif // SFML_STRING_HPP
Utility string class that automatically handles conversions between types and encodings.
std::basic_string< Uint32 >::const_iterator ConstIterator
Read-only iterator type.
std::basic_string< Uint32 >::iterator Iterator
Iterator type.
static const std::size_t InvalidPos
Represents an invalid position in the string.