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

Class ostream

src/fl/stl/ostream.h:16–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14namespace fl {
15
16class ostream {
17public:
18 ostream() = default;
19
20 // Stream output operators that immediately print
21 ostream& operator<<(const char* str) FL_NOEXCEPT {
22 if (str) {
23 print(str);
24 }
25 return *this;
26 }
27
28 ostream& operator<<(const string& str) FL_NOEXCEPT {
29 print(str.c_str());
30 return *this;
31 }
32
33 ostream& operator<<(char c) FL_NOEXCEPT {
34 char str[2] = {c, '\0'};
35 print(str);
36 return *this;
37 }
38
39 ostream& operator<<(fl::i8 n) FL_NOEXCEPT;
40 ostream& operator<<(fl::u8 n) FL_NOEXCEPT;
41 ostream& operator<<(fl::i16 n) FL_NOEXCEPT;
42 ostream& operator<<(fl::i32 n) FL_NOEXCEPT;
43 ostream& operator<<(fl::u32 n) FL_NOEXCEPT;
44
45 ostream& operator<<(float f) FL_NOEXCEPT {
46 string temp;
47 temp.append(f);
48 print(temp.c_str());
49 return *this;
50 }
51
52 ostream& operator<<(double d) FL_NOEXCEPT {
53 string temp;
54 temp.append(d);
55 print(temp.c_str());
56 return *this;
57 }
58
59 ostream& operator<<(const CRGB& rgb) FL_NOEXCEPT {
60 string temp;
61 temp.append(rgb);
62 print(temp.c_str());
63 return *this;
64 }
65
66 // Generic integer handler using SFINAE - handles all multi-byte integer types
67 // (including unsigned long on Windows) by casting to the appropriate fl:: type.
68 // Mirrors the pattern used by sstream.
69 template<typename T>
70 typename fl::enable_if<fl::is_multi_byte_integer<T>::value, ostream&>::type
71 operator<<(T val) FL_NOEXCEPT {
72 using target_t = typename int_cast_detail::cast_target<T>::type;
73 string temp;

Callers

nothing calls this directly

Calls 3

printFunction · 0.70
c_strMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected