Skip to content

Commit

Permalink
upf
Browse files Browse the repository at this point in the history
  • Loading branch information
GyverLibs committed Oct 11, 2024
1 parent b09f7c5 commit 8664641
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Settings
version=1.1.0
version=1.1.1
author=AlexGyver <alex@alexgyver.ru>
maintainer=AlexGyver <alex@alexgyver.ru>
sentence=Simple UI webface builder for esp8266/esp32
Expand Down
7 changes: 7 additions & 0 deletions src/core/AnyPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class AnyPtr {
enum class Type {
None,
Text,
ConstChar,
ConstFstr,
Char,
String,
Int8,
Expand All @@ -19,6 +21,8 @@ class AnyPtr {
public:
AnyPtr() {}
AnyPtr(std::nullptr_t p) {}
AnyPtr(const char* p) : p((void*)p), type(Type::ConstChar) {}
AnyPtr(const __FlashStringHelper* p) : p((void*)p), type(Type::ConstFstr) {}
AnyPtr(char* p, size_t len) : p(p), len(len), type(Type::Char) {}
AnyPtr(String* p) : p(p), type(Type::String) {}
AnyPtr(Text* p) : p(p), type(p->valid() ? Type::Text : Type::None) {}
Expand All @@ -40,6 +44,9 @@ class AnyPtr {

void write(sets::Packet* pkt) {
switch (type) {
case Type::ConstChar: pkt->addText((const char*)p); break;
case Type::ConstFstr: pkt->addText((const __FlashStringHelper*)p); break;

case Type::Text: pkt->addText(*((Text*)p)); break;
case Type::String: pkt->addText(*((String*)p)); break;
case Type::Char: pkt->addText((char*)p); break;
Expand Down

0 comments on commit 8664641

Please sign in to comment.