Notes on the relocation of existing Delphi project to Tiburon

Source: Internet
Author: User

With the Embarcadero August 25 release of RAD Studio 2009 (Tiburon's RTM date may be postponed to September-October), with Tiburon full support for Unicode, the existing Delphi /C + + Builder project to migrate to Unicode what should be paid attention to also become the most concerned about the issue. Tiburon support for Unicode is not just a direct conversion of the String type that maps the original type to ansistring, but a modification of the ansistring structure, with the addition of a unicodestring type to perfect support Unicode. This means that in order to migrate smoothly to Unicode, programmers have to make some changes to existing code.

In previous versions of Tiburon, Ansistring and widestring were functionally identical except for data size. The structure of the previous version of the ansistring is as follows:

Format of Ansistring Data Type

Reference Count Length String Data (Byte sized) Null Term
-8 -4 0 Length

This structure has changed in Tiburon, Ansistring has added two new fields, one is CodePage and the other is Elemsize, which allows the new version of Ansistring and unicodestring to be structurally aligned.

The widestring type is used in earlier versions to hold Double-byte data. Its essence is the same as that of Windows BSTR. In Tiburon, Widestring is still compatible with COM, which means that it still has no reference count, compared to unicodestring, which will be the preferred character type for programs other than COM in terms of performance and efficiency.

UnicodeString type of Flash debut

In Tiburon, the new, default string is the UnicodeString. This type can contain either ANSI characters or Unicode characters. The following is the structure of the unicodestring type:

Format of UnicodeString Data Type

CodePage Element Size Reference Count Length String Data (element sized) Null Term
-12 -10 -8 -4 0 Length * ElementSize

UnicodeString and ansistring are all the above structures, although unicodestring contains double-byte data, Ansistring contains Single-byte.

Using the Object Pascal language to describe the structure of the unicodestring, it should be this:

type
StrRec = record
  CodePage: Word;
  ElemSize: Word;
  refCount: Integer;
  Len: Integer;
  case Integer of
   1: array[0..0] of AnsiChar;
   2: array[0..0] of WideChar;
end;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.