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
9CX_C_BEGIN
10
14
16typedef enum ConKey {
17 CON_Key_None = 0,
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
53
56 CON_Mod_Shift = 0x01,
57 CON_Mod_Alt = 0x02,
58 CON_Mod_Ctrl = 0x04,
59};
60
62typedef struct ConKeyEvent {
64 int32 ch;
65 flags_t mods;
69
75
94bool conSetMode(_In_ ConStream* con, ConInputMode mode);
95
103bool conSetEcho(_In_ ConStream* con, bool echo);
104
109bool conInWait(_In_ ConStream* con, int64 timeout);
110
122bool conReadKey(_In_ ConStream* con, _Out_ ConKeyEvent* out, int64 timeout);
123
137bool conReadLine(_In_ ConStream* con, _Inout_ string* out);
138
147bool conReadPassword(_In_ ConStream* con, _Inout_ string* out);
148
150
151CX_C_END
bool conSetEcho(ConStream *con, bool echo)
ConInputMode
Input mode for a stream. See conSetMode().
Definition conin.h:71
bool conReadLine(ConStream *con, string *out)
CON_MOD_FLAGS
Modifier flags for ConKeyEvent::mods.
Definition conin.h:55
bool conReadKey(ConStream *con, ConKeyEvent *out, int64 timeout)
ConKey
Logical key identity, independent of the byte/escape sequence a terminal happened to send.
Definition conin.h:16
bool conReadPassword(ConStream *con, string *out)
bool conInWait(ConStream *con, int64 timeout)
bool conSetMode(ConStream *con, ConInputMode mode)
@ CON_Raw
Keystrokes available immediately, one at a time.
Definition conin.h:73
@ CON_Cooked
Line-buffered, terminal-echoed, signal-generating – the default.
Definition conin.h:72
@ CON_Key_Resize
Synthetic: the terminal size changed (Windows only – see conReadKey())
Definition conin.h:51
@ CON_Key_Char
A printable/control character; the codepoint is in ConKeyEvent::ch.
Definition conin.h:19
@ CON_Key_None
Definition conin.h:17
A single decoded key press.
Definition conin.h:62
int32 ch
Unicode codepoint for CON_Key_Char; 0 for every other key.
Definition conin.h:64
ConKey key
Which key. CON_Key_Char means ch holds the codepoint.
Definition conin.h:63
flags_t mods
Definition conin.h:65
Time manipulation and conversion functions.