Skip to content

Commit 85bfdef

Browse files
committed
refactor: remove redundant unpack function
1 parent 516ff8a commit 85bfdef

2 files changed

Lines changed: 3 additions & 7 deletions

File tree

infra/tsf/include/modian/tsf/tsf_key_event_service.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@
44
#include <string>
55
#include <memory>
66

7-
#include "modian/common/core/protocol/v1/input/instruction.h"
87
#include "modian/common/core/ipc/isync_ipc_client.h"
98

109
namespace modian::brush::infra::tsf {
11-
constexpr auto parse_content = [](const auto& p){ return p.payload; };
12-
constexpr auto parse_commit_flag = [](const auto& p){ return p.type == common::core::protocol::input::v1::message_type::COMMIT; };
13-
1410
class tsf_key_event_service final : public ITfKeyEventSink, public ITfCompositionSink {
1511
public:
1612
explicit tsf_key_event_service(IUnknown* owner);

infra/tsf/src/tsf_key_event_service.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "modian/tsf/tsf_key_event_service.h"
22

3-
#include <cwctype>
43
#include <windows.h>
54

65
#include "modian/tsf/tsf_edit_session.h"
@@ -47,8 +46,9 @@ namespace modian::brush::infra::tsf {
4746
const auto key_event = common::core::protocol::input::v1::key_event::from_os_key(w_param);
4847
const std::string req_data = common::service::input_protocol_service::build_key_event_request(key_event);
4948
const std::string response = input_protocol_ipc_client_->sync_send(req_data);
50-
const auto [content, is_commit] = common::service::input_protocol_service::parse_instruction_response(response)
51-
.unpack(parse_content, parse_commit_flag);
49+
const auto instruction = common::service::input_protocol_service::parse_instruction_response(response);
50+
const auto content = instruction.payload;
51+
const auto is_commit = instruction.type == common::core::protocol::input::v1::message_type::COMMIT;
5252

5353
if (pic != nullptr && client_id_ != TF_CLIENTID_NULL) {
5454
if (!content.empty() || current_composition_) {

0 commit comments

Comments
 (0)