OLD | NEW |
(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 const std::string& AddressData::GetField(AddressField field) const { |
| 26 switch (field) { |
| 27 case COUNTRY: |
| 28 return country_code; |
| 29 case ADMIN_AREA: |
| 30 return administrative_area; |
| 31 case LOCALITY: |
| 32 return locality; |
| 33 case DEPENDENT_LOCALITY: |
| 34 return dependent_locality; |
| 35 case SORTING_CODE: |
| 36 return sorting_code; |
| 37 case POSTAL_CODE: |
| 38 return postal_code; |
| 39 case ORGANIZATION: |
| 40 return organization; |
| 41 case RECIPIENT: |
| 42 return recipient; |
| 43 default: |
| 44 assert(false); |
| 45 return recipient; |
| 46 } |
| 47 } |
| 48 |
| 49 } // namespace addressinput |
| 50 } // namespace i18n |
OLD | NEW |