mirror of
https://github.com/mii443/mozc.git
synced 2025-08-22 16:15:46 +00:00
Uses the default copy operator to copy engine_converter.
PiperOrigin-RevId: 731200351
This commit is contained in:
committed by
Hiroyuki Komatsu
parent
f35915da57
commit
914e13462e
@ -113,6 +113,15 @@ class CandidateList final {
|
|||||||
rotate_(rotate),
|
rotate_(rotate),
|
||||||
focused_(false) {}
|
focused_(false) {}
|
||||||
|
|
||||||
|
// Minimum copy operator.
|
||||||
|
// TODO(all): Support full copy operation of CandidateList as EngineConverter
|
||||||
|
// is currently copyable. Since the CandidateList contractor is
|
||||||
|
// initialized with `rotate`, `rotate_` is copied in the copy operator.
|
||||||
|
CandidateList &operator=(const CandidateList &candidate_list) {
|
||||||
|
rotate_ = candidate_list.rotate_;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
const Candidate &GetDeepestFocusedCandidate() const;
|
const Candidate &GetDeepestFocusedCandidate() const;
|
||||||
|
@ -1151,26 +1151,7 @@ void EngineConverter::FillOutput(const composer::Composer &composer,
|
|||||||
EngineConverter *EngineConverter::Clone() const {
|
EngineConverter *EngineConverter::Clone() const {
|
||||||
EngineConverter *engine_converter =
|
EngineConverter *engine_converter =
|
||||||
new EngineConverter(converter_, request_, config_);
|
new EngineConverter(converter_, request_, config_);
|
||||||
|
*engine_converter = *this;
|
||||||
// Copy the members in order of their declarations.
|
|
||||||
engine_converter->state_ = state_;
|
|
||||||
// TODO(team): copy of |converter_| member.
|
|
||||||
// We cannot copy the member converter_ from EngineConverterInterface because
|
|
||||||
// it doesn't (and shouldn't) define a method like GetConverter(). At the
|
|
||||||
// moment it's ok because the current design guarantees that the converter is
|
|
||||||
// singleton. However, we should refactor such bad design; see also the
|
|
||||||
// comment right above.
|
|
||||||
engine_converter->segments_ = segments_;
|
|
||||||
engine_converter->incognito_segments_ = incognito_segments_;
|
|
||||||
engine_converter->segment_index_ = segment_index_;
|
|
||||||
engine_converter->previous_suggestions_ = previous_suggestions_;
|
|
||||||
engine_converter->conversion_preferences_ = conversion_preferences();
|
|
||||||
engine_converter->result_ = result_;
|
|
||||||
engine_converter->request_ = request_;
|
|
||||||
engine_converter->config_ = config_;
|
|
||||||
engine_converter->use_cascading_window_ = use_cascading_window_;
|
|
||||||
engine_converter->selected_candidate_indices_ = selected_candidate_indices_;
|
|
||||||
engine_converter->request_type_ = request_type_;
|
|
||||||
|
|
||||||
if (engine_converter->CheckState(SUGGESTION | PREDICTION | CONVERSION)) {
|
if (engine_converter->CheckState(SUGGESTION | PREDICTION | CONVERSION)) {
|
||||||
// UpdateCandidateList() is not simple setter and it uses some members.
|
// UpdateCandidateList() is not simple setter and it uses some members.
|
||||||
|
@ -61,7 +61,6 @@ class EngineConverter : public EngineConverterInterface {
|
|||||||
std::shared_ptr<const config::Config> config);
|
std::shared_ptr<const config::Config> config);
|
||||||
explicit EngineConverter(std::shared_ptr<const ConverterInterface> converter);
|
explicit EngineConverter(std::shared_ptr<const ConverterInterface> converter);
|
||||||
EngineConverter(const EngineConverter &) = delete;
|
EngineConverter(const EngineConverter &) = delete;
|
||||||
EngineConverter &operator=(const EngineConverter &) = delete;
|
|
||||||
|
|
||||||
// Checks if the current state is in the state bitmap.
|
// Checks if the current state is in the state bitmap.
|
||||||
bool CheckState(States) const override;
|
bool CheckState(States) const override;
|
||||||
@ -245,8 +244,6 @@ class EngineConverter : public EngineConverterInterface {
|
|||||||
void OnStartComposition(const commands::Context &context) override;
|
void OnStartComposition(const commands::Context &context) override;
|
||||||
|
|
||||||
// Copies EngineConverter
|
// Copies EngineConverter
|
||||||
// TODO(hsumita): Copy all member variables.
|
|
||||||
// Currently, converter_ is not copied.
|
|
||||||
EngineConverter *Clone() const override;
|
EngineConverter *Clone() const override;
|
||||||
|
|
||||||
void set_selection_shortcut(
|
void set_selection_shortcut(
|
||||||
@ -264,6 +261,9 @@ class EngineConverter : public EngineConverterInterface {
|
|||||||
std::numeric_limits<size_t>::max();
|
std::numeric_limits<size_t>::max();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Uses default copy operator to simply copy all members.
|
||||||
|
EngineConverter &operator=(const EngineConverter &) = default;
|
||||||
|
|
||||||
friend class EngineConverterTest;
|
friend class EngineConverterTest;
|
||||||
|
|
||||||
// Resets the result value stored at the previous command.
|
// Resets the result value stored at the previous command.
|
||||||
|
@ -66,10 +66,6 @@ struct ConversionPreferences {
|
|||||||
// support stateful operations related with the converter.
|
// support stateful operations related with the converter.
|
||||||
class EngineConverterInterface {
|
class EngineConverterInterface {
|
||||||
public:
|
public:
|
||||||
EngineConverterInterface() = default;
|
|
||||||
EngineConverterInterface(const EngineConverterInterface &) = delete;
|
|
||||||
EngineConverterInterface &operator=(const EngineConverterInterface &) =
|
|
||||||
delete;
|
|
||||||
virtual ~EngineConverterInterface() = default;
|
virtual ~EngineConverterInterface() = default;
|
||||||
|
|
||||||
typedef int States;
|
typedef int States;
|
||||||
|
Reference in New Issue
Block a user