2
* Copyright (C) 2014 The Libphonenumber Authors
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
#ifndef I18N_PHONENUMBERS_REGEX_BASED_MATCHER_H_
18
#define I18N_PHONENUMBERS_REGEX_BASED_MATCHER_H_
23
#include "phonenumbers/base/basictypes.h"
24
#include "phonenumbers/base/memory/scoped_ptr.h"
25
#include "phonenumbers/matcher_api.h"
28
namespace phonenumbers {
30
class AbstractRegExpFactory;
31
class PhoneNumberDesc;
34
// Implementation of the matcher API using the regular expressions in the
35
// PhoneNumberDesc proto message to match numbers.
36
class RegexBasedMatcher : public MatcherApi {
41
bool MatchesNationalNumber(const string& national_number,
42
const PhoneNumberDesc& number_desc,
43
bool allow_prefix_match) const;
45
bool MatchesPossibleNumber(const string& national_number,
46
const PhoneNumberDesc& number_desc) const;
49
bool Match(const string& national_number, const string& number_pattern,
50
bool allow_prefix_match) const;
52
const scoped_ptr<const AbstractRegExpFactory> regexp_factory_;
53
const scoped_ptr<RegExpCache> regexp_cache_;
55
DISALLOW_COPY_AND_ASSIGN(RegexBasedMatcher);
58
} // namespace phonenumbers
61
#endif // I18N_PHONENUMBERS_REGEX_BASED_MATCHER_H_