Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core): split context API from Core primary API 🌱 #10401

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
391 changes: 0 additions & 391 deletions core/include/keyman/keyman_core_api.h

Large diffs are not rendered by default.

486 changes: 486 additions & 0 deletions core/include/keyman/keyman_core_api_context.h

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions core/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ python = py.find_installation()
# For now, we use KM_CORE_LIBRARY to inject the km::core::kmx namespace
defns += ['-DKM_CORE_LIBRARY']

# See keyman_core_api_context.h
defns += ['-D_KM_CORE_ACCESS_PRIVATE_CONTEXT_API']

# #define DEBUG when we are on a debug build
if get_option('buildtype') == 'debug'
add_global_arguments('-DDEBUG', language : 'cpp')
Expand Down
1 change: 0 additions & 1 deletion core/src/action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <sstream>
#include <memory>

#include <keyman/keyman_core_api.h>

#include "action.hpp"
#include "state.hpp"
Expand Down
2 changes: 1 addition & 1 deletion core/src/action.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#pragma once

#include <keyman/keyman_core_api.h>
#include "keyman_core.h"
#include <state.hpp>

namespace km {
Expand Down
2 changes: 1 addition & 1 deletion core/src/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#pragma once
#include <list>
#include <vector>
#include <keyman/keyman_core_api.h>
#include "keyman_core.h"

// Forward declarations
class json;
Expand Down
3 changes: 1 addition & 2 deletions core/src/debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#include <cassert>
#include <vector>

#include <keyman/keyman_core_api.h>
#include <keyman/keyman_core_api_debug.h>
#include "keyman_core.h"

namespace km {
namespace core
Expand Down
2 changes: 1 addition & 1 deletion core/src/keyboard.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <string>
#include <vector>

#include <keyman/keyman_core_api.h>
#include "keyman_core.h"

#include "option.hpp"
#include "path.hpp"
Expand Down
5 changes: 5 additions & 0 deletions core/src/keyman_core.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once

#include <keyman/keyman_core_api.h>
#include <keyman/keyman_core_api_context.h>
#include <keyman/keyman_core_api_debug.h>
3 changes: 2 additions & 1 deletion core/src/km_core_action_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#include <algorithm>
#include <sstream>

#include <keyman/keyman_core_api.h>
#include "keyman_core.h"

#include "jsonpp.hpp"

#include "processor.hpp"
Expand Down
2 changes: 1 addition & 1 deletion core/src/km_core_context_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <algorithm>
#include <vector>

#include <keyman/keyman_core_api.h>
#include "keyman_core.h"

#include "context.hpp"
#include "jsonpp.hpp"
Expand Down
2 changes: 1 addition & 1 deletion core/src/km_core_debug_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <algorithm>
#include <sstream>

#include <keyman/keyman_core_api.h>
#include "keyman_core.h"

#include "processor.hpp"
#include "state.hpp"
Expand Down
3 changes: 2 additions & 1 deletion core/src/km_core_keyboard_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#include <cassert>
#include <vector>

#include <keyman/keyman_core_api.h>
#include "keyman_core.h"

#include "keyboard.hpp"
#include "processor.hpp"
#include "kmx/kmx_processor.hpp"
Expand Down
3 changes: 2 additions & 1 deletion core/src/km_core_options_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#include <cassert>
#include <sstream>

#include <keyman/keyman_core_api.h>
#include "keyman_core.h"

#include "processor.hpp"

#include "jsonpp.hpp"
Expand Down
3 changes: 2 additions & 1 deletion core/src/km_core_processevent_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
History: 17 Oct 2018 - TSE - Initial implementation.
*/

#include <keyman/keyman_core_api.h>
#include "keyman_core.h"

#include "processor.hpp"
#include "state.hpp"

Expand Down
2 changes: 1 addition & 1 deletion core/src/km_core_state_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <iomanip>
#include <codecvt>

#include <keyman/keyman_core_api.h>
#include "keyman_core.h"
#include "jsonpp.hpp"

#include "processor.hpp"
Expand Down
2 changes: 1 addition & 1 deletion core/src/km_core_state_context_set_if_needed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
#include <cassert>

#include <keyman/keyman_core_api.h>
#include "keyman_core.h"

#include "processor.hpp"
#include "state.hpp"
Expand Down
3 changes: 1 addition & 2 deletions core/src/kmx/kmx_base.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once

#include <keyman/keyman_core_api_bits.h>
#include <keyman/keyman_core_api.h>
#include "keyman_core.h"

#if defined(_WIN32) || defined(_WIN64)
#define snprintf _snprintf
Expand Down
2 changes: 1 addition & 1 deletion core/src/kmx/kmx_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <string>
#include <vector>

#include <keyman/keyman_core_api.h>
#include "keyman_core.h"
#include "option.hpp"

#include "kmx_base.h"
Expand Down
2 changes: 1 addition & 1 deletion core/src/kmx/kmx_processor.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <keyman/keyman_core_api.h>
#include "keyman_core.h"
#include "state.hpp"
#include "kmx/kmx_processor.hpp"
#include <map>
Expand Down
2 changes: 1 addition & 1 deletion core/src/kmx/kmx_processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#pragma once

#include <string>
#include <keyman/keyman_core_api.h>
#include "keyman_core.h"
#include "kmx/kmx_processevent.h"
#include "keyboard.hpp"
#include "processor.hpp"
Expand Down
2 changes: 1 addition & 1 deletion core/src/ldml/ldml_processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <utility>
#include <vector>
#include <memory>
#include <keyman/keyman_core_api.h>
#include "keyman_core.h"
#include "processor.hpp"
#include "option.hpp"
#include "ldml_vkeys.hpp"
Expand Down
2 changes: 1 addition & 1 deletion core/src/ldml/ldml_vkeys.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <utility>
#include <vector>

#include <keyman/keyman_core_api.h>
#include "keyman_core.h"

namespace km {
namespace core {
Expand Down
2 changes: 1 addition & 1 deletion core/src/mock/mock_processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <string>
#include <unordered_map>
#include <keyman/keyman_core_api.h>
#include "keyman_core.h"

#include "processor.hpp"
#include "option.hpp"
Expand Down
3 changes: 2 additions & 1 deletion core/src/option.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

#include <string>

#include <keyman/keyman_core_api.h>
#include "keyman_core.h"


// Forward declarations
class json;
Expand Down
3 changes: 2 additions & 1 deletion core/src/path.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#include <string>
#include <type_traits>

#include <keyman/keyman_core_api.h>
#include "keyman_core.h"

#include "jsonpp.hpp"
#include "utfcodec.hpp"

Expand Down
2 changes: 1 addition & 1 deletion core/src/processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <string>
#include <unordered_map>

#include <keyman/keyman_core_api.h>
#include "keyman_core.h"

#include "keyboard.hpp"

Expand Down
2 changes: 1 addition & 1 deletion core/src/state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <cassert>
#include <vector>

#include <keyman/keyman_core_api.h>
#include "keyman_core.h"

#include "context.hpp"
#include "option.hpp"
Expand Down
2 changes: 1 addition & 1 deletion core/tests/unit/kmnkbd/action_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
History: 23 Oct 2023 - MCD - Initial implementation.
*/
#include <string>
#include <keyman/keyman_core_api.h>
#include "keyman_core.h"

#include "path.hpp"
#include "action.hpp"
Expand Down
2 changes: 1 addition & 1 deletion core/tests/unit/kmnkbd/action_items.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <keyman/keyman_core_api.h>
#include "keyman_core.h"
#include <string>
#include <iostream>

Expand Down
3 changes: 2 additions & 1 deletion core/tests/unit/kmnkbd/action_set_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
History: 23 Oct 2023 - MCD - Initial implementation.
*/
#include <string>
#include <keyman/keyman_core_api.h>

#include "keyman_core.h"

#include "path.hpp"
#include "action.hpp"
Expand Down
3 changes: 2 additions & 1 deletion core/tests/unit/kmnkbd/context_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
mutation functions.
*/
#include <string>
#include <keyman/keyman_core_api.h>

#include "keyman_core.h"

#include "context.hpp"
#include "utfcodec.hpp"
Expand Down
4 changes: 3 additions & 1 deletion core/tests/unit/kmnkbd/debug_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#include <algorithm>
#include <iterator>
#include <string>
#include <keyman/keyman_core_api.h>

#include "keyman_core.h"

#include "path.hpp"
#include "state.hpp"
#include "kmx/kmx_base.h"
Expand Down
3 changes: 1 addition & 2 deletions core/tests/unit/kmnkbd/debug_items.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <iostream>
#include <keyman/keyman_core_api.h>
#include <keyman/keyman_core_api_debug.h>
#include "keyman_core.h"
#include "kmx/kmx_base.h"
#include "kmx/kmx_xstring.h"

Expand Down
2 changes: 1 addition & 1 deletion core/tests/unit/kmnkbd/keyboard_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
#include <string>

#include <keyman/keyman_core_api.h>
#include "keyman_core.h"
#include "path.hpp"

//#include "keyboard.hpp"
Expand Down
2 changes: 1 addition & 1 deletion core/tests/unit/kmnkbd/options_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <cstdlib>
#include <string>

#include <keyman/keyman_core_api.h>
#include "keyman_core.h"

#include "option.hpp"
#include "state.hpp"
Expand Down
2 changes: 1 addition & 1 deletion core/tests/unit/kmnkbd/state_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <iostream>
#include <string>

#include <keyman/keyman_core_api.h>
#include "keyman_core.h"

#include "path.hpp"
#include "state.hpp"
Expand Down
2 changes: 2 additions & 0 deletions core/tests/unit/kmx/kmx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include <string>
#include <type_traits>

#include "keyman_core.h"

#include <kmx/kmx_processevent.h>
#include <kmx/kmx_xstring.h>

Expand Down
2 changes: 2 additions & 0 deletions core/tests/unit/ldml/ldml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include <test_assert.h>
#include <test_color.h>

#include "keyman_core.h"

#include <kmx/kmx_xstring.h> // for surrogate pair macros

#include "ldml_test_source.hpp"
Expand Down
3 changes: 2 additions & 1 deletion core/tests/unit/ldml/ldml_test_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
#include <kmx/kmx_processevent.h> // for char to vk mapping tables
#include <kmx/kmx_xstring.h> // for surrogate pair macros
#include <kmx/kmx_plus.h>
#include <keyman/keyman_core_api.h>

#include "keyman_core.h"

namespace km {
namespace tests {
Expand Down
2 changes: 1 addition & 1 deletion core/tests/unit/ldml/test_context_normalization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
History: 15 Jan 2024 - MCD - Initial implementation.
*/
#include <string>
#include <keyman/keyman_core_api.h>
#include "keyman_core.h"

#include "path.hpp"
#include "action.hpp"
Expand Down
1 change: 1 addition & 0 deletions windows/src/engine/keyman32/keymanengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <msctf.h>
#include "../../../../common/windows/cpp/include/legacy_kmx_file.h"
#include <keyman/keyman_core_api.h>
#include <keyman/keyman_core_api_context.h> // for intermediate context
#include <keyman/keyman_core_api_consts.h>

/***************************************************************************/
Expand Down