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 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 |
OLD | NEW |