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

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

Issue 131223004: [rac] Format an address for display. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 6 years, 11 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 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_;

Powered by Google App Engine
This is Rietveld 408576698