From 604fbc1a752a168d481bce80fbf3d70e4c3b7fd4 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Wed, 18 Oct 2023 16:28:54 +0200 Subject: [PATCH 1/2] chore(linux): Rename namespace kbp to core --- common/include/kmx_file.h | 4 +- core/meson.build | 2 +- core/src/context.hpp | 8 ++-- core/src/debug.hpp | 4 +- core/src/debuglog.cpp | 2 +- core/src/debuglog.h | 6 +-- core/src/keyboard.cpp | 4 +- core/src/keyboard.hpp | 10 ++--- core/src/km_core_context_api.cpp | 2 +- core/src/km_core_debug_api.cpp | 2 +- core/src/km_core_keyboard_api.cpp | 2 +- core/src/km_core_state_api.cpp | 2 +- core/src/kmx/kmx_actions.cpp | 2 +- core/src/kmx/kmx_actions.h | 4 +- core/src/kmx/kmx_base.h | 4 +- core/src/kmx/kmx_capslock.cpp | 2 +- core/src/kmx/kmx_consts.cpp | 4 +- core/src/kmx/kmx_context.cpp | 2 +- core/src/kmx/kmx_context.h | 4 +- core/src/kmx/kmx_conversion.cpp | 4 +- core/src/kmx/kmx_conversion.h | 4 +- core/src/kmx/kmx_debugger.cpp | 4 +- core/src/kmx/kmx_debugger.h | 6 +-- core/src/kmx/kmx_environment.cpp | 2 +- core/src/kmx/kmx_environment.h | 4 +- core/src/kmx/kmx_file.cpp | 4 +- core/src/kmx/kmx_file_validator.hpp | 4 +- core/src/kmx/kmx_modifiers.cpp | 8 ++-- core/src/kmx/kmx_options.cpp | 2 +- core/src/kmx/kmx_options.h | 4 +- core/src/kmx/kmx_plus.cpp | 6 +-- core/src/kmx/kmx_plus.h | 6 +-- core/src/kmx/kmx_processevent.cpp | 24 +++++------ core/src/kmx/kmx_processevent.h | 6 +-- core/src/kmx/kmx_processor.cpp | 8 ++-- core/src/kmx/kmx_processor.hpp | 4 +- core/src/kmx/kmx_xstring.cpp | 38 ++++++++--------- core/src/kmx/kmx_xstring.h | 16 +++---- core/src/ldml/ldml_processor.cpp | 14 +++---- core/src/ldml/ldml_processor.hpp | 4 +- core/src/ldml/ldml_transforms.cpp | 16 +++---- core/src/ldml/ldml_transforms.hpp | 10 ++--- core/src/ldml/ldml_vkeys.cpp | 4 +- core/src/ldml/ldml_vkeys.hpp | 4 +- core/src/mock/mock_processor.cpp | 6 +-- core/src/mock/mock_processor.hpp | 6 +-- core/src/option.cpp | 4 +- core/src/option.hpp | 4 +- core/src/path.hpp | 4 +- core/src/processor.hpp | 6 +-- core/src/state.cpp | 4 +- core/src/state.hpp | 34 +++++++-------- .../tests/kmx_test_source/kmx_test_source.cpp | 14 +++---- .../tests/kmx_test_source/kmx_test_source.hpp | 2 +- core/tests/unit/kmnkbd/debug_api.cpp | 4 +- core/tests/unit/kmnkbd/debug_items.hpp | 2 +- core/tests/unit/kmnkbd/keyboard_api.cpp | 2 +- core/tests/unit/kmnkbd/options_api.cpp | 4 +- core/tests/unit/kmnkbd/state_api.cpp | 2 +- core/tests/unit/kmnkbd/test_kmx_context.cpp | 2 +- core/tests/unit/kmnkbd/test_kmx_xstring.cpp | 2 +- core/tests/unit/kmx/kmx.cpp | 8 ++-- core/tests/unit/kmx/kmx_external_event.cpp | 8 ++-- core/tests/unit/kmx/kmx_imx.cpp | 12 +++--- core/tests/unit/kmx/kmx_key_list.cpp | 6 +-- core/tests/unit/ldml/keyboards/meson.build | 2 +- core/tests/unit/ldml/ldml.cpp | 8 ++-- core/tests/unit/ldml/ldml_test_source.cpp | 42 +++++++++---------- core/tests/unit/ldml/ldml_test_source.hpp | 8 ++-- core/tests/unit/ldml/ldml_test_utils.cpp | 2 +- core/tests/unit/ldml/meson.build | 2 +- core/tests/unit/ldml/test_kmx_plus.cpp | 6 +-- core/tests/unit/ldml/test_transforms.cpp | 6 +-- linux/ibus-keyman/tests/testfixture.cpp | 4 +- 74 files changed, 246 insertions(+), 246 deletions(-) diff --git a/common/include/kmx_file.h b/common/include/kmx_file.h index fb071ef4e5f..7dbc2261d0d 100644 --- a/common/include/kmx_file.h +++ b/common/include/kmx_file.h @@ -28,7 +28,7 @@ typedef KMX_WORD __attribute__((aligned(1))) KMX_WORD_unaligned; #ifdef KM_CORE_LIBRARY // TODO: move this to a common namespace keyman::common::kmx_file or similar in the future namespace km { -namespace kbp { +namespace core { namespace kmx { #endif @@ -404,6 +404,6 @@ static_assert(sizeof(COMP_KEYBOARD) == KEYBOARDFILEHEADER_SIZE, "COMP_KEYBOARD m #ifdef KM_CORE_LIBRARY } // namespace kmx -} // namespace kbp +} // namespace core } // namespace km #endif diff --git a/core/meson.build b/core/meson.build index 6f5429a7b1a..12f66f32ab0 100644 --- a/core/meson.build +++ b/core/meson.build @@ -25,7 +25,7 @@ py = import('python') python = py.find_installation() # TODO: Shared includes may use namespaces, etc which need future tidyup. -# For now, we use KM_CORE_LIBRARY to inject the km::kbp::kmx namespace +# For now, we use KM_CORE_LIBRARY to inject the km::core::kmx namespace defns += ['-DKM_CORE_LIBRARY'] # #define DEBUG when we are on a debug build diff --git a/core/src/context.hpp b/core/src/context.hpp index 08edc861634..dba7bec0608 100644 --- a/core/src/context.hpp +++ b/core/src/context.hpp @@ -15,7 +15,7 @@ class json; namespace km { -namespace kbp +namespace core { // This will likely be replaced with a class implementing a more space @@ -39,13 +39,13 @@ void context::push_marker(uint32_t marker) { emplace_back(km_core_context_item { KM_CORE_CT_MARKER, {0,}, {marker} }); } -} // namespace kbp +} // namespace core } // namespace km -json & operator << (json &, km::kbp::context const &); +json & operator << (json &, km::core::context const &); json & operator << (json &, km_core_context_item const &); -struct km_core_context : public km::kbp::context +struct km_core_context : public km::core::context { }; diff --git a/core/src/debug.hpp b/core/src/debug.hpp index 935fad155ca..a68d9f1e578 100644 --- a/core/src/debug.hpp +++ b/core/src/debug.hpp @@ -13,7 +13,7 @@ #include namespace km { -namespace kbp +namespace core { class debug_items : public std::vector @@ -66,6 +66,6 @@ void debug_items::set_enabled(bool value) noexcept { _is_enabled = value; } -} // namespace kbp +} // namespace core } // namespace km diff --git a/core/src/debuglog.cpp b/core/src/debuglog.cpp index 9519f3d3bc1..a4f8847892c 100644 --- a/core/src/debuglog.cpp +++ b/core/src/debuglog.cpp @@ -9,7 +9,7 @@ #include "debuglog.h" namespace km { -namespace kbp { +namespace core { namespace kmx { #define TAB "\t" diff --git a/core/src/debuglog.h b/core/src/debuglog.h index 1ecbaca6124..d8e3dc9473f 100644 --- a/core/src/debuglog.h +++ b/core/src/debuglog.h @@ -3,7 +3,7 @@ #include namespace km { -namespace kbp { +namespace core { namespace kmx { extern KMX_BOOL g_debug_ToConsole, g_debug_KeymanLog, g_silent; @@ -17,11 +17,11 @@ extern const struct modifier_names s_modifier_names[]; extern const char *s_key_names[]; #ifdef _MSC_VER -#define DebugLog(msg,...) (km::kbp::kmx::ShouldDebug() ? km::kbp::kmx::DebugLog_1(__FILE__, __LINE__, __FUNCTION__, (msg),__VA_ARGS__) : 0) +#define DebugLog(msg,...) (km::core::kmx::ShouldDebug() ? km::core::kmx::DebugLog_1(__FILE__, __LINE__, __FUNCTION__, (msg),__VA_ARGS__) : 0) #define console_error(msg,...) write_console(TRUE, (msg), __VA_ARGS__) #define console_log(msg,...) write_console(FALSE, (msg), __VA_ARGS__) #else -#define DebugLog(msg,...) (km::kbp::kmx::ShouldDebug() ? km::kbp::kmx::DebugLog_1(__FILE__, __LINE__, __FUNCTION__, (msg), ##__VA_ARGS__) : 0) +#define DebugLog(msg,...) (km::core::kmx::ShouldDebug() ? km::core::kmx::DebugLog_1(__FILE__, __LINE__, __FUNCTION__, (msg), ##__VA_ARGS__) : 0) #define console_error(msg,...) write_console(TRUE, (msg), ##__VA_ARGS__) #define console_log(msg,...) write_console(FALSE, (msg), ##__VA_ARGS__) #endif diff --git a/core/src/keyboard.cpp b/core/src/keyboard.cpp index 47693b9b664..2c3a0c11b2c 100644 --- a/core/src/keyboard.cpp +++ b/core/src/keyboard.cpp @@ -8,7 +8,7 @@ #include "keyboard.hpp" #include "jsonpp.hpp" -using namespace km::kbp; +using namespace km::core; inline @@ -54,7 +54,7 @@ keyboard_attributes & keyboard_attributes::operator = (keyboard_attributes &&rhs } -json & km::kbp::operator << (json & j, km::kbp::keyboard_attributes const & kb) +json & km::core::operator << (json & j, km::core::keyboard_attributes const & kb) { j << json::object << "id" << kb.id diff --git a/core/src/keyboard.hpp b/core/src/keyboard.hpp index 97329b7e761..6dd8517ce10 100644 --- a/core/src/keyboard.hpp +++ b/core/src/keyboard.hpp @@ -20,13 +20,13 @@ class json; namespace km { -namespace kbp +namespace core { class keyboard_attributes : public km_core_keyboard_attrs { std::u16string _keyboard_id; std::u16string _version_string; - kbp::path _folder_path; + core::path _folder_path; std::vector