-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathsteno_key_code_emitter.h
35 lines (27 loc) · 1.09 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
//---------------------------------------------------------------------------
#pragma once
#include <stddef.h>
#include "steno_key_code.h"
#include "steno_key_code_buffer.h"
//---------------------------------------------------------------------------
class StenoKeyCodeEmitter {
public:
struct EmitterContext;
// Processes previous and current keycode buffers and determines what
// differences to emit.
//
// Returns true if the last stroke should be combined with previous for undo
// purposes.
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.GetCount(), next.buffer,
next.GetCount());
}
void Emit(const StenoKeyCode *value, size_t length) const;
void Emit(const StenoKeyCodeBuffer &buffer) const {
Emit(buffer.buffer, buffer.GetCount());
}
};
//---------------------------------------------------------------------------