33536468d09e06d29ad6f13cb4f74544751fc21a
[platform/upstream/libphonenumber.git] / cpp / src / phonenumbers / matcher_api.h
1 #ifndef I18N_PHONENUMBERS_MATCHER_API_H_
2 #define I18N_PHONENUMBERS_MATCHER_API_H_
3
4 #include <string>
5
6 namespace i18n {
7 namespace phonenumbers {
8
9 using std::string;
10
11 class PhoneNumberDesc;
12
13 // Internal phonenumber matching API used to isolate the underlying
14 // implementation of the matcher and allow different implementations to be
15 // swapped in easily.
16 class MatcherApi {
17  public:
18   virtual ~MatcherApi() {}
19
20   // Returns whether the given national number (a string containing only decimal
21   // digits) matches the national number pattern defined in the given
22   // PhoneNumberDesc message.
23   virtual bool MatchesNationalNumber(const string& national_number,
24                                      const PhoneNumberDesc& number_desc,
25                                      bool allow_prefix_match) const = 0;
26
27   // Returns whether the given national number (a string containing only decimal
28   // digits) matches the possible number pattern defined in the given
29   // PhoneNumberDesc message.
30   virtual bool MatchesPossibleNumber(
31       const string& national_number,
32       const PhoneNumberDesc& number_desc) const = 0;
33 };
34
35 }  // namespace phonenumbers
36 }  // namespace i18n
37
38 #endif  // I18N_PHONENUMBERS_MATCHER_API_H_