MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / Char16String

Class Char16String

modules/gui/gui/src/backend/text_server/ustring.h:101–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99/*************************************************************************/
100
101class Char16String
102{
103 CowData<char16_t> _cowdata;
104 static const char16_t _null;
105
106public:
107 _FORCE_INLINE_ char16_t* ptrw() { return _cowdata.ptrw(); }
108 _FORCE_INLINE_ const char16_t* ptr() const { return _cowdata.ptr(); }
109 _FORCE_INLINE_ int size() const { return _cowdata.size(); }
110 Error resize(int p_size) { return _cowdata.resize(p_size); }
111
112 _FORCE_INLINE_ char16_t get(int p_index) const { return _cowdata.get(p_index); }
113 _FORCE_INLINE_ void set(int p_index, const char16_t& p_elem) { _cowdata.set(p_index, p_elem); }
114 _FORCE_INLINE_ const char16_t& operator[](int p_index) const
115 {
116 if (unlikely(p_index == _cowdata.size()))
117 {
118 return _null;
119 }
120
121 return _cowdata.get(p_index);
122 }
123 _FORCE_INLINE_ CharProxy<char16_t> operator[](int p_index) { return CharProxy<char16_t>(p_index, _cowdata); }
124
125 _FORCE_INLINE_ Char16String() {}
126 _FORCE_INLINE_ Char16String(const Char16String& p_str) { _cowdata._ref(p_str._cowdata); }
127 _FORCE_INLINE_ void operator=(const Char16String& p_str) { _cowdata._ref(p_str._cowdata); }
128 _FORCE_INLINE_ Char16String(const char16_t* p_cstr) { copy_from(p_cstr); }
129
130 void operator=(const char16_t* p_cstr);
131 bool operator<(const Char16String& p_right) const;
132 Char16String& operator+=(char16_t p_char);
133 int length() const { return size() ? size() - 1 : 0; }
134 const char16_t* get_data() const;
135 operator const char16_t*() const { return get_data(); };
136
137protected:
138 void copy_from(const char16_t* p_cstr);
139};
140
141/*************************************************************************/
142/* CharString */

Callers

nothing calls this directly

Calls 3

get_dataFunction · 0.50
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected