git.iko.soy/typeable/libphonenumber
on main help sign in
More standards-comforming passing of C++ class pointers
5ea8441mniip
cxxbits/c_phonenumber.cpp+6−4
@@ -55,7 +55,7 @@ static country_code_source unmarshal_country_code_source(PhoneNumber::CountryCod
55 return static_cast<country_code_source>(value);
55 return static_cast<country_code_source>(value);
56}
56}
57
57
58−extern "C" PhoneNumber *c_phone_number_marshal(phone_number const *c_number)
58+extern "C" CxxPhoneNumber *c_phone_number_marshal(phone_number const *c_number)
59{
59{
60 PhoneNumber *number = new PhoneNumber();
60 PhoneNumber *number = new PhoneNumber();
61 if (c_number->extension != nullptr)
61 if (c_number->extension != nullptr)
@@ -72,11 +72,12 @@ extern "C" PhoneNumber *c_phone_number_marshal(phone_number const *c_number)
72 number->set_country_code_source(marshal_country_code_source(c_number->country_code_source));
72 number->set_country_code_source(marshal_country_code_source(c_number->country_code_source));
73 if (c_number->has_number_of_leading_zeros)
73 if (c_number->has_number_of_leading_zeros)
74 number->set_number_of_leading_zeros(c_number->number_of_leading_zeros);
74 number->set_number_of_leading_zeros(c_number->number_of_leading_zeros);
75− return number;
75+ return reinterpret_cast<CxxPhoneNumber *>(number);
76}
76}
77
77
78−extern "C" void c_phone_number_unmarshal(PhoneNumber const *number, phone_number *c_number)
78+extern "C" void c_phone_number_unmarshal(CxxPhoneNumber const *ptr, phone_number *c_number)
79{
79{
80+ auto number = reinterpret_cast<PhoneNumber const *>(ptr);
80 if (number->has_extension())
81 if (number->has_extension())
81 unmarshal_string_size(number->extension(), c_number->extension, c_number->extension_size);
82 unmarshal_string_size(number->extension(), c_number->extension, c_number->extension_size);
82 else
83 else
@@ -99,7 +100,8 @@ extern "C" void c_phone_number_unmarshal(PhoneNumber const *number, phone_number
99 c_number->number_of_leading_zeros = number->number_of_leading_zeros();
100 c_number->number_of_leading_zeros = number->number_of_leading_zeros();
100}
101}
101
102
102−extern "C" void c_phone_number_free(PhoneNumber *number)
103+extern "C" void c_phone_number_free(CxxPhoneNumber *ptr)
103{
104{
105+ auto number = reinterpret_cast<PhoneNumber *>(ptr);
104 delete number;
106 delete number;
105}
107}
cxxbits/c_phonenumberutil.cpp+45−26
@@ -310,10 +310,11 @@ extern "C" void c_phone_number_util_normalize_dialable_chars_only(
310}
310}
311
311
312extern "C" void c_phone_number_util_get_national_significant_number(
312extern "C" void c_phone_number_util_get_national_significant_number(
313− PhoneNumber const *number,
313+ CxxPhoneNumber const *ptr,
314 c_string *c_nsn
314 c_string *c_nsn
315)
315)
316{
316{
317+ auto number = reinterpret_cast<PhoneNumber const *>(ptr);
317 std::string nsn;
318 std::string nsn;
318 PhoneNumberUtil::GetInstance()->GetNationalSignificantNumber(*number, &nsn);
319 PhoneNumberUtil::GetInstance()->GetNationalSignificantNumber(*number, &nsn);
319 unmarshal_c_string(nsn, *c_nsn);
320 unmarshal_c_string(nsn, *c_nsn);
@@ -330,23 +331,25 @@ extern "C" void c_phone_number_util_get_country_mobile_token(
330}
331}
331
332
332extern "C" void c_phone_number_util_format(
333extern "C" void c_phone_number_util_format(
333− PhoneNumber const *number,
334+ CxxPhoneNumber const *ptr,
334 phone_number_format format,
335 phone_number_format format,
335 c_string *c_string
336 c_string *c_string
336)
337)
337{
338{
339+ auto number = reinterpret_cast<PhoneNumber const *>(ptr);
338 std::string string;
340 std::string string;
339 PhoneNumberUtil::GetInstance()->Format(*number, marshal_phone_number_format(format), &string);
341 PhoneNumberUtil::GetInstance()->Format(*number, marshal_phone_number_format(format), &string);
340 unmarshal_c_string(string, *c_string);
342 unmarshal_c_string(string, *c_string);
341}
343}
342
344
343extern "C" void c_phone_number_util_format_national_number_with_carrier_code(
345extern "C" void c_phone_number_util_format_national_number_with_carrier_code(
344− PhoneNumber const *number,
346+ CxxPhoneNumber const *ptr,
345 char const *c_carrier_code,
347 char const *c_carrier_code,
346 size_t c_carrier_code_size,
348 size_t c_carrier_code_size,
347 c_string *c_string
349 c_string *c_string
348)
350)
349{
351{
352+ auto number = reinterpret_cast<PhoneNumber const *>(ptr);
350 std::string const carrier_code(c_carrier_code, c_carrier_code_size);
353 std::string const carrier_code(c_carrier_code, c_carrier_code_size);
351 std::string string;
354 std::string string;
352 PhoneNumberUtil::GetInstance()->FormatNationalNumberWithCarrierCode(*number, carrier_code, &string);
355 PhoneNumberUtil::GetInstance()->FormatNationalNumberWithCarrierCode(*number, carrier_code, &string);
@@ -354,12 +357,13 @@ extern "C" void c_phone_number_util_format_national_number_with_carrier_code(
354}
357}
355
358
356extern "C" void c_phone_number_util_format_national_number_with_preferred_carrier_code(
359extern "C" void c_phone_number_util_format_national_number_with_preferred_carrier_code(
357− PhoneNumber const *number,
360+ CxxPhoneNumber const *ptr,
358 char const *c_carrier_code,
361 char const *c_carrier_code,
359 size_t c_carrier_code_size,
362 size_t c_carrier_code_size,
360 c_string *c_string
363 c_string *c_string
361)
364)
362{
365{
366+ auto number = reinterpret_cast<PhoneNumber const *>(ptr);
363 std::string const carrier_code(c_carrier_code, c_carrier_code_size);
367 std::string const carrier_code(c_carrier_code, c_carrier_code_size);
364 std::string string;
368 std::string string;
365 PhoneNumberUtil::GetInstance()->FormatNationalNumberWithPreferredCarrierCode(*number, carrier_code, &string);
369 PhoneNumberUtil::GetInstance()->FormatNationalNumberWithPreferredCarrierCode(*number, carrier_code, &string);
@@ -367,13 +371,14 @@ extern "C" void c_phone_number_util_format_national_number_with_preferred_carrie
367}
371}
368
372
369extern "C" void c_phone_number_util_format_number_for_mobile_dialing(
373extern "C" void c_phone_number_util_format_number_for_mobile_dialing(
370− PhoneNumber const *number,
374+ CxxPhoneNumber const *ptr,
371 char const *c_region,
375 char const *c_region,
372 size_t c_region_size,
376 size_t c_region_size,
373 int with_formatting,
377 int with_formatting,
374 c_string *c_string
378 c_string *c_string
375)
379)
376{
380{
381+ auto number = reinterpret_cast<PhoneNumber const *>(ptr);
377 std::string const region(c_region, c_region_size);
382 std::string const region(c_region, c_region_size);
378 std::string string;
383 std::string string;
379 PhoneNumberUtil::GetInstance()->FormatNumberForMobileDialing(*number, region, with_formatting, &string);
384 PhoneNumberUtil::GetInstance()->FormatNumberForMobileDialing(*number, region, with_formatting, &string);
@@ -381,12 +386,13 @@ extern "C" void c_phone_number_util_format_number_for_mobile_dialing(
381}
386}
382
387
383extern "C" void c_phone_number_util_format_out_of_country_calling_number(
388extern "C" void c_phone_number_util_format_out_of_country_calling_number(
384− PhoneNumber const *number,
389+ CxxPhoneNumber const *ptr,
385 char const *c_region,
390 char const *c_region,
386 size_t c_region_size,
391 size_t c_region_size,
387 c_string *c_string
392 c_string *c_string
388)
393)
389{
394{
395+ auto number = reinterpret_cast<PhoneNumber const *>(ptr);
390 std::string const region(c_region, c_region_size);
396 std::string const region(c_region, c_region_size);
391 std::string string;
397 std::string string;
392 PhoneNumberUtil::GetInstance()->FormatOutOfCountryCallingNumber(*number, region, &string);
398 PhoneNumberUtil::GetInstance()->FormatOutOfCountryCallingNumber(*number, region, &string);
@@ -394,12 +400,13 @@ extern "C" void c_phone_number_util_format_out_of_country_calling_number(
394}
400}
395
401
396extern "C" void c_phone_number_util_format_in_original_format(
402extern "C" void c_phone_number_util_format_in_original_format(
397− PhoneNumber const *number,
403+ CxxPhoneNumber const *ptr,
398 char const *c_region,
404 char const *c_region,
399 size_t c_region_size,
405 size_t c_region_size,
400 c_string *c_string
406 c_string *c_string
401)
407)
402{
408{
409+ auto number = reinterpret_cast<PhoneNumber const *>(ptr);
403 std::string const region(c_region, c_region_size);
410 std::string const region(c_region, c_region_size);
404 std::string string;
411 std::string string;
405 PhoneNumberUtil::GetInstance()->FormatInOriginalFormat(*number, region, &string);
412 PhoneNumberUtil::GetInstance()->FormatInOriginalFormat(*number, region, &string);
@@ -407,24 +414,26 @@ extern "C" void c_phone_number_util_format_in_original_format(
407}
414}
408
415
409extern "C" void c_phone_number_util_format_out_of_country_keeping_alpha_chars(
416extern "C" void c_phone_number_util_format_out_of_country_keeping_alpha_chars(
410− PhoneNumber const *number,
417+ CxxPhoneNumber const *ptr,
411 char const *c_region,
418 char const *c_region,
412 size_t c_region_size,
419 size_t c_region_size,
413 c_string *c_string
420 c_string *c_string
414)
421)
415{
422{
423+ auto number = reinterpret_cast<PhoneNumber const *>(ptr);
416 std::string const region(c_region, c_region_size);
424 std::string const region(c_region, c_region_size);
417 std::string string;
425 std::string string;
418 PhoneNumberUtil::GetInstance()->FormatOutOfCountryKeepingAlphaChars(*number, region, &string);
426 PhoneNumberUtil::GetInstance()->FormatOutOfCountryKeepingAlphaChars(*number, region, &string);
419 unmarshal_c_string(string, *c_string);
427 unmarshal_c_string(string, *c_string);
420}
428}
421
429
422−extern "C" PhoneNumber *c_phone_number_util_truncate_too_long_number(PhoneNumber const *input)
430+extern "C" CxxPhoneNumber *c_phone_number_util_truncate_too_long_number(CxxPhoneNumber const *ptr)
423{
431{
432+ auto input = reinterpret_cast<PhoneNumber const *>(ptr);
424 auto *output = new PhoneNumber(*input);
433 auto *output = new PhoneNumber(*input);
425 if (PhoneNumberUtil::GetInstance()->TruncateTooLongNumber(output))
434 if (PhoneNumberUtil::GetInstance()->TruncateTooLongNumber(output))
426 {
435 {
427− return output;
436+ return reinterpret_cast<CxxPhoneNumber *>(output);
428 }
437 }
429 else
438 else
430 {
439 {
@@ -433,33 +442,37 @@ extern "C" PhoneNumber *c_phone_number_util_truncate_too_long_number(PhoneNumber
433 }
442 }
434}
443}
435
444
436−extern "C" phone_number_type c_phone_number_util_get_number_type(PhoneNumber const *number)
445+extern "C" phone_number_type c_phone_number_util_get_number_type(CxxPhoneNumber const *ptr)
437{
446{
447+ auto number = reinterpret_cast<PhoneNumber const *>(ptr);
438 return unmarshal_phone_number_type(
448 return unmarshal_phone_number_type(
439 PhoneNumberUtil::GetInstance()->GetNumberType(*number)
449 PhoneNumberUtil::GetInstance()->GetNumberType(*number)
440 );
450 );
441}
451}
442
452
443−extern "C" int c_phone_number_util_is_valid_number(PhoneNumber const *number)
453+extern "C" int c_phone_number_util_is_valid_number(CxxPhoneNumber const *ptr)
444{
454{
455+ auto number = reinterpret_cast<PhoneNumber const *>(ptr);
445 return PhoneNumberUtil::GetInstance()->IsValidNumber(*number);
456 return PhoneNumberUtil::GetInstance()->IsValidNumber(*number);
446}
457}
447
458
448extern "C" int c_phone_number_util_is_valid_number_for_region(
459extern "C" int c_phone_number_util_is_valid_number_for_region(
449− PhoneNumber const *number,
460+ CxxPhoneNumber const *ptr,
450 char const *c_region,
461 char const *c_region,
451 size_t c_region_size
462 size_t c_region_size
452)
463)
453{
464{
465+ auto number = reinterpret_cast<PhoneNumber const *>(ptr);
454 std::string const region(c_region, c_region_size);
466 std::string const region(c_region, c_region_size);
455 return PhoneNumberUtil::GetInstance()->IsValidNumberForRegion(*number, region);
467 return PhoneNumberUtil::GetInstance()->IsValidNumberForRegion(*number, region);
456}
468}
457
469
458extern "C" void c_phone_number_util_get_region_code_for_number(
470extern "C" void c_phone_number_util_get_region_code_for_number(
459− PhoneNumber const *number,
471+ CxxPhoneNumber const *ptr,
460 c_string *c_region
472 c_string *c_region
461)
473)
462{
474{
475+ auto number = reinterpret_cast<PhoneNumber const *>(ptr);
463 std::string region;
476 std::string region;
464 PhoneNumberUtil::GetInstance()->GetRegionCodeForNumber(*number, &region);
477 PhoneNumberUtil::GetInstance()->GetRegionCodeForNumber(*number, &region);
465 unmarshal_c_string(region, *c_region);
478 unmarshal_c_string(region, *c_region);
@@ -518,10 +531,11 @@ extern "C" void c_phone_number_util_get_ndd_prefix_for_region(
518}
531}
519
532
520extern "C" validation_result c_phone_number_util_is_possible_number_for_type_with_reason(
533extern "C" validation_result c_phone_number_util_is_possible_number_for_type_with_reason(
521− PhoneNumber const *number,
534+ CxxPhoneNumber const *ptr,
522 phone_number_type ntype
535 phone_number_type ntype
523)
536)
524{
537{
538+ auto number = reinterpret_cast<PhoneNumber const *>(ptr);
525 return unmarshal_validation_result(
539 return unmarshal_validation_result(
526 PhoneNumberUtil::GetInstance()->IsPossibleNumberForTypeWithReason(
540 PhoneNumberUtil::GetInstance()->IsPossibleNumberForTypeWithReason(
527 *number,
541 *number,
@@ -530,13 +544,15 @@ extern "C" validation_result c_phone_number_util_is_possible_number_for_type_wit
530 );
544 );
531}
545}
532
546
533−extern "C" int c_phone_number_util_can_be_internationally_dialed(PhoneNumber const *number)
547+extern "C" int c_phone_number_util_can_be_internationally_dialed(CxxPhoneNumber const *ptr)
534{
548{
549+ auto number = reinterpret_cast<PhoneNumber const *>(ptr);
535 return PhoneNumberUtil::GetInstance()->CanBeInternationallyDialled(*number);
550 return PhoneNumberUtil::GetInstance()->CanBeInternationallyDialled(*number);
536}
551}
537
552
538−extern "C" int c_phone_number_util_is_number_geographical_1(PhoneNumber const *number)
553+extern "C" int c_phone_number_util_is_number_geographical_1(CxxPhoneNumber const *ptr)
539{
554{
555+ auto number = reinterpret_cast<PhoneNumber const *>(ptr);
540 return PhoneNumberUtil::GetInstance()->IsNumberGeographical(*number);
556 return PhoneNumberUtil::GetInstance()->IsNumberGeographical(*number);
541}
557}
542
558
@@ -556,14 +572,14 @@ extern "C" error_type c_phone_number_util_parse(
556 size_t c_string_size,
572 size_t c_string_size,
557 char const *c_region,
573 char const *c_region,
558 size_t c_region_size,
574 size_t c_region_size,
559− PhoneNumber **number
575+ CxxPhoneNumber **number
560)
576)
561{
577{
562 std::string const string(c_string, c_string_size);
578 std::string const string(c_string, c_string_size);
563 std::string const region(c_region, c_region_size);
579 std::string const region(c_region, c_region_size);
564− *number = new PhoneNumber();
580+ *number = reinterpret_cast<CxxPhoneNumber *>(new PhoneNumber());
565 return unmarshal_error_type(
581 return unmarshal_error_type(
566− PhoneNumberUtil::GetInstance()->Parse(string, region, *number)
582+ PhoneNumberUtil::GetInstance()->Parse(string, region, reinterpret_cast<PhoneNumber *>(*number))
567 );
583 );
568}
584}
569
585
@@ -572,22 +588,24 @@ extern "C" error_type c_phone_number_util_parse_and_keep_raw_input(
572 size_t c_string_size,
588 size_t c_string_size,
573 char const *c_region,
589 char const *c_region,
574 size_t c_region_size,
590 size_t c_region_size,
575− PhoneNumber **number
591+ CxxPhoneNumber **number
576)
592)
577{
593{
578 std::string const string(c_string, c_string_size);
594 std::string const string(c_string, c_string_size);
579 std::string const region(c_region, c_region_size);
595 std::string const region(c_region, c_region_size);
580− *number = new PhoneNumber();
596+ *number = reinterpret_cast<CxxPhoneNumber *>(new PhoneNumber());
581 return unmarshal_error_type(
597 return unmarshal_error_type(
582− PhoneNumberUtil::GetInstance()->ParseAndKeepRawInput(string, region, *number)
598+ PhoneNumberUtil::GetInstance()->ParseAndKeepRawInput(string, region, reinterpret_cast<PhoneNumber *>(*number))
583 );
599 );
584}
600}
585
601
586extern "C" match_type c_phone_number_util_is_number_match(
602extern "C" match_type c_phone_number_util_is_number_match(
587− PhoneNumber const *number1,
603+ CxxPhoneNumber const *ptr1,
588− PhoneNumber const *number2
604+ CxxPhoneNumber const *ptr2
589)
605)
590{
606{
607+ auto number1 = reinterpret_cast<PhoneNumber const *>(ptr1);
608+ auto number2 = reinterpret_cast<PhoneNumber const *>(ptr2);
591 return unmarshal_match_type(
609 return unmarshal_match_type(
592 PhoneNumberUtil::GetInstance()->IsNumberMatch(*number1, *number2)
610 PhoneNumberUtil::GetInstance()->IsNumberMatch(*number1, *number2)
593 );
611 );
@@ -608,11 +626,12 @@ extern "C" match_type c_phone_number_util_is_number_match_with_two_strings(
608}
626}
609
627
610extern "C" match_type c_phone_number_util_is_number_match_with_one_string(
628extern "C" match_type c_phone_number_util_is_number_match_with_one_string(
611− PhoneNumber const *number1,
629+ CxxPhoneNumber const *ptr1,
612 char const *c_number2,
630 char const *c_number2,
613 size_t c_number2_size
631 size_t c_number2_size
614)
632)
615{
633{
634+ auto number1 = reinterpret_cast<PhoneNumber const *>(ptr1);
616 std::string const number2(c_number2, c_number2_size);
635 std::string const number2(c_number2, c_number2_size);
617 return unmarshal_match_type(
636 return unmarshal_match_type(
618 PhoneNumberUtil::GetInstance()->IsNumberMatchWithOneString(*number1, number2)
637 PhoneNumberUtil::GetInstance()->IsNumberMatchWithOneString(*number1, number2)
include/c_phonenumber.h+4−8
@@ -43,20 +43,16 @@ typedef struct
43 char has_number_of_leading_zeros;
43 char has_number_of_leading_zeros;
44} phone_number;
44} phone_number;
45
45
46−#ifdef __cplusplus
46+struct CxxPhoneNumber;
47−typedef i18n::phonenumbers::PhoneNumber PhoneNumber;
48−#else
49−typedef struct PhoneNumber PhoneNumber;
50−#endif
51
47
52// The returned object is allocated by `new` and managed by C++ RAII, and it is
48// The returned object is allocated by `new` and managed by C++ RAII, and it is
53// haskell's responsibility to call its finalizer (c_phone_number_free).
49// haskell's responsibility to call its finalizer (c_phone_number_free).
54−PhoneNumber *c_phone_number_marshal(phone_number const *);
50+struct CxxPhoneNumber *c_phone_number_marshal(phone_number const *);
55
51
56// phone_number * points to an area which will be filled with the data of the
52// phone_number * points to an area which will be filled with the data of the
57// given PhoneNumber.
53// given PhoneNumber.
58−void c_phone_number_unmarshal(PhoneNumber const *, phone_number *);
54+void c_phone_number_unmarshal(struct CxxPhoneNumber const *, phone_number *);
59
55
60−void c_phone_number_free(PhoneNumber *);
56+void c_phone_number_free(struct CxxPhoneNumber *);
61
57
62#endif
58#endif
include/c_phonenumberutil.h+20−20
@@ -97,34 +97,34 @@ int c_phone_number_util_is_alpha_number(char const *, size_t);
97void c_phone_number_util_convert_alpha_characters_in_number(char const *, size_t, c_string *);
97void c_phone_number_util_convert_alpha_characters_in_number(char const *, size_t, c_string *);
98void c_phone_number_util_normalize_digits_only(char const *, size_t, c_string *);
98void c_phone_number_util_normalize_digits_only(char const *, size_t, c_string *);
99void c_phone_number_util_normalize_dialable_chars_only(char const *, size_t, c_string *);
99void c_phone_number_util_normalize_dialable_chars_only(char const *, size_t, c_string *);
100−void c_phone_number_util_get_national_significant_number(PhoneNumber const *, c_string *);
100+void c_phone_number_util_get_national_significant_number(struct CxxPhoneNumber const *, c_string *);
101void c_phone_number_util_get_country_mobile_token(int, c_string *);
101void c_phone_number_util_get_country_mobile_token(int, c_string *);
102−void c_phone_number_util_format(PhoneNumber const *, enum phone_number_format, c_string *);
102+void c_phone_number_util_format(struct CxxPhoneNumber const *, enum phone_number_format, c_string *);
103−void c_phone_number_util_format_national_number_with_carrier_code(PhoneNumber const *, char const *, size_t, c_string *);
103+void c_phone_number_util_format_national_number_with_carrier_code(struct CxxPhoneNumber const *, char const *, size_t, c_string *);
104−void c_phone_number_util_format_national_number_with_preferred_carrier_code(PhoneNumber const *, char const *, size_t, c_string *);
104+void c_phone_number_util_format_national_number_with_preferred_carrier_code(struct CxxPhoneNumber const *, char const *, size_t, c_string *);
105−void c_phone_number_util_format_number_for_mobile_dialing(PhoneNumber const *, char const *, size_t, int, c_string *);
105+void c_phone_number_util_format_number_for_mobile_dialing(struct CxxPhoneNumber const *, char const *, size_t, int, c_string *);
106−void c_phone_number_util_format_out_of_country_calling_number(PhoneNumber const *, char const *, size_t, c_string *);
106+void c_phone_number_util_format_out_of_country_calling_number(struct CxxPhoneNumber const *, char const *, size_t, c_string *);
107−void c_phone_number_util_format_in_original_format(PhoneNumber const *, char const *, size_t, c_string *);
107+void c_phone_number_util_format_in_original_format(struct CxxPhoneNumber const *, char const *, size_t, c_string *);
108−void c_phone_number_util_format_out_of_country_keeping_alpha_chars(PhoneNumber const *, char const *, size_t, c_string *);
108+void c_phone_number_util_format_out_of_country_keeping_alpha_chars(struct CxxPhoneNumber const *, char const *, size_t, c_string *);
109// /!\ May return NULL
109// /!\ May return NULL
110−PhoneNumber *c_phone_number_util_truncate_too_long_number(PhoneNumber const *);
110+struct CxxPhoneNumber *c_phone_number_util_truncate_too_long_number(struct CxxPhoneNumber const *);
111−enum phone_number_type c_phone_number_util_get_number_type(PhoneNumber const *);
111+enum phone_number_type c_phone_number_util_get_number_type(struct CxxPhoneNumber const *);
112−int c_phone_number_util_is_valid_number(PhoneNumber const *);
112+int c_phone_number_util_is_valid_number(struct CxxPhoneNumber const *);
113−int c_phone_number_util_is_valid_number_for_region(PhoneNumber const *, char const *, size_t);
113+int c_phone_number_util_is_valid_number_for_region(struct CxxPhoneNumber const *, char const *, size_t);
114−void c_phone_number_util_get_region_code_for_number(PhoneNumber const *, c_string *);
114+void c_phone_number_util_get_region_code_for_number(struct CxxPhoneNumber const *, c_string *);
115int c_phone_number_util_get_country_code_for_region(char const *, size_t);
115int c_phone_number_util_get_country_code_for_region(char const *, size_t);
116void c_phone_number_util_get_region_code_for_country_code(int, c_string *);
116void c_phone_number_util_get_region_code_for_country_code(int, c_string *);
117void c_phone_number_util_get_region_codes_for_country_calling_code(int, c_string **, size_t *);
117void c_phone_number_util_get_region_codes_for_country_calling_code(int, c_string **, size_t *);
118int c_phone_number_util_is_nanpa_country(char const *, size_t);
118int c_phone_number_util_is_nanpa_country(char const *, size_t);
119void c_phone_number_util_get_ndd_prefix_for_region(char const *, size_t, int, c_string *);
119void c_phone_number_util_get_ndd_prefix_for_region(char const *, size_t, int, c_string *);
120−enum validation_result c_phone_number_util_is_possible_number_for_type_with_reason(PhoneNumber const *, enum phone_number_type);
120+enum validation_result c_phone_number_util_is_possible_number_for_type_with_reason(struct CxxPhoneNumber const *, enum phone_number_type);
121−int c_phone_number_util_can_be_internationally_dialed(PhoneNumber const *);
121+int c_phone_number_util_can_be_internationally_dialed(struct CxxPhoneNumber const *);
122−int c_phone_number_util_is_number_geographical_1(PhoneNumber const *);
122+int c_phone_number_util_is_number_geographical_1(struct CxxPhoneNumber const *);
123int c_phone_number_util_is_number_geographical_2(enum phone_number_type, int);
123int c_phone_number_util_is_number_geographical_2(enum phone_number_type, int);
124−enum error_type c_phone_number_util_parse(char const *, size_t, char const *, size_t, PhoneNumber **);
124+enum error_type c_phone_number_util_parse(char const *, size_t, char const *, size_t, struct CxxPhoneNumber **);
125−enum error_type c_phone_number_util_parse_and_keep_raw_input(char const *, size_t, char const *, size_t, PhoneNumber **);
125+enum error_type c_phone_number_util_parse_and_keep_raw_input(char const *, size_t, char const *, size_t, struct CxxPhoneNumber **);
126−enum match_type c_phone_number_util_is_number_match(PhoneNumber const *, PhoneNumber const *);
126+enum match_type c_phone_number_util_is_number_match(struct CxxPhoneNumber const *, struct CxxPhoneNumber const *);
127enum match_type c_phone_number_util_is_number_match_with_two_strings(char const *, size_t, char const *, size_t);
127enum match_type c_phone_number_util_is_number_match_with_two_strings(char const *, size_t, char const *, size_t);
128−enum match_type c_phone_number_util_is_number_match_with_one_string(PhoneNumber const *, char const *, size_t);
128+enum match_type c_phone_number_util_is_number_match_with_one_string(struct CxxPhoneNumber const *, char const *, size_t);
129
129
130#endif
130#endif
src/Data/PhoneNumber/Internal/Number.chs+1−1
@@ -126,7 +126,7 @@ acquireCPhoneNumber p = do
126-- , 'Data.PhoneNumber.Number.numberOfLeadingZeros' :: !('Maybe' 'Int')
126-- , 'Data.PhoneNumber.Number.numberOfLeadingZeros' :: !('Maybe' 'Int')
127-- }
127-- }
128-- @
128-- @
129−{#pointer *PhoneNumber foreign finalizer c_phone_number_free newtype#}
129+{#pointer *CxxPhoneNumber as PhoneNumber foreign finalizer c_phone_number_free newtype#}
130
130
131{#fun unsafe c_phone_number_marshal
131{#fun unsafe c_phone_number_marshal
132 { withCPhoneNumber* `CPhoneNumber'
132 { withCPhoneNumber* `CPhoneNumber'