ESPHome  2022.9.1
select_call.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "esphome/core/helpers.h"
4 
5 namespace esphome {
6 namespace select {
7 
8 class Select;
9 
18 };
19 
20 class SelectCall {
21  public:
22  explicit SelectCall(Select *parent) : parent_(parent) {}
23  void perform();
24 
25  SelectCall &set_option(const std::string &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 std::string &option);
36  SelectCall &with_index(size_t index);
37 
38  protected:
39  Select *const parent_;
43  bool cycle_;
44 };
45 
46 } // namespace select
47 } // namespace esphome
SelectCall & select_next(bool cycle)
Definition: select_call.cpp:16
SelectCall & with_cycle(bool cycle)
Definition: select_call.cpp:29
SelectCall & set_index(size_t index)
Definition: select_call.cpp:14
SelectOperation operation_
Definition: select_call.h:42
SelectCall & with_option(const std::string &option)
Definition: select_call.cpp:34
SelectCall & with_operation(SelectOperation operation)
Definition: select_call.cpp:24
SelectCall & with_index(size_t index)
Definition: select_call.cpp:39
SelectCall & select_previous(bool cycle)
Definition: select_call.cpp:18
optional< size_t > index_
Definition: select_call.h:41
Base-class for all selects.
Definition: select.h:24
Definition: a4988.cpp:4
optional< std::string > option_
Definition: select_call.h:40
SelectCall(Select *parent)
Definition: select_call.h:22
SelectCall & set_option(const std::string &option)
Definition: select_call.cpp:10