OLD | NEW |
(Empty) | |
| 1 // Copyright (C) 2009 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 // Author: Philippe Liard |
| 16 |
| 17 #include "phonemetadata.pb.h" |
| 18 #include "phonenumber.pb.h" |
| 19 |
| 20 namespace i18n { |
| 21 namespace phonenumbers { |
| 22 |
| 23 bool ExactlySameAs(const PhoneNumber& first_number, |
| 24 const PhoneNumber& second_number) { |
| 25 if (first_number.has_country_code() != second_number.has_country_code() || |
| 26 first_number.country_code() != second_number.country_code()) { |
| 27 return false; |
| 28 } |
| 29 if (first_number.has_national_number() != |
| 30 second_number.has_national_number() || |
| 31 first_number.national_number() != second_number.national_number()) { |
| 32 return false; |
| 33 } |
| 34 if (first_number.has_extension() != second_number.has_extension() || |
| 35 first_number.extension() != second_number.extension()) { |
| 36 return false; |
| 37 } |
| 38 if (first_number.has_italian_leading_zero() != |
| 39 second_number.has_italian_leading_zero() || |
| 40 first_number.italian_leading_zero() != |
| 41 second_number.italian_leading_zero()) { |
| 42 return false; |
| 43 } |
| 44 if (first_number.has_raw_input() != second_number.has_raw_input() || |
| 45 first_number.raw_input() != second_number.raw_input()) { |
| 46 return false; |
| 47 } |
| 48 if (first_number.has_country_code_source() != |
| 49 second_number.has_country_code_source() || |
| 50 first_number.country_code_source() != |
| 51 second_number.country_code_source()) { |
| 52 return false; |
| 53 } |
| 54 if (first_number.has_preferred_domestic_carrier_code() != |
| 55 second_number.has_preferred_domestic_carrier_code() || |
| 56 first_number.preferred_domestic_carrier_code() != |
| 57 second_number.preferred_domestic_carrier_code()) { |
| 58 return false; |
| 59 } |
| 60 return true; |
| 61 } |
| 62 |
| 63 bool ExactlySameAs(const PhoneNumberDesc& first_number_desc, |
| 64 const PhoneNumberDesc& second_number_desc) { |
| 65 if (first_number_desc.has_national_number_pattern() != |
| 66 second_number_desc.has_national_number_pattern() || |
| 67 first_number_desc.national_number_pattern() != |
| 68 second_number_desc.national_number_pattern()) { |
| 69 return false; |
| 70 } |
| 71 if (first_number_desc.has_possible_number_pattern() != |
| 72 second_number_desc.has_possible_number_pattern() || |
| 73 first_number_desc.possible_number_pattern() != |
| 74 second_number_desc.possible_number_pattern()) { |
| 75 return false; |
| 76 } |
| 77 if (first_number_desc.has_example_number() != |
| 78 second_number_desc.has_example_number() || |
| 79 first_number_desc.example_number() != |
| 80 second_number_desc.example_number()) { |
| 81 return false; |
| 82 } |
| 83 return true; |
| 84 } |
| 85 |
| 86 } // namespace phonenumbers |
| 87 } // namespace i18n |
OLD | NEW |