template<typename T>
BufferedSafeStringBase class
Derived classes
-
template<typename T, s32 L>class FixedSafeStringBase
-
template<typename T>class HeapSafeStringBase
Constructors, destructors, conversion operators
- __attribute__((always_inline)) BufferedSafeStringBase(T *buffer
- if(size<= 0)
- BufferedSafeStringBase(const BufferedSafeStringBase&) defaulted
- ~BufferedSafeStringBase() defaulted override
Public functions
- auto operator=(const SafeStringBase<T>& other) -> BufferedSafeStringBase<T>& override
- auto operator[](s32 idx) const -> const T&
- auto getBuffer() -> T*
- auto getBufferSize() const -> s32
- auto copy(const SafeStringBase<T>& src, s32 copyLength = -1) -> s32
- auto copyAt(s32 at, const SafeStringBase<T>& src, s32 copyLength = -1) -> s32
- auto cutOffCopy(const SafeStringBase<T>& src, s32 copyLength = -1) -> s32
- auto cutOffCopyAt(s32 at, const SafeStringBase<T>& src, s32 copyLength = -1) -> s32
- auto copyAtWithTerminate(s32 at, const SafeStringBase<T>& src, s32 copyLength = -1) -> s32
- auto format(const T* format, ...) -> s32
- auto formatV(const T* format, std::va_list args) -> s32
- auto appendWithFormat(const T* formatStr, ...) -> s32
- auto appendWithFormatV(const T* formatStr, std::va_list args) -> s32
- auto append(const SafeStringBase<T>& str, s32 append_length = -1) -> s32
- Append append_length characters from str.
- auto append(T c) -> s32
- Append a character.
- auto append(T c, s32 n) -> s32
- Append a character n times.
- auto prepend(const SafeStringBase<T>& str, s32 prepend_length = -1) -> s32
- auto chop(s32 num) -> s32
- auto chopMatchedChar(T c) -> s32
- auto chopMatchedChar(const T* characters) -> s32
- auto chopUnprintableAsciiChar() -> s32
- auto rstrip(const T* characters) -> s32
- auto rstripUnprintableAsciiChars() -> s32
- auto trim(s32 trim_length) -> s32
- auto trimMatchedString(const SafeStringBase<T>& suffix) -> s32
- auto removeSuffix(const SafeStringBase<T>& suffix) -> s32
- auto replaceChar(T old_char, T new_char) -> s32
- auto replaceCharList(const SafeStringBase<T>& old_chars, const SafeStringBase<T>& new_chars) -> s32
- auto setReplaceString(const SafeStringBase<T>& target_str, const SafeStringBase<T>& old_str, const SafeStringBase<T>& new_str) -> s32
- auto replaceString(const SafeStringBase<T>& old_str, const SafeStringBase<T>& new_str) -> s32
- auto convertFromMultiByteString(const SafeStringBase<char>& str, s32 str_length) -> s32
- auto convertFromWideCharString(const SafeStringBase<char16>& str, s32 str_length) -> s32
- void clear()
- auto format(const char* formatStr, ...) -> s32
- auto format(const char16* formatStr, ...) -> s32
- auto formatV(const char* formatStr, va_list args) -> s32
- auto formatV(const char16* formatStr, va_list args) -> s32
- auto appendWithFormat(const char* formatStr, ...) -> s32
- auto appendWithFormat(const char16* formatStr, ...) -> s32
- auto appendWithFormatV(const char* formatStr, va_list args) -> s32
- auto appendWithFormatV(const char16* formatStr, va_list args) -> s32
- auto operator=(const SafeStringBase<char>& other) -> BufferedSafeStringBase<char>&
- auto operator=(const SafeStringBase<char16>& other) -> BufferedSafeStringBase<char16>&
- auto formatV(const char* formatStr, va_list args) -> s32
- auto formatV(const char16* formatStr, va_list args) -> s32
- auto format(const char* formatStr, ...) -> s32
- auto format(const char16* formatStr, ...) -> s32
- auto appendWithFormatV(const char* format, std::va_list args) -> s32
- auto appendWithFormatV(const char16* format, std::va_list args) -> s32
- auto appendWithFormat(const char* format, ...) -> s32
- auto appendWithFormat(const char16* format, ...) -> s32
Public variables
Protected static functions
- static auto formatImpl_(T* dst, s32 dst_size, const T* format, std::va_list arg) -> s32
Protected functions
- void assureTerminationImpl_() const override
- auto getMutableStringTop_() -> T*
-
template<typename OtherType>auto convertFromOtherType_(const SafeStringBase<OtherType>& src, s32 src_size) -> s32
- void assureTerminationImpl_() const
- void assureTerminationImpl_() const
- auto formatImpl_(char* s, s32 n, const char* formatStr, va_list args) -> s32
- auto formatImpl_(char16* s, s32 n, const char16* formatStr, va_list args) -> s32
Protected variables
Function documentation
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: copy(const SafeStringBase<T>& src,
s32 copyLength = -1)
| Parameters | |
|---|---|
| src | Source string |
| copyLength | Number of characters from src to copy (must not cause a buffer overflow) |
Copy up to copyLength characters to the beginning of the string, then writes NUL.
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: copyAt(s32 at,
const SafeStringBase<T>& src,
s32 copyLength = -1)
| Parameters | |
|---|---|
| at | Start position (-1 for end of string) |
| src | Source string |
| copyLength | Number of characters from src to copy (must not cause a buffer overflow) |
Copy up to copyLength characters to the specified position, then writes NUL if the copy makes this string longer.
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: cutOffCopy(const SafeStringBase<T>& src,
s32 copyLength = -1)
| Parameters | |
|---|---|
| src | Source string |
| copyLength | Number of characters from src to copy |
Copy up to copyLength characters to the beginning of the string, then writes NUL. Silently truncates the source string if the buffer is too small.
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: cutOffCopyAt(s32 at,
const SafeStringBase<T>& src,
s32 copyLength = -1)
| Parameters | |
|---|---|
| at | Start position (-1 for end of string) |
| src | Source string |
| copyLength | Number of characters from src to copy |
Copy up to copyLength characters to the specified position, then writes NUL if the copy makes this string longer. Silently truncates the source string if the buffer is too small.
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: copyAtWithTerminate(s32 at,
const SafeStringBase<T>& src,
s32 copyLength = -1)
| Parameters | |
|---|---|
| at | Start position (-1 for end of string) |
| src | Source string |
| copyLength | Number of characters from src to copy (must not cause a buffer overflow) |
Copy up to copyLength characters to the specified position, then always writes NUL.
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: prepend(const SafeStringBase<T>& str,
s32 prepend_length = -1)
| Returns | the new length |
|---|
Append prepend_length characters from str.
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: chopMatchedChar(T c)
| Returns | the number of characters that were removed |
|---|
Remove the last character if it is equal to c.
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: chopMatchedChar(const T* characters)
| Parameters | |
|---|---|
| characters | List of characters to remove |
| Returns | the number of characters that were removed |
Remove the last character if it is equal to any of the specified characters.
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: chopUnprintableAsciiChar()
| Returns | the number of characters that were removed |
|---|
Remove the last character if it is unprintable.
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: rstripUnprintableAsciiChars()
| Returns | the number of characters that were removed |
|---|
Remove trailing characters that are unprintable.
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: trimMatchedString(const SafeStringBase<T>& suffix)
| Returns | the new length |
|---|
Remove the specified suffix from the string if it ends with the suffix.
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: removeSuffix(const SafeStringBase<T>& suffix)
| Returns | the new length |
|---|
Remove the specified suffix from the string if it ends with the suffix. Alias of trimMatchedString.
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: replaceChar(T old_char,
T new_char)
| Returns | the number of characters that were replaced |
|---|
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: replaceCharList(const SafeStringBase<T>& old_chars,
const SafeStringBase<T>& new_chars)
| Returns | the number of characters that were replaced |
|---|
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: setReplaceString(const SafeStringBase<T>& target_str,
const SafeStringBase<T>& old_str,
const SafeStringBase<T>& new_str)
| Returns | the number of replaced occurrences |
|---|
Set the contents of this string to target_str, after replacing occurrences of old_str in target_str with new_str.
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: replaceString(const SafeStringBase<T>& old_str,
const SafeStringBase<T>& new_str)
| Returns | the number of replaced occurrences |
|---|
Replace occurrences of old_str in this string with new_str.
template<typename T>
BufferedSafeStringBase<char>& sead:: BufferedSafeStringBase<T>:: operator=(const SafeStringBase<char>& other)
template<typename T>
BufferedSafeStringBase<char16>& sead:: BufferedSafeStringBase<T>:: operator=(const SafeStringBase<char16>& other)
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: appendWithFormatV(const char* format,
std::va_list args)
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: appendWithFormatV(const char16* format,
std::va_list args)
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: appendWithFormat(const char* format,
...)
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: appendWithFormat(const char16* format,
...)
template<typename T>
void sead:: BufferedSafeStringBase<T>:: assureTerminationImpl_() const protected
template<typename T>
void sead:: BufferedSafeStringBase<T>:: assureTerminationImpl_() const protected
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: formatImpl_(char* s,
s32 n,
const char* formatStr,
va_list args) protected
template<typename T>
s32 sead:: BufferedSafeStringBase<T>:: formatImpl_(char16* s,
s32 n,
const char16* formatStr,
va_list args) protected