DEADSOFTWARE

correctly freeing dynrecords; as a consequence, no more memory leaks in custom game...
[d2df-sdl.git] / src / shared / xparser.pas
index 3f1d1db5b462a6ed9fc69fa7ff8284029e2270b6..76ac3c0165483ef90d4066904540d1eef5b7a2dd 100644 (file)
@@ -182,6 +182,20 @@ type
     procedure flush (); override;
   end;
 
+  TStrTextWriter = class(TTextWriter)
+  private
+    mStr: AnsiString;
+
+  protected
+    procedure putBuf (constref buf; len: SizeUInt); override;
+
+  public
+    constructor Create ();
+    destructor Destroy (); override;
+
+    property str: AnsiString read mStr;
+  end;
+
 
 implementation
 
@@ -732,4 +746,32 @@ begin
 end;
 
 
+// ////////////////////////////////////////////////////////////////////////// //
+constructor TStrTextWriter.Create ();
+begin
+  mStr := '';
+end;
+
+
+destructor TStrTextWriter.Destroy ();
+begin
+  mStr := '';
+  inherited;
+end;
+
+
+procedure TStrTextWriter.putBuf (constref buf; len: SizeUInt);
+var
+  st: AnsiString = '';
+begin
+  if (len > 0) then
+  begin
+    SetLength(st, Integer(len));
+    Move(buf, PChar(st)^, Integer(len));
+    mStr += st;
+    st := '';
+  end;
+end;
+
+
 end.