Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
sstr::SString Class Referencefinal

String. More...

#include <SString.h>

Inheritance diagram for sstr::SString:
sstr::SStringView

Public Member Functions

 SString () noexcept
 
 SString (const char *str, size_t size)
 
 SString (const SString &s_string) noexcept
 
 SString (SString &&s_string) noexcept
 
 ~SString () noexcept override
 
size_t cap () const
 
size_t size () const override
 
void toLower ()
 Convert the string to lowercase.
 
void toUpper ()
 Convert the string to uppercase.
 
char * data ()
 Get data pointer.
 
void operator+= (const SStringView &str)
 
void operator+= (const char *u8str)
 
- Public Member Functions inherited from sstr::SStringView
 SStringView () noexcept=default
 
 SStringView (const char *u8str) noexcept
 
virtual ~SStringView ()=default
 
Iterator begin ()
 
Iterator end ()
 
bool null () const
 
bool empty () const
 
size_t len () const
 
const char * data () const
 
int32_t find (const SStringView &str) const
 
int32_t find (const char *u8str) const
 
int32_t findByBytes (const char *bytes) const
 
SString trim () const
 
SString reverse () const
 
SString append (const SStringView &str) const
 
SString append (const char *u8str) const
 
std::vector< SStringsplit (const SStringView &str) const
 
std::vector< SStringsplit (const char *str) const
 
SString substring (size_t begin) const
 
SString substring (size_t begin, size_t len) const
 Extract substring [begin, begin + len - 1].
 
bool endsWith (const SStringView &suffix) const
 Check if the string ends with a given substring.
 
bool endsWith (const std::string_view &suffix) const
 Check if the string ends with a given substring.
 
bool startsWith (const SStringView &prefix) const
 Check if the string starts with a given substring.
 
bool startsWith (const std::string_view &prefix) const
 Check if the string starts with a given substring.
 
bool isLower () const
 Check if the letter is entirely lowercase.
 
bool isUpper () const
 Check if the letter is entirely uppercase.
 
SString toLower () const
 Create a copy with all letters converted to lowercase.
 
SString toUpper () const
 Create a copy with all letters converted to uppercase.
 
SChar at (size_t index) const
 
std::vector< SChartoChars () const
 
std::string toString () const
 
std::wstring toWString () const
 
std::unique_ptr< wchar_t[]> toCWString () const
 
SChar operator[] (size_t index) const
 
bool operator!= (const SStringView &str) const
 
bool operator!= (const char *u8str) const
 
bool operator== (const SStringView &str) const
 
bool operator== (const char *u8str) const
 
SString operator+ (const SStringView &str) const
 
SString operator+ (const char *u8str) const
 

Static Public Member Functions

static SString fromSChars (SChar ch[], size_t size)
 
static SString fromSChars (std::vector< SChar > &chars)
 
static SString fromUTF8 (const char *str)
 
static SString fromUCS2LE (const wchar_t *str)
 

Protected Attributes

size_t _capacity = 0
 
- Protected Attributes inherited from sstr::SStringView
char * _data = nullptr
 
size_t _size = 0
 

Friends

class SStringView
 

Detailed Description

String.

Constructor & Destructor Documentation

◆ SString() [1/4]

sstr::SString::SString ( )
explicitnoexcept

◆ SString() [2/4]

SString::SString ( const char * str,
size_t size )

◆ SString() [3/4]

SString::SString ( const SString & s_string)
noexcept

◆ SString() [4/4]

SString::SString ( sstr::SString && s_string)
noexcept

◆ ~SString()

sstr::SString::~SString ( )
overridenoexcept

References free().

Member Function Documentation

◆ cap()

size_t SString::cap ( ) const
nodiscard

Get buffer capacity

Returns
Buffer capacity

References _capacity.

◆ data()

char * sstr::SString::data ( )

Get data pointer.

Deprecated
This function should generally not be used

◆ fromSChars() [1/2]

◆ fromSChars() [2/2]

◆ fromUCS2LE()

◆ fromUTF8()

◆ operator+=() [1/2]

void SString::operator+= ( const char * u8str)

◆ operator+=() [2/2]

◆ size()

size_t SString::size ( ) const
nodiscardoverridevirtual

Get used buffer size

Returns
Used buffer size

Reimplemented from sstr::SStringView.

References sstr::SStringView::_size.

Referenced by fromSChars(), and SString().

◆ toLower()

void SString::toLower ( )

Convert the string to lowercase.

References sstr::SStringView::_data, and toLower().

Referenced by toLower().

◆ toUpper()

void SString::toUpper ( )

Convert the string to uppercase.

References sstr::SStringView::_data, and toUpper().

Referenced by toUpper().

Friends And Related Symbol Documentation

◆ SStringView

friend class SStringView
friend

Member Data Documentation

◆ _capacity


The documentation for this class was generated from the following files: