| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 101 |
| 102 // Returns the latinized version of the name. For example, the latinized | 102 // Returns the latinized version of the name. For example, the latinized |
| 103 // version of "北京市" is "Beijing Shi". | 103 // version of "北京市" is "Beijing Shi". |
| 104 const std::string& GetLatinName() const { return latin_name_; } | 104 const std::string& GetLatinName() const { return latin_name_; } |
| 105 | 105 |
| 106 // Returns the format of the address as it should appear on an envelope. | 106 // Returns the format of the address as it should appear on an envelope. |
| 107 const std::vector<std::vector<FormatElement> >& GetFormat() const { | 107 const std::vector<std::vector<FormatElement> >& GetFormat() const { |
| 108 return format_; | 108 return format_; |
| 109 } | 109 } |
| 110 | 110 |
| 111 // Returns the latinized format of the address as it should appear on an | |
| 112 // envelope. | |
| 113 const std::vector<std::vector<FormatElement> >& GetLatinFormat() const { | |
| 114 return latin_format_; | |
| 115 } | |
| 116 | |
| 117 // Returns the required fields for this rule. | 111 // Returns the required fields for this rule. |
| 118 const std::vector<AddressField>& GetRequired() const { return required_; } | 112 const std::vector<AddressField>& GetRequired() const { return required_; } |
| 119 | 113 |
| 120 // Returns the sub-keys for this rule, which are the administrative areas of a | 114 // Returns the sub-keys for this rule, which are the administrative areas of a |
| 121 // country, the localities of an administrative area, or the dependent | 115 // country, the localities of an administrative area, or the dependent |
| 122 // localities of a locality. For example, the rules for "US" have sub-keys of | 116 // localities of a locality. For example, the rules for "US" have sub-keys of |
| 123 // "CA", "NY", "TX", etc. | 117 // "CA", "NY", "TX", etc. |
| 124 const std::vector<std::string>& GetSubKeys() const { return sub_keys_; } | 118 const std::vector<std::string>& GetSubKeys() const { return sub_keys_; } |
| 125 | 119 |
| 126 // Returns all of the language codes for which this rule has custom rules, for | 120 // Returns all of the language codes for which this rule has custom rules, for |
| 127 // example ["de", "fr", "it"]. | 121 // example ["de", "fr", "it"]. |
| 128 const std::vector<std::string>& GetLanguages() const { return languages_; } | 122 const std::vector<std::string>& GetLanguages() const { return languages_; } |
| 129 | 123 |
| 130 // Returns all of the languages codes for addresses that adhere to this rule, | |
| 131 // for example ["de", "fr", "gsw", "it"]. | |
| 132 const std::vector<std::string>& GetInputLanguages() const { | |
| 133 return input_languages_; | |
| 134 } | |
| 135 | |
| 136 // Returns the language code of this rule, for example "de". | 124 // Returns the language code of this rule, for example "de". |
| 137 const std::string& GetLanguage() const { return language_; } | 125 const std::string& GetLanguage() const { return language_; } |
| 138 | 126 |
| 139 // Returns the postal code format, for example "\\d{5}([ \\-]\\d{4})?". | 127 // Returns the postal code format, for example "\\d{5}([ \\-]\\d{4})?". |
| 140 const std::string& GetPostalCodeFormat() const { return postal_code_format_; } | 128 const std::string& GetPostalCodeFormat() const { return postal_code_format_; } |
| 141 | 129 |
| 142 // The message string identifier for admin area name. If not set, then | 130 // The message string identifier for admin area name. If not set, then |
| 143 // INVALID_MESSAGE_ID. | 131 // INVALID_MESSAGE_ID. |
| 144 int GetAdminAreaNameMessageId() const { return admin_area_name_message_id_; } | 132 int GetAdminAreaNameMessageId() const { return admin_area_name_message_id_; } |
| 145 | 133 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 173 // Finds |target| in |values| and sets |sub_key| to the associated value from | 161 // 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|. | 162 // |sub_keys_|, or returns false if |target| is not in |values|. |
| 175 bool GetMatchingSubKey(const std::string& target, | 163 bool GetMatchingSubKey(const std::string& target, |
| 176 const std::vector<std::string>& values, | 164 const std::vector<std::string>& values, |
| 177 std::string* sub_key) const; | 165 std::string* sub_key) const; |
| 178 | 166 |
| 179 std::string key_; | 167 std::string key_; |
| 180 std::string name_; | 168 std::string name_; |
| 181 std::string latin_name_; | 169 std::string latin_name_; |
| 182 std::vector<std::vector<FormatElement> > format_; | 170 std::vector<std::vector<FormatElement> > format_; |
| 183 std::vector<std::vector<FormatElement> > latin_format_; | |
| 184 std::vector<AddressField> required_; | 171 std::vector<AddressField> required_; |
| 185 std::vector<std::string> sub_keys_; | 172 std::vector<std::string> sub_keys_; |
| 186 std::vector<std::string> sub_names_; | 173 std::vector<std::string> sub_names_; |
| 187 // The Latin names (when |sub_names_| is not in Latin characters). | 174 // The Latin names (when |sub_names_| is not in Latin characters). |
| 188 std::vector<std::string> sub_lnames_; | 175 std::vector<std::string> sub_lnames_; |
| 189 std::vector<std::string> languages_; | 176 std::vector<std::string> languages_; |
| 190 std::vector<std::string> input_languages_; | |
| 191 std::string language_; | 177 std::string language_; |
| 192 std::string postal_code_format_; | 178 std::string postal_code_format_; |
| 193 int admin_area_name_message_id_; | 179 int admin_area_name_message_id_; |
| 194 int invalid_admin_area_message_id_; | 180 int invalid_admin_area_message_id_; |
| 195 int postal_code_name_message_id_; | 181 int postal_code_name_message_id_; |
| 196 int invalid_postal_code_message_id_; | 182 int invalid_postal_code_message_id_; |
| 197 | 183 |
| 198 DISALLOW_COPY_AND_ASSIGN(Rule); | 184 DISALLOW_COPY_AND_ASSIGN(Rule); |
| 199 }; | 185 }; |
| 200 | 186 |
| 201 } // namespace addressinput | 187 } // namespace addressinput |
| 202 } // namespace i18n | 188 } // namespace i18n |
| 203 | 189 |
| 204 #endif // I18N_ADDRESSINPUT_RULE_H_ | 190 #endif // I18N_ADDRESSINPUT_RULE_H_ |
| OLD | NEW |