examples: fixed pascalstream with FPC 3.0+

git-svn-id: trunk@54891 -
This commit is contained in:
mattias 2017-05-12 22:54:44 +00:00
parent 510e6e4c49
commit d3ff637f6e
3 changed files with 15 additions and 9 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/> <Version Value="10"/>
<General> <General>
<Flags> <Flags>
<MainUnitHasCreateFormStatements Value="False"/> <MainUnitHasCreateFormStatements Value="False"/>
@ -14,7 +14,6 @@
<VersionInfo> <VersionInfo>
<Language Value=""/> <Language Value=""/>
<CharSet Value=""/> <CharSet Value=""/>
<StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
@ -43,7 +42,6 @@
<Unit0> <Unit0>
<Filename Value="PascalStream1.lpr"/> <Filename Value="PascalStream1.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="PascalStream1"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="componentstreampas.pas"/> <Filename Value="componentstreampas.pas"/>
@ -66,9 +64,6 @@
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions> </CompilerOptions>
<Debugging> <Debugging>
<Exceptions Count="3"> <Exceptions Count="3">

View File

@ -92,6 +92,9 @@ type
procedure WriteBoolean(Value: Boolean); override; procedure WriteBoolean(Value: Boolean); override;
// procedure WriteChar(Value: Char); // procedure WriteChar(Value: Char);
procedure WriteFloat(const Value: Extended); override; procedure WriteFloat(const Value: Extended); override;
{$IF FPC_FULLVERSION >= 30000}
procedure WriteSignature; override;
{$ENDIF}
procedure WriteSingle(const Value: Single); override; procedure WriteSingle(const Value: Single); override;
procedure WriteCurrency(const Value: Currency); override; procedure WriteCurrency(const Value: Currency); override;
procedure WriteDate(const Value: TDateTime); override; procedure WriteDate(const Value: TDateTime); override;
@ -236,6 +239,7 @@ var
i: Integer; i: Integer;
InString: Boolean; InString: Boolean;
begin begin
Result:='';
InString:=false; InString:=false;
for i:=1 to length(s) do begin for i:=1 to length(s) do begin
case s[i] of case s[i] of
@ -363,6 +367,13 @@ begin
WritePropertyAssignment(FloatToStr(Value)); WritePropertyAssignment(FloatToStr(Value));
end; end;
{$IF FPC_FULLVERSION >= 30000}
procedure TPASObjectWriter.WriteSignature;
begin
end;
{$ENDIF}
procedure TPASObjectWriter.WriteSingle(const Value: Single); procedure TPASObjectWriter.WriteSingle(const Value: Single);
begin begin
WritePropertyAssignment(FloatToStr(Value)); WritePropertyAssignment(FloatToStr(Value));
@ -430,7 +441,7 @@ end;
procedure TPASObjectWriter.WriteUnicodeString(const Value: UnicodeString); procedure TPASObjectWriter.WriteUnicodeString(const Value: UnicodeString);
// save unicodestrings as utf8 // save unicodestrings as utf8
begin begin
WritePropertyAssignment(StringToConstant(Value)); WritePropertyAssignment(StringToConstant(String(Value)));
end; end;
procedure TPASObjectWriter.WriteVariant(const VarValue: Variant); procedure TPASObjectWriter.WriteVariant(const VarValue: Variant);

View File

@ -99,7 +99,7 @@ type
procedure WriteComponents; procedure WriteComponents;
procedure ReadComponents; procedure ReadComponents;
procedure OnFindComponentClass(Reader: TReader; const AClassName: string; procedure OnFindComponentClass({%H-}Reader: TReader; const AClassName: string;
var ComponentClass: TComponentClass); var ComponentClass: TComponentClass);
property Filename: string read FFilename write SetFilename; property Filename: string read FFilename write SetFilename;
end; end;