Chromium Code Reviews| 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 9e6fa098405f8971d5c3dcec6842ae86cd7f8b97..825f5a0c81a0702afcb952c146feb4a6529f9b2f 100644 |
| --- a/third_party/libaddressinput/chromium/cpp/src/rule.h |
| +++ b/third_party/libaddressinput/chromium/cpp/src/rule.h |
| @@ -26,6 +26,23 @@ |
| namespace i18n { |
| namespace addressinput { |
| +struct FormatElement { |
| + enum Type { |
|
Evan Stade
2014/01/14 18:05:22
imo, you don't need this type. Just key off the em
please use gerrit instead
2014/01/14 23:21:12
Done.
|
| + FIELD, |
| + LITERAL |
|
Evan Stade
2014/01/14 18:05:22
docs
please use gerrit instead
2014/01/14 23:21:12
Done.
|
| + }; |
| + |
| + explicit FormatElement(AddressField field); |
| + explicit FormatElement(const std::string& literal); |
| + ~FormatElement(); |
| + |
| + bool operator==(const FormatElement& other) const; |
| + |
| + Type type; |
| + AddressField field; |
| + std::string literal; |
| +}; |
| + |
| // Stores the validation rules. Sample usage: |
| // Rule rule; |
| // if (rule.ParseSerializedRule("{\"fmt\": \"%A%n%C%S %Z\"}")) { |
| @@ -49,7 +66,7 @@ class Rule { |
| bool ParseSerializedRule(const std::string& serialized_rule); |
| // Returns the address format for this rule. |
| - const std::vector<std::vector<AddressField> >& GetFormat() const { |
| + const std::vector<std::vector<FormatElement> >& GetFormat() const { |
| return format_; |
| } |
| @@ -98,7 +115,7 @@ class Rule { |
| int GetInvalidFieldMessageId(AddressField field) const; |
| private: |
| - std::vector<std::vector<AddressField> > format_; |
| + std::vector<std::vector<FormatElement> > format_; |
| std::vector<AddressField> required_; |
| std::vector<std::string> sub_keys_; |
| std::vector<std::string> languages_; |