将Delphi引用转换为过程C ++ Builder

时间:2015-10-26 05:12:31

标签: c++ delphi c++builder

我在这里需要很少的帮助将delphi转换为c ++ builder 几乎完成转换但发现一个问题

delphi文件CloudPopulator.pas

TTransferJobVisitor = reference to procedure(const Job: TCloudTransferJob);

TCloudTransferManager = class
  private
  public
    procedure ForEachJob(AVisitor: TTransferJobVisitor);
  end;

用法脚本CloudExplorerUI.pas

TCloudTransferManager.Instance.ForEachJob(
            procedure(const Job: TCloudTransferJob)
            begin
              if Job.JobType = tjtUPLOAD then
                TransferGrid.Cells[0,I] := 'UPLOAD'
              else
                TransferGrid.Cells[0,I] := 'DOWNLOAD';
            end);

我已转换为c ++ builder:

CloudPopulator.h

typedef void __fastcall (* TTransferJobVisitor)(const TCloudTransferJob* Job);

class TCloudTransferManager: public System::TObject
{
  private:          
  public:
      void __fastcall ForEachJob(TTransferJobVisitor AVisitor);  
};

如何在c ++ builder

上编写这个部分

我做了类似的事

struct MyAVisitor
{
    TCloudUIForm* form;
    MyAVisitor(TCloudUIForm *_form) : form(_form) {}
    void operator()(const TCloudTransferJob* Job)
    {
        if (Job->JobType == tjtUPLOAD)
            form->TransferGrid->Cells[0][0] = L"UPLOAD";
        else
            form->TransferGrid->Cells[0][0] = L"DOWNLOAD";
    }
};

但仍不确定

typedef TMethodRef<TCloudTransferJob, MyAVisitor, void> MyMethRef;

0 个答案:

没有答案