t2t-soft

Since Delphi 7 the abilities of records have been expanded to more class-like structures with properties, methods and nested types. Example:


type
   TMyRecord = record
     type
       TInnerColorType = Integer;
     var
       Red: Integer;
     class var
       Blue: Integer;
     procedure printRed();
     constructor Create(val: Integer);
     property RedProperty: TInnerColorType read Red write Red;
     class property BlueProp: TInnerColorType read Blue write Blue;
 end;

implementation

 constructor TMyRecord.Create(val: Integer);
 begin
   Red := val;
 end;

 procedure TMyRecord.printRed;
 begin
   Writeln('Red: ', Red);
 end;

Delphi2Cpp 2.x converts these new features for C++Builder to:


struct TMyRecord
{
  typedef int TInnerColorType;
  int Red;
  static int Blue;
  void __fastcall printRed();
  __fastcall TMyRecord(int val);
  __property TInnerColorType RedProperty = { read = Red, write = Red };
  /*static */__property TInnerColorType BlueProp = { read = Blue, write = Blue };

TMyRecord() {}
};


---------------


int TMyRecord::Blue = 0;

__fastcall TMyRecord::TMyRecord(int val)
: Red(val)
{
}

void __fastcall TMyRecord::printRed()
{
  { Write(L"Red: "); WriteLn(Red); };
}

And for other compilers it becomes:


struct TMyRecord
{
  typedef int TInnerColorType;
  int Red;
  static int Blue;
  void printRed();
  TMyRecord(int val);
  /*property RedProperty : TInnerColorType read Red write Red;*/
  TInnerColorType ReadPropertyRedProperty() { return Red;}
  void WritePropertyRedProperty(int Value){Red = Value;}
  /*property BlueProp : TInnerColorType read Blue write Blue;*/
  static TInnerColorType ReadPropertyBlueProp() { return Blue;}
  static void WritePropertyBlueProp(int Value){Blue = Value;}
  void InitMembers(){Red = 0;}

TMyRecord() {InitMembers();}
};

---------------------


int TMyRecord::Blue = 0;

TMyRecord::TMyRecord(int val)
: Red(val)
{
}

void TMyRecord::printRed()
{
{ Write(L"Red: "); WriteLn(Red); };
}




   deutsch Deutsch


 
Latest News
05/18/26
Delphi2Cpp 2.7: Translation heuristics [more...]

11/18/25
Delphi2Cpp 2.6: Delphi Interfaces [more...]



"We have successfully completed the projects, and the applications are (for the most part) already running at our customers' sites."





"Thanks for your great work, really appreciate the work you have done on zlib and compiling ... test case."


Mattewada, Udayabhaskar
Nokia India 02/01/2021




[from case study...]

"A masterpiece -- Delphi2Cpp has exceeded all my expectations by far."


Tony Hürlimann
virtual-optima 08/20/2011



"First off, I have to say WOW! Delphi2Cpp is doing a *fantastic* job!"


Daniel Flower
linkrealms 01/15/2011



"Though we have not finished the conversion yet, I'm glad that we've found you and could transform Eurocap to C++ with the help of Delphi2CB and you. (And I'm also glad that we could help you to make Delphi2CB better😉)"


Gáspár Huba


 
This website is generated from plain text with [Minimal Website]

Minimal Website
 
Minimal Website is made with TextTransformer

TextTransformer
 
TextTransformer is made with Borland C++Builder

  Borland