From a60139801c4a5581143333939b074879b78242ea Mon Sep 17 00:00:00 2001 From: vincents Date: Tue, 30 Sep 2008 14:54:55 +0000 Subject: [PATCH] LCL: added unicode streaming, fixes compilation with fpc 2.3.1, from Anton Kavalenka (issue #12258) git-svn-id: trunk@16814 - --- lcl/lresources.pp | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/lcl/lresources.pp b/lcl/lresources.pp index 3ed88df208..8cba4ef6cc 100644 --- a/lcl/lresources.pp +++ b/lcl/lresources.pp @@ -148,6 +148,9 @@ type function ReadStr: String; override; function ReadString(StringType: TValueType): String; override; function ReadWideString: WideString; override; + {$ifndef VER2_2} + function ReadUnicodeString: UnicodeString; override; + {$endif} procedure SkipComponent(SkipComponentInfos: Boolean); override; procedure SkipValue; override; public @@ -210,7 +213,10 @@ type procedure WriteSet(Value: LongInt; SetType: Pointer); override; procedure WriteString(const Value: String); override; procedure WriteWideString(const Value: WideString); override; - + {$ifndef VER2_2} + procedure WriteUnicodeString(const Value: UnicodeString); override; + {$endif} + property InstanceStack: TStringList read FInstanceStack write FInstanceStack;// list of TPersistent end; TLRSObjectWriterClass = class of TLRSObjectWriter; @@ -3840,6 +3846,19 @@ begin //debugln('TLRSObjectReader.ReadWideString ',Result); end; +{$ifndef VER2_2} +function TLRSObjectReader.ReadUnicodeString: UnicodeString; +var + i: Integer; +begin + i:=ReadIntegerContent; + SetLength(Result, i); + if i > 0 then + Read(Pointer(@Result[1])^, i*2); + //debugln('TLRSObjectReader.ReadWideString ',Result); +end; +{$endif} + procedure TLRSObjectReader.SkipComponent(SkipComponentInfos: Boolean); var Flags: TFilerFlags; @@ -4367,6 +4386,17 @@ begin WriteWideStringContent(Value); end; +{$ifndef VER2_2} +procedure TLRSObjectWriter.WriteUnicodeString(const Value: UnicodeString); +var + i: Integer; +begin + WriteValue(vaUString); + i := Length(Value); + WriteIntegerContent(i); + WriteWideStringContent(Value); +end; +{$endif} { TLRPositionLinks }