Codebase list mozc / a035ae9
Add std:: prefix to Windows build BUG=#392 TEST=unittest REF_BUG=71969651 REF_CL=185083237 REF_TIME=2018-02-09T11:17:12+09:00 REF_TIME_RAW=1518142632 +0900 Hiroyuki Komatsu 6 years ago
14 changed file(s) with 27 addition(s) and 26 deletion(s). Raw diff Collapse all Expand all
2929
3030 MAJOR=2
3131 MINOR=23
32 BUILD=2803
32 BUILD=2804
3333 REVISION=102
3434 # This version represents the version of Mozc IME engine (converter, predictor,
3535 # etc.). This version info is included both in the Mozc server and in the Mozc
8383 // characters.
8484 // If the cache service is not installed, default settings is returned
8585 // with setting |installed| flag to false.
86 static bool BackupStateAsString(wstring *buffer);
86 static bool BackupStateAsString(std::wstring *buffer);
8787
8888 // Return true if the previous status of the service is successfully
8989 // restored from the specified std::wstring instance.
201201 const bool show_suggest_window =
202202 ui_visibility_tracker.IsSuggestWindowVisible();
203203
204 std::vector<wstring> candidate_list;
204 std::vector<std::wstring> candidate_list;
205205 DWORD focused_index = 0;
206206 if (!context.IsEmpty() && context.GetOpenStatus()) {
207207 // Copy the last output.
349349
350350 virtual ULONG AddRef() {
351351 const LONG count = ::InterlockedIncrement(&reference_count_);
352 return static_cast<ULONG>(max(count, static_cast<LONG>(0)));
352 return static_cast<ULONG>(std::max(count, static_cast<LONG>(0)));
353353 }
354354
355355 virtual ULONG Release() {
118118
119119 class EnumTfCandidatesImpl : public IEnumTfCandidates {
120120 public:
121 explicit EnumTfCandidatesImpl(const std::vector<wstring> &candidates)
121 explicit EnumTfCandidatesImpl(const std::vector<std::wstring> &candidates)
122122 : candidates_(candidates),
123123 current_(0) {
124124 }
209209
210210 TipRefCount ref_count_;
211211
212 std::vector<wstring> candidates_;
212 std::vector<std::wstring> candidates_;
213213 size_t current_;
214214
215215 DISALLOW_COPY_AND_ASSIGN(EnumTfCandidatesImpl);
217217
218218 class CandidateListImpl : public ITfCandidateList {
219219 public:
220 CandidateListImpl(const std::vector<wstring> &candidates,
220 CandidateListImpl(const std::vector<std::wstring> &candidates,
221221 TipCandidateListCallback *callback)
222222 : candidates_(candidates),
223223 callback_(callback) {
305305 }
306306
307307 TipRefCount ref_count_;
308 std::vector<wstring> candidates_;
308 std::vector<std::wstring> candidates_;
309309 unique_ptr<TipCandidateListCallback> callback_;
310310
311311 DISALLOW_COPY_AND_ASSIGN(CandidateListImpl);
317317 }
318318
319319 // static
320 ITfCandidateList *TipCandidateList::New(const std::vector<wstring> &candidates,
321 TipCandidateListCallback *callback) {
320 ITfCandidateList *TipCandidateList::New(
321 const std::vector<std::wstring> &candidates,
322 TipCandidateListCallback *callback) {
322323 return new CandidateListImpl(candidates, callback);
323324 }
324325
5959 // is called with CAND_FINALIZED. TipCandidateList will take the
6060 // ownership of |callback|. |callback| can be nullptr.
6161 // Caller must maintain the reference count of the returned object.
62 static ITfCandidateList *New(const std::vector<wstring> &candidates,
62 static ITfCandidateList *New(const std::vector<std::wstring> &candidates,
6363 TipCandidateListCallback *callback);
6464 static const IID& GetIID();
6565
159159 TEST(TipCandidateListTest, EmptyCandiate) {
160160 MockCallbackResult result;
161161
162 std::vector<wstring> empty;
162 std::vector<std::wstring> empty;
163163 CComPtr<ITfCandidateList> candidate_list(
164164 TipCandidateList::New(empty, new MockCallback(&result)));
165165 ASSERT_NE(nullptr, candidate_list);
193193 TEST(TipCandidateListTest, NonEmptyCandiates) {
194194 MockCallbackResult result;
195195
196 std::vector<wstring> source;
196 std::vector<std::wstring> source;
197197 for (wchar_t c = L'A'; c < L'Z'; ++c) {
198198 source.push_back(std::wstring(c, 1));
199199 }
130130 if (!TipEditSession::GetTextSync(text_service_, range, &query)) {
131131 return E_FAIL;
132132 }
133 std::vector<wstring> candidates;
133 std::vector<std::wstring> candidates;
134134 if (!provider_->Query(query, TipQueryProvider::kDefault, &candidates)) {
135135 return E_FAIL;
136136 }
6060 // The TipQueryProvider interface methods.
6161 virtual bool Query(const std::wstring &query,
6262 QueryType type,
63 std::vector<wstring> *result) {
63 std::vector<std::wstring> *result) {
6464 if (type == kReconversion) {
6565 return ReconvertQuery(query, result);
6666 }
6868 }
6969
7070 bool SimpleQuery(const std::wstring &query,
71 std::vector<wstring> *result) {
71 std::vector<std::wstring> *result) {
7272 {
7373 KeyEvent key_event;
7474 string utf8_query;
103103 }
104104
105105 bool ReconvertQuery(const std::wstring &query,
106 std::vector<wstring> *result) {
106 std::vector<std::wstring> *result) {
107107 {
108108 string utf8_query;
109109 Util::WideToUTF8(query, &utf8_query);
5353 };
5454 virtual bool Query(const std::wstring &query,
5555 QueryType type,
56 std::vector<wstring> *result) = 0;
56 std::vector<std::wstring> *result) = 0;
5757 };
5858
5959 } // namespace tsf
247247 // This is why we should carefully choose parameters passed to
248248 // ITfContextView::GetRangeFromPoint here.
249249 const POINT dummy_point = {
250 numeric_limits<LONG>::min(), numeric_limits<LONG>::min()
250 std::numeric_limits<LONG>::min(), std::numeric_limits<LONG>::min()
251251 };
252252 CComPtr<ITfRange> dummy_range;
253253 const HRESULT next_hr = context_view->GetRangeFromPoint(
199199 if (!TipEditSession::GetTextSync(text_service_, range, &query)) {
200200 return E_FAIL;
201201 }
202 std::vector<wstring> candidates;
202 std::vector<std::wstring> candidates;
203203 if (!provider->Query(query,
204204 TipQueryProvider::kReconversion,
205205 &candidates)) {
118118 if (candidate_list == nullptr) {
119119 return E_INVALIDARG;
120120 }
121 std::vector<wstring> candidates;
121 std::vector<std::wstring> candidates;
122122 if (!provider_->Query(query, TipQueryProvider::kDefault, &candidates)) {
123123 return E_FAIL;
124124 }
12381238 return;
12391239 }
12401240 // Transfer the ownership.
1241 unique_ptr<TipPrivateContext> private_context(it->second);
1241 std::unique_ptr<TipPrivateContext> private_context(it->second);
12421242 private_context_map_.erase(it);
12431243 if (private_context.get() == nullptr) {
12441244 return;
17941794 CComPtrHash<ITfContext>>;
17951795 PrivateContextMap private_context_map_;
17961796 PreservedKeyMap preserved_key_map_;
1797 unique_ptr<TipThreadContext> thread_context_;
1797 std::unique_ptr<TipThreadContext> thread_context_;
17981798 HWND task_window_handle_;
17991799 HWND renderer_callback_window_handle_;
18001800
122122 void CalcLayout(const Candidates &candidates,
123123 const TextRenderer &text_renderer,
124124 TableLayout *table_layout,
125 std::vector<wstring> *candidate_strings) {
125 std::vector<std::wstring> *candidate_strings) {
126126 table_layout->Initialize(candidates.candidate_size(), NUMBER_OF_COLUMNS);
127127
128128 table_layout->SetWindowBorder(kWindowBorder);
179179 CBitmapHandle RenderImpl(const Candidates &candidates,
180180 const TableLayout &table_layout,
181181 const TextRenderer &text_renderer,
182 const std::vector<wstring> &candidate_strings) {
182 const std::vector<std::wstring> &candidate_strings) {
183183 const int width = table_layout.GetTotalSize().width;
184184 const int height = table_layout.GetTotalSize().height;
185185
273273 const renderer::win32::TextRenderer *text_renderer,
274274 renderer::TableLayout *table_layout,
275275 SIZE *size, int *left_align_offset) {
276 std::vector<wstring> candidate_strings;
276 std::vector<std::wstring> candidate_strings;
277277 CalcLayout(candidates, *text_renderer, table_layout, &candidate_strings);
278278
279279 const Size &total_size = table_layout->GetTotalSize();