• 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 <string>
18 #include <ostream>
19 #include <vector>
20 
21 #include "phonenumbers/phonenumber.h"
22 
23 namespace i18n {
24 namespace phonenumbers {
25 
26 using std::string;
27 using std::ostream;
28 using std::vector;
29 
30 class PhoneNumber;
31 
32 // Provides PhoneNumber comparison operators to support the use of EXPECT_EQ and
33 // EXPECT_NE in the unittests.
34 inline bool operator==(const PhoneNumber& number1, const PhoneNumber& number2) {
35   return ExactlySameAs(number1, number2);
36 }
37 
38 inline bool operator!=(const PhoneNumber& number1, const PhoneNumber& number2) {
39   return !(number1 == number2);
40 }
41 
42 // Needed by Google Test to display errors.
43 ostream& operator<<(ostream& os, const PhoneNumber& number);
44 
45 ostream& operator<<(ostream& os, const vector<PhoneNumber>& numbers);
46 
47 // Class containing string constants of region codes for easier testing. Note
48 // that another private RegionCode class is defined in
49 // cpp/src/phonenumbers/region_code.h. This one contains more constants.
50 class RegionCode {
51  public:
AD()52   static const char* AD() {
53     return "AD";
54   }
55 
AE()56   static const char* AE() {
57     return "AE";
58   }
59 
AM()60   static const char* AM() {
61     return "AM";
62   }
63 
AO()64   static const char* AO() {
65     return "AO";
66   }
67 
AQ()68   static const char* AQ() {
69     return "AQ";
70   }
71 
AR()72   static const char* AR() {
73     return "AR";
74   }
75 
AU()76   static const char* AU() {
77     return "AU";
78   }
79 
BB()80   static const char* BB() {
81     return "BB";
82   }
83 
BR()84   static const char* BR() {
85     return "BR";
86   }
87 
BS()88   static const char* BS() {
89     return "BS";
90   }
91 
BY()92   static const char* BY() {
93     return "BY";
94   }
95 
CA()96   static const char* CA() {
97     return "CA";
98   }
99 
CH()100   static const char* CH() {
101     return "CH";
102   }
103 
CL()104   static const char* CL() {
105     return "CL";
106   }
107 
CN()108   static const char* CN() {
109     return "CN";
110   }
111 
CS()112   static const char* CS() {
113     return "CS";
114   }
115 
CX()116   static const char* CX() {
117     return "CX";
118   }
119 
DE()120   static const char* DE() {
121     return "DE";
122   }
123 
FR()124   static const char* FR() {
125     return "FR";
126   }
127 
GB()128   static const char* GB() {
129     return "GB";
130   }
131 
HU()132   static const char* HU() {
133     return "HU";
134   }
135 
IT()136   static const char* IT() {
137     return "IT";
138   }
139 
JP()140   static const char* JP() {
141     return "JP";
142   }
143 
KR()144   static const char* KR() {
145     return "KR";
146   }
147 
MX()148   static const char* MX() {
149     return "MX";
150   }
151 
NZ()152   static const char* NZ() {
153     return "NZ";
154   }
155 
PL()156   static const char* PL() {
157     return "PL";
158   }
159 
RE()160   static const char* RE() {
161     return "RE";
162   }
163 
RU()164   static const char* RU() {
165     return "RU";
166   }
167 
SE()168   static const char* SE() {
169     return "SE";
170   }
171 
SG()172   static const char* SG() {
173     return "SG";
174   }
175 
UN001()176   static const char* UN001() {
177     return "001";
178   }
179 
US()180   static const char* US() {
181     return "US";
182   }
183 
UZ()184   static const char* UZ() {
185     return "UZ";
186   }
187 
YT()188   static const char* YT() {
189     return "YT";
190   }
191 
ZW()192   static const char* ZW() {
193     return "ZW";
194   }
195 
196   // Returns a region code string representing the "unknown" region.
GetUnknown()197   static const char* GetUnknown() {
198     return "ZZ";
199   }
200 
ZZ()201   static const char* ZZ() {
202     return GetUnknown();
203   }
204 };
205 
206 }  // namespace phonenumbers
207 }  // namespace i18n
208