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

Unified Diff: third_party/libaddressinput/chromium/cpp/src/rule.h

Issue 106763007: [rac] Parse postal code formats and required fields in libaddressinput. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/libaddressinput/chromium/cpp/src/rule.h
diff --git a/third_party/libaddressinput/chromium/cpp/src/rule.h b/third_party/libaddressinput/chromium/cpp/src/rule.h
index a11dff84ef7d28b917ae3b1d019e4ec33d612915..6c940b5fd5c310c54a938b035bfc18c2ebdf6379 100644
--- a/third_party/libaddressinput/chromium/cpp/src/rule.h
+++ b/third_party/libaddressinput/chromium/cpp/src/rule.h
@@ -52,6 +52,9 @@ class Rule {
// NEWLINE extension for AddressField enum.
const std::vector<AddressField>& GetFormat() const { return format_; }
+ // Returns the required fields for this rule.
+ const std::vector<AddressField>& GetRequired() const { return required_; }
+
// Returns the sub-keys for this rule, which are the administrative areas of a
// country, the localities of an administrative area, or the dependent
// localities of a locality. For example, the rules for "US" have sub-keys of
@@ -65,6 +68,19 @@ class Rule {
// Returns the language code of this rule, for example "de".
const std::string& GetLanguage() const { return language_; }
+ // Returns examples of valid postal codes, for example "95014,22162-1010".
+ const std::string& GetPostalCodeExamples() const {
Evan Stade 2013/12/13 23:34:29 how is this useful?
please use gerrit instead 2013/12/16 20:49:56 Left out until we decided to use the error message
+ return postal_code_examples_;
+ }
+
+ // Returns the postal code format, for example "\\d{5}([ \\-]\\d{4})?".
+ const std::string& GetPostalCodeFormat() const { return postal_code_format_; }
+
+ // Returns the URL that helps determine the postal code for an address. This
+ // URL should be shown to the user. For example:
+ // https://tools.usps.com/go/ZipLookupAction!input.action
+ const std::string& GetPostalCodesUrl() const { return postal_codes_url_; }
Evan Stade 2013/12/13 23:34:29 how is this useful? Please leave this out until w
please use gerrit instead 2013/12/16 20:49:56 Left out until we decided to use the error message
+
// The message string identifier for admin area name. If not set, then
// INVALID_MESSAGE_ID.
int GetAdminAreaNameMessageId() const { return admin_area_name_message_id_; }
@@ -77,9 +93,13 @@ class Rule {
private:
std::vector<AddressField> format_;
+ std::vector<AddressField> required_;
std::vector<std::string> sub_keys_;
std::vector<std::string> languages_;
std::string language_;
+ std::string postal_code_examples_;
+ std::string postal_code_format_;
+ std::string postal_codes_url_;
int admin_area_name_message_id_;
int postal_code_name_message_id_;

Powered by Google App Engine
This is Rietveld 408576698