rtl: raise EContructException in TCharacter constructor (compatible to delphi behavior)

git-svn-id: trunk@19189 -
This commit is contained in:
paul 2011-09-23 02:50:40 +00:00
parent 8af1fa3e57
commit 98f6ec4a05
3 changed files with 10 additions and 0 deletions

View File

@ -52,6 +52,8 @@ type
TCharacter = class sealed
public
constructor Create;
class function ConvertFromUtf32(AChar : UCS4Char) : UnicodeString; static;
class function ConvertToUtf32(const AString : UnicodeString; AIndex : Integer) : UCS4Char; overload; static;
class function ConvertToUtf32(const AString : UnicodeString; AIndex : Integer; out ACharLength : Integer) : UCS4Char; overload; static;
@ -184,6 +186,11 @@ end;
{ TCharacter }
constructor TCharacter.Create;
begin
raise ENoConstructException.CreateFmt(SClassCantBeConstructed, [ClassName]);
end;
class function TCharacter.ConvertFromUtf32(AChar : UCS4Char) : UnicodeString; static;
begin
if AChar < UCS4_HALF_BASE then

View File

@ -294,6 +294,7 @@ ResourceString
SLowSurrogateOutOfRange = 'Low surrogate $%x out of range [$DC00 - $DFFF]';
SInvalidUTF32Char = 'Invalid UTF32 character $%x. Valid UTF32 character must be in range [$0 - $10FFFF] except surrogate range [$D800-$DFFF]';
SInvalidHighSurrogate = 'Invalid high surrogate at index %d. High surrogate must be followed by a low surrogate pair';
SClassCantBeConstructed = 'Class %s can not be constructed';
{ ---------------------------------------------------------------------
Keysim Names

View File

@ -202,6 +202,8 @@ type
EArgumentException = class(Exception);
EArgumentOutOfRangeException = class(EArgumentException);
ENoConstructException = class(Exception);
{ Exception handling routines }
function ExceptObject: TObject;
function ExceptAddr: Pointer;