Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Google LibPhonenumber import issues
#1
Greetings.. using latest CrossTalk demo and Delphi 11.3 for win32


DCL: 2.0.32
NET: 533320
Middle (x86): 2.0.32
Right: 2.0.32
UI: 2.0.32

I am messing around with Google LibPhonenumber for C#    ( For life of me can't get CPP version to compile so gave up.  )

Originally I found this @ landrix/LibPhonenumber-for-Delphi: Delphi-wrapper for the .NET port of Google's libphonenumber for parsing, formatting and validating international phone numbers. (github.com)

And for most part it works.  Looks like he wrote a middle man DLL type deal to go between Delphi and the .NET DLL ...  but only covers 2 calls of the over all library.

Limited, but does work.

Then I remembered CrossTalk and gave it A whirl.

It created a NET.PhoneNumbers.pas file

But it is missing a few things....?

Unreferenced <--- not sure?

Code:
  PhoneNumberUtil = class(TCTBaseObject)
  private
    class function ValidStartCharPatternRead: Unreferenced; static; /// <--- lots of references in the source import for "Unreferenced"
    class procedure ValidStartCharPatternWrite(const aValue: Unreferenced); static;
  protected
    class function CTFullTypeName: string; override;
  public const

..

..


RegexOptions <-- only used once... but I think? I just need to import some other .NET library to include this regex engine maybe?


Code:
  PhoneRegex = class(TCTBaseObject)
  private
  protected
    class function CTFullTypeName: string; override;
  public
    constructor Create(const aPattern: string); reintroduce; overload;
    constructor Create(const aPattern: string; const aOptions: RegexOptions); reintroduce; overload;  <--- only reference
    function IsMatch(const aValue: string): Boolean; overload;


TCTObject <--- Atozed.CrossTalk.BaseObject has no mention of this?
TypeNET  <--- this i get as Type is a reserved word... so it must create TypeNet ... but i figure this is to be something else really in the end?

Pretty much every object has this "Equals" call that references TCTObject the and GetType:TypeNet;


Code:
  AreaCodeMapStorageStrategy = class(TCTBaseObject)
  private
  protected
    class function CTFullTypeName: string; override;
  public
    function GetPrefix(const aIndex: Int32): Int32; overload;
    function GetStorageSize: Int32; overload;
    function GetDescription(const aIndex: Int32): string; overload;
    function GetNumOfEntries: Int32; overload;
    function ToString: string; reintroduce; overload;
    function Equals(const aObj: TCTObject): Boolean; reintroduce; overload; <--------- every TCTBaseObject seems to have this
    function GetHashCode: Int32; reintroduce; overload;
    function GetType: TypeNET; overload; <--------- every TCTBaseObject seems to have this
  end;

For now I just did this to get by

Code:
  RegexOptions = class
  end;

  Unreferenced = class
  end;

  TCTObject = class
  end;

  TypeNET = class
  end;

And it compiles...

And it runs....

Code:
Uses NET.PhoneNumbers, ...
..
..

var
  p: string;
  r: boolean;
begin
  Memo1.Clear;

  p := '18594091234';
  r := PhoneNumberUtil.IsViablePhoneNumber(p);
  Memo1.Lines.Add(format('phone %s is %s', [p, BoolToStr(r)]));  // -1 returned = true

  p := 'dumbstuff';
  r := PhoneNumberUtil.IsViablePhoneNumber(p);
  Memo1.Lines.Add(format('phone %s is %s', [p, BoolToStr(r )])); // 0 returned = false
end;

I imported a small DLL I wrote in C# ... Add/Subtract kind of deal. Just to play with.

And it too created references to TCTObject the and GetType:TypeNet;


This the win32 .NET DLL I imported

https://github.com/landrix/LibPhonenumbe...umbers.dll
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)