• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2011 The Libphonenumber Authors
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 <iostream>
18 #include <vector>
19 
20 #include "phonenumbers/phonenumber.pb.h"
21 #include "phonenumbers/test_util.h"
22 
23 namespace i18n {
24 namespace phonenumbers {
25 
operator <<(ostream & os,const PhoneNumber & number)26 ostream& operator<<(ostream& os, const PhoneNumber& number) {
27   os << std::endl
28      << "country_code: " << number.country_code() << std::endl
29      << "national_number: " << number.national_number() << std::endl;
30   if (number.has_extension()) {
31      os << "extension: " << number.extension() << std::endl;
32   }
33   if (number.has_italian_leading_zero()) {
34      os << "italian_leading_zero: " << number.italian_leading_zero() << std::endl;
35   }
36   if (number.has_raw_input()) {
37      os << "raw_input: " << number.raw_input() << std::endl;
38   }
39   if (number.has_country_code_source()) {
40      os << "country_code_source: " << number.country_code_source() << std::endl;
41   }
42   if (number.has_preferred_domestic_carrier_code()) {
43      os << "preferred_domestic_carrier_code: "
44         << number.preferred_domestic_carrier_code() << std::endl;
45   }
46   return os;
47 }
48 
operator <<(ostream & os,const vector<PhoneNumber> & numbers)49 ostream& operator<<(ostream& os, const vector<PhoneNumber>& numbers) {
50   os << "[" << std::endl;
51   for (vector<PhoneNumber>::const_iterator it = numbers.begin();
52        it != numbers.end(); ++it) {
53     os << *it;
54   }
55   os << std::endl << "]" << std::endl;
56   return os;
57 }
58 
59 }  // namespace phonenumbers
60 }  // namespace i18n
61