THRIFT-4862 better ToString() support for enums and container types
Client: Delphi
Patch: Jens Geyer
This closes #1795
diff --git a/lib/delphi/src/Thrift.Protocol.pas b/lib/delphi/src/Thrift.Protocol.pas
index 36509ca..609dfc6 100644
--- a/lib/delphi/src/Thrift.Protocol.pas
+++ b/lib/delphi/src/Thrift.Protocol.pas
@@ -29,6 +29,7 @@
Contnrs,
Thrift.Exception,
Thrift.Stream,
+ Thrift.Utils,
Thrift.Collections,
Thrift.Transport;
@@ -111,12 +112,6 @@
function GetProtocol( const trans: ITransport): IProtocol;
end;
- TThriftStringBuilder = class( TStringBuilder)
- public
- function Append(const Value: TBytes): TStringBuilder; overload;
- function Append(const Value: IThriftContainer): TStringBuilder; overload;
- end;
-
TProtocolException = class( TException)
public
const // TODO(jensg): change into enum
@@ -292,9 +287,8 @@
constructor Create( trans: ITransport );
end;
- IBase = interface
- ['{08D9BAA8-5EAA-410F-B50B-AC2E6E5E4155}']
- function ToString: string;
+ IBase = interface( ISupportsToString)
+ ['{AFF6CECA-5200-4540-950E-9B89E0C1C00C}']
procedure Read( const iprot: IProtocol);
procedure Write( const iprot: IProtocol);
end;
@@ -1034,19 +1028,6 @@
inherited HiddenCreate(Msg);
end;
-{ TThriftStringBuilder }
-
-function TThriftStringBuilder.Append(const Value: TBytes): TStringBuilder;
-begin
- Result := Append( string( RawByteString(Value)) );
-end;
-
-function TThriftStringBuilder.Append(
- const Value: IThriftContainer): TStringBuilder;
-begin
- Result := Append( Value.ToString );
-end;
-
{ TBinaryProtocolImpl.TFactory }
constructor TBinaryProtocolImpl.TFactory.Create(AStrictRead, AStrictWrite: Boolean);