2
$Id: twriter.inc,v 1.1 2003/10/06 21:01:06 peter Exp $
3
This file is part of the Free Component Library (FCL)
4
Copyright (c) 1999-2000 by Michael Van Canneyt and Florian Klaempfl
6
See the file COPYING.FPC, included in this distribution,
7
for details about the copyright.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
**********************************************************************}
15
(*Procedure TTextWriter.WriteLn(Const Msg : String);
23
Procedure TTextWriter.Write(Const Msg : String);
29
FStream.Write(Pointer(S)^,Length(S));
33
Procedure TTextWriter.WriteFmt(Fmt : String; Args : Array of const);
36
Writeln(Format(Fmt,Args));
39
Procedure TTextWriter.StartObject(Const AClassName, AName : String);
42
WriteFmt('Object %s %s',[AName,AClassName]);
46
Procedure TTextWriter.EndObject;
53
SetLength(FPrefix,L-2);
57
Procedure TTextWriter.StartCollection(Const AName : String);
60
WriteFmt('%s = (',[AName]);
64
Procedure TTextWriter.StartCollectionItem;
69
Procedure TTextWriter.EndCollectionItem;
74
Procedure TTextWriter.EndCollection;
81
SetLength(FPrefix,L-2);
86
Procedure TTextWriter.WritePropName(const PropName: string);
92
Constructor TTextWriter.Create(S : TStream);
100
Destructor TTextWriter.Destroy;
105
Procedure TTextWriter.WriteIntegerProperty(Const Name : Shortstring;Value : Longint);
108
WriteFmt('%s = %d',[Name,Value]);
111
Procedure TTextWriter.WriteSetProperty (Const Name : ShortString;Value : longint; BaseType : TTypeInfo);
114
//!! needs implementing.
115
WriteFmt('%s = []',[Name]);
118
Procedure TTextWriter.WriteEnumerationProperty (Const Name : ShortString;Value : Longint; Const EnumName : ShortSTring);
121
WriteFmt('%s = %s',[Name,EnumName])
124
Procedure TTextWriter.WriteStringProperty(Const Name : ShortString; Const Value : String);
127
TMode = (quoted,unquoted);
135
Procedure Add (A : String);
148
If (ord(C)>31) and (Ord(c)<=128) and (c<>'''') then
165
Add(Format('#%d',[ord(c)]));
176
if mode=quoted then Add('''');
180
Procedure TTextWriter.WriteFloatProperty(Const Name : ShortString; Value : Extended);
183
WriteFmt('%s = %e',[Name,Value])
186
Procedure TTextWriter.WriteCollectionProperty(Const Name : ShortString;Value : TCollection);
192
Procedure TTextWriter.WriteClassProperty(Instance : TPersistent;Propinfo :PPropInfo);
197
Procedure TTextWriter.WriteComponentProperty(Const Name : ShortSTring; Value : TComponent);
200
WriteFmt ('%s = %s',[Name,Value.Name]);
203
Procedure TTextWriter.WriteNilProperty(Const Name : Shortstring);
206
system.Writeln(stderr,'Nil : ',Name);
207
WriteFmt ('%s = Nil',[Name])
210
Procedure TTextWriter.WriteMethodProperty(Const Name,AMethodName : ShortString);
213
WriteFmt ('%s = %s',[Name,AMethodName]);
217
$Log: twriter.inc,v $
218
Revision 1.1 2003/10/06 21:01:06 peter
219
* moved classes unit to rtl
221
Revision 1.3 2002/09/07 15:15:26 peter
222
* old logs removed and tabs fixed