OLD | NEW |
1 // Copyright (C) 2012 The Libphonenumber Authors | 1 // Copyright (C) 2012 The Libphonenumber Authors |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with 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 | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "phonenumbers/default_logger.h" | 24 #include "phonenumbers/default_logger.h" |
25 #include "phonenumbers/phonemetadata.pb.h" | 25 #include "phonenumbers/phonemetadata.pb.h" |
26 #include "phonenumbers/phonenumberutil.h" | 26 #include "phonenumbers/phonenumberutil.h" |
27 #include "phonenumbers/regexp_adapter.h" | 27 #include "phonenumbers/regexp_adapter.h" |
28 #include "phonenumbers/regexp_factory.h" | 28 #include "phonenumbers/regexp_factory.h" |
29 #include "phonenumbers/short_metadata.h" | 29 #include "phonenumbers/short_metadata.h" |
30 | 30 |
31 namespace i18n { | 31 namespace i18n { |
32 namespace phonenumbers { | 32 namespace phonenumbers { |
33 | 33 |
34 using std::cerr; | |
35 using std::endl; | |
36 using std::make_pair; | 34 using std::make_pair; |
37 using std::map; | 35 using std::map; |
38 using std::string; | 36 using std::string; |
39 | 37 |
40 bool LoadCompiledInMetadata(PhoneMetadataCollection* metadata) { | 38 bool LoadCompiledInMetadata(PhoneMetadataCollection* metadata) { |
41 if (!metadata->ParseFromArray(short_metadata_get(), short_metadata_size())) { | 39 if (!metadata->ParseFromArray(short_metadata_get(), short_metadata_size())) { |
42 cerr << "Could not parse binary data." << endl; | 40 LOG(ERROR) << "Could not parse binary data."; |
43 return false; | 41 return false; |
44 } | 42 } |
45 return true; | 43 return true; |
46 } | 44 } |
47 | 45 |
48 | 46 |
49 ShortNumberInfo::ShortNumberInfo() | 47 ShortNumberInfo::ShortNumberInfo() |
50 : phone_util_(*PhoneNumberUtil::GetInstance()), | 48 : phone_util_(*PhoneNumberUtil::GetInstance()), |
51 region_to_short_metadata_map_(new map<string, PhoneMetadata>()) { | 49 region_to_short_metadata_map_(new map<string, PhoneMetadata>()) { |
52 PhoneMetadataCollection metadata_collection; | 50 PhoneMetadataCollection metadata_collection; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // In Brazil and Chile, emergency numbers don't work when additional digits | 112 // In Brazil and Chile, emergency numbers don't work when additional digits |
115 // are appended. | 113 // are appended. |
116 return (!allow_prefix_match || | 114 return (!allow_prefix_match || |
117 region_code == "BR" || region_code == "CL") | 115 region_code == "BR" || region_code == "CL") |
118 ? emergency_number_pattern->FullMatch(extracted_number) | 116 ? emergency_number_pattern->FullMatch(extracted_number) |
119 : emergency_number_pattern->Consume(normalized_number_input.get()); | 117 : emergency_number_pattern->Consume(normalized_number_input.get()); |
120 } | 118 } |
121 | 119 |
122 } // namespace phonenumbers | 120 } // namespace phonenumbers |
123 } // namespace i18n | 121 } // namespace i18n |
OLD | NEW |