#pragma XOD dirtiness disable
class FlashStringView : public ListView<char> {
public:
class Cursor : public detail::Cursor<char> {
public:
Cursor(PGM_P str) : _ptr(str) {}
bool isValid() const override {
return static_cast<bool>(static_cast<char>(pgm_read_byte(_ptr)));
}
bool value(char* out) const override {
*out = static_cast<char>(pgm_read_byte(_ptr));
return static_cast<bool>(*out);
}
void next() override { ++_ptr; }
private:
PGM_P _ptr;
};
public:
FlashStringView(PGM_P str = nullptr) : _str(str) {}
FlashStringView(const __FlashStringHelper* str)
: _str(reinterpret_cast<const char PROGMEM*>(str)) {}
FlashStringView& operator=(const FlashStringView& rhs) {
_str = rhs._str;
return *this;
}
virtual Iterator<char> iterate() const override {
return _str ? Iterator<char>(new Cursor(_str)) : Iterator<char>::nil();
}
private:
friend class Cursor;
const char* PROGMEM _str;
};
class XStringFlashString : public XString {
public:
XStringFlashString(PGM_P str) : XString(&_view), _view(str) {}
XStringFlashString(const __FlashStringHelper* str)
: XString(&_view), _view(str) {}
private:
FlashStringView _view;
};
struct State {
};
{{ GENERATED_CODE }}
const char text[] PROGMEM = "Branch Menu 1";
static XStringFlashString out_text = XStringFlashString(text);
void evaluate(Context ctx) {
if (isSettingUp()) {
emitValue<output_TXT>(ctx, out_text);
}
}