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

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: Test that parsing empty data does not overwrite a rule. Created 6 years, 12 months 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 5cd4dd2af58d940e27d545f4a396f7dc16700f7a..428a44d66a5f01dc6a8febcc1af88e86294b9a78 100644
--- a/third_party/libaddressinput/chromium/cpp/src/rule.h
+++ b/third_party/libaddressinput/chromium/cpp/src/rule.h
@@ -43,9 +43,13 @@ class Rule {
// format (JSON dictionary).
bool ParseSerializedRule(const std::string& serialized_rule);
- // Returns the address format for this rule. The format can include the
- // NEWLINE extension for AddressField enum.
- const std::vector<AddressField>& GetFormat() const { return format_; }
+ // Returns the address format for this rule.
+ const std::vector<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
@@ -60,6 +64,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_; }
@@ -71,10 +78,12 @@ class Rule {
}
private:
- std::vector<AddressField> format_;
+ std::vector<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_;
« no previous file with comments | « third_party/libaddressinput/chromium/cpp/src/address_ui.cc ('k') | third_party/libaddressinput/chromium/cpp/src/rule.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698