-
Notifications
You must be signed in to change notification settings - Fork 3
/
furqFiler.pas
58 lines (49 loc) · 892 Bytes
/
furqFiler.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
unit furqFiler;
{ $Id: furqFiler.pas,v 1.1 2017/06/28 18:42:16 Àíòîí Exp $ }
interface
uses
d2dUtils;
type
TFURQFiler = class(Td2dFiler)
public
function ReadVarValue: Variant;
procedure WriteVarValue(aValue: Variant);
end;
implementation
uses
Variants;
const
cStrValue = 1;
cNumValue = 2;
function TFURQFiler.ReadVarValue: Variant;
var
l_Type: Byte;
begin
f_Stream.ReadBuffer(l_Type, 1);
case l_Type of
cStrValue: Result := ReadString;
cNumValue: Result := ReadDouble;
end;
end;
procedure TFURQFiler.WriteVarValue(aValue: Variant);
var
l_Type: Byte;
l_Str: string;
l_Num: Double;
begin
if VarType(aValue) = varString then
begin
l_Type := cStrValue;
f_Stream.WriteBuffer(l_Type, 1);
l_Str := aValue;
WriteString(l_Str);
end
else
begin
l_Type := cNumValue;
f_Stream.WriteBuffer(l_Type, 1);
l_Num := aValue;
WriteDouble(l_Num);
end;
end;
end.