Home | History | Annotate | Download | only in phonenumbers
      1 // 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 //
     21 // This class is deprecated. Users should migrate to ShortNumberInfo instead for
     22 // this information.
     23 
     24 #ifndef I18N_PHONENUMBERS_SHORTNUMBERUTIL_H_
     25 #define I18N_PHONENUMBERS_SHORTNUMBERUTIL_H_
     26 
     27 #include <string>
     28 
     29 #include "phonenumbers/base/basictypes.h"
     30 
     31 namespace i18n {
     32 namespace phonenumbers {
     33 
     34 using std::string;
     35 
     36 // Deprecated - use ShortNumberInfo instead.
     37 class 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:
     59   DISALLOW_COPY_AND_ASSIGN(ShortNumberUtil);
     60 };
     61 
     62 }  // namespace phonenumbers
     63 }  // namespace i18n
     64 
     65 #endif  // I18N_PHONENUMBERS_SHORTNUMBERUTIL_H_
     66