8
8
#include < boost/filesystem.hpp>
9
9
#include < stdint.h>
10
10
#include < utf8.h>
11
+ #include < utility>
11
12
#include < rime/candidate.h>
12
13
#include < rime/common.h>
13
14
#include < rime/config.h>
@@ -45,24 +46,22 @@ class Opencc {
45
46
}
46
47
}
47
48
48
- bool ConvertWord (const string& text,
49
- vector<string>* forms) {
49
+ bool ConvertWord (const string& text, vector<string>* forms) {
50
50
if (dict_ == nullptr ) return false ;
51
51
opencc::Optional<const opencc::DictEntry*> item = dict_->Match (text);
52
52
if (item.IsNull ()) {
53
53
// Match not found
54
54
return false ;
55
55
} else {
56
56
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) );
59
59
}
60
60
return forms->size () > 0 ;
61
61
}
62
62
}
63
63
64
- bool RandomConvertText (const string& text,
65
- string* simplified) {
64
+ bool RandomConvertText (const string& text, string* simplified) {
66
65
if (dict_ == nullptr ) return false ;
67
66
const char *phrase = text.c_str ();
68
67
std::ostringstream buffer;
@@ -83,8 +82,7 @@ class Opencc {
83
82
return *simplified != text;
84
83
}
85
84
86
- bool ConvertText (const string& text,
87
- string* simplified) {
85
+ bool ConvertText (const string& text, string* simplified) {
88
86
if (converter_ == nullptr ) return false ;
89
87
*simplified = converter_->Convert (text);
90
88
return *simplified != text;
0 commit comments