Skip to content

Commit

Permalink
Remove unused methods depending on Segment::Candidate.
Browse files Browse the repository at this point in the history
We can make SessionConverterInterface be independent from Segments.

PiperOrigin-RevId: 702603198
  • Loading branch information
taku910 authored and hiroyuki-komatsu committed Dec 4, 2024
1 parent 1856122 commit 73836cf
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 38 deletions.
3 changes: 0 additions & 3 deletions src/session/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ mozc_cc_test(
"//base:clock_mock",
"//composer:query",
"//config:config_handler",
"//converter:segments",
"//data_manager",
"//data_manager/testing:mock_data_manager",
"//engine",
Expand Down Expand Up @@ -795,8 +794,6 @@ mozc_cc_library(
visibility = ["//session/internal:__pkg__"],
deps = [
"//composer",
"//converter:converter_interface",
"//converter:segments",
"//protocol:commands_cc_proto",
"//protocol:config_cc_proto",
"//transliteration",
Expand Down
17 changes: 0 additions & 17 deletions src/session/session_converter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -989,23 +989,6 @@ void SessionConverter::SegmentWidthShrink(const composer::Composer &composer) {
ResizeSegmentWidth(composer, -1);
}

const Segment::Candidate *
SessionConverter::GetSelectedCandidateOfFocusedSegment() const {
if (!candidate_list_.focused()) {
return nullptr;
}
const Candidate &cand = candidate_list_.focused_candidate();
return GetCandidateById(cand.id());
}

const Segment::Candidate *SessionConverter::GetCandidateById(int id) const {
const Segment &segment = segments_.conversion_segment(segment_index_);
if (!segment.is_valid_index(id)) {
return nullptr;
}
return &segment.candidate(id);
}

void SessionConverter::CandidateNext(const composer::Composer &composer) {
DCHECK(CheckState(PREDICTION | CONVERSION));
ResetResult();
Expand Down
8 changes: 0 additions & 8 deletions src/session/session_converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@

#include "absl/strings/string_view.h"
#include "converter/converter_interface.h"
#include "converter/segments.h"
#include "protocol/commands.pb.h"
#include "protocol/config.pb.h"
#include "request/conversion_request.h"
Expand Down Expand Up @@ -74,13 +73,6 @@ class SessionConverter : public SessionConverterInterface {
// conversion.
const ConversionPreferences &conversion_preferences() const override;

// Gets the selected candidate. If no candidate is selected, returns nullptr.
const Segment::Candidate *GetSelectedCandidateOfFocusedSegment()
const override;

// Gets the candidate specified by id.
const Segment::Candidate *GetCandidateById(int id) const override;

// Sends a conversion request to the converter.
bool Convert(const composer::Composer &composer) override;
bool ConvertWithPreferences(
Expand Down
9 changes: 0 additions & 9 deletions src/session/session_converter_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@

#include "absl/strings/string_view.h"
#include "composer/composer.h"
#include "converter/converter_interface.h"
#include "converter/segments.h"
#include "protocol/commands.pb.h"
#include "protocol/config.pb.h"
#include "transliteration/transliteration.h"
Expand Down Expand Up @@ -94,13 +92,6 @@ class SessionConverterInterface {
// conversion.
virtual const ConversionPreferences &conversion_preferences() const = 0;

// Gets the selected candidate. If no candidate is selected, returns NULL.
virtual const Segment::Candidate *GetSelectedCandidateOfFocusedSegment()
const = 0;

// Gets the candidate specified by id. If id is invalid, nullptr is returned.
virtual const Segment::Candidate *GetCandidateById(int id) const = 0;

// Send a conversion request to the converter.
virtual bool Convert(const composer::Composer &composer) = 0;
virtual bool ConvertWithPreferences(
Expand Down
1 change: 0 additions & 1 deletion src/session/session_handler_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
#include "base/clock_mock.h"
#include "composer/query.h"
#include "config/config_handler.h"
#include "converter/segments.h"
#include "data_manager/data_manager.h"
#include "data_manager/testing/mock_data_manager.h"
#include "engine/engine.h"
Expand Down

0 comments on commit 73836cf

Please sign in to comment.