4#include "../Foundation/Buffer.h"
5#include "../Strings/StringView.h"
87 [[nodiscard]]
bool operator==(const
String& other)
const {
return view() == (other.view()); }
116 return view() == other;
125 return view() != other;
146 [[nodiscard]]
native_char_t* nativeWritableBytesIncludingTerminator();
150 friend struct StringTest;
155 template <
typename T>
192 String& operator=(
const char (&text)[Q])
#define SC_COMPILER_EXPORT
Macro for symbol visibility in non-MSVC compilers.
Definition: Compiler.h:78
#define SC_COMPILER_EXTERN
Define compiler-specific export macros for DLL visibility.
Definition: Compiler.h:74
#define SC_ASSERT_RELEASE(e)
Assert expression e to be true.
Definition: Assert.h:66
constexpr T && move(T &value)
Converts an lvalue to an rvalue reference.
Definition: Compiler.h:269
char native_char_t
The native char for the platform (wchar_t (4 bytes) on Windows, char (1 byte) everywhere else )
Definition: PrimitiveTypes.h:34
unsigned int uint32_t
Platform independent (4) bytes unsigned int.
Definition: PrimitiveTypes.h:38
StringEncoding
String Encoding (Ascii, Utf8, Utf16)
Definition: StringIterator.h:17
@ Ascii
Encoding is ASCII.
An heap allocated byte buffer that can optionally use an inline buffer.
Definition: Buffer.h:25
Wraps a SC::FileDescriptor to open it and use strings / buffers.
Definition: File.h:19
Execute fs operations { exists, copy, delete } for { files and directories }.
Definition: FileSystem.h:26
Basic class template that must be partially specialized for each type.
Definition: Reflection.h:195
size_t size() const
Returns current size.
Definition: Segment.h:150
bool isEmpty() const
Check if is empty (size() == 0)
Definition: Segment.h:141
const T * data() const SC_LANGUAGE_LIFETIME_BOUND
Access data owned by the segment or nullptr if segment is empty.
Definition: Segment.h:112
String with compile time configurable inline storage (small string optimization)
Definition: String.h:168
Builds String out of a sequence of StringView or formatting through StringFormat.
Definition: StringBuilder.h:16
Converts String to a different encoding (UTF8, UTF16).
Definition: StringConverter.h:24
A non-modifiable owning string with associated encoding.
Definition: String.h:29
StringView view() const SC_LANGUAGE_LIFETIME_BOUND
Obtain a null-terminated StringView from current String.
StringEncoding getEncoding() const
Get StringView encoding.
Definition: String.h:66
bool operator==(const StringView other) const
Check if current String is same as other StringView.
Definition: String.h:97
bool operator!=(const String &other) const
Check if current String is different from other String.
Definition: String.h:92
bool operator<(const StringView other) const
Check if current String is smaller to another StringView (using StringView::compare)
Definition: String.h:107
bool assign(StringView sv)
Assigns a StringView to this String, replacing existing contents.
bool operator==(const String &other) const
Check if current String is same as other String.
Definition: String.h:87
bool operator!=(const char(&other)[N]) const
Check if current String is different from the ascii string literal.
Definition: String.h:123
String(const char(&text)[N])
Builds String with a null terminated char string literal.
Definition: String.h:48
size_t sizeInBytesIncludingTerminator() const
Get length of the string in bytes (including null terminator bytes)
Definition: String.h:70
String(StringEncoding encoding=StringEncoding::Utf8)
Builds an empty String with a given Encoding.
Definition: String.h:32
String & operator=(StringView view)
Assigns (copy) contents of given StringView in current String.
String(StringView sv)
Builds String from a StringView.
Definition: String.h:37
String & operator=(const char(&text)[N])
Assigns an ascii string literal to current String.
Definition: String.h:134
bool isEmpty() const
Check if String is empty.
Definition: String.h:78
const char * bytesIncludingTerminator() const
Access current string content as read-only null-terminated const char*
Definition: String.h:74
String(Buffer &&otherData, StringEncoding encoding)
Builds a String from a buffer ensuring zero termination.
bool operator!=(const StringView other) const
Check if current String is different from other StringView.
Definition: String.h:102
bool owns(StringView view) const
Checks if the memory pointed by the StringView is owned by this String.
bool operator==(const char(&other)[N]) const
Check if current String is equal to the ascii string literal.
Definition: String.h:114
Non-owning view over a range of characters with UTF Encoding.
Definition: StringView.h:47