@@ -9,6 +9,18 @@ extern "C" {
10using i18n::phonenumbers::PhoneNumber;
10using i18n::phonenumbers::PhoneNumber;
12+// libphonenumber versions < 8.6.0 do not define CountryCodeSource::UNSPECIFIED
13+// The value PN_UNSPECIFIED contains CountryCodeSource::UNSPECIFIED if it is
14+// defined, otherwise 0 (the value used in the newer versions).
15+template<typename T, typename = void>
16+struct check_UNSPECIFIED: std::integral_constant<T, static_cast<T>(0)>
19+struct check_UNSPECIFIED<T, void_t<decltype(T::UNSPECIFIED)>>:
20+ std::integral_constant<T, T::UNSPECIFIED>
22+static constexpr auto PN_UNSPECIFIED = check_UNSPECIFIED<PhoneNumber::CountryCodeSource>::value;
12static PhoneNumber::CountryCodeSource marshal_country_code_source(country_code_source value)
24static PhoneNumber::CountryCodeSource marshal_country_code_source(country_code_source value)
14 static_assert(is_same_enum<
26 static_assert(is_same_enum<
@@ -20,7 +32,7 @@ static PhoneNumber::CountryCodeSource marshal_country_code_source(country_code_s
20 FROM_DEFAULT_COUNTRY
32 FROM_DEFAULT_COUNTRY
22 enum_values<PhoneNumber::CountryCodeSource,
34 enum_values<PhoneNumber::CountryCodeSource,
23− PhoneNumber::UNSPECIFIED,
35+ PN_UNSPECIFIED,
24 PhoneNumber::FROM_NUMBER_WITH_PLUS_SIGN,
36 PhoneNumber::FROM_NUMBER_WITH_PLUS_SIGN,
25 PhoneNumber::FROM_NUMBER_WITH_IDD,
37 PhoneNumber::FROM_NUMBER_WITH_IDD,
26 PhoneNumber::FROM_NUMBER_WITHOUT_PLUS_SIGN,
38 PhoneNumber::FROM_NUMBER_WITHOUT_PLUS_SIGN,