mdbs99 / james

James is a collection of object-oriented Pascal primitives for Lazarus and Delphi
MIT License
53 stars 20 forks source link

New IDataGuid and TDataGuid #44

Closed mdbs99 closed 7 years ago

mdbs99 commented 7 years ago

Let's create a Interface that represents a GUID and a first class to implement it. I'll handle it.

  IDataGuid = interface
    function Value: TGuid;
    function AsString: string;
    function AsSmallString: string;
  end;

  TDataGuid = class(TInterfacedObject, IDataGuid)
  private
    FGuid: TGuid;
  public
    constructor Create(Guid: TGuid); reintroduce;
    class function New(Guid: TGuid): IDataGuid; overload;
    class function New(const Guid: string): IDataGuid; overload;
    class function New(Guid: Variant): IDataGuid; overload;
    class function New: IDataGuid; overload;
    function Value: TGuid;
    function AsString: string;
    function AsSmallString: string;
  end;
mdbs99 commented 7 years ago

Done.