pg-libphonenumber/short_phone_number.h

34 lines
782 B
C
Raw Normal View History

#include <exception>
#include "phonenumbers/phonenumberutil.h"
class PhoneNumberTooLongException : std::runtime_error {
public:
PhoneNumberTooLongException(const i18n::phonenumbers::PhoneNumber& number, const char* msg);
private:
i18n::phonenumbers::PhoneNumber _number;
static const i18n::phonenumbers::PhoneNumberUtil* const phoneUtil;
};
2015-07-21 17:32:30 +00:00
class ShortPhoneNumber {
public:
enum : size_t {
MAX_COUNTRY_CODE = 999,
//15 digits
MAX_NATIONAL_NUMBER = 999999999999999,
MAX_LEADING_ZEROS = 15,
};
ShortPhoneNumber(i18n::phonenumbers::PhoneNumber number);
2015-07-21 17:32:30 +00:00
operator i18n::phonenumbers::PhoneNumber() const;
private:
google::protobuf::uint32 _country_code : 10;
google::protobuf::uint64 _national_number : 50;
google::protobuf::uint32 _leading_zeros : 4;
};