Index: third_party/libaddressinput/chromium/cpp/src/ruleset.h |
diff --git a/third_party/libaddressinput/chromium/cpp/src/ruleset.h b/third_party/libaddressinput/chromium/cpp/src/ruleset.h |
index b9fdb33a56dbf42ec55933382c57fe07ac37ed17..ca0ce1c87af3be905aae9ef0ecb8aa572b464bd2 100644 |
--- a/third_party/libaddressinput/chromium/cpp/src/ruleset.h |
+++ b/third_party/libaddressinput/chromium/cpp/src/ruleset.h |
@@ -15,6 +15,7 @@ |
#ifndef I18N_ADDRESSINPUT_RULESET_H_ |
#define I18N_ADDRESSINPUT_RULESET_H_ |
+#include <libaddressinput/address_field.h> |
#include <libaddressinput/util/basictypes.h> |
#include <libaddressinput/util/scoped_ptr.h> |
@@ -24,6 +25,7 @@ |
namespace i18n { |
namespace addressinput { |
+class AddressData; |
class Rule; |
// A recursive data structure that stores a set of rules for a region. Can store |
@@ -58,14 +60,20 @@ class Ruleset { |
// Adds a language-specific |rule| for |language_code| for this region. |
void AddLanguageCode(const std::string& language_code, scoped_ptr<Rule> rule); |
- // Returns the set of rules for |sub_region|. The result can be NULL. The |
- // caller does not own the result. |
+ // Returns the set of rules for |sub_region|. The result is NULL if there's no |
+ // such |sub_region|. The caller does not own the result. |
Ruleset* GetSubRegion(const std::string& sub_region) const; |
- // Returns the language-specific rule for |language_code|. The result can be |
- // NULL. The caller does not own the result. |
+ // Returns the language-specific rule for |language_code|. The result is NULL |
+ // if there's no such |language_code|. The caller does not own the result. |
const Rule* GetLanguageCode(const std::string& language_code) const; |
+ // Returns a mapping of field types to validation rules based on the field |
+ // values in |address|. Should be invoked only on a root ruleset (at country |
+ // level). |
+ std::map<AddressField, const Rule*> BuildRulesForAddress( |
+ const AddressData& address) const; |
+ |
private: |
// The region-wide rule in the default language of the country. |
scoped_ptr<const Rule> rule_; |