SensESP 3.0.1
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
truth_text.h
Go to the documentation of this file.
1#ifndef SENSESP_TRANSFORMS_TRUTH_TEXT_H_
2#define SENSESP_TRANSFORMS_TRUTH_TEXT_H_
3
4#include "transform.h"
5
6namespace sensesp {
7
24class TextToTruth : public Transform<String, bool> {
25 public:
26 virtual void set(const String& input) override;
27
32 static bool is_valid_true(const String& value);
33
39 static bool is_valid_false(const String& value);
40};
41
48class TruthToText : public Transform<bool, String> {
49 public:
50 TruthToText(const String& true_value = "ON",
51 const String& false_value = "OFF");
52
53 virtual void set(const bool& input) override;
54
55 protected:
56 String truth_value_[2];
57};
58
59} // namespace sensesp
60#endif
Consumes a string and outputs boolean "true" if the text represents a human readable version of "true...
Definition truth_text.h:24
static bool is_valid_false(const String &value)
static bool is_valid_true(const String &value)
Definition truth_text.cpp:7
virtual void set(const String &input) override
The main Transform class. A transform is identified primarily by the type of value that is produces (...
Definition transform.h:53
Consumes a boolean value and outputs one the appropriate truth string specified in the constructor....
Definition truth_text.h:48
String truth_value_[2]
Definition truth_text.h:56
TruthToText(const String &true_value="ON", const String &false_value="OFF")
virtual void set(const bool &input) override