21 , const_str_(str ? str :
"")
22 , length_(str ? ecs_os_strlen(str) : 0) { }
34 string(
string&& str)
noexcept {
37 const_str_ = str.const_str_;
38 length_ = str.length_;
42 operator const char*()
const {
46 string& operator=(
string&& str)
noexcept {
49 const_str_ = str.const_str_;
50 length_ = str.length_;
56 string& operator=(
const string& str) =
delete;
57 string(
const string& str) =
delete;
60 if (str.const_str_ == const_str_) {
64 if (!const_str_ || !str.const_str_) {
68 if (str.length_ != length_) {
72 return ecs_os_strcmp(str, const_str_) == 0;
76 return !(*
this == str);
79 bool operator==(
const char *str)
const {
80 if (const_str_ == str) {
84 if (!const_str_ || !str) {
88 return ecs_os_strcmp(str, const_str_) == 0;
91 bool operator!=(
const char *str)
const {
92 return !(*
this == str);
95 const char* c_str()
const {
99 std::size_t length()
const {
100 return static_cast<std::size_t
>(length_);
104 static constexpr size_t length(
char const (&)[N] ) {
108 std::size_t size()
const {
115 const_str_ =
nullptr;
118 bool contains(
const char *substr) {
120 return strstr(const_str_, substr) !=
nullptr;
134 , const_str_(str ? str :
"")
135 , length_(str ? ecs_os_strlen(str) : 0) { }
137 char *str_ =
nullptr;
138 const char *const_str_;