AceCommon
1.4.5
Arduino library for low-level common functions and features with no external dependencies
|
25 #ifndef ACE_COMMON_FCSTRING_H
26 #define ACE_COMMON_FCSTRING_H
33 class __FlashStringHelper;
35 namespace ace_common {
65 explicit FCString(
const __FlashStringHelper* s):
71 bool isNull()
const {
return mString.cstring ==
nullptr; }
74 uint8_t
getType()
const {
return mStringType; }
77 const char*
getCString()
const {
return mString.cstring; }
80 const __FlashStringHelper*
getFString()
const {
return mString.fstring; }
88 size_t printTo(Print& printer)
const;
97 const __FlashStringHelper* fstring;
98 } mString = {
nullptr };
bool isNull() const
Return if this is a null string.
const char * getCString() const
Get the c-string pointer.
FCString(const __FlashStringHelper *s)
Construct with a flash string.
size_t printTo(Print &printer) const
Convenience method for printing an FCString to printer.
FCString(const char *s)
Construct with a c-string.
FCString()
Default constructor initializes to a nullptr of kCStringType.
A union of (const char*) and (const __FlashStringHelper*) with a discriminator.
int compareTo(const FCString &that) const
Compare to another FCString.
const __FlashStringHelper * getFString() const
Get the flash string pointer.
static const uint8_t kFStringType
Identifies the object as holding an f-string.
uint8_t getType() const
Get the internal type of string.
static const uint8_t kCStringType
Identifies the object as holding a c-string.