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

Class String

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

Source from the content-addressed store, hash-verified

199};
200
201class String
202{
203 CowData<char32_t> _cowdata;
204 static const char32_t _null;
205
206 void copy_from(const char* p_cstr);
207 void copy_from(const char* p_cstr, const int p_clip_to);
208 void copy_from(const wchar_t* p_cstr);
209 void copy_from(const wchar_t* p_cstr, const int p_clip_to);
210 void copy_from(const char32_t* p_cstr);
211 void copy_from(const char32_t* p_cstr, const int p_clip_to);
212
213 void copy_from(const char32_t& p_char);
214
215 void copy_from_unchecked(const char32_t* p_char, const int p_length);
216
217 bool _base_is_subsequence_of(const String& p_string, bool case_insensitive) const;
218 int _count(const String& p_string, int p_from, int p_to, bool p_case_insensitive) const;
219 String _camelcase_to_underscore() const;
220
221public:
222 enum
223 {
224 npos = -1 ///< for "some" compatibility with std::string (npos is a huge value in std::string)
225 };
226
227 _FORCE_INLINE_ char32_t* ptrw() { return _cowdata.ptrw(); }
228 _FORCE_INLINE_ const char32_t* ptr() const { return _cowdata.ptr(); }
229
230 void remove_at(int p_index) { _cowdata.remove_at(p_index); }
231
232 _FORCE_INLINE_ void clear() { resize(0); }
233
234 _FORCE_INLINE_ char32_t get(int p_index) const { return _cowdata.get(p_index); }
235 _FORCE_INLINE_ void set(int p_index, const char32_t& p_elem) { _cowdata.set(p_index, p_elem); }
236 _FORCE_INLINE_ int size() const { return _cowdata.size(); }
237 Error resize(int p_size) { return _cowdata.resize(p_size); }
238
239 _FORCE_INLINE_ const char32_t& operator[](int p_index) const
240 {
241 if (unlikely(p_index == _cowdata.size()))
242 {
243 return _null;
244 }
245
246 return _cowdata.get(p_index);
247 }
248 _FORCE_INLINE_ CharProxy<char32_t> operator[](int p_index) { return CharProxy<char32_t>(p_index, _cowdata); }
249
250 bool operator==(const String& p_str) const;
251 bool operator!=(const String& p_str) const;
252 String operator+(const String& p_str) const;
253 String operator+(char32_t p_char) const;
254
255 String& operator+=(const String&);
256 String& operator+=(char32_t p_char);
257 String& operator+=(const char* p_str);
258 String& operator+=(const wchar_t* p_str);

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected