MCPcopy Create free account
hub / github.com/FastLED/FastLED / string

Class string

src/fl/stl/string.h:193–445  ·  view source on GitHub ↗

`fl::string` extends `string_n ` with the composite-type formatter overloads (CRGB, vec2, span, vector, optional, …), the `substring()` / `trim()` family (returning `string` so callers chain naturally), and the static factory + comparison methods. The trampoline pattern is: fl::string -> fl::string_n -> fl::basic_string where only `basic_string` carries the real bytes

Source from the content-addressed store, hash-verified

191// where only `basic_string` carries the real bytes; the upper
192// layers are thin wrappers that get folded out by the optimizer.
193class string : public string_n<FASTLED_STR_INLINED_SIZE> {
194 public:
195 static constexpr fl::size npos = static_cast<fl::size>(-1);
196
197 using basic_string::copy;
198 using basic_string::assign;
199 using basic_string::append;
200 using basic_string::appendHex;
201 using basic_string::appendOct;
202
203 // ======= STATIC FACTORY METHODS =======
204 static string from_literal(const char* literal) FL_NOEXCEPT;
205 static string from_view(const char* data, fl::size len) FL_NOEXCEPT;
206 static string from_view(const string_view& sv) FL_NOEXCEPT;
207 static string interned(const char* str, fl::size len) FL_NOEXCEPT;
208 static string interned(const char* str) FL_NOEXCEPT;
209 static string interned(const string_view& sv) FL_NOEXCEPT;
210 static string copy_no_view(const string& str) FL_NOEXCEPT;
211 static int strcmp(const string& a, const string& b) FL_NOEXCEPT;
212
213 // ======= CONSTRUCTORS =======
214 // All non-template ctors delegate to string_n<N>'s ctors —
215 // defined in string.cpp.hpp as one-line forwarders for header
216 // hygiene. Template ctors stay inline (they're parameterised
217 // on caller types and can't be split out).
218 string() FL_NOEXCEPT;
219 string(const char* str) FL_NOEXCEPT;
220 string(const char* str, fl::size len) FL_NOEXCEPT;
221 string(fl::size len, char c) FL_NOEXCEPT;
222 string(const string& other) FL_NOEXCEPT;
223 string(string&& other) FL_NOEXCEPT;
224 string(const basic_string& other) FL_NOEXCEPT;
225 string(const string_view& sv) FL_NOEXCEPT;
226 string(const fl::span<const char>& s) FL_NOEXCEPT;
227 string(const fl::span<char>& s) FL_NOEXCEPT;
228 string(const fl::shared_ptr<StringHolder>& holder) FL_NOEXCEPT;
229 template <typename InputIt>
230 string(InputIt first, InputIt last) FL_NOEXCEPT
231 : string_n<FASTLED_STR_INLINED_SIZE>(first, last) {}
232 template <int N>
233 string(const char (&str)[N]) FL_NOEXCEPT
234 : string_n<FASTLED_STR_INLINED_SIZE>(str) {}
235
236 // ======= ASSIGNMENT =======
237 string& operator=(const string& other) FL_NOEXCEPT;
238 string& operator=(string&& other) FL_NOEXCEPT;
239 string& operator=(const char* str) FL_NOEXCEPT;
240 template <int N> string& operator=(const char (&str)[N]) FL_NOEXCEPT {
241 assign(str, N - 1);
242 return *this;
243 }
244
245 string& assign(string_view sv) FL_NOEXCEPT;
246
247 // ======= SUBSTRING (returns string, so must live here) =======
248 string substring(fl::size start, fl::size end) const FL_NOEXCEPT;
249 string substr(fl::size start, fl::size length) const FL_NOEXCEPT;
250 string substr(fl::size start) const FL_NOEXCEPT;

Callers 15

urlClass · 0.70
parse_lnk_with_metadataFunction · 0.70
format_integerFunction · 0.70
format_stringFunction · 0.70
formatMethod · 0.70
append_u64_decimalFunction · 0.70
ieee754_format_decimalFunction · 0.70
acceptMethod · 0.70
readLineFunction · 0.70
hexFunction · 0.70
internedMethod · 0.70
string.cpp.hppFile · 0.70

Calls 9

assignFunction · 0.85
to_stringMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
use_countMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
has_valueMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected