mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-12 20:05:34 +00:00
Turn the keyboard class backing the km_kbp_keyboard and km_kbp_keyboard_attr objects into just keyboard_attributes. Move the abstract_processor and sublcasses as the objects that back km_kbp_keyboard and make keyboard_attrs a member of the asbtract_processor. Move kmx_processor and mock_processor declarations into their own headers. Make all vector<km_kbp_option_item> into vector<option> to handle memory management, moving and copying correctly. Update test cases accordingly
52 lines
1.4 KiB
C++
52 lines
1.4 KiB
C++
/*
|
|
Copyright: © 2018 SIL International.
|
|
Description: Internal keyboard class and adaptor class for the API.
|
|
Create Date: 2 Oct 2018
|
|
Authors: Tim Eves (TSE)
|
|
History: 2 Oct 2018 - TSE - Refactored out of km_kbp_keyboard_api.cpp
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <keyman/keyboardprocessor.h>
|
|
|
|
#include "keyboard.hpp"
|
|
|
|
namespace km {
|
|
namespace kbp
|
|
{
|
|
class abstract_processor
|
|
{
|
|
protected:
|
|
keyboard_attributes _attributes;
|
|
|
|
public:
|
|
abstract_processor() {}
|
|
abstract_processor(keyboard_attributes && kb) : _attributes(std::move(kb)) {}
|
|
virtual ~abstract_processor() { };
|
|
|
|
keyboard_attributes const & keyboard() const noexcept {
|
|
return _attributes;
|
|
}
|
|
|
|
virtual km_kbp_status process_event(km_kbp_state *,
|
|
km_kbp_virtual_key,
|
|
uint16_t modifier_state) = 0;
|
|
|
|
virtual km_kbp_attr const & attributes() const = 0;
|
|
virtual km_kbp_status validate() const = 0;
|
|
|
|
virtual void update_option(km_kbp_state *state,
|
|
km_kbp_option_scope,
|
|
std::u16string const & key,
|
|
std::u16string const & value) = 0;
|
|
|
|
virtual void init_state(std::vector<option> &default_env) = 0;
|
|
};
|
|
|
|
} // namespace kbp
|
|
} // namespace km
|
|
|
|
struct km_kbp_keyboard : public km::kbp::abstract_processor {};
|