2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
27 TThriftConsole = class
29 procedure Write( const S: string); virtual;
30 procedure WriteLine( const S: string); virtual;
33 TGUIConsole = class( TThriftConsole )
38 procedure InternalWrite( const S: string; bWriteLine: Boolean);
40 procedure Write( const S: string); override;
41 procedure WriteLine( const S: string); override;
42 constructor Create( AMemo: TStrings);
45 function Console: TThriftConsole;
46 procedure ChangeConsole( AConsole: TThriftConsole );
47 procedure RestoreConsoleToDefault;
52 FDefaultConsole : TThriftConsole;
53 FConsole : TThriftConsole;
55 function Console: TThriftConsole;
62 procedure TThriftConsole.Write(const S: string);
67 procedure TThriftConsole.WriteLine(const S: string);
72 procedure ChangeConsole( AConsole: TThriftConsole );
77 procedure RestoreConsoleToDefault;
79 FConsole := FDefaultConsole;
84 constructor TGUIConsole.Create( AMemo: TStrings);
91 procedure TGUIConsole.InternalWrite(const S: string; bWriteLine: Boolean);
100 idx := FMemo.Count - 1;
104 FMemo[idx] := FMemo[idx] + S;
106 FLineBreak := bWriteLine;
109 procedure TGUIConsole.Write(const S: string);
111 InternalWrite( S, False);
114 procedure TGUIConsole.WriteLine(const S: string);
116 InternalWrite( S, True);
121 FDefaultConsole := TThriftConsole.Create;
122 FConsole := FDefaultConsole;
127 FDefaultConsole.Free;