13 static std::vector<std::string> split_string(
const std::string &str) {
14 std::vector<std::string> strings;
15 auto delimiter = std::string(
"\n");
17 std::string::size_type pos;
18 std::string::size_type prev = 0;
19 while ((pos = str.find(delimiter, prev)) != std::string::npos) {
20 strings.push_back(str.substr(prev, pos - prev));
21 prev = pos + delimiter.size();
25 strings.push_back(str.substr(prev));
41 auto value = this->
at(index);
49 void control(
const std::string &value)
override {
value_type const & value() const
optional< const char * > initial_state_
optional< std::string > at(size_t index) const
Return the (optional) option value at the provided index offset.
void set_options(const char *str)
void set_options(std::vector< std::string > options)
void publish_index(size_t index)
std::function< void(size_t)> control_lambda_
void set_control_lambda(std::function< void(size_t)> lambda)
void publish_state(const std::string &state)
Base-class for all selects.
Implementation of SPI Controller mode.
optional< size_t > index_of(const std::string &option) const
Find the (optional) index offset of the provided option value.
void control(const std::string &value) override