~ken-vandine/+junk/libphonenumber

« back to all changes in this revision

Viewing changes to cpp/src/phonenumbers/regex_based_matcher.h

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2015-09-25 13:20:24 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20150925132024-jhc5afks3lirr982
Tags: 7.0.11-2
* Split libgeocoding out into a separate package.
* Make library packages Multi-Arch: same
* Rename -dev package to not include the version - this means that
  our reverse build-deps don't need to have source changes whenever we bump
  the ABI version.
* debian/patches/0001-Boost-build-fix.patch: Make sure to install all the
  headers.
* debian/patches/0002-C-symbols-map.patch: Control our exported symbols to
  not leak those of libraries we depend on.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2014 The Libphonenumber Authors
 
3
 *
 
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
 
7
 *
 
8
 * http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
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.
 
15
 */
 
16
 
 
17
#ifndef I18N_PHONENUMBERS_REGEX_BASED_MATCHER_H_
 
18
#define I18N_PHONENUMBERS_REGEX_BASED_MATCHER_H_
 
19
 
 
20
#include <memory>
 
21
#include <string>
 
22
 
 
23
#include "phonenumbers/base/basictypes.h"
 
24
#include "phonenumbers/base/memory/scoped_ptr.h"
 
25
#include "phonenumbers/matcher_api.h"
 
26
 
 
27
namespace i18n {
 
28
namespace phonenumbers {
 
29
 
 
30
class AbstractRegExpFactory;
 
31
class PhoneNumberDesc;
 
32
class RegExpCache;
 
33
 
 
34
// Implementation of the matcher API using the regular expressions in the
 
35
// PhoneNumberDesc proto message to match numbers.
 
36
class RegexBasedMatcher : public MatcherApi {
 
37
 public:
 
38
  RegexBasedMatcher();
 
39
  ~RegexBasedMatcher();
 
40
 
 
41
  bool MatchesNationalNumber(const string& national_number,
 
42
                             const PhoneNumberDesc& number_desc,
 
43
                             bool allow_prefix_match) const;
 
44
 
 
45
  bool MatchesPossibleNumber(const string& national_number,
 
46
                             const PhoneNumberDesc& number_desc) const;
 
47
 
 
48
 private:
 
49
  bool Match(const string& national_number, const string& number_pattern,
 
50
             bool allow_prefix_match) const;
 
51
 
 
52
  const scoped_ptr<const AbstractRegExpFactory> regexp_factory_;
 
53
  const scoped_ptr<RegExpCache> regexp_cache_;
 
54
 
 
55
  DISALLOW_COPY_AND_ASSIGN(RegexBasedMatcher);
 
56
};
 
57
 
 
58
}  // namespace phonenumbers
 
59
}  // namespace i18n
 
60
 
 
61
#endif  // I18N_PHONENUMBERS_REGEX_BASED_MATCHER_H_