CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
conin.h
Go to the documentation of this file.
1
3
4
#pragma once
5
6
#include <
cx/time/time.h
>
7
#include "console.h"
8
9
CX_C_BEGIN
10
14
16
typedef
enum
ConKey
{
17
CON_Key_None
= 0,
19
CON_Key_Char
,
20
21
CON_Key_Enter,
22
CON_Key_Tab,
23
CON_Key_Backspace,
24
CON_Key_Escape,
25
26
CON_Key_Up,
27
CON_Key_Down,
28
CON_Key_Left,
29
CON_Key_Right,
30
31
CON_Key_Home,
32
CON_Key_End,
33
CON_Key_PageUp,
34
CON_Key_PageDown,
35
CON_Key_Insert,
36
CON_Key_Delete,
37
38
CON_Key_F1,
39
CON_Key_F2,
40
CON_Key_F3,
41
CON_Key_F4,
42
CON_Key_F5,
43
CON_Key_F6,
44
CON_Key_F7,
45
CON_Key_F8,
46
CON_Key_F9,
47
CON_Key_F10,
48
CON_Key_F11,
49
CON_Key_F12,
50
51
CON_Key_Resize
,
52
}
ConKey
;
53
55
enum
CON_MOD_FLAGS
{
56
CON_Mod_Shift = 0x01,
57
CON_Mod_Alt = 0x02,
58
CON_Mod_Ctrl = 0x04,
59
};
60
62
typedef
struct
ConKeyEvent
{
63
ConKey
key
;
64
int32
ch
;
65
flags_t
mods
;
68
}
ConKeyEvent
;
69
71
typedef
enum
ConInputMode
{
72
CON_Cooked
,
73
CON_Raw
,
74
}
ConInputMode
;
75
94
bool
conSetMode
(_In_ ConStream* con,
ConInputMode
mode);
95
103
bool
conSetEcho
(_In_ ConStream* con,
bool
echo);
104
109
bool
conInWait
(_In_ ConStream* con, int64 timeout);
110
122
bool
conReadKey
(_In_ ConStream* con, _Out_
ConKeyEvent
* out, int64 timeout);
123
137
bool
conReadLine
(_In_ ConStream* con, _Inout_
string
* out);
138
147
bool
conReadPassword
(_In_ ConStream* con, _Inout_
string
* out);
148
150
151
CX_C_END
conSetEcho
bool conSetEcho(ConStream *con, bool echo)
ConInputMode
ConInputMode
Input mode for a stream. See conSetMode().
Definition
conin.h:71
conReadLine
bool conReadLine(ConStream *con, string *out)
CON_MOD_FLAGS
CON_MOD_FLAGS
Modifier flags for ConKeyEvent::mods.
Definition
conin.h:55
conReadKey
bool conReadKey(ConStream *con, ConKeyEvent *out, int64 timeout)
ConKey
ConKey
Logical key identity, independent of the byte/escape sequence a terminal happened to send.
Definition
conin.h:16
conReadPassword
bool conReadPassword(ConStream *con, string *out)
conInWait
bool conInWait(ConStream *con, int64 timeout)
conSetMode
bool conSetMode(ConStream *con, ConInputMode mode)
CON_Raw
@ CON_Raw
Keystrokes available immediately, one at a time.
Definition
conin.h:73
CON_Cooked
@ CON_Cooked
Line-buffered, terminal-echoed, signal-generating – the default.
Definition
conin.h:72
CON_Key_Resize
@ CON_Key_Resize
Synthetic: the terminal size changed (Windows only – see conReadKey())
Definition
conin.h:51
CON_Key_Char
@ CON_Key_Char
A printable/control character; the codepoint is in ConKeyEvent::ch.
Definition
conin.h:19
CON_Key_None
@ CON_Key_None
Definition
conin.h:17
ConKeyEvent
A single decoded key press.
Definition
conin.h:62
ConKeyEvent::ch
int32 ch
Unicode codepoint for CON_Key_Char; 0 for every other key.
Definition
conin.h:64
ConKeyEvent::key
ConKey key
Which key. CON_Key_Char means ch holds the codepoint.
Definition
conin.h:63
ConKeyEvent::mods
flags_t mods
Definition
conin.h:65
time.h
Time manipulation and conversion functions.
cx
console
conin.h
Generated by
1.9.8