blob: eb9e584d385d410d2e3ed42a856eeb684c627ae1 [file] [log] [blame]
davinci@google.com6276be92012-07-04 13:52:11 +00001// Copyright (C) 2012 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// Utility for international short phone numbers, such as short codes and
16// emergency numbers. Note most commercial short numbers are not handled here,
17// but by the phonenumberutil.
18//
19// Author: David Yonge-Mallo
20//
lararennie@google.comb3bfbbc2013-09-02 17:02:03 +000021// This class is deprecated. Users should migrate to ShortNumberInfo instead for
22// this information.
davinci@google.com6276be92012-07-04 13:52:11 +000023
24#ifndef I18N_PHONENUMBERS_SHORTNUMBERUTIL_H_
25#define I18N_PHONENUMBERS_SHORTNUMBERUTIL_H_
26
27#include <string>
28
philip.liard@gmail.comaf4a2ce2013-04-30 11:35:55 +000029#include "phonenumbers/base/basictypes.h"
davinci@google.com6276be92012-07-04 13:52:11 +000030
31namespace i18n {
32namespace phonenumbers {
33
34using std::string;
35
lararennie@google.comb3bfbbc2013-09-02 17:02:03 +000036// Deprecated - use ShortNumberInfo instead.
davinci@google.com6276be92012-07-04 13:52:11 +000037class ShortNumberUtil {
38 public:
39 ShortNumberUtil();
40
41 // Returns true if the number might be used to connect to an emergency service
42 // in the given region.
43 //
44 // This method takes into account cases where the number might contain
45 // formatting, or might have additional digits appended (when it is okay to do
46 // that in the region specified).
47 bool ConnectsToEmergencyNumber(const string& number,
48 const string& region_code) const;
49
50 // Returns true if the number exactly matches an emergency service number in
51 // the given region.
52 //
53 // This method takes into account cases where the number might contain
54 // formatting, but doesn't allow additional digits to be appended.
55 bool IsEmergencyNumber(const string& number,
56 const string& region_code) const;
57
58 private:
davinci@google.com6276be92012-07-04 13:52:11 +000059 DISALLOW_COPY_AND_ASSIGN(ShortNumberUtil);
60};
61
62} // namespace phonenumbers
63} // namespace i18n
64
65#endif // I18N_PHONENUMBERS_SHORTNUMBERUTIL_H_