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 5cd4dd2af58d940e27d545f4a396f7dc16700f7a..b6cca6838812aec5669c513cdcd1a13e94a58ffb 100644 |
--- a/third_party/libaddressinput/chromium/cpp/src/rule.h |
+++ b/third_party/libaddressinput/chromium/cpp/src/rule.h |
@@ -26,6 +26,12 @@ |
namespace i18n { |
namespace addressinput { |
+// An extension of AddressField enum used only internally. The values are |
Evan Stade
2013/12/18 23:18:17
"internally" sounds like "internal to Rule", but I
|
+// negative to avoid clashing with the values in AddressField. |
+enum { |
+ NEWLINE = -1 |
Evan Stade
2013/12/18 23:18:17
comment should explain what this actually means...
|
+}; |
+ |
// Stores the validation rules. Sample usage: |
// Rule rule; |
// if (rule.ParseSerializedRule("{\"fmt\": \"%A%n%C%S %Z\"}")) { |
@@ -47,6 +53,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 |
@@ -60,6 +69,9 @@ class Rule { |
// Returns the language code of this rule, for example "de". |
const std::string& GetLanguage() const { return language_; } |
+ // Returns the postal code format, for example "\\d{5}([ \\-]\\d{4})?". |
+ const std::string& GetPostalCodeFormat() const { return postal_code_format_; } |
+ |
// The message string identifier for admin area name. If not set, then |
// INVALID_MESSAGE_ID. |
int GetAdminAreaNameMessageId() const { return admin_area_name_message_id_; } |
@@ -72,9 +84,11 @@ 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_format_; |
int admin_area_name_message_id_; |
int postal_code_name_message_id_; |