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

Side by Side Diff: third_party/libaddressinput/chromium/cpp/src/address_data.cc

Issue 116363003: [rac] Validate an address. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (C) 2013 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #include <libaddressinput/address_data.h>
16
17 #include <libaddressinput/address_field.h>
18
19 #include <cassert>
20 #include <string>
21
22 namespace i18n {
23 namespace addressinput {
24
25 namespace {
26
27 static const char kEmptyString[] = "";
28
29 } // namespace
30
31 const std::string& AddressData::GetField(AddressField field) const {
32 switch (field) {
33 case COUNTRY:
34 return country_code;
35 case ADMIN_AREA:
36 return administrative_area;
37 case LOCALITY:
38 return locality;
39 case DEPENDENT_LOCALITY:
40 return dependent_locality;
41 case SORTING_CODE:
42 return sorting_code;
43 case POSTAL_CODE:
44 return postal_code;
45 case ORGANIZATION:
46 return organization;
47 case RECIPIENT:
48 return recipient;
49 default:
50 assert(false);
51 return kEmptyString;
52 }
53 }
54
55 } // namespace addressinput
56 } // namespace i18n
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698