Browse Source

+ Added WriteAnsiString method to TStream

michael 27 years ago
parent
commit
cdabf66ae1
2 changed files with 38 additions and 2 deletions
  1. 7 1
      fcl/inc/classesh.inc
  2. 31 1
      fcl/inc/streams.inc

+ 7 - 1
fcl/inc/classesh.inc

@@ -50,6 +50,7 @@ const
 { TFileStream create mode }
 
   fmCreate = $FFFF;
+  fmOpenRead = fmInput;
 
 { TParser special tokens }
 
@@ -442,9 +443,11 @@ type
     function ReadByte : Byte;
     function ReadWord : Word;
     function ReadDWord : Cardinal;
+    function ReadAnsiString : String;
     procedure WriteByte(b : Byte);
     procedure WriteWord(w : Word);
     procedure WriteDWord(d : Cardinal);
+    Procedure WriteAnsiString (S : String);
     property Position: Longint read GetPosition write SetPosition;
     property Size: Longint read GetSize write SetSize;
   end;
@@ -1043,7 +1046,10 @@ function LineStart(Buffer, BufPos: PChar): PChar;
 
 {
   $Log$
-  Revision 1.2  1998-05-04 14:30:11  michael
+  Revision 1.3  1998-05-06 12:58:35  michael
+  + Added WriteAnsiString method to TStream
+
+  Revision 1.2  1998/05/04 14:30:11  michael
   * Split file according to Class; implemented dummys for all methods, so unit compiles.
 
   Revision 1.1  1998/05/04 12:16:01  florian

+ 31 - 1
fcl/inc/streams.inc

@@ -221,6 +221,33 @@
        ReadDWord:=d;
     end;
 
+  Function TStream.ReadAnsiString : String;
+
+    Type PByte = ^Byte;
+
+    Var TheSize : Longint;
+        P : PByte ;
+  
+
+  begin
+    ReadBuffer (TheSize,SizeOf(TheSize));
+    //!! SetLength(Result,Size);
+    //!! Illegal typecast if no AnsiStrings defined.
+    //!! ReadBuffer (Pointer (Result^),Size);
+    //!! P:=Pointer(Result^)+Size;
+    //!! p^:=0;
+    end;
+
+  Procedure TStream.WriteAnsiString (S : String);
+  
+  Var L : Longint;
+
+  begin
+    L:=Length(S);
+    WriteBuffer (L,SizeOf(L));
+    //!! WriteBuffer (Pointer(S)^,L);
+  end;
+
   procedure TStream.WriteByte(b : Byte);
 
     begin
@@ -464,7 +491,10 @@ end;
 
 {
   $Log$
-  Revision 1.2  1998-05-05 15:25:04  michael
+  Revision 1.3  1998-05-06 12:58:35  michael
+  + Added WriteAnsiString method to TStream
+
+  Revision 1.2  1998/05/05 15:25:04  michael
   + Fix to be able to compile from florian
 
   Revision 1.1  1998/05/04 14:30:12  michael