Special RTL/VCL-functions

Top  Previous  Next

What is translated > Special RTL/VCL-functions

 

Some functions of the Delphi RTL/VCL either don't exist in the C++Builder counterpart or have become to member functions of the String classes. The conversion of calls of the latter kind of functions into calls of the according member functions is done automatically by Delphi2Cpp. For Delphi I/O routines there is a ready translated C++ file. In addition the calls of some compile time functions and some other special functions is done automatically. See the following examples:

 

var

 i, j : Integer;

 p1 : Pointer;

 s1, s2 : String;

 iset : set Of int;

 obj : TObject;

 e :TEnum;

                                                     / std::string

begin 

 Assigned( obj );         ->  ( obj != NULL );                  

 Copy(s1, i, j);          ->  s1.SubString( i, j );  / s1.substr( i - 1, j );          

 Dec(i);                  ->  i--;                            

 Dec(i, j);               ->  i -= j;                         

 Dec(e1);                 ->  e1--;                                

 Delete(s1, i, j);        ->  s1.Delete( i, j );     / s1.erase( i - 1, j );          

 Dispose(p1);             ->  delete p1;                      

 Exclude(iset, i);        ->  iset >> i;                      

 FreeAndNil(p1);          ->  delete p1; p1 = NULL;           

 High(TEnum);             ->  /*# High(TEnum) */ 2;           

 High(strarray);          ->  strarray.High;                  

 High(type);              ->  High<type>(); // defined in d2c_system.pas                 

 Inc(i);                  ->  i++;                            

 Inc(i, j);               ->  i += j;                         

 Inc(e1);                 ->  e1++;                                

 Include(iset, i);        ->  iset << i;                      

 Insert(s1, s2, i);       ->  s2.Insert( s1, i );    / s2.insert( i - 1, s1 );            

 Length(s1);              ->  s1.Length( );          / s1.length( );         

 Length(strarray);        ->  strarray.Length;                

 Low(TEnum);              ->  /*# Low(TEnum) */ 0;            

 Low(strarray);           ->  strarray.Low;                   

 Low(type);               ->  Low<type>();  // defined in d2c_system.pas                 

 New(obj);                ->  obj = new obj;                  

 PAnsiChar(s1);           ->  s1.c_str();                     

 Pos(s1, s2);             ->  s2.Pos( s1 );          / no longer from 1.4.9 on: s2.find( s1 ); (at least 1 should be added)         

 SetLength(s1, i);        ->  s1.SetLength( i );     / s1.resize( i );

 Str(d:8:2, S);           ->  Str( d, 8, 2, S );        

                          

 RegisterComponents(s1, [a,b,c]);  -> 

    

  TComponentClass classes[ 4 ] = { __classid( a ), __classid( b ), __classid( c ) };

  RegisterComponents( s1 , classes,  3 );

 

 

 

You can switch off the special treatment of this functions..

 

see also: RegisterComponents



This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content