/
steno_key_code_emitter.h
51 lines (36 loc) · 1.27 KB
/
steno_key_code_emitter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//---------------------------------------------------------------------------
#pragma once
#include <stddef.h>
#include "steno_key_code.h"
#include "steno_key_code_buffer.h"
//---------------------------------------------------------------------------
enum class UnicodeMode : uint8_t {
NONE,
MACOS_US,
MACOS_UNICODE_HEX,
WINDOWS_ALT,
WINDOWS_HEX,
LINUX_IBUS,
COUNT,
};
const char *UnicodeModeName(UnicodeMode mode);
//---------------------------------------------------------------------------
class StenoKeyCodeEmitter {
public:
struct EmitterContext;
bool Process(const StenoKeyCode *previous, size_t previousLength,
const StenoKeyCode *value, size_t valueLength) const;
bool Process(const StenoKeyCodeBuffer &previous,
const StenoKeyCodeBuffer &next) const {
return Process(previous.buffer, previous.count, next.buffer, next.count);
}
static const char *GetUnicodeModeName() {
return UnicodeModeName(emitterMode);
}
static bool SetUnicodeMode(const char *name);
static void SetUnicodeMode(UnicodeMode newMode) { emitterMode = newMode; }
static const char *const UNICODE_EMITTER_NAMES[];
private:
static UnicodeMode emitterMode;
};
//---------------------------------------------------------------------------