SpaIot Library
Loading...
Searching...
No Matches
buttoncontroller.h
1
/*
2
SpaIot Library (c) by epsilonrt - epsilonrt@epsilonrt.fr
3
This file is part of SpaIot library <https://github.com/epsilonrt/spaiot-lib>
4
5
SPDX-License-Identifier: BSD-3-Clause
6
7
SpaIot library is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY;
9
*/
10
#pragma once
11
12
#include <map>
13
#include "global.h"
14
15
namespace
SpaIot
{
16
26
class
ButtonController
{
27
public
:
31
ButtonController
(
const
ButtonController
&other);
32
37
ButtonController
(
ButtonController
&&other);
38
42
virtual
ButtonController
&
operator=
(
const
ButtonController
&other);
43
48
virtual
ButtonController
&
operator=
(
ButtonController
&&other);
49
54
virtual
~ButtonController
();
55
59
virtual
void
clear
();
60
64
bool
isNull
()
const
;
65
69
virtual
bool
isEmpty
()
const
;
70
74
virtual
bool
operator==
(
const
ButtonController
&other)
const
;
75
79
virtual
bool
operator!=
(
const
ButtonController
&other)
const
;
80
84
virtual
void
begin
();
85
89
virtual
void
end
();
90
97
virtual
int
select
(
int
button) = 0;
98
103
virtual
void
deselect
() = 0;
104
108
virtual
int
selected
()
const
;
109
113
virtual
bool
isOpen
()
const
;
114
118
virtual
bool
isSelected
()
const
;
119
123
virtual
const
String &
name
()
const
;
124
130
static
bool
addToRegister
(
const
String &
name
,
ButtonController
&controller);
131
141
static
ButtonController
&
getFromRegister
(
const
String &
name
);
142
148
static
bool
registerContains
(
const
String &
name
);
149
150
protected
:
151
class
Private;
152
ButtonController
(Private &dd);
153
std::unique_ptr<Private> d_ptr;
154
private
:
155
PIMPL_DECLARE_PRIVATE (
ButtonController
)
156
};
157
}
SpaIot::ButtonController
This class is the base class of all button controllers.
Definition
buttoncontroller.h:26
SpaIot::ButtonController::isOpen
virtual bool isOpen() const
Returns true if begin() has been successfully called.
SpaIot::ButtonController::ButtonController
ButtonController(ButtonController &&other)
Move Constructor after the move, other is null, other.clear() must be called if it is to be used agai...
SpaIot::ButtonController::selected
virtual int selected() const
Returns the button number that is selected, or -1 if no button is selected.
SpaIot::ButtonController::ButtonController
ButtonController(const ButtonController &other)
Copy Constructor.
SpaIot::ButtonController::end
virtual void end()
Releases all ressources used by the object.
SpaIot::ButtonController::operator!=
virtual bool operator!=(const ButtonController &other) const
Returns true if the two objects are not equal.
SpaIot::ButtonController::isNull
bool isNull() const
Returns true if the object is null (i.e. it has not been initialized, d_ptr is null)
SpaIot::ButtonController::operator=
virtual ButtonController & operator=(const ButtonController &other)
Assignment operator.
SpaIot::ButtonController::isEmpty
virtual bool isEmpty() const
Checks if all attributes are set to their default values (same as the default constructor)
SpaIot::ButtonController::deselect
virtual void deselect()=0
Deselects the button After the call to this function, isSelected() must return false,...
SpaIot::ButtonController::registerContains
static bool registerContains(const String &name)
Returns true if the register contains a ButtonController object with the given name.
SpaIot::ButtonController::select
virtual int select(int button)=0
Selects a button.
SpaIot::ButtonController::getFromRegister
static ButtonController & getFromRegister(const String &name)
Returns a ButtonController object from the register.
SpaIot::ButtonController::addToRegister
static bool addToRegister(const String &name, ButtonController &controller)
Adds a ButtonController object to the register.
SpaIot::ButtonController::~ButtonController
virtual ~ButtonController()
Destructor By default, this calls the virtual function end()
SpaIot::ButtonController::begin
virtual void begin()
Configures all ressources needed to use the object.
SpaIot::ButtonController::clear
virtual void clear()
Sets all attributes to their default values (same as the default constructor)
SpaIot::ButtonController::isSelected
virtual bool isSelected() const
Returns true if a button is selected.
SpaIot::ButtonController::name
virtual const String & name() const
Returns the name of the ButtonController object if it has been set, otherwise it returns an empty str...
SpaIot::ButtonController::operator==
virtual bool operator==(const ButtonController &other) const
Returns true if the two objects are equal.
SpaIot
SpaIot name space.
Definition
bussettings.h:15
src
buttoncontroller.h
Generated by
1.9.8