String types

Top  Previous  Next

User interface > Translation options > Types > String types

 

On the Types page of the options dialog you can chose how the string types AnsiString, WideString and String are translated.

 

Options_StringType

 

 

If Delphi string is selected, the three types of strings keep their names, but if you select Standard string following replacements are carried out:

 

AnsiString -> std::string 

WideString -> std::wstring

String -> String  // the user has to define: typedef std::string String; or  typedef std::wstring String;

 

AnsiChar -> char

WideChar -> wchar_t

Char -> Char // the user has to define: typedef char Char; or  typedef wchar_t Char;

 

 

Also the treatment of string parameters will be changed. E.g.

 

procedure foo1 (const s : string);

procedure foo2 (s : string);

procedure foo3 (var s : string);

 

will be translated for Delphi strings to::

 

void __fastcall foo1( const String s );

void __fastcall foo2( String s );

void __fastcall foo3( String& s );

 

For standard strings the translation is:

 

void __fastcall foo1( const String& s );

void __fastcall foo2( String s );

void __fastcall foo3( String& s );

 

If the C-like option is enabled, Strings are passed as pointers. For standard strings:

 

extern "C" void __fastcall foo1( const String* s );

extern "C" void __fastcall foo2( const String* s );

extern "C" void __fastcall foo3( String* s );

 

 

The ""String" as option determines the type, which is associated with the word String. E.g.

 

var

S: String:

begin

S := 'hallo';

 

is translated for an Ansi association to:

 

String S;

S = "hallo";

 

and for the Wide association to

 

String S;

S = L"hallo";

 

The Unicode association is treated like the Wide association till now.

 

 

 



This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content