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