FastLED 3.9.15
Loading...
Searching...
No Matches
basic_string.h
Go to the documentation of this file.
1#pragma once
2
9
10#include "fl/stl/int.h"
11#include "fl/stl/cstring.h"
13#include "fl/stl/cctype.h"
14#include "fl/stl/charconv.h"
15#include "fl/stl/not_null.h"
17#include "fl/stl/shared_ptr.h"
18#include "fl/stl/type_traits.h"
19#include "fl/stl/variant.h"
20#include "fl/stl/iterator.h"
21#include "fl/stl/bit_cast.h"
22#include "fl/stl/cstddef.h"
23#include "fl/stl/move.h"
24#include "fl/math/math.h"
25#include "fl/stl/noexcept.h"
26
27namespace fl {
28
29// Forward declarations
30class string_view;
31template <typename T, fl::size Extent> class span;
32
33// Define shared_ptr type for StringHolder
36
45 public:
46 // ======= NESTED TYPES =======
47
48 // Non-owning pointer to constant null-terminated string data.
49 struct ConstLiteral {
50 const char* data;
51 constexpr ConstLiteral() FL_NOEXCEPT : data(nullptr) {}
52 constexpr explicit ConstLiteral(const char* str) FL_NOEXCEPT : data(str) {}
53 };
54
55 // Non-owning pointer + length to constant string data.
56 struct ConstView {
57 const char* data;
58 fl::size length;
59 constexpr ConstView() FL_NOEXCEPT : data(nullptr), length(0) {}
60 constexpr ConstView(const char* str, fl::size len) FL_NOEXCEPT : data(str), length(len) {}
61 };
62
63 class iterator {
64 private:
65 char* ptr;
66 public:
67 typedef char value_type;
68 typedef char& reference;
69 typedef char* pointer;
72
73 iterator() FL_NOEXCEPT : ptr(nullptr) {}
74 explicit iterator(char* p) FL_NOEXCEPT : ptr(p) {}
75
76 reference operator*() const FL_NOEXCEPT { return *ptr; }
77 pointer operator->() const FL_NOEXCEPT { return ptr; }
78 iterator& operator++() FL_NOEXCEPT { ++ptr; return *this; }
79 iterator operator++(int) FL_NOEXCEPT { iterator tmp = *this; ++ptr; return tmp; }
80 iterator& operator--() FL_NOEXCEPT { --ptr; return *this; }
81 iterator operator--(int) FL_NOEXCEPT { iterator tmp = *this; --ptr; return tmp; }
82
87 difference_type operator-(const iterator& other) const FL_NOEXCEPT { return ptr - other.ptr; }
89
90 bool operator==(const iterator& other) const FL_NOEXCEPT { return ptr == other.ptr; }
91 bool operator!=(const iterator& other) const FL_NOEXCEPT { return ptr != other.ptr; }
92 bool operator<(const iterator& other) const FL_NOEXCEPT { return ptr < other.ptr; }
93 bool operator>(const iterator& other) const FL_NOEXCEPT { return ptr > other.ptr; }
94 bool operator<=(const iterator& other) const FL_NOEXCEPT { return ptr <= other.ptr; }
95 bool operator>=(const iterator& other) const FL_NOEXCEPT { return ptr >= other.ptr; }
96
97 operator char*() const FL_NOEXCEPT { return ptr; }
98 };
99
101 private:
102 const char* ptr;
103 public:
104 typedef char value_type;
105 typedef const char& reference;
106 typedef const char* pointer;
109
111 explicit const_iterator(const char* p) FL_NOEXCEPT : ptr(p) {}
112 const_iterator(const iterator& it) FL_NOEXCEPT : ptr(it.operator char*()) {}
113
114 reference operator*() const FL_NOEXCEPT { return *ptr; }
115 pointer operator->() const FL_NOEXCEPT { return ptr; }
116 const_iterator& operator++() FL_NOEXCEPT { ++ptr; return *this; }
117 const_iterator operator++(int) FL_NOEXCEPT { const_iterator tmp = *this; ++ptr; return tmp; }
118 const_iterator& operator--() FL_NOEXCEPT { --ptr; return *this; }
119 const_iterator operator--(int) FL_NOEXCEPT { const_iterator tmp = *this; --ptr; return tmp; }
120
125 difference_type operator-(const const_iterator& other) const FL_NOEXCEPT { return ptr - other.ptr; }
127
128 bool operator==(const const_iterator& other) const FL_NOEXCEPT { return ptr == other.ptr; }
129 bool operator!=(const const_iterator& other) const FL_NOEXCEPT { return ptr != other.ptr; }
130 bool operator<(const const_iterator& other) const FL_NOEXCEPT { return ptr < other.ptr; }
131 bool operator>(const const_iterator& other) const FL_NOEXCEPT { return ptr > other.ptr; }
132 bool operator<=(const const_iterator& other) const FL_NOEXCEPT { return ptr <= other.ptr; }
133 bool operator>=(const const_iterator& other) const FL_NOEXCEPT { return ptr >= other.ptr; }
134
135 operator const char*() const FL_NOEXCEPT { return ptr; }
136 };
137
140
141 // ======= CONSTANTS =======
142 static constexpr fl::size npos = static_cast<fl::size>(-1);
143
144 // ======= STORAGE TYPE QUERIES =======
145 bool is_literal() const FL_NOEXCEPT { return mStorage.is<ConstLiteral>(); }
146 bool is_view() const FL_NOEXCEPT { return mStorage.is<ConstView>(); }
147 bool is_owning() const FL_NOEXCEPT {
148 return isInline() || mStorage.is<NotNullStringHolderPtr>();
149 }
150 bool is_referencing() const FL_NOEXCEPT { return is_literal() || is_view(); }
151
152 // ======= ACCESSORS =======
153 fl::size size() const FL_NOEXCEPT { return mLength; }
154 fl::size length() const FL_NOEXCEPT { return mLength; }
155 bool empty() const FL_NOEXCEPT { return mLength == 0; }
156 const char* c_str() const FL_NOEXCEPT;
157 const char* data() const FL_NOEXCEPT { return c_str(); }
159 fl::size capacity() const FL_NOEXCEPT;
160
161 // ======= ELEMENT ACCESS =======
162 char operator[](fl::size index) const FL_NOEXCEPT;
163 char& operator[](fl::size index) FL_NOEXCEPT;
164 char& at(fl::size pos) FL_NOEXCEPT;
165 const char& at(fl::size pos) const FL_NOEXCEPT;
166 char front() const FL_NOEXCEPT;
167 char back() const FL_NOEXCEPT;
168 char charAt(fl::size index) const FL_NOEXCEPT;
169
170 // ======= ITERATORS =======
183
184 // ======= COMPARISON OPERATORS =======
185 bool operator==(const basic_string& other) const FL_NOEXCEPT;
186 bool operator!=(const basic_string& other) const FL_NOEXCEPT;
187 bool operator<(const basic_string& other) const FL_NOEXCEPT;
188 bool operator>(const basic_string& other) const FL_NOEXCEPT;
189 bool operator<=(const basic_string& other) const FL_NOEXCEPT;
190 bool operator>=(const basic_string& other) const FL_NOEXCEPT;
191
192 bool operator==(const char* other) const FL_NOEXCEPT;
193 bool operator!=(const char* other) const FL_NOEXCEPT;
194
195 // ======= WRITE OPERATIONS =======
196 fl::size write(const fl::u8* data, fl::size n) FL_NOEXCEPT;
197 fl::size write(const char* str, fl::size n) FL_NOEXCEPT;
198 fl::size write(char c) FL_NOEXCEPT;
199 fl::size write(fl::u8 c) FL_NOEXCEPT;
200 fl::size write(const fl::u16& n) FL_NOEXCEPT;
201 fl::size write(const fl::u32& val) FL_NOEXCEPT;
202 fl::size write(const u64& val) FL_NOEXCEPT;
203 fl::size write(const i64& val) FL_NOEXCEPT;
204 fl::size write(const fl::i32& val) FL_NOEXCEPT;
205 fl::size write(const fl::i8 val) FL_NOEXCEPT;
206
207 // Generic write for multi-byte integer types
208 template <typename T>
210 write(const T& val) FL_NOEXCEPT {
211 using target_t = typename int_cast_detail::cast_target<T>::type;
212 char buf[64] = {0};
213 int len;
215 len = fl::itoa(static_cast<fl::i32>(val), buf, 10);
216 } else {
217 len = fl::utoa32(static_cast<fl::u32>(val), buf, 10);
218 }
219 return write(buf, len);
220 }
221
222 // ======= COPY OPERATIONS =======
223 void copy(const char* str) FL_NOEXCEPT;
224 void copy(const char* str, fl::size len) FL_NOEXCEPT;
225 void copy(const basic_string& other) FL_NOEXCEPT;
226 fl::size copy(char* dest, fl::size count, fl::size pos = 0) const FL_NOEXCEPT;
227
228 // ======= ASSIGN OPERATIONS =======
229 void assign(const char* str, fl::size len) FL_NOEXCEPT;
231 basic_string& assign(const basic_string& str, fl::size pos, fl::size count = npos) FL_NOEXCEPT;
232 basic_string& assign(fl::size count, char c) FL_NOEXCEPT;
234
235 // Assign from iterator range
236 template <typename InputIt>
237 basic_string& assign(InputIt first, InputIt last) FL_NOEXCEPT {
238 clear();
239 fl::size len = 0;
240 for (auto it = first; it != last; ++it) {
241 ++len;
242 }
243 if (len == 0) {
244 return *this;
245 }
246 mLength = len;
247 if (len + 1 <= mInlineCapacity) {
248 if (!isInline()) {
249 mStorage.reset();
250 }
251 fl::size i = 0;
252 for (auto it = first; it != last; ++it, ++i) {
253 inlineBufferPtr()[i] = *it;
254 }
255 inlineBufferPtr()[len] = '\0';
256 } else {
259 fl::size i = 0;
260 for (auto it = first; it != last; ++it, ++i) {
261 ptr->data()[i] = *it;
262 }
263 ptr->data()[len] = '\0';
264 }
265 return *this;
266 }
267
268 // ======= FIND OPERATIONS =======
269 fl::size find(const char& value) const FL_NOEXCEPT;
270 fl::size find(const char* substr) const FL_NOEXCEPT;
271 fl::size find(const basic_string& other) const FL_NOEXCEPT;
272 fl::size find(const char& value, fl::size start_pos) const FL_NOEXCEPT;
273 fl::size find(const char* substr, fl::size start_pos) const FL_NOEXCEPT;
274 fl::size find(const basic_string& other, fl::size start_pos) const FL_NOEXCEPT;
275
276 fl::size rfind(char c, fl::size pos = npos) const FL_NOEXCEPT;
277 fl::size rfind(const char* s, fl::size pos, fl::size count) const FL_NOEXCEPT;
278 fl::size rfind(const char* s, fl::size pos = npos) const FL_NOEXCEPT;
279 fl::size rfind(const basic_string& str, fl::size pos = npos) const FL_NOEXCEPT;
280
281 fl::size find_first_of(char c, fl::size pos = 0) const FL_NOEXCEPT;
282 fl::size find_first_of(const char* s, fl::size pos, fl::size count) const FL_NOEXCEPT;
283 fl::size find_first_of(const char* s, fl::size pos = 0) const FL_NOEXCEPT;
284 fl::size find_first_of(const basic_string& str, fl::size pos = 0) const FL_NOEXCEPT;
285
286 fl::size find_last_of(char c, fl::size pos = npos) const FL_NOEXCEPT;
287 fl::size find_last_of(const char* s, fl::size pos, fl::size count) const FL_NOEXCEPT;
288 fl::size find_last_of(const char* s, fl::size pos = npos) const FL_NOEXCEPT;
289 fl::size find_last_of(const basic_string& str, fl::size pos = npos) const FL_NOEXCEPT;
290
291 fl::size find_first_not_of(char c, fl::size pos = 0) const FL_NOEXCEPT;
292 fl::size find_first_not_of(const char* s, fl::size pos, fl::size count) const FL_NOEXCEPT;
293 fl::size find_first_not_of(const char* s, fl::size pos = 0) const FL_NOEXCEPT;
294 fl::size find_first_not_of(const basic_string& str, fl::size pos = 0) const FL_NOEXCEPT;
295
296 fl::size find_last_not_of(char c, fl::size pos = npos) const FL_NOEXCEPT;
297 fl::size find_last_not_of(const char* s, fl::size pos, fl::size count) const FL_NOEXCEPT;
298 fl::size find_last_not_of(const char* s, fl::size pos = npos) const FL_NOEXCEPT;
300
301 // ======= CONTAINS / STARTS_WITH / ENDS_WITH =======
302 bool contains(const char* substr) const FL_NOEXCEPT;
303 bool contains(char c) const FL_NOEXCEPT;
304 bool contains(const basic_string& other) const FL_NOEXCEPT;
305
306 bool starts_with(const char* prefix) const FL_NOEXCEPT;
307 bool starts_with(char c) const FL_NOEXCEPT;
308 bool starts_with(const basic_string& prefix) const FL_NOEXCEPT;
309
310 bool ends_with(const char* suffix) const FL_NOEXCEPT;
311 bool ends_with(char c) const FL_NOEXCEPT;
312 bool ends_with(const basic_string& suffix) const FL_NOEXCEPT;
313
314 // ======= STACK OPERATIONS =======
315 void push_back(char c) FL_NOEXCEPT;
316 void push_ascii(char c) FL_NOEXCEPT;
317 void pop_back() FL_NOEXCEPT;
318
319 // ======= APPEND OPERATIONS =======
320 basic_string& append(const char* str) FL_NOEXCEPT;
321 basic_string& append(const char* str, fl::size len) FL_NOEXCEPT;
323 basic_string& append(const i8& val) FL_NOEXCEPT;
324 basic_string& append(const u8& val) FL_NOEXCEPT;
325 basic_string& append(const bool& val) FL_NOEXCEPT;
326 basic_string& append(const i16& val) FL_NOEXCEPT;
327 basic_string& append(const u16& val) FL_NOEXCEPT;
328 basic_string& append(const i32& val) FL_NOEXCEPT;
329 basic_string& append(const u32& val) FL_NOEXCEPT;
330 basic_string& append(const i64& val) FL_NOEXCEPT;
331 basic_string& append(const u64& val) FL_NOEXCEPT;
332 basic_string& append(const float& val) FL_NOEXCEPT;
333 basic_string& append(const float& val, int precision) FL_NOEXCEPT;
334 basic_string& append(const double& val) FL_NOEXCEPT;
336
337 // SFINAE catch-all for integer types not covered by explicit overloads
338 // (e.g. unsigned long on Windows, which is distinct from both u32 and u64).
339 // Casts to the appropriate fl:: type via cast_target.
340 template<typename T>
342 && !fl::is_same<T, i8>::value && !fl::is_same<T, u8>::value
343 && !fl::is_same<T, i16>::value && !fl::is_same<T, u16>::value
344 && !fl::is_same<T, i32>::value && !fl::is_same<T, u32>::value
345 && !fl::is_same<T, i64>::value && !fl::is_same<T, u64>::value,
348 using target_t = typename int_cast_detail::cast_target<T>::type;
349 return append(static_cast<target_t>(val));
350 }
351
352 // ======= HEX/OCT APPEND =======
369
370 // ======= INSERT =======
371 basic_string& insert(fl::size pos, fl::size count, char ch) FL_NOEXCEPT;
372 basic_string& insert(fl::size pos, const char* s) FL_NOEXCEPT;
373 basic_string& insert(fl::size pos, const char* s, fl::size count) FL_NOEXCEPT;
374 basic_string& insert(fl::size pos, const basic_string& str) FL_NOEXCEPT;
375 basic_string& insert(fl::size pos, const basic_string& str, fl::size pos2, fl::size count = npos) FL_NOEXCEPT;
376
377 // ======= ERASE =======
378 basic_string& erase(fl::size pos = 0, fl::size count = npos) FL_NOEXCEPT;
379
380 // Iterator-based erase (SFINAE for pointer types)
381 template<typename T>
383 erase(T it_pos) FL_NOEXCEPT {
384 if (!it_pos) return end();
385 const char* str_begin = c_str();
386 const char* str_end = str_begin + mLength;
387 if (it_pos < str_begin || it_pos >= str_end) return end();
388 fl::size pos = it_pos - str_begin;
389 erase(pos, 1);
390 return begin() + pos;
391 }
392
393 template<typename T>
395 erase(T first, T last) FL_NOEXCEPT {
396 if (!first || !last || first >= last) return end();
397 const char* str_begin = c_str();
398 const char* str_end = str_begin + mLength;
399 if (first < str_begin) first = begin();
400 if (last > str_end) last = end();
401 if (first >= str_end) return end();
402 fl::size pos = first - str_begin;
403 fl::size count = last - first;
404 erase(pos, count);
405 return begin() + pos;
406 }
407
408 // ======= REPLACE =======
409 basic_string& replace(fl::size pos, fl::size count, const basic_string& str) FL_NOEXCEPT;
410 basic_string& replace(fl::size pos, fl::size count, const basic_string& str,
411 fl::size pos2, fl::size count2 = npos) FL_NOEXCEPT;
412 basic_string& replace(fl::size pos, fl::size count, const char* s, fl::size count2) FL_NOEXCEPT;
413 basic_string& replace(fl::size pos, fl::size count, const char* s) FL_NOEXCEPT;
414 basic_string& replace(fl::size pos, fl::size count, fl::size count2, char ch) FL_NOEXCEPT;
415
416 // ======= COMPARE =======
417 int compare(const basic_string& str) const FL_NOEXCEPT;
418 int compare(fl::size pos1, fl::size count1, const basic_string& str) const FL_NOEXCEPT;
419 int compare(fl::size pos1, fl::size count1, const basic_string& str,
420 fl::size pos2, fl::size count2 = npos) const FL_NOEXCEPT;
421 int compare(const char* s) const FL_NOEXCEPT;
422 int compare(fl::size pos1, fl::size count1, const char* s) const FL_NOEXCEPT;
423 int compare(fl::size pos1, fl::size count1, const char* s, fl::size count2) const FL_NOEXCEPT;
424
425 // ======= MEMORY MANAGEMENT =======
426 void reserve(fl::size newCapacity) FL_NOEXCEPT;
427 void clear(bool freeMemory = false) FL_NOEXCEPT;
429 fl::size max_size() const FL_NOEXCEPT { return (npos / 2) - 1; }
430 void resize(fl::size count) FL_NOEXCEPT;
431 void resize(fl::size count, char ch) FL_NOEXCEPT;
432
433 // ======= OTHER =======
434 float toFloat() const FL_NOEXCEPT;
435
436 // ======= DESTRUCTOR =======
437 // Body in basic_string.cpp.hpp per the project's header-thin
438 // convention (declarations in `*.h`, definitions in `*.cpp.hpp`).
440
441 // ======= PUBLIC CONSTRUCTION =======
442 // Construct a basic_string backed by a caller-provided buffer.
443 // The span / (ptr, len) pair points at a block of `char` the
444 // caller owns; the resulting basic_string is non-owning until
445 // the first write that exceeds the buffer's capacity, which
446 // promotes to heap-backed storage via `mStorage`.
447 //
448 // Lifetime contract: the buffer must outlive the basic_string
449 // AND the basic_string must not be trivially relocated (bitwise
450 // copied to a different address) — `mInlineOffset` is computed
451 // from `this` at construction time. For member-stored use,
452 // either co-locate the buffer with the basic_string (the
453 // `fl::string` pattern) or arrange the buffer at a fixed
454 // offset from `this` (e.g. as a class field).
455 basic_string(char* inlineBuffer, fl::size inlineCapacity) FL_NOEXCEPT
456 : mInlineOffset(static_cast<fl::size>(
457 inlineBuffer -
458 static_cast<char*>(static_cast<void*>(this))))
459 , mInlineCapacity(inlineCapacity)
460 , mLength(0)
461 , mStorage() // empty variant = inline mode
462 {}
463
464 basic_string(fl::span<char, static_cast<fl::size>(-1)> storage) FL_NOEXCEPT;
465
466 protected:
467 // Deleted copy/move — wrappers (fl::string) handle these via
468 // `copy(const basic_string&)` / `moveFrom(basic_string&&)`.
471 basic_string& operator=(const basic_string&) FL_NOEXCEPT = delete;
472 basic_string& operator=(basic_string&&) FL_NOEXCEPT = delete;
473
474 // ======= CONTENT POPULATION (for wrapper constructors) =======
475 void moveFrom(basic_string&& other) FL_NOEXCEPT;
476 void moveAssign(basic_string&& other) FL_NOEXCEPT;
477 void swapWith(basic_string& other) FL_NOEXCEPT;
478
479 // Factory helpers
480 void setLiteral(const char* literal) FL_NOEXCEPT;
481 void setView(const char* data, fl::size len) FL_NOEXCEPT;
483
484 // ======= DATA MEMBERS =======
485 // Store offset from `this` to the inline buffer, not a raw pointer.
486 // This survives trivial relocation (bitwise copy by containers) because
487 // the offset is relative to `this` which updates with the object.
492
493 // ======= HELPER METHODS =======
494 // Compute inline buffer pointer from offset (survives trivial relocation)
496 return static_cast<char*>(static_cast<void*>(this)) + mInlineOffset;
497 }
498 const char* inlineBufferPtr() const FL_NOEXCEPT {
499 return static_cast<const char*>(static_cast<const void*>(this)) + mInlineOffset;
500 }
501
502 bool isInline() const FL_NOEXCEPT { return mStorage.empty(); }
504 bool hasConstLiteral() const FL_NOEXCEPT { return mStorage.is<ConstLiteral>(); }
505 bool hasConstView() const FL_NOEXCEPT { return mStorage.is<ConstView>(); }
506 bool isNonOwning() const FL_NOEXCEPT { return hasConstLiteral() || hasConstView(); }
507
508 const char* constData() const FL_NOEXCEPT;
510
513};
514
515} // namespace fl
uint8_t pos
Definition Blur.ino:11
bool operator==(const const_iterator &other) const FL_NOEXCEPT
const_iterator operator+(difference_type n) const FL_NOEXCEPT
const_iterator & operator-=(difference_type n) FL_NOEXCEPT
reference operator*() const FL_NOEXCEPT
const_iterator operator--(int) FL_NOEXCEPT
fl::random_access_iterator_tag iterator_category
const_iterator & operator--() FL_NOEXCEPT
reference operator[](difference_type n) const FL_NOEXCEPT
bool operator>=(const const_iterator &other) const FL_NOEXCEPT
bool operator<=(const const_iterator &other) const FL_NOEXCEPT
const_iterator operator++(int) FL_NOEXCEPT
const_iterator operator-(difference_type n) const FL_NOEXCEPT
bool operator<(const const_iterator &other) const FL_NOEXCEPT
difference_type operator-(const const_iterator &other) const FL_NOEXCEPT
const_iterator(const iterator &it) FL_NOEXCEPT
const_iterator & operator++() FL_NOEXCEPT
const_iterator(const char *p) FL_NOEXCEPT
pointer operator->() const FL_NOEXCEPT
const_iterator & operator+=(difference_type n) FL_NOEXCEPT
bool operator!=(const const_iterator &other) const FL_NOEXCEPT
bool operator>(const const_iterator &other) const FL_NOEXCEPT
bool operator<=(const iterator &other) const FL_NOEXCEPT
iterator operator+(difference_type n) const FL_NOEXCEPT
reference operator[](difference_type n) const FL_NOEXCEPT
iterator & operator+=(difference_type n) FL_NOEXCEPT
bool operator>=(const iterator &other) const FL_NOEXCEPT
iterator operator-(difference_type n) const FL_NOEXCEPT
iterator operator--(int) FL_NOEXCEPT
iterator operator++(int) FL_NOEXCEPT
iterator & operator++() FL_NOEXCEPT
fl::random_access_iterator_tag iterator_category
bool operator!=(const iterator &other) const FL_NOEXCEPT
iterator & operator-=(difference_type n) FL_NOEXCEPT
pointer operator->() const FL_NOEXCEPT
reference operator*() const FL_NOEXCEPT
iterator(char *p) FL_NOEXCEPT
bool operator==(const iterator &other) const FL_NOEXCEPT
difference_type operator-(const iterator &other) const FL_NOEXCEPT
iterator & operator--() FL_NOEXCEPT
bool operator>(const iterator &other) const FL_NOEXCEPT
fl::ptrdiff_t difference_type
bool operator<(const iterator &other) const FL_NOEXCEPT
const_reverse_iterator rbegin() const FL_NOEXCEPT
fl::size length() const FL_NOEXCEPT
const_iterator cbegin() const FL_NOEXCEPT
reverse_iterator rbegin() FL_NOEXCEPT
bool operator==(const basic_string &other) const FL_NOEXCEPT
basic_string & erase(fl::size pos=0, fl::size count=npos) FL_NOEXCEPT
bool is_owning() const FL_NOEXCEPT
fl::size find_last_of(char c, fl::size pos=npos) const FL_NOEXCEPT
const_iterator cend() const FL_NOEXCEPT
bool operator>=(const basic_string &other) const FL_NOEXCEPT
const char * inlineBufferPtr() const FL_NOEXCEPT
void pop_back() FL_NOEXCEPT
bool isNonOwning() const FL_NOEXCEPT
char front() const FL_NOEXCEPT
bool isInline() const FL_NOEXCEPT
bool operator<=(const basic_string &other) const FL_NOEXCEPT
fl::enable_if< fl::is_pointer< T >::value &&fl::is_same< typenamefl::remove_cv< typenamefl::remove_pointer< T >::type >::type, char >::value, char * >::type erase(T first, T last) FL_NOEXCEPT
bool is_literal() const FL_NOEXCEPT
const_iterator begin() const FL_NOEXCEPT
float toFloat() const FL_NOEXCEPT
fl::size write(const fl::u8 *data, fl::size n) FL_NOEXCEPT
bool hasHeapData() const FL_NOEXCEPT
void reserve(fl::size newCapacity) FL_NOEXCEPT
fl::size max_size() const FL_NOEXCEPT
char & at(fl::size pos) FL_NOEXCEPT
bool is_referencing() const FL_NOEXCEPT
bool empty() const FL_NOEXCEPT
void swapWith(basic_string &other) FL_NOEXCEPT
basic_string(const basic_string &) FL_NOEXCEPT=delete
bool operator<(const basic_string &other) const FL_NOEXCEPT
const_reverse_iterator crbegin() const FL_NOEXCEPT
void materialize() FL_NOEXCEPT
bool hasConstView() const FL_NOEXCEPT
void copy(const char *str) FL_NOEXCEPT
fl::size find_first_not_of(char c, fl::size pos=0) const FL_NOEXCEPT
bool hasConstLiteral() const FL_NOEXCEPT
void resize(fl::size count) FL_NOEXCEPT
void push_ascii(char c) FL_NOEXCEPT
const_reverse_iterator rend() const FL_NOEXCEPT
fl::size mInlineCapacity
fl::size find_last_not_of(char c, fl::size pos=npos) const FL_NOEXCEPT
const_reverse_iterator crend() const FL_NOEXCEPT
void clear(bool freeMemory=false) FL_NOEXCEPT
void assign(const char *str, fl::size len) FL_NOEXCEPT
NotNullStringHolderPtr & heapData() FL_NOEXCEPT
const_iterator end() const FL_NOEXCEPT
static constexpr fl::size npos
bool starts_with(const char *prefix) const FL_NOEXCEPT
fl::reverse_iterator< iterator > reverse_iterator
basic_string(basic_string &&) FL_NOEXCEPT=delete
void shrink_to_fit() FL_NOEXCEPT
fl::size find(const char &value) const FL_NOEXCEPT
bool is_view() const FL_NOEXCEPT
basic_string & replace(fl::size pos, fl::size count, const basic_string &str) FL_NOEXCEPT
basic_string & insert(fl::size pos, fl::size count, char ch) FL_NOEXCEPT
const char * data() const FL_NOEXCEPT
fl::variant< NotNullStringHolderPtr, ConstLiteral, ConstView > mStorage
char * c_str_mutable() FL_NOEXCEPT
char back() const FL_NOEXCEPT
void setView(const char *data, fl::size len) FL_NOEXCEPT
char * inlineBufferPtr() FL_NOEXCEPT
basic_string & append(const char *str) FL_NOEXCEPT
basic_string & appendHex(i32 val) FL_NOEXCEPT
fl::enable_if< fl::is_multi_byte_integer< T >::value, fl::size >::type write(const T &val) FL_NOEXCEPT
basic_string(char *inlineBuffer, fl::size inlineCapacity) FL_NOEXCEPT
bool contains(const char *substr) const FL_NOEXCEPT
int compare(const basic_string &str) const FL_NOEXCEPT
fl::reverse_iterator< const_iterator > const_reverse_iterator
void moveFrom(basic_string &&other) FL_NOEXCEPT
char charAt(fl::size index) const FL_NOEXCEPT
fl::size find_first_of(char c, fl::size pos=0) const FL_NOEXCEPT
iterator end() FL_NOEXCEPT
void setLiteral(const char *literal) FL_NOEXCEPT
void push_back(char c) FL_NOEXCEPT
fl::size capacity() const FL_NOEXCEPT
fl::size mInlineOffset
reverse_iterator rend() FL_NOEXCEPT
iterator begin() FL_NOEXCEPT
bool operator!=(const basic_string &other) const FL_NOEXCEPT
void setSharedHolder(const fl::shared_ptr< StringHolder > &holder) FL_NOEXCEPT
const char * constData() const FL_NOEXCEPT
const char * c_str() const FL_NOEXCEPT
void moveAssign(basic_string &&other) FL_NOEXCEPT
fl::size rfind(char c, fl::size pos=npos) const FL_NOEXCEPT
bool operator>(const basic_string &other) const FL_NOEXCEPT
fl::size size() const FL_NOEXCEPT
basic_string & appendOct(i32 val) FL_NOEXCEPT
fl::enable_if< fl::is_pointer< T >::value &&fl::is_same< typenamefl::remove_cv< typenamefl::remove_pointer< T >::type >::type, char >::value, char * >::type erase(T it_pos) FL_NOEXCEPT
bool ends_with(const char *suffix) const FL_NOEXCEPT
Concrete type-erased string class.
Reverse iterator adapter - reverses the direction of a bidirectional iterator.
Definition iterator.h:160
long ptrdiff_t
Definition s16x16x4.h:22
unsigned char u8
Definition s16x16x4.h:132
signed char i8
Definition s16x16x4.h:131
typename fl::conditional< IsSigned, typename fl::conditional< Size==1, fl::i8, typename fl::conditional< Size==2, fl::i16, typename fl::conditional< Size==4, fl::i32, typename fl::conditional< Size==8, fl::i64, fl::i64 >::type >::type >::type >::type, typename fl::conditional< Size==1, fl::u16, typename fl::conditional< Size==2, fl::u16, typename fl::conditional< Size==4, fl::u32, typename fl::conditional< Size==8, fl::u64, fl::u64 >::type >::type >::type >::type >::type type
unsigned char u8
Definition stdint.h:131
constexpr int type_rank< T >::value
int itoa(i32 value, char *sp, int radix)
Convert signed 32-bit integer to string buffer in given radix.
fl::not_null< StringHolderPtr > NotNullStringHolderPtr
int utoa32(u32 value, char *sp, int radix)
Convert unsigned 32-bit integer to string buffer in given radix.
fl::i64 i64
Definition s16x16x4.h:222
shared_ptr< T > make_shared(Args &&... args) FL_NOEXCEPT
Definition shared_ptr.h:414
fl::shared_ptr< fl::StringHolder > StringHolderPtr
signed char i8
Definition stdint.h:130
fl::u64 u64
Definition s16x16x4.h:221
Base definition for an LED controller.
Definition crgb.hpp:179
#define FL_NOEXCEPT
constexpr ConstLiteral(const char *str) FL_NOEXCEPT
constexpr ConstLiteral() FL_NOEXCEPT
constexpr ConstView() FL_NOEXCEPT
constexpr ConstView(const char *str, fl::size len) FL_NOEXCEPT