AUnit
1.5.4
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
|
25 #ifndef AUNIT_FSTRING_H
26 #define AUNIT_FSTRING_H
31 class __FlashStringHelper;
60 static const uint8_t kCStringType = 0;
61 static const uint8_t kFStringType = 1;
68 mStringType(kCStringType) {
73 explicit FCString(
const __FlashStringHelper* s):
74 mStringType(kFStringType) {
79 uint8_t
getType()
const {
return mStringType; }
82 const char*
getCString()
const {
return mString.cstring; }
85 const __FlashStringHelper*
getFString()
const {
return mString.fstring; }
88 void print(Print* printer)
const;
91 void println(Print* printer)
const;
101 int compareToN(
const char* that,
size_t n)
const;
108 int compareToN(
const __FlashStringHelper* that,
size_t n)
const;
114 const __FlashStringHelper* fstring;
115 } mString = {
nullptr };
117 uint8_t mStringType = kCStringType;
void println(Print *printer) const
Convenience method for printing an FCString.
FCString(const char *s)
Construct with a c-string.
int compareToN(const char *that, size_t n) const
Compare to C-string using the first n characters.
A union of (const char*) and (const __FlashStringHelper*) with a discriminator.
const __FlashStringHelper * getFString() const
Get the flash string pointer.
const char * getCString() const
Get the c-string pointer.
int compareTo(const FCString &that) const
Compare to another FCString.
FCString(const __FlashStringHelper *s)
Construct with a flash string.
FCString()
Default constructor initializes to a nullptr of kCStringType.
uint8_t getType() const
Get the internal type of string.
void print(Print *printer) const
Convenience method for printing an FCString.