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

Unified Diff: third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_data.h

Issue 131223004: [rac] Format an address for display. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/include/libaddressinput/address_data.h
diff --git a/third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_data.h b/third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_data.h
index 8c8b75e316af5d7e139d105c866c283971981de3..5dee26f0d8eb1dd8aad097ed3ad4e5bb7e1e3754 100644
--- a/third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_data.h
+++ b/third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_data.h
@@ -29,16 +29,34 @@ namespace addressinput {
// Stores an address. Sample usage:
// AddressData address;
-// address.country_code = "US";
+// address.recipient = "Chen-Kang Yang";
+// address.organization = "Google";
// address.address_lines.push_back("1098 Alta Ave");
// address.administrative_area = "CA";
// address.locality = "Mountain View";
// address.postal_code = "94043";
-// address.organization = "Google";
-// address.recipient = "Chen-Kang Yang";
+// address.country_code = "US";
// address.language_code = "en";
// Process(address);
struct AddressData {
+ enum FormatType {
+ // Use the default address format.
+ FORMAT_FULL,
+
+ // Place a single line break between street address lines and the larger
+ // areas.
+ FORMAT_TWO_LINES,
Evan Stade 2014/01/13 22:04:39 what is this going to be used for? I think the AP
please use gerrit instead 2014/01/14 01:17:47 Done. New API: a) AddressData::BuildDisplayLines(
+
+ // Fit everything on one line.
+ FORMAT_ONE_LINE
+ };
+
+ // Returns the address as a string formatted according to |country_code|
+ // rules. If there're no address formatting rules for |country_code|, then the
+ // default rules are used:
+ // https://i18napis.appspot.com/ssl-address/data/ZZ
+ std::string ToString(FormatType format_type) const;
+
// Returns the value of the |field|. The parameter should not be
// STREET_ADDRESS, which comprises multiple fields.
const std::string& GetField(AddressField field) const;

Powered by Google App Engine
This is Rietveld 408576698