ESPHome 2025.12.1
Loading...
Searching...
No Matches
select_call.h
Go to the documentation of this file.
1#pragma once
2
4
5namespace esphome::select {
6
7class Select;
8
17
19 public:
20 explicit SelectCall(Select *parent) : parent_(parent) {}
21 void perform();
22
23 SelectCall &set_option(const char *option, size_t len);
24 SelectCall &set_option(const std::string &option) { return this->set_option(option.data(), option.size()); }
25 SelectCall &set_option(const char *option) { return this->set_option(option, strlen(option)); }
26 SelectCall &set_index(size_t index);
27
28 SelectCall &select_next(bool cycle);
29 SelectCall &select_previous(bool cycle);
32
34 SelectCall &with_cycle(bool cycle);
35 SelectCall &with_option(const char *option, size_t len);
36 SelectCall &with_option(const std::string &option) { return this->with_option(option.data(), option.size()); }
37 SelectCall &with_option(const char *option) { return this->with_option(option, strlen(option)); }
38 SelectCall &with_index(size_t index);
39
40 protected:
41 __attribute__((always_inline)) inline optional<size_t> calculate_target_index_(const char *name);
42
46 bool cycle_;
47};
48
49} // namespace esphome::select
SelectCall & select_next(bool cycle)
SelectCall & with_index(size_t index)
optional< size_t > index_
Definition select_call.h:44
SelectCall(Select *parent)
Definition select_call.h:20
SelectCall & with_cycle(bool cycle)
SelectCall & select_previous(bool cycle)
SelectOperation operation_
Definition select_call.h:45
SelectCall & with_operation(SelectOperation operation)
__attribute__((always_inline)) inline optional< size_t > calculate_target_index_(const char *name)
SelectCall & set_index(size_t index)
SelectCall & set_option(const char *option, size_t len)
SelectCall & with_option(const char *option)
Definition select_call.h:37
SelectCall & set_option(const std::string &option)
Definition select_call.h:24
SelectCall & with_option(const std::string &option)
Definition select_call.h:36
SelectCall & set_option(const char *option)
Definition select_call.h:25
SelectCall & with_option(const char *option, size_t len)
Base-class for all selects.
Definition select.h:30
std::string size_t len
Definition helpers.h:503