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

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

Issue 261013010: autocomplete: add ability to get full address (hidden behind a flag). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: self review Created 6 years, 7 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 const std::vector<std::string>& GetInputLanguages() const { 132 const std::vector<std::string>& GetInputLanguages() const {
133 return input_languages_; 133 return input_languages_;
134 } 134 }
135 135
136 // Returns the language code of this rule, for example "de". 136 // Returns the language code of this rule, for example "de".
137 const std::string& GetLanguage() const { return language_; } 137 const std::string& GetLanguage() const { return language_; }
138 138
139 // Returns the postal code format, for example "\\d{5}([ \\-]\\d{4})?". 139 // Returns the postal code format, for example "\\d{5}([ \\-]\\d{4})?".
140 const std::string& GetPostalCodeFormat() const { return postal_code_format_; } 140 const std::string& GetPostalCodeFormat() const { return postal_code_format_; }
141 141
142 // The message string identifier for admin area name. If not set, then 142 // A string identifying the type of admin area name for this country, e.g.
143 // INVALID_MESSAGE_ID. 143 // "state", "province", or "district".
144 int GetAdminAreaNameMessageId() const { return admin_area_name_message_id_; } 144 const std::string& GetAdminAreaNameType() const {
145 145 return admin_area_name_type_;
146 // The error message string identifier for an invalid admin area. If not set,
147 // then INVALID_MESSAGE_ID.
148 int GetInvalidAdminAreaMessageId() const {
149 return invalid_admin_area_message_id_;
150 } 146 }
151 147
152 // The message string identifier for postal code name. If not set, then 148 // A string identifying the type of postal code name for this country, either
153 // INVALID_MESSAGE_ID. 149 // "postal" or "zip".
154 int GetPostalCodeNameMessageId() const { 150 const std::string& GetPostalCodeNameType() const {
155 return postal_code_name_message_id_; 151 return postal_code_name_type_;
156 } 152 }
157 153
158 // The error message string identifier for an invalid postal code. If not set,
159 // then INVALID_MESSAGE_ID.
160 int GetInvalidPostalCodeMessageId() const {
161 return invalid_postal_code_message_id_;
162 }
163
164 // Returns the error message string identifier for an invalid |field|.
165 int GetInvalidFieldMessageId(AddressField field) const;
166
167 // Outputs the sub key for a given user input. For example, Texas will map to 154 // Outputs the sub key for a given user input. For example, Texas will map to
168 // TX. 155 // TX.
169 // 156 //
170 // If |keep_input_latin| is true, then does not convert a latinized region 157 // If |keep_input_latin| is true, then does not convert a latinized region
171 // name into a sub key. For example, tOKYo will change to TOKYO. If 158 // name into a sub key. For example, tOKYo will change to TOKYO. If
172 // |keep_input_latin| is false, then converts a latinized region name into a 159 // |keep_input_latin| is false, then converts a latinized region name into a
173 // sub key. For example, tOKYo becomes 東京都. 160 // sub key. For example, tOKYo becomes 東京都.
174 // 161 //
175 // |sub_key| should not be NULL. 162 // |sub_key| should not be NULL.
176 bool CanonicalizeSubKey(const std::string& user_input, 163 bool CanonicalizeSubKey(const std::string& user_input,
177 bool keep_input_latin, 164 bool keep_input_latin,
178 std::string* sub_key) const; 165 std::string* sub_key) const;
179 166
180 private: 167 private:
181 std::string key_; 168 std::string key_;
182 std::string name_; 169 std::string name_;
183 std::string latin_name_; 170 std::string latin_name_;
184 std::vector<std::vector<FormatElement> > format_; 171 std::vector<std::vector<FormatElement> > format_;
185 std::vector<std::vector<FormatElement> > latin_format_; 172 std::vector<std::vector<FormatElement> > latin_format_;
186 std::vector<AddressField> required_; 173 std::vector<AddressField> required_;
187 std::vector<std::string> sub_keys_; 174 std::vector<std::string> sub_keys_;
188 std::vector<std::string> sub_names_; 175 std::vector<std::string> sub_names_;
189 // The Latin names (when |sub_names_| is not in Latin characters). 176 // The Latin names (when |sub_names_| is not in Latin characters).
190 std::vector<std::string> sub_lnames_; 177 std::vector<std::string> sub_lnames_;
191 std::vector<std::string> languages_; 178 std::vector<std::string> languages_;
192 std::vector<std::string> input_languages_; 179 std::vector<std::string> input_languages_;
193 std::string language_; 180 std::string language_;
194 std::string postal_code_format_; 181 std::string postal_code_format_;
195 int admin_area_name_message_id_; 182 std::string admin_area_name_type_;
196 int invalid_admin_area_message_id_; 183 std::string postal_code_name_type_;
197 int postal_code_name_message_id_;
198 int invalid_postal_code_message_id_;
199 184
200 DISALLOW_COPY_AND_ASSIGN(Rule); 185 DISALLOW_COPY_AND_ASSIGN(Rule);
201 }; 186 };
202 187
203 } // namespace addressinput 188 } // namespace addressinput
204 } // namespace i18n 189 } // namespace i18n
205 190
206 #endif // I18N_ADDRESSINPUT_RULE_H_ 191 #endif // I18N_ADDRESSINPUT_RULE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698