Libmacro
0.2
Libmacro is an extensible macro and hotkey library.
serial.h
Go to the documentation of this file.
1
/* Libmacro - A multi-platform, extendable macro and hotkey C library
2
Copyright (C) 2013 Jonathan Pelletier, New Paradigm Software
3
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Lesser General Public
6
License as published by the Free Software Foundation; either
7
version 2.1 of the License, or (at your option) any later version.
8
9
This library is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
Lesser General Public License for more details.
13
14
You should have received a copy of the GNU Lesser General Public
15
License along with this library; if not, write to the Free Software
16
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
*/
18
23
#ifndef __cplusplus
24
#pragma message "C++ support is required for extras module"
25
#include "
mcr/err.h
"
26
#endif
27
28
#ifndef MCR_EXTRAS_SERIAL_H_
29
#define MCR_EXTRAS_SERIAL_H_
30
31
#include "mcr/extras/base_cpp.h"
32
33
namespace
mcr
34
{
36
class
SerialPrivate;
37
class
MCR_API
Serial
final
// And that's final!
38
{
39
friend
class
SerialPrivate;
40
public
:
43
Serial
();
44
Serial
(
const
Serial
&) =
delete
;
47
~
Serial
();
48
Serial
&operator =(
const
Serial
&) =
delete
;
49
50
int
applyType(
const
char
*name)
const
;
51
inline
int
applyTypeMax()
const
52
{
53
return
MCR_TOGGLE
;
54
}
55
inline
unsigned
int
applyTypeCount()
const
56
{
57
return
applyTypeMax() + 1;
58
}
59
const
char
*applyTypeName(
int
value)
const
;
60
61
inline
int
keyPress(
const
char
*name)
const
62
{
63
return
applyType(name);
64
}
65
inline
int
keyPressMax()
const
66
{
67
return
applyTypeMax();
68
}
69
inline
unsigned
int
keyPressCount()
const
70
{
71
return
applyTypeCount();
72
}
73
const
char
*keyPressName(
int
value)
const
;
74
75
int
dimension(
const
char
*name)
const
;
76
inline
int
dimensionMax()
const
77
{
78
return
MCR_DIMENSION_MAX;
79
}
80
inline
unsigned
int
dimensionCount()
const
81
{
82
return
dimensionMax() + 1;
83
}
84
const
char
*dimensionName(
int
value)
const
;
85
86
size_t
echo(
const
char
*name)
const
;
87
size_t
echoMax()
const
;
88
inline
size_t
echoCount()
const
89
{
90
return
echoMax() + 1;
91
}
92
const
char
*echoName(
size_t
value)
const
;
93
void
setEcho(
size_t
value,
const
char
*name);
94
void
addEcho(
size_t
value,
const
char
*
const
*addNames,
size_t
count);
95
void
mapEcho(
size_t
value,
const
char
*name,
const
char
*
const
*addNames,
96
size_t
count);
97
98
int
key(
const
char
*name)
const
;
99
int
keyMax()
const
;
100
size_t
keyCount()
const
;
101
const
char
*keyName(
int
value)
const
;
102
void
setKey(
int
value,
const
char
*name);
103
void
addKey(
int
value,
const
char
*
const
*addNames,
size_t
count);
104
void
mapKey(
int
value,
const
char
*name,
const
char
*
const
*addNames,
size_t
count);
105
106
unsigned
int
modifiers(
const
char
*name)
const
;
107
unsigned
int
modifiersMax()
const
108
{
109
return
MCR_MF_USER;
110
}
111
unsigned
int
modifiersCount()
const
;
112
const
char
*modifiersName(
unsigned
int
value)
const
;
113
114
unsigned
int
triggerFlags(
const
char
*name)
const
;
115
unsigned
int
triggerFlagsMax()
const
116
{
117
return
MCR_TF_USER
;
118
}
119
unsigned
int
triggerFlagsCount()
const
;
120
const
char
*triggerFlagsName(
unsigned
int
value)
const
;
121
122
int
interrupt(
const
char
*name)
const
;
123
int
interruptMax()
const
;
124
int
interruptCount()
const
;
125
const
char
*interruptName(
int
value);
126
private
:
127
/* non-export */
128
SerialPrivate *_private;
129
130
template
<
typename
vT,
typename
mT>
131
static
inline
vT nameValue(mT &map,
const
char
*name, vT valNotFound)
132
{
133
auto
it = map.find(name);
134
if
(it == map.end())
135
return
valNotFound;
136
return
it->second;
137
}
138
139
void
platformInitialize();
140
};
141
}
142
143
#endif
mcr::Serial
Definition:
serial.h:37
MCR_TOGGLE
Definition:
types.h:168
err.h
Raise a compiler error. Usage: #include "mcr/err.h"
MCR_TF_USER
Definition:
trigger_flags.h:67
mcr
Libmacro, by Jonathan Pelletier, New Paradigm Software. Alpha version.
Definition:
classes.h:31
mcr
extras
serial.h
Generated on Sun Sep 27 2020 01:58:03 for Libmacro by
1.8.12