Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: third_party/libaddressinput/chromium/cpp/src/rule.h

Issue 237693002: requestAutocomplete should not unlatinize administrative region names. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Canonicalize latinized name without unlatinizing it. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (C) 2013 Google Inc. 1 // Copyright (C) 2013 Google Inc.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // The error message string identifier for an invalid postal code. If not set, 158 // The error message string identifier for an invalid postal code. If not set,
159 // then INVALID_MESSAGE_ID. 159 // then INVALID_MESSAGE_ID.
160 int GetInvalidPostalCodeMessageId() const { 160 int GetInvalidPostalCodeMessageId() const {
161 return invalid_postal_code_message_id_; 161 return invalid_postal_code_message_id_;
162 } 162 }
163 163
164 // Returns the error message string identifier for an invalid |field|. 164 // Returns the error message string identifier for an invalid |field|.
165 int GetInvalidFieldMessageId(AddressField field) const; 165 int GetInvalidFieldMessageId(AddressField field) const;
166 166
167 // Outputs the sub key for a given user input. For example, Texas will map to 167 // Outputs the sub key for a given user input. For example, Texas will map to
168 // TX. 168 // TX. If |canonicalize_latin_name| is true, then canonicalizes latin names,
169 // too. This can lead to changing a latinized name into local script.
170 // |sub_key| should not be NULL.
169 bool CanonicalizeSubKey(const std::string& user_input, 171 bool CanonicalizeSubKey(const std::string& user_input,
172 bool canonicalize_latin_name,
170 std::string* sub_key) const; 173 std::string* sub_key) const;
171 174
172 private: 175 private:
173 // Finds |target| in |values| and sets |sub_key| to the associated value from 176 // Finds |target| in |values| and sets |sub_key| to the associated value from
174 // |sub_keys_|, or returns false if |target| is not in |values|. 177 // |sub_keys_|. Returns false if |target| is not in |values|. |sub_key| should
178 // not be NULL.
175 bool GetMatchingSubKey(const std::string& target, 179 bool GetMatchingSubKey(const std::string& target,
176 const std::vector<std::string>& values, 180 const std::vector<std::string>& values,
177 std::string* sub_key) const; 181 std::string* sub_key) const;
178 182
183 // Finds |target| in |values| and sets |value| to the associated value from
184 // |values|. Returns false if |target| is not in |values|. |value| should not
185 // be NULL.
186 bool GetMatchingValue(const std::string& target,
187 const std::vector<std::string>& values,
188 std::string* value) const;
189
179 std::string key_; 190 std::string key_;
180 std::string name_; 191 std::string name_;
181 std::string latin_name_; 192 std::string latin_name_;
182 std::vector<std::vector<FormatElement> > format_; 193 std::vector<std::vector<FormatElement> > format_;
183 std::vector<std::vector<FormatElement> > latin_format_; 194 std::vector<std::vector<FormatElement> > latin_format_;
184 std::vector<AddressField> required_; 195 std::vector<AddressField> required_;
185 std::vector<std::string> sub_keys_; 196 std::vector<std::string> sub_keys_;
186 std::vector<std::string> sub_names_; 197 std::vector<std::string> sub_names_;
187 // The Latin names (when |sub_names_| is not in Latin characters). 198 // The Latin names (when |sub_names_| is not in Latin characters).
188 std::vector<std::string> sub_lnames_; 199 std::vector<std::string> sub_lnames_;
189 std::vector<std::string> languages_; 200 std::vector<std::string> languages_;
190 std::vector<std::string> input_languages_; 201 std::vector<std::string> input_languages_;
191 std::string language_; 202 std::string language_;
192 std::string postal_code_format_; 203 std::string postal_code_format_;
193 int admin_area_name_message_id_; 204 int admin_area_name_message_id_;
194 int invalid_admin_area_message_id_; 205 int invalid_admin_area_message_id_;
195 int postal_code_name_message_id_; 206 int postal_code_name_message_id_;
196 int invalid_postal_code_message_id_; 207 int invalid_postal_code_message_id_;
197 208
198 DISALLOW_COPY_AND_ASSIGN(Rule); 209 DISALLOW_COPY_AND_ASSIGN(Rule);
199 }; 210 };
200 211
201 } // namespace addressinput 212 } // namespace addressinput
202 } // namespace i18n 213 } // namespace i18n
203 214
204 #endif // I18N_ADDRESSINPUT_RULE_H_ 215 #endif // I18N_ADDRESSINPUT_RULE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698