| OLD | NEW |
| 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 Loading... |
| 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 a local script name. |
| 169 bool CanonicalizeSubKey(const std::string& user_input, | 170 bool CanonicalizeSubKey(const std::string& user_input, |
| 171 bool canonicalize_latin_name, |
| 170 std::string* sub_key) const; | 172 std::string* sub_key) const; |
| 171 | 173 |
| 172 private: | 174 private: |
| 173 // Finds |target| in |values| and sets |sub_key| to the associated value from | 175 // 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|. | 176 // |sub_keys_|, or returns false if |target| is not in |values|. |sub_key| can |
| 177 // be NULL. |
| 175 bool GetMatchingSubKey(const std::string& target, | 178 bool GetMatchingSubKey(const std::string& target, |
| 176 const std::vector<std::string>& values, | 179 const std::vector<std::string>& values, |
| 177 std::string* sub_key) const; | 180 std::string* sub_key) const; |
| 178 | 181 |
| 179 std::string key_; | 182 std::string key_; |
| 180 std::string name_; | 183 std::string name_; |
| 181 std::string latin_name_; | 184 std::string latin_name_; |
| 182 std::vector<std::vector<FormatElement> > format_; | 185 std::vector<std::vector<FormatElement> > format_; |
| 183 std::vector<std::vector<FormatElement> > latin_format_; | 186 std::vector<std::vector<FormatElement> > latin_format_; |
| 184 std::vector<AddressField> required_; | 187 std::vector<AddressField> required_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 195 int postal_code_name_message_id_; | 198 int postal_code_name_message_id_; |
| 196 int invalid_postal_code_message_id_; | 199 int invalid_postal_code_message_id_; |
| 197 | 200 |
| 198 DISALLOW_COPY_AND_ASSIGN(Rule); | 201 DISALLOW_COPY_AND_ASSIGN(Rule); |
| 199 }; | 202 }; |
| 200 | 203 |
| 201 } // namespace addressinput | 204 } // namespace addressinput |
| 202 } // namespace i18n | 205 } // namespace i18n |
| 203 | 206 |
| 204 #endif // I18N_ADDRESSINPUT_RULE_H_ | 207 #endif // I18N_ADDRESSINPUT_RULE_H_ |
| OLD | NEW |