2015-07-17 20:22:30 +00:00
|
|
|
#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 {
|
2015-07-17 20:22:30 +00:00
|
|
|
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;
|
|
|
|
|
2015-07-17 20:22:30 +00:00
|
|
|
private:
|
|
|
|
google::protobuf::uint32 _country_code : 10;
|
|
|
|
google::protobuf::uint64 _national_number : 50;
|
|
|
|
google::protobuf::uint32 _leading_zeros : 4;
|
|
|
|
};
|
|
|
|
|