Skip to content

Commit beae5b1

Browse files
committed
fix(simplifier): opencc::DictEntry::Values() type change in opencc 1.1.0
Closes #367
1 parent 7dbfe49 commit beae5b1

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/rime/gear/simplifier.cc

+6-8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <boost/filesystem.hpp>
99
#include <stdint.h>
1010
#include <utf8.h>
11+
#include <utility>
1112
#include <rime/candidate.h>
1213
#include <rime/common.h>
1314
#include <rime/config.h>
@@ -45,24 +46,22 @@ class Opencc {
4546
}
4647
}
4748

48-
bool ConvertWord(const string& text,
49-
vector<string>* forms) {
49+
bool ConvertWord(const string& text, vector<string>* forms) {
5050
if (dict_ == nullptr) return false;
5151
opencc::Optional<const opencc::DictEntry*> item = dict_->Match(text);
5252
if (item.IsNull()) {
5353
// Match not found
5454
return false;
5555
} else {
5656
const opencc::DictEntry* entry = item.Get();
57-
for (const char* value : entry->Values()) {
58-
forms->push_back(value);
57+
for (auto&& value : entry->Values()) {
58+
forms->push_back(std::move(value));
5959
}
6060
return forms->size() > 0;
6161
}
6262
}
6363

64-
bool RandomConvertText(const string& text,
65-
string* simplified) {
64+
bool RandomConvertText(const string& text, string* simplified) {
6665
if (dict_ == nullptr) return false;
6766
const char *phrase = text.c_str();
6867
std::ostringstream buffer;
@@ -83,8 +82,7 @@ class Opencc {
8382
return *simplified != text;
8483
}
8584

86-
bool ConvertText(const string& text,
87-
string* simplified) {
85+
bool ConvertText(const string& text, string* simplified) {
8886
if (converter_ == nullptr) return false;
8987
*simplified = converter_->Convert(text);
9088
return *simplified != text;

src/rime/gear/simplifier.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Simplifier : public Filter, TagMatching {
2020
explicit Simplifier(const Ticket& ticket);
2121

2222
virtual an<Translation> Apply(an<Translation> translation,
23-
CandidateList* candidates);
23+
CandidateList* candidates);
2424

2525

2626
virtual bool AppliesToSegment(Segment* segment) {
@@ -35,7 +35,8 @@ class Simplifier : public Filter, TagMatching {
3535

3636
void Initialize();
3737
void PushBack(const an<Candidate>& original,
38-
CandidateQueue* result, const string& simplified);
38+
CandidateQueue* result,
39+
const string& simplified);
3940

4041
bool initialized_ = false;
4142
the<Opencc> opencc_;

0 commit comments

Comments
 (0)