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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // Returns the language code of this rule, for example "de". | 69 // Returns the language code of this rule, for example "de". |
70 const std::string& GetLanguage() const { return language_; } | 70 const std::string& GetLanguage() const { return language_; } |
71 | 71 |
72 // Returns the postal code format, for example "\\d{5}([ \\-]\\d{4})?". | 72 // Returns the postal code format, for example "\\d{5}([ \\-]\\d{4})?". |
73 const std::string& GetPostalCodeFormat() const { return postal_code_format_; } | 73 const std::string& GetPostalCodeFormat() const { return postal_code_format_; } |
74 | 74 |
75 // The message string identifier for admin area name. If not set, then | 75 // The message string identifier for admin area name. If not set, then |
76 // INVALID_MESSAGE_ID. | 76 // INVALID_MESSAGE_ID. |
77 int GetAdminAreaNameMessageId() const { return admin_area_name_message_id_; } | 77 int GetAdminAreaNameMessageId() const { return admin_area_name_message_id_; } |
78 | 78 |
| 79 // The error message string identifier for an invalid admin area. If not set, |
| 80 // then INVALID_MESSAGE_ID. |
| 81 int GetInvalidAdminAreaMessageId() const { |
| 82 return invalid_admin_area_message_id_; |
| 83 } |
| 84 |
79 // The message string identifier for postal code name. If not set, then | 85 // The message string identifier for postal code name. If not set, then |
80 // INVALID_MESSAGE_ID. | 86 // INVALID_MESSAGE_ID. |
81 int GetPostalCodeNameMessageId() const { | 87 int GetPostalCodeNameMessageId() const { |
82 return postal_code_name_message_id_; | 88 return postal_code_name_message_id_; |
83 } | 89 } |
84 | 90 |
| 91 // The error message string identifier for an invalid postal code. If not set, |
| 92 // then INVALID_MESSAGE_ID. |
| 93 int GetInvalidPostalCodeMessageId() const { |
| 94 return invalid_postal_code_message_id_; |
| 95 } |
| 96 |
| 97 // Returns the error message string identifier for an invalid |field|. |
| 98 int GetInvalidFieldMessageId(AddressField field) const; |
| 99 |
85 private: | 100 private: |
86 std::vector<std::vector<AddressField> > format_; | 101 std::vector<std::vector<AddressField> > format_; |
87 std::vector<AddressField> required_; | 102 std::vector<AddressField> required_; |
88 std::vector<std::string> sub_keys_; | 103 std::vector<std::string> sub_keys_; |
89 std::vector<std::string> languages_; | 104 std::vector<std::string> languages_; |
90 std::string language_; | 105 std::string language_; |
91 std::string postal_code_format_; | 106 std::string postal_code_format_; |
92 int admin_area_name_message_id_; | 107 int admin_area_name_message_id_; |
| 108 int invalid_admin_area_message_id_; |
93 int postal_code_name_message_id_; | 109 int postal_code_name_message_id_; |
| 110 int invalid_postal_code_message_id_; |
94 | 111 |
95 DISALLOW_COPY_AND_ASSIGN(Rule); | 112 DISALLOW_COPY_AND_ASSIGN(Rule); |
96 }; | 113 }; |
97 | 114 |
98 } // namespace addressinput | 115 } // namespace addressinput |
99 } // namespace i18n | 116 } // namespace i18n |
100 | 117 |
101 #endif // I18N_ADDRESSINPUT_RULE_H_ | 118 #endif // I18N_ADDRESSINPUT_RULE_H_ |
OLD | NEW |