29 class __FlashStringHelper;
45 static DEFINE_FSTR_DATA(__fstr__, str); \
46 static_cast<const FSTR::String*>(&__fstr__.object); \
56 #define FS(str) (*FS_PTR(str))
63 #define DECLARE_FSTR(name) DECLARE_FSTR_OBJECT(name, FSTR::String)
77 #define DEFINE_FSTR(name, str) \
78 static DEFINE_FSTR_DATA(FSTR_DATA_NAME(name), str); \
79 DEFINE_FSTR_REF_NAMED(name, FSTR::String);
84 #define DEFINE_FSTR_LOCAL(name, str) \
85 static DEFINE_FSTR_DATA(FSTR_DATA_NAME(name), str); \
86 static constexpr DEFINE_FSTR_REF_NAMED(name, FSTR::String);
93 #define DEFINE_FSTR_DATA(name, str) \
94 constexpr const struct { \
95 FSTR::ObjectBase object; \
96 char data[ALIGNUP4(sizeof(str))]; \
97 } name PROGMEM = {{sizeof(str) - 1}, str}; \
98 FSTR_CHECK_STRUCT(name);
111 #define LOAD_FSTR(name, fstr) \
112 char name[(fstr).size()] FSTR_ALIGNED; \
113 memcpy_aligned(name, (fstr).data(), (fstr).length()); \
114 name[(fstr).length()] = '\0';
123 #define FSTR_ARRAY(name, str) \
124 static DEFINE_FSTR_DATA(FSTR_DATA_NAME(name), str); \
125 LOAD_FSTR(name, FSTR_DATA_NAME(name).object.template as<FSTR::String>())
133 #define IMPORT_FSTR(name, file) IMPORT_FSTR_OBJECT(name, FSTR::String, file)
138 #define IMPORT_FSTR_LOCAL(name, file) IMPORT_FSTR_OBJECT_LOCAL(name, FSTR::String, file)
161 #define FSTR_TABLE(name) const FSTR::String* const name[] PROGMEM
200 bool equals(
const char* cstr,
size_t len,
bool ignoreCase =
false)
const;
204 return equals(cstr, len,
true);
207 bool equals(
const char* cstr,
bool ignoreCase =
false)
const;
const __FlashStringHelper * flash_string_t
Definition: String.hpp:29
const __FlashStringHelper * flash_string_t
Provides a strongly-typed pointer to allow safe implicit operation using String class methods.
Definition: WString.h:96
Base class template for all types.
Definition: Object.hpp:121
constexpr const size_t length() const
Get the length of the content in elements.
Definition: Object.hpp:168
DataPtrType data() const
Definition: Object.hpp:205
Wrapper class to efficiently print large Strings.
Definition: StringPrinter.hpp:35
size_t printTo(Print &p) const
describes a counted string stored in flash memory
Definition: String.hpp:174
bool equals(const WString &str, bool ignoreCase=false) const
bool operator!=(const T &str) const
Definition: String.hpp:225
bool equalsIgnoreCase(const T &str) const
Definition: String.hpp:209
bool equals(const char *cstr, bool ignoreCase=false) const
bool equalsIgnoreCase(const char *cstr, size_t len) const
Definition: String.hpp:202
bool operator==(const T &str) const
Definition: String.hpp:220
bool equals(const char *cstr, size_t len, bool ignoreCase=false) const
Check for equality with a C-string.
StringPrinter printer() const
Supports printing of large String objects.
Definition: String.hpp:247
flash_string_t data() const
Get a WString-compatible pointer to the flash data.
Definition: String.hpp:188
size_t size() const
Get the number of bytes used to store the String.
Definition: String.hpp:180
size_t printTo(Print &p) const
Definition: String.hpp:252
bool equals(const String &str, bool ignoreCase=false) const
Check for equality with another String.
Provides formatted output to stream.
Definition: Print.h:37
The String class.
Definition: WString.h:137
#define ALIGNUP4(n)
Align a size up to the nearest word boundary.
Definition: FakePgmSpace.h:39
Definition: Array.hpp:108
::String WString
A Wiring String.
Definition: String.hpp:168
#define str(s)
Definition: testrunner.h:124