std::string type_name( t_type* ttype, bool b_cls=false, bool b_no_postfix=false, bool b_exception_factory=false, bool b_full_exception_factory = false);
std::string normalize_clsnm(std::string name, std::string prefix, bool b_no_check_keyword = false);
-
+ std::string input_arg_prefix( t_type* ttype);
+
std::string base_type_name(t_base_type* tbase);
std::string declare_field(t_field* tfield, bool init=false, std::string prefix="", bool is_xception_class = false);
- std::string function_signature(t_function* tfunction, std::string full_cls="", bool is_xception = false);
+ std::string function_signature(t_function* tfunction, std::string full_cls="", bool is_xception = false);
std::string argument_list(t_struct* tstruct);
std::string constructor_argument_list(t_struct* tstruct, std::string current_indent);
std::string type_to_enum(t_type* ttype);
if ((! is_exception) || is_x_factory) {
out << endl;
indent(out) << "// IBase" << endl;
- indent(out) << "procedure Read( iprot: IProtocol);" << endl;
- indent(out) << "procedure Write( oprot: IProtocol);" << endl;
+ indent(out) << "procedure Read( const iprot: IProtocol);" << endl;
+ indent(out) << "procedure Write( const oprot: IProtocol);" << endl;
}
if (is_exception && is_x_factory) {
indent_down_impl();
indent_impl(s_service_impl) << "end;" << endl << endl;
- indent(s_service) << "constructor Create( iprot: IProtocol; oprot: IProtocol); overload;" << endl;
+ indent(s_service) << "constructor Create( const iprot: IProtocol; const oprot: IProtocol); overload;" << endl;
- indent_impl(s_service_impl) << "constructor " << normalize_clsnm( service_name_, "T") << ".TClient.Create( iprot: IProtocol; oprot: IProtocol);" << endl;
+ indent_impl(s_service_impl) <<
+ "constructor " << normalize_clsnm( service_name_, "T") <<
+ ".TClient.Create( const iprot: IProtocol; const oprot: IProtocol);" << endl;
indent_impl(s_service_impl) << "begin" << endl;
indent_up_impl();
indent_impl(s_service_impl) << "iprot_ := iprot;" << endl;
indent_up();
indent(s_service) << "type" << endl;
indent_up();
- indent(s_service) << "TProcessFunction = reference to procedure( seqid: Integer; iprot: IProtocol; oprot: IProtocol);" << endl;
+ indent(s_service) << "TProcessFunction = reference to procedure( seqid: Integer; const iprot: IProtocol; const oprot: IProtocol);" << endl;
indent_down();
indent_down();
indent(s_service) << "public" << endl;
indent_up();
if (extends.empty()) {
- indent(s_service) << "function Process( iprot: IProtocol; oprot: IProtocol): Boolean;" << endl;
+ indent(s_service) << "function Process( const iprot: IProtocol; const oprot: IProtocol): Boolean;" << endl;
} else {
- indent(s_service) << "function Process( iprot: IProtocol; oprot: IProtocol): Boolean; reintroduce;" << endl;
+ indent(s_service) << "function Process( const iprot: IProtocol; const oprot: IProtocol): Boolean; reintroduce;" << endl;
}
- indent_impl(s_service_impl) << "function " << full_cls << ".Process( iprot: IProtocol; oprot: IProtocol): Boolean;" << endl;;
+ indent_impl(s_service_impl) << "function " << full_cls << ".Process( const iprot: IProtocol; const oprot: IProtocol): Boolean;" << endl;;
indent_impl(s_service_impl) << "var" << endl;
indent_up_impl();
indent_impl(s_service_impl) << "msg : IMessage;" << endl;
string result_intfnm = normalize_clsnm(org_resultname, "I");
indent(s_service) <<
- "procedure " << funcname << "_Process( seqid: Integer; iprot: IProtocol; oprot: IProtocol);" << endl;
+ "procedure " << funcname << "_Process( seqid: Integer; const iprot: IProtocol; const oprot: IProtocol);" << endl;
if (tfunction->is_oneway()) {
indent_impl(s_service_impl) << "// one way processor" << endl;
}
indent_impl(s_service_impl) <<
- "procedure " << full_cls << "." << funcname << "_Process( seqid: Integer; iprot: IProtocol; oprot: IProtocol);" << endl;
+ "procedure " << full_cls << "." << funcname << "_Process( seqid: Integer; const iprot: IProtocol; const oprot: IProtocol);" << endl;
indent_impl(s_service_impl) << "var" << endl;
indent_up_impl();
indent_impl(s_service_impl) << "args: " << args_intfnm << ";" << endl;
return nm;
}
+// returns "const " for some argument types
+string t_delphi_generator::input_arg_prefix( t_type* ttype) {
+
+ // base types
+ if (ttype->is_base_type()) {
+ switch (((t_base_type*)ttype)->get_base()) {
+
+ // these should be const'ed for optimal performamce
+ case t_base_type::TYPE_STRING: // refcounted pointer
+ case t_base_type::TYPE_I64: // larger than 32 bit
+ case t_base_type::TYPE_DOUBLE: // larger than 32 bit
+ return "const ";
+
+ // all others don't need to be
+ case t_base_type::TYPE_BYTE:
+ case t_base_type::TYPE_I16:
+ case t_base_type::TYPE_I32:
+ case t_base_type::TYPE_BOOL:
+ case t_base_type::TYPE_VOID:
+ return "";
+
+ // we better always report any unknown types
+ default:
+ throw "compiler error: no input_arg_prefix() for base type " + (((t_base_type*)ttype)->get_base());
+ }
+
+ // enums
+ } else if (ttype->is_enum()) {
+ return ""; // usually <= 32 bit
+
+ // containers
+ } else if (ttype->is_map()) {
+ return "const "; // refcounted pointer
+
+ } else if (ttype->is_set()) {
+ return "const "; // refcounted pointer
+
+ } else if (ttype->is_list()) {
+ return "const "; // refcounted pointer
+
+ }
+
+ // any other type, either TSomething or ISomething
+ return "const "; // possibly refcounted pointer
+}
+
string t_delphi_generator::base_type_name(t_base_type* tbase) {
switch (tbase->get_base()) {
case t_base_type::TYPE_VOID:
}
tt = (*f_iter)->get_type();
- result += normalize_name((*f_iter)->get_name()) + ": " + type_name( tt, false, true, tt->is_xception(), true);
+ result += input_arg_prefix(tt); // const?
+ result += normalize_name((*f_iter)->get_name()) + ": " + type_name( tt, false, true, tt->is_xception(), true);
}
return result;
}
}
tt = (*f_iter)->get_type();
+ line += input_arg_prefix(tt); // const?
line += constructor_param_name((*f_iter)->get_name()) + ": " + type_name( tt, false, true, tt->is_xception(), true);
}
cls_nm = type_name(tstruct,true,false,is_exception,is_exception);
- indent_impl(out) << "procedure " << cls_prefix << cls_nm << ".Read( iprot: IProtocol);" << endl;
+ indent_impl(out) << "procedure " << cls_prefix << cls_nm << ".Read( const iprot: IProtocol);" << endl;
indent_impl(out) << "var" << endl;
indent_up_impl();
indent_impl(out) << "field_ : IField;" << endl;
cls_nm = type_name(tstruct,true,false,is_exception,is_exception);
- indent_impl(out) << "procedure " << cls_prefix << cls_nm << ".Write( oprot: IProtocol);" << endl;
+ indent_impl(out) << "procedure " << cls_prefix << cls_nm << ".Write( const oprot: IProtocol);" << endl;
indent_impl(out) << "var" << endl;
indent_up_impl();
indent_impl(out) << "struc : IStruct;" << endl;
cls_nm = type_name(tstruct,true,false,is_exception,is_exception);
- indent_impl(out) << "procedure " << cls_prefix << cls_nm << ".Write( oprot: IProtocol);" << endl;
+ indent_impl(out) << "procedure " << cls_prefix << cls_nm << ".Write( const oprot: IProtocol);" << endl;
indent_impl(out) << "var" << endl;
indent_up_impl();
indent_impl(out) << "struc : IStruct;" << endl;
function GetCount: Integer;\r
property Count: Integer read GetCount;\r
property IsReadOnly: Boolean read GetIsReadOnly;\r
- procedure Add( item: TValue);\r
+ procedure Add( const item: TValue);\r
procedure Clear;\r
- function Contains( item: TValue): Boolean;\r
+ function Contains( const item: TValue): Boolean;\r
procedure CopyTo(var A: TArray<TValue>; arrayIndex: Integer);\r
- function Remove( item: TValue ): Boolean;\r
+ function Remove( const item: TValue ): Boolean;\r
end;\r
\r
THashSetImpl<TValue> = class( TInterfacedObject, IHashSet<TValue>)\r
function GetCount: Integer;\r
property Count: Integer read GetCount;\r
property IsReadOnly: Boolean read FIsReadOnly;\r
- procedure Add( item: TValue);\r
+ procedure Add( const item: TValue);\r
procedure Clear;\r
- function Contains( item: TValue): Boolean;\r
+ function Contains( const item: TValue): Boolean;\r
procedure CopyTo(var A: TArray<TValue>; arrayIndex: Integer);\r
- function Remove( item: TValue ): Boolean;\r
+ function Remove( const item: TValue ): Boolean;\r
public\r
constructor Create;\r
end;\r
\r
{ THashSetImpl<TValue> }\r
\r
-procedure THashSetImpl<TValue>.Add(item: TValue);\r
+procedure THashSetImpl<TValue>.Add( const item: TValue);\r
begin\r
if not FDictionary.ContainsKey(item) then\r
begin\r
FDictionary.Clear;\r
end;\r
\r
-function THashSetImpl<TValue>.Contains(item: TValue): Boolean;\r
+function THashSetImpl<TValue>.Contains( const item: TValue): Boolean;\r
begin\r
Result := FDictionary.ContainsKey(item);\r
end;\r
Result := FIsReadOnly;\r
end;\r
\r
-function THashSetImpl<TValue>.Remove(item: TValue): Boolean;\r
+function THashSetImpl<TValue>.Remove( const item: TValue): Boolean;\r
begin\r
Result := False;\r
if FDictionary.ContainsKey( item ) then\r
end;\r
\r
{$IF CompilerVersion >= 21.0}\r
-function TThriftDictionaryImpl<TKey, TValue>.ExtractPair(\r
- const Key: TKey): TPair<TKey, TValue>;\r
+function TThriftDictionaryImpl<TKey, TValue>.ExtractPair( const Key: TKey): TPair<TKey, TValue>;\r
begin\r
Result := FDictionaly.ExtractPair( Key);\r
end;\r
type
TFactory = class( TInterfacedObject, IProtocolFactory)
public
- function GetProtocol( trans: ITransport): IProtocol;
+ function GetProtocol( const trans: ITransport): IProtocol;
end;
private
// Push/pop a new JSON context onto/from the stack.
procedure ResetContextStack;
- procedure PushContext( aCtx : TJSONBaseContext);
+ procedure PushContext( const aCtx : TJSONBaseContext);
procedure PopContext;
public
// TJSONProtocolImpl Constructor
- constructor Create( aTrans : ITransport);
+ constructor Create( const aTrans : ITransport);
destructor Destroy; override;
protected
// Write the bytes in array buf as a JSON characters, escaping as needed
procedure WriteJSONString( const b : TBytes); overload;
- procedure WriteJSONString( str : string); overload;
+ procedure WriteJSONString( const str : string); overload;
// Write out number as a JSON value. If the context dictates so, it will be
// wrapped in quotes to output as a JSON string.
- procedure WriteJSONInteger( num : Int64);
+ procedure WriteJSONInteger( const num : Int64);
// Write out a double as a JSON value. If it is NaN or infinity or if the
// context dictates escaping, Write out as JSON string.
public
// IProtocol
- procedure WriteMessageBegin( aMsg : IMessage); override;
+ procedure WriteMessageBegin( const aMsg : IMessage); override;
procedure WriteMessageEnd; override;
- procedure WriteStructBegin(struc: IStruct); override;
+ procedure WriteStructBegin( const struc: IStruct); override;
procedure WriteStructEnd; override;
- procedure WriteFieldBegin(field: IField); override;
+ procedure WriteFieldBegin( const field: IField); override;
procedure WriteFieldEnd; override;
procedure WriteFieldStop; override;
- procedure WriteMapBegin(map: IMap); override;
+ procedure WriteMapBegin( const map: IMap); override;
procedure WriteMapEnd; override;
- procedure WriteListBegin( list: IList); override;
+ procedure WriteListBegin( const list: IList); override;
procedure WriteListEnd(); override;
- procedure WriteSetBegin( set_: ISet ); override;
+ procedure WriteSetBegin( const set_: ISet ); override;
procedure WriteSetEnd(); override;
procedure WriteBool( b: Boolean); override;
procedure WriteByte( b: ShortInt); override;
procedure WriteI16( i16: SmallInt); override;
procedure WriteI32( i32: Integer); override;
- procedure WriteI64( i64: Int64); override;
- procedure WriteDouble( d: Double); override;
+ procedure WriteI64( const i64: Int64); override;
+ procedure WriteDouble( const d: Double); override;
procedure WriteString( const s: string ); override;
procedure WriteBinary( const b: TBytes); override;
//
//--- TJSONProtocolImpl ----------------------
-function TJSONProtocolImpl.TFactory.GetProtocol( trans: ITransport): IProtocol;
+function TJSONProtocolImpl.TFactory.GetProtocol( const trans: ITransport): IProtocol;
begin
result := TJSONProtocolImpl.Create(trans);
end;
end;
-constructor TJSONProtocolImpl.Create( aTrans : ITransport);
+constructor TJSONProtocolImpl.Create( const aTrans : ITransport);
begin
inherited Create( aTrans);
end;
-procedure TJSONProtocolImpl.PushContext( aCtx : TJSONBaseContext);
+procedure TJSONProtocolImpl.PushContext( const aCtx : TJSONBaseContext);
begin
FContextStack.Push( FContext);
FContext := aCtx;
end;
-procedure TJSONProtocolImpl.WriteJSONString( str : string);
+procedure TJSONProtocolImpl.WriteJSONString( const str : string);
begin
WriteJSONString( SysUtils.TEncoding.UTF8.GetBytes( str));
end;
end;
-procedure TJSONProtocolImpl.WriteJSONInteger( num : Int64);
+procedure TJSONProtocolImpl.WriteJSONInteger( const num : Int64);
var str : String;
escapeNum : Boolean;
begin
end;
-procedure TJSONProtocolImpl.WriteMessageBegin( aMsg : IMessage);
+procedure TJSONProtocolImpl.WriteMessageBegin( const aMsg : IMessage);
begin
ResetContextStack; // THRIFT-1473
end;
-procedure TJSONProtocolImpl.WriteStructBegin( struc: IStruct);
+procedure TJSONProtocolImpl.WriteStructBegin( const struc: IStruct);
begin
WriteJSONObjectStart;
end;
end;
-procedure TJSONProtocolImpl.WriteFieldBegin( field : IField);
+procedure TJSONProtocolImpl.WriteFieldBegin( const field : IField);
begin
WriteJSONInteger(field.ID);
WriteJSONObjectStart;
// nothing to do
end;
-procedure TJSONProtocolImpl.WriteMapBegin( map: IMap);
+procedure TJSONProtocolImpl.WriteMapBegin( const map: IMap);
begin
WriteJSONArrayStart;
WriteJSONString( GetTypeNameForTypeID( map.KeyType));
end;
-procedure TJSONProtocolImpl.WriteListBegin( list: IList);
+procedure TJSONProtocolImpl.WriteListBegin( const list: IList);
begin
WriteJSONArrayStart;
WriteJSONString( GetTypeNameForTypeID( list.ElementType));
end;
-procedure TJSONProtocolImpl.WriteSetBegin( set_: ISet);
+procedure TJSONProtocolImpl.WriteSetBegin( const set_: ISet);
begin
WriteJSONArrayStart;
WriteJSONString( GetTypeNameForTypeID( set_.ElementType));
WriteJSONInteger( i32);
end;
-procedure TJSONProtocolImpl.WriteI64( i64: Int64);
+procedure TJSONProtocolImpl.WriteI64( const i64: Int64);
begin
WriteJSONInteger(i64);
end;
-procedure TJSONProtocolImpl.WriteDouble( d: Double);
+procedure TJSONProtocolImpl.WriteDouble( const d: Double);
begin
WriteJSONDouble( d);
end;
\r
IProtocolFactory = interface\r
['{7CD64A10-4E9F-4E99-93BF-708A31F4A67B}']\r
- function GetProtocol( trans: ITransport): IProtocol;\r
+ function GetProtocol( const trans: ITransport): IProtocol;\r
end;\r
\r
TThriftStringBuilder = class( TStringBuilder)\r
IProtocol = interface\r
['{FD95C151-1527-4C96-8134-B902BFC4B4FC}']\r
function GetTransport: ITransport;\r
- procedure WriteMessageBegin( message: IMessage);\r
+ procedure WriteMessageBegin( const msg: IMessage);\r
procedure WriteMessageEnd;\r
- procedure WriteStructBegin(struc: IStruct);\r
+ procedure WriteStructBegin( const struc: IStruct);\r
procedure WriteStructEnd;\r
- procedure WriteFieldBegin(field: IField);\r
+ procedure WriteFieldBegin( const field: IField);\r
procedure WriteFieldEnd;\r
procedure WriteFieldStop;\r
- procedure WriteMapBegin(map: IMap);\r
+ procedure WriteMapBegin( const map: IMap);\r
procedure WriteMapEnd;\r
- procedure WriteListBegin( list: IList);\r
+ procedure WriteListBegin( const list: IList);\r
procedure WriteListEnd();\r
- procedure WriteSetBegin( set_: ISet );\r
+ procedure WriteSetBegin( const set_: ISet );\r
procedure WriteSetEnd();\r
procedure WriteBool( b: Boolean);\r
procedure WriteByte( b: ShortInt);\r
procedure WriteI16( i16: SmallInt);\r
procedure WriteI32( i32: Integer);\r
- procedure WriteI64( i64: Int64);\r
- procedure WriteDouble( d: Double);\r
+ procedure WriteI64( const i64: Int64);\r
+ procedure WriteDouble( const d: Double);\r
procedure WriteString( const s: string );\r
procedure WriteAnsiString( const s: AnsiString);\r
procedure WriteBinary( const b: TBytes);\r
FTrans : ITransport;\r
function GetTransport: ITransport;\r
public\r
- procedure WriteMessageBegin( message: IMessage); virtual; abstract;\r
+ procedure WriteMessageBegin( const msg: IMessage); virtual; abstract;\r
procedure WriteMessageEnd; virtual; abstract;\r
- procedure WriteStructBegin(struc: IStruct); virtual; abstract;\r
+ procedure WriteStructBegin( const struc: IStruct); virtual; abstract;\r
procedure WriteStructEnd; virtual; abstract;\r
- procedure WriteFieldBegin(field: IField); virtual; abstract;\r
+ procedure WriteFieldBegin( const field: IField); virtual; abstract;\r
procedure WriteFieldEnd; virtual; abstract;\r
procedure WriteFieldStop; virtual; abstract;\r
- procedure WriteMapBegin(map: IMap); virtual; abstract;\r
+ procedure WriteMapBegin( const map: IMap); virtual; abstract;\r
procedure WriteMapEnd; virtual; abstract;\r
- procedure WriteListBegin( list: IList); virtual; abstract;\r
+ procedure WriteListBegin( const list: IList); virtual; abstract;\r
procedure WriteListEnd(); virtual; abstract;\r
- procedure WriteSetBegin( set_: ISet ); virtual; abstract;\r
+ procedure WriteSetBegin( const set_: ISet ); virtual; abstract;\r
procedure WriteSetEnd(); virtual; abstract;\r
procedure WriteBool( b: Boolean); virtual; abstract;\r
procedure WriteByte( b: ShortInt); virtual; abstract;\r
procedure WriteI16( i16: SmallInt); virtual; abstract;\r
procedure WriteI32( i32: Integer); virtual; abstract;\r
- procedure WriteI64( i64: Int64); virtual; abstract;\r
- procedure WriteDouble( d: Double); virtual; abstract;\r
+ procedure WriteI64( const i64: Int64); virtual; abstract;\r
+ procedure WriteDouble( const d: Double); virtual; abstract;\r
procedure WriteString( const s: string ); virtual;\r
procedure WriteAnsiString( const s: AnsiString); virtual;\r
procedure WriteBinary( const b: TBytes); virtual; abstract;\r
IBase = interface\r
['{08D9BAA8-5EAA-410F-B50B-AC2E6E5E4155}']\r
function ToString: string;\r
- procedure Read( iprot: IProtocol);\r
- procedure Write( iprot: IProtocol);\r
+ procedure Read( const iprot: IProtocol);\r
+ procedure Write( const iprot: IProtocol);\r
end;\r
\r
IStruct = interface\r
FStrictRead : Boolean;\r
FStrictWrite : Boolean;\r
public\r
- function GetProtocol(trans: ITransport): IProtocol;\r
+ function GetProtocol( const trans: ITransport): IProtocol;\r
constructor Create( AStrictRead, AStrictWrite: Boolean ); overload;\r
constructor Create; overload;\r
end;\r
\r
- constructor Create( trans: ITransport); overload;\r
- constructor Create( trans: ITransport; strictRead: Boolean; strictWrite: Boolean); overload;\r
+ constructor Create( const trans: ITransport); overload;\r
+ constructor Create( const trans: ITransport; strictRead: Boolean; strictWrite: Boolean); overload;\r
\r
- procedure WriteMessageBegin( message: IMessage); override;\r
+ procedure WriteMessageBegin( const msg: IMessage); override;\r
procedure WriteMessageEnd; override;\r
- procedure WriteStructBegin(struc: IStruct); override;\r
+ procedure WriteStructBegin( const struc: IStruct); override;\r
procedure WriteStructEnd; override;\r
- procedure WriteFieldBegin(field: IField); override;\r
+ procedure WriteFieldBegin( const field: IField); override;\r
procedure WriteFieldEnd; override;\r
procedure WriteFieldStop; override;\r
- procedure WriteMapBegin(map: IMap); override;\r
+ procedure WriteMapBegin( const map: IMap); override;\r
procedure WriteMapEnd; override;\r
- procedure WriteListBegin( list: IList); override;\r
+ procedure WriteListBegin( const list: IList); override;\r
procedure WriteListEnd(); override;\r
- procedure WriteSetBegin( set_: ISet ); override;\r
+ procedure WriteSetBegin( const set_: ISet ); override;\r
procedure WriteSetEnd(); override;\r
procedure WriteBool( b: Boolean); override;\r
procedure WriteByte( b: ShortInt); override;\r
procedure WriteI16( i16: SmallInt); override;\r
procedure WriteI32( i32: Integer); override;\r
- procedure WriteI64( i64: Int64); override;\r
- procedure WriteDouble( d: Double); override;\r
+ procedure WriteI64( const i64: Int64); override;\r
+ procedure WriteDouble( const d: Double); override;\r
procedure WriteBinary( const b: TBytes); override;\r
\r
function ReadMessageBegin: IMessage; override;\r
\r
implementation\r
\r
-function ConvertInt64ToDouble( n: Int64): Double;\r
+function ConvertInt64ToDouble( const n: Int64): Double;\r
begin\r
ASSERT( SizeOf(n) = SizeOf(Result));\r
System.Move( n, Result, SizeOf(Result));\r
end;\r
\r
-function ConvertDoubleToInt64( d: Double): Int64;\r
+function ConvertDoubleToInt64( const d: Double): Int64;\r
begin\r
ASSERT( SizeOf(d) = SizeOf(Result));\r
System.Move( d, Result, SizeOf(Result));\r
\r
{ TBinaryProtocolImpl }\r
\r
-constructor TBinaryProtocolImpl.Create( trans: ITransport);\r
+constructor TBinaryProtocolImpl.Create( const trans: ITransport);\r
begin\r
Create( trans, False, True);\r
end;\r
end;\r
end;\r
\r
-constructor TBinaryProtocolImpl.Create(trans: ITransport; strictRead,\r
+constructor TBinaryProtocolImpl.Create( const trans: ITransport; strictRead,\r
strictWrite: Boolean);\r
begin\r
inherited Create( trans );\r
FTrans.Write( a, 0, 1 );\r
end;\r
\r
-procedure TBinaryProtocolImpl.WriteDouble(d: Double);\r
+procedure TBinaryProtocolImpl.WriteDouble( const d: Double);\r
begin\r
WriteI64(ConvertDoubleToInt64(d));\r
end;\r
\r
-procedure TBinaryProtocolImpl.WriteFieldBegin(field: IField);\r
+procedure TBinaryProtocolImpl.WriteFieldBegin( const field: IField);\r
begin\r
WriteByte(ShortInt(field.Type_));\r
WriteI16(field.ID);\r
FTrans.Write( i32out, 0, 4);\r
end;\r
\r
-procedure TBinaryProtocolImpl.WriteI64(i64: Int64);\r
+procedure TBinaryProtocolImpl.WriteI64( const i64: Int64);\r
var\r
i64out : TBytes;\r
begin\r
FTrans.Write( i64out, 0, 8);\r
end;\r
\r
-procedure TBinaryProtocolImpl.WriteListBegin(list: IList);\r
+procedure TBinaryProtocolImpl.WriteListBegin( const list: IList);\r
begin\r
WriteByte(ShortInt(list.ElementType));\r
WriteI32(list.Count);\r
\r
end;\r
\r
-procedure TBinaryProtocolImpl.WriteMapBegin(map: IMap);\r
+procedure TBinaryProtocolImpl.WriteMapBegin( const map: IMap);\r
begin\r
WriteByte(ShortInt(map.KeyType));\r
WriteByte(ShortInt(map.ValueType));\r
\r
end;\r
\r
-procedure TBinaryProtocolImpl.WriteMessageBegin( message: IMessage);\r
+procedure TBinaryProtocolImpl.WriteMessageBegin( const msg: IMessage);\r
var\r
version : Cardinal;\r
begin\r
if FStrictWrite then\r
begin\r
- version := VERSION_1 or Cardinal( message.Type_);\r
+ version := VERSION_1 or Cardinal( msg.Type_);\r
WriteI32( Integer( version) );\r
- WriteString( message.Name);\r
- WriteI32(message.SeqID);\r
+ WriteString( msg.Name);\r
+ WriteI32( msg.SeqID);\r
end else\r
begin\r
- WriteString(message.Name);\r
- WriteByte(ShortInt(message.Type_));\r
- WriteI32(message.SeqID);\r
+ WriteString( msg.Name);\r
+ WriteByte(ShortInt( msg.Type_));\r
+ WriteI32( msg.SeqID);\r
end;\r
end;\r
\r
\r
end;\r
\r
-procedure TBinaryProtocolImpl.WriteSetBegin(set_: ISet);\r
+procedure TBinaryProtocolImpl.WriteSetBegin( const set_: ISet);\r
begin\r
WriteByte(ShortInt(set_.ElementType));\r
WriteI32(set_.Count);\r
\r
end;\r
\r
-procedure TBinaryProtocolImpl.WriteStructBegin(struc: IStruct);\r
+procedure TBinaryProtocolImpl.WriteStructBegin( const struc: IStruct);\r
begin\r
\r
end;\r
Create( False, True )\r
end;\r
\r
-function TBinaryProtocolImpl.TFactory.GetProtocol(trans: ITransport): IProtocol;\r
+function TBinaryProtocolImpl.TFactory.GetProtocol( const trans: ITransport): IProtocol;\r
begin\r
Result := TBinaryProtocolImpl.Create( trans );\r
end;\r
TServerImpl = class abstract( TInterfacedObject, IServer )
public
type
- TLogDelegate = reference to procedure( str: string);
+ TLogDelegate = reference to procedure( const str: string);
protected
FProcessor : IProcessor;
FServerTransport : IServerTransport;
FOutputProtocolFactory : IProtocolFactory;
FLogDelegate : TLogDelegate;
- class procedure DefaultLogDelegate( str: string);
+ class procedure DefaultLogDelegate( const str: string);
procedure Serve; virtual; abstract;
procedure Stop; virtual; abstract;
public
constructor Create(
- AProcessor :IProcessor;
- AServerTransport: IServerTransport;
- AInputTransportFactory : ITransportFactory;
- AOutputTransportFactory : ITransportFactory;
- AInputProtocolFactory : IProtocolFactory;
- AOutputProtocolFactory : IProtocolFactory;
- ALogDelegate : TLogDelegate
+ const AProcessor :IProcessor;
+ const AServerTransport: IServerTransport;
+ const AInputTransportFactory : ITransportFactory;
+ const AOutputTransportFactory : ITransportFactory;
+ const AInputProtocolFactory : IProtocolFactory;
+ const AOutputProtocolFactory : IProtocolFactory;
+ const ALogDelegate : TLogDelegate
); overload;
- constructor Create( AProcessor :IProcessor;
- AServerTransport: IServerTransport); overload;
+ constructor Create(
+ const AProcessor :IProcessor;
+ const AServerTransport: IServerTransport
+ ); overload;
constructor Create(
- AProcessor :IProcessor;
- AServerTransport: IServerTransport;
- ALogDelegate: TLogDelegate
+ const AProcessor :IProcessor;
+ const AServerTransport: IServerTransport;
+ const ALogDelegate: TLogDelegate
); overload;
constructor Create(
- AProcessor :IProcessor;
- AServerTransport: IServerTransport;
- ATransportFactory : ITransportFactory
+ const AProcessor :IProcessor;
+ const AServerTransport: IServerTransport;
+ const ATransportFactory : ITransportFactory
); overload;
constructor Create(
- AProcessor :IProcessor;
- AServerTransport: IServerTransport;
- ATransportFactory : ITransportFactory;
- AProtocolFactory : IProtocolFactory
+ const AProcessor :IProcessor;
+ const AServerTransport: IServerTransport;
+ const ATransportFactory : ITransportFactory;
+ const AProtocolFactory : IProtocolFactory
); overload;
end;
private
FStop : Boolean;
public
- constructor Create( AProcessor: IProcessor; AServerTransport: IServerTransport); overload;
- constructor Create( AProcessor: IProcessor; AServerTransport: IServerTransport;
+ constructor Create( const AProcessor: IProcessor; const AServerTransport: IServerTransport); overload;
+ constructor Create( const AProcessor: IProcessor; const AServerTransport: IServerTransport;
ALogDel: TServerImpl.TLogDelegate); overload;
- constructor Create( AProcessor: IProcessor; AServerTransport: IServerTransport;
- ATransportFactory: ITransportFactory); overload;
- constructor Create( AProcessor: IProcessor; AServerTransport: IServerTransport;
- ATransportFactory: ITransportFactory; AProtocolFactory: IProtocolFactory); overload;
+ constructor Create( const AProcessor: IProcessor; const AServerTransport: IServerTransport;
+ const ATransportFactory: ITransportFactory); overload;
+ constructor Create( const AProcessor: IProcessor; const AServerTransport: IServerTransport;
+ const ATransportFactory: ITransportFactory; const AProtocolFactory: IProtocolFactory); overload;
procedure Serve; override;
procedure Stop; override;
{ TServerImpl }
-constructor TServerImpl.Create(AProcessor: IProcessor;
- AServerTransport: IServerTransport; ALogDelegate: TLogDelegate);
+constructor TServerImpl.Create( const AProcessor: IProcessor;
+ const AServerTransport: IServerTransport; const ALogDelegate: TLogDelegate);
var
InputFactory, OutputFactory : IProtocolFactory;
InputTransFactory, OutputTransFactory : ITransportFactory;
);
end;
-constructor TServerImpl.Create(AProcessor: IProcessor;
- AServerTransport: IServerTransport);
+constructor TServerImpl.Create(const AProcessor: IProcessor;
+ const AServerTransport: IServerTransport);
var
InputFactory, OutputFactory : IProtocolFactory;
InputTransFactory, OutputTransFactory : ITransportFactory;
);
end;
-constructor TServerImpl.Create(AProcessor: IProcessor;
- AServerTransport: IServerTransport; ATransportFactory: ITransportFactory);
+constructor TServerImpl.Create(const AProcessor: IProcessor;
+ const AServerTransport: IServerTransport; const ATransportFactory: ITransportFactory);
var
InputProtocolFactory : IProtocolFactory;
OutputProtocolFactory : IProtocolFactory;
InputProtocolFactory, OutputProtocolFactory, DefaultLogDelegate);
end;
-constructor TServerImpl.Create(AProcessor: IProcessor;
- AServerTransport: IServerTransport; AInputTransportFactory,
- AOutputTransportFactory: ITransportFactory; AInputProtocolFactory,
- AOutputProtocolFactory: IProtocolFactory;
- ALogDelegate : TLogDelegate);
+constructor TServerImpl.Create(const AProcessor: IProcessor;
+ const AServerTransport: IServerTransport;
+ const AInputTransportFactory, AOutputTransportFactory: ITransportFactory;
+ const AInputProtocolFactory, AOutputProtocolFactory: IProtocolFactory;
+ const ALogDelegate : TLogDelegate);
begin
FProcessor := AProcessor;
FServerTransport := AServerTransport;
FLogDelegate := ALogDelegate;
end;
-class procedure TServerImpl.DefaultLogDelegate( str: string);
+class procedure TServerImpl.DefaultLogDelegate( const str: string);
begin
Writeln( str );
end;
-constructor TServerImpl.Create(AProcessor: IProcessor;
- AServerTransport: IServerTransport; ATransportFactory: ITransportFactory;
- AProtocolFactory: IProtocolFactory);
+constructor TServerImpl.Create( const AProcessor: IProcessor;
+ const AServerTransport: IServerTransport; const ATransportFactory: ITransportFactory;
+ const AProtocolFactory: IProtocolFactory);
begin
Create( AProcessor, AServerTransport,
ATransportFactory, ATransportFactory,
{ TSimpleServer }
-constructor TSimpleServer.Create(AProcessor: IProcessor;
- AServerTransport: IServerTransport);
+constructor TSimpleServer.Create( const AProcessor: IProcessor;
+ const AServerTransport: IServerTransport);
var
InputProtocolFactory : IProtocolFactory;
OutputProtocolFactory : IProtocolFactory;
OutputTransportFactory, InputProtocolFactory, OutputProtocolFactory, DefaultLogDelegate);
end;
-constructor TSimpleServer.Create(AProcessor: IProcessor;
- AServerTransport: IServerTransport; ALogDel: TServerImpl.TLogDelegate);
+constructor TSimpleServer.Create( const AProcessor: IProcessor;
+ const AServerTransport: IServerTransport; ALogDel: TServerImpl.TLogDelegate);
var
InputProtocolFactory : IProtocolFactory;
OutputProtocolFactory : IProtocolFactory;
OutputTransportFactory, InputProtocolFactory, OutputProtocolFactory, ALogDel);
end;
-constructor TSimpleServer.Create(AProcessor: IProcessor;
- AServerTransport: IServerTransport; ATransportFactory: ITransportFactory);
+constructor TSimpleServer.Create( const AProcessor: IProcessor;
+ const AServerTransport: IServerTransport; const ATransportFactory: ITransportFactory);
begin
inherited Create( AProcessor, AServerTransport, ATransportFactory,
ATransportFactory, TBinaryProtocolImpl.TFactory.Create, TBinaryProtocolImpl.TFactory.Create, DefaultLogDelegate);
end;
-constructor TSimpleServer.Create(AProcessor: IProcessor;
- AServerTransport: IServerTransport; ATransportFactory: ITransportFactory;
- AProtocolFactory: IProtocolFactory);
+constructor TSimpleServer.Create( const AProcessor: IProcessor;
+ const AServerTransport: IServerTransport; const ATransportFactory: ITransportFactory;
+ const AProtocolFactory: IProtocolFactory);
begin
inherited Create( AProcessor, AServerTransport, ATransportFactory,
ATransportFactory, AProtocolFactory, AProtocolFactory, DefaultLogDelegate);
function IsOpen: Boolean; override;\r
function ToArray: TBytes; override;\r
public\r
- constructor Create( AStream: TStream; AOwnsStream : Boolean);\r
+ constructor Create( const AStream: TStream; AOwnsStream : Boolean);\r
destructor Destroy; override;\r
end;\r
\r
function IsOpen: Boolean; override;\r
function ToArray: TBytes; override;\r
public\r
- constructor Create( AStream: IStream);\r
+ constructor Create( const AStream: IStream);\r
end;\r
\r
implementation\r
FStream := nil;\r
end;\r
\r
-constructor TThriftStreamAdapterCOM.Create(AStream: IStream);\r
+constructor TThriftStreamAdapterCOM.Create( const AStream: IStream);\r
begin\r
FStream := AStream;\r
end;\r
FOwnsStream := False;\r
end;\r
\r
-constructor TThriftStreamAdapterDelphi.Create(AStream: TStream; AOwnsStream: Boolean);\r
+constructor TThriftStreamAdapterDelphi.Create( const AStream: TStream; AOwnsStream: Boolean);\r
begin\r
FStream := AStream;\r
FOwnsStream := AOwnsStream;\r
\r
ITransportFactory = interface\r
['{DD809446-000F-49E1-9BFF-E0D0DC76A9D7}']\r
- function GetTransport( ATrans: ITransport): ITransport;\r
+ function GetTransport( const ATrans: ITransport): ITransport;\r
end;\r
\r
TTransportFactoryImpl = class( TInterfacedObject, ITransportFactory)\r
- function GetTransport( ATrans: ITransport): ITransport; virtual;\r
+ function GetTransport( const ATrans: ITransport): ITransport; virtual;\r
end;\r
\r
TTcpSocketStreamImpl = class( TThriftStreamImpl )\r
function IsOpen: Boolean; override;\r
function ToArray: TBytes; override;\r
public\r
- constructor Create( ATcpClient: TCustomIpClient);\r
+ constructor Create( const ATcpClient: TCustomIpClient);\r
end;\r
\r
IStreamTransport = interface( ITransport )\r
procedure Flush; override;\r
function Read(var buf: TBytes; off: Integer; len: Integer): Integer; override;\r
procedure Write( const buf: TBytes; off: Integer; len: Integer); override;\r
- constructor Create( AInputStream : IThriftStream; AOutputStream : IThriftStream);\r
+ constructor Create( const AInputStream : IThriftStream; const AOutputStream : IThriftStream);\r
destructor Destroy; override;\r
end;\r
\r
function IsOpen: Boolean; override;\r
function ToArray: TBytes; override;\r
public\r
- constructor Create( AStream: IThriftStream; ABufSize: Integer);\r
+ constructor Create( const AStream: IThriftStream; ABufSize: Integer);\r
destructor Destroy; override;\r
end;\r
\r
protected\r
function AcceptImpl: ITransport; override;\r
public\r
- constructor Create( AServer: TTcpServer ); overload;\r
- constructor Create( AServer: TTcpServer; AClientTimeout: Integer); overload;\r
+ constructor Create( const AServer: TTcpServer ); overload;\r
+ constructor Create( const AServer: TTcpServer; AClientTimeout: Integer); overload;\r
constructor Create( APort: Integer); overload;\r
constructor Create( APort: Integer; AClientTimeout: Integer); overload;\r
constructor Create( APort: Integer; AClientTimeout: Integer;\r
procedure Close(); override;\r
function Read(var buf: TBytes; off: Integer; len: Integer): Integer; override;\r
procedure Write( const buf: TBytes; off: Integer; len: Integer); override;\r
- constructor Create( ATransport : IStreamTransport ); overload;\r
- constructor Create( ATransport : IStreamTransport; ABufSize: Integer); overload;\r
+ constructor Create( const ATransport : IStreamTransport ); overload;\r
+ constructor Create( const ATransport : IStreamTransport; ABufSize: Integer); overload;\r
property UnderlyingTransport: ITransport read GetUnderlyingTransport;\r
property IsOpen: Boolean read GetIsOpen;\r
end;\r
function GetIsOpen: Boolean; override;\r
public\r
procedure Open; override;\r
- constructor Create( AClient : TCustomIpClient); overload;\r
+ constructor Create( const AClient : TCustomIpClient); overload;\r
constructor Create( const AHost: string; APort: Integer); overload;\r
constructor Create( const AHost: string; APort: Integer; ATimeout: Integer); overload;\r
destructor Destroy; override;\r
type\r
TFactory = class( TTransportFactoryImpl )\r
public\r
- function GetTransport( ATrans: ITransport): ITransport; override;\r
+ function GetTransport( const ATrans: ITransport): ITransport; override;\r
end;\r
\r
{$IF CompilerVersion >= 21.0}\r
class constructor Create;\r
{$IFEND}\r
constructor Create; overload;\r
- constructor Create( ATrans: ITransport); overload;\r
+ constructor Create( const ATrans: ITransport); overload;\r
destructor Destroy; override;\r
\r
procedure Open(); override;\r
\r
{ TTransportFactoryImpl }\r
\r
-function TTransportFactoryImpl.GetTransport(ATrans: ITransport): ITransport;\r
+function TTransportFactoryImpl.GetTransport( const ATrans: ITransport): ITransport;\r
begin\r
Result := ATrans;\r
end;\r
\r
{ TServerSocket }\r
\r
-constructor TServerSocketImpl.Create(AServer: TTcpServer; AClientTimeout: Integer);\r
+constructor TServerSocketImpl.Create( const AServer: TTcpServer; AClientTimeout: Integer);\r
begin\r
FServer := AServer;\r
FClientTimeout := AClientTimeout;\r
end;\r
\r
-constructor TServerSocketImpl.Create(AServer: TTcpServer);\r
+constructor TServerSocketImpl.Create( const AServer: TTcpServer);\r
begin\r
Create( AServer, 0 );\r
end;\r
\r
{ TSocket }\r
\r
-constructor TSocketImpl.Create(AClient : TCustomIpClient);\r
+constructor TSocketImpl.Create( const AClient : TCustomIpClient);\r
var\r
stream : IThriftStream;\r
begin\r
FBuffer := nil;\r
end;\r
\r
-constructor TBufferedStreamImpl.Create(AStream: IThriftStream; ABufSize: Integer);\r
+constructor TBufferedStreamImpl.Create( const AStream: IThriftStream; ABufSize: Integer);\r
begin\r
FStream := AStream;\r
FBufSize := ABufSize;\r
end;\r
end;\r
\r
-constructor TStreamTransportImpl.Create( AInputStream : IThriftStream; AOutputStream : IThriftStream);\r
+constructor TStreamTransportImpl.Create( const AInputStream : IThriftStream; const AOutputStream : IThriftStream);\r
begin\r
FInputStream := AInputStream;\r
FOutputStream := AOutputStream;\r
\r
{ TBufferedTransportImpl }\r
\r
-constructor TBufferedTransportImpl.Create(ATransport: IStreamTransport);\r
+constructor TBufferedTransportImpl.Create( const ATransport: IStreamTransport);\r
begin\r
Create( ATransport, 1024 );\r
end;\r
FTransport.Close;\r
end;\r
\r
-constructor TBufferedTransportImpl.Create(ATransport: IStreamTransport;\r
+constructor TBufferedTransportImpl.Create( const ATransport: IStreamTransport;\r
ABufSize: Integer);\r
begin\r
FTransport := ATransport;\r
FTransport.Close;\r
end;\r
\r
-constructor TFramedTransportImpl.Create(ATrans: ITransport);\r
+constructor TFramedTransportImpl.Create( const ATrans: ITransport);\r
begin\r
InitWriteBuffer;\r
FTransport := ATrans;\r
\r
{ TFramedTransport.TFactory }\r
\r
-function TFramedTransportImpl.TFactory.GetTransport(ATrans: ITransport): ITransport;\r
+function TFramedTransportImpl.TFactory.GetTransport( const ATrans: ITransport): ITransport;\r
begin\r
Result := TFramedTransportImpl.Create( ATrans );\r
end;\r
FTcpClient.Close;\r
end;\r
\r
-constructor TTcpSocketStreamImpl.Create(ATcpClient: TCustomIpClient);\r
+constructor TTcpSocketStreamImpl.Create( const ATcpClient: TCustomIpClient);\r
begin\r
FTcpClient := ATcpClient;\r
end;\r
type
IProcessor = interface
['{B1538A07-6CAC-4406-8A4C-AFED07C70A89}']
- function Process( iprot :IProtocol; oprot: IProtocol): Boolean;
+ function Process( const iprot :IProtocol; const oprot: IProtocol): Boolean;
end;
TApplicationException = class( SysUtils.Exception )
constructor Create( AType: TExceptionType); overload;
constructor Create( AType: TExceptionType; const msg: string); overload;
- class function Read( iprot: IProtocol): TApplicationException;
- procedure Write( oprot: IProtocol );
+ class function Read( const iprot: IProtocol): TApplicationException;
+ procedure Write( const oprot: IProtocol );
end;
// base class for IDL-generated exceptions
FType := AType;
end;
-class function TApplicationException.Read(
- iprot: IProtocol): TApplicationException;
+class function TApplicationException.Read( const iprot: IProtocol): TApplicationException;
var
field : IField;
msg : string;
Result := TApplicationException.Create( typ, msg );
end;
-procedure TApplicationException.Write(oprot: IProtocol);
+procedure TApplicationException.Write( const oprot: IProtocol);
var
struc : IStruct;
field : IField;
protected\r
procedure Execute; override;\r
public\r
- constructor Create(ATransport: ITransport; AProtocol : IProtocol; ANumIteration: Integer);\r
+ constructor Create( const ATransport: ITransport; const AProtocol : IProtocol; ANumIteration: Integer);\r
destructor Destroy; override;\r
end;\r
\r
end;\r
\r
\r
-constructor TClientThread.Create(ATransport: ITransport; AProtocol : IProtocol; ANumIteration: Integer);\r
+constructor TClientThread.Create( const ATransport: ITransport; const AProtocol : IProtocol; ANumIteration: Integer);\r
begin\r
inherited Create( True );\r
FNumIteration := ANumIteration;\r
type
ITestHandler = interface( TThriftTest.Iface )
- procedure SetServer( AServer : IServer );
+ procedure SetServer( const AServer : IServer );
end;
TTestHandlerImpl = class( TInterfacedObject, ITestHandler )
FServer : IServer;
protected
procedure testVoid();
- function testString(thing: string): string;
+ function testString(const thing: string): string;
function testByte(thing: ShortInt): ShortInt;
function testI32(thing: Integer): Integer;
- function testI64(thing: Int64): Int64;
- function testDouble(thing: Double): Double;
- function testStruct(thing: IXtruct): IXtruct;
- function testNest(thing: IXtruct2): IXtruct2;
- function testMap(thing: IThriftDictionary<Integer, Integer>): IThriftDictionary<Integer, Integer>;
- function testStringMap(thing: IThriftDictionary<string, string>): IThriftDictionary<string, string>;
- function testSet(thing: IHashSet<Integer>): IHashSet<Integer>;
- function testList(thing: IThriftList<Integer>): IThriftList<Integer>;
+ function testI64(const thing: Int64): Int64;
+ function testDouble(const thing: Double): Double;
+ function testStruct(const thing: IXtruct): IXtruct;
+ function testNest(const thing: IXtruct2): IXtruct2;
+ function testMap(const thing: IThriftDictionary<Integer, Integer>): IThriftDictionary<Integer, Integer>;
+ function testStringMap(const thing: IThriftDictionary<string, string>): IThriftDictionary<string, string>;
+ function testSet(const thing: IHashSet<Integer>): IHashSet<Integer>;
+ function testList(const thing: IThriftList<Integer>): IThriftList<Integer>;
function testEnum(thing: TNumberz): TNumberz;
- function testTypedef(thing: Int64): Int64;
+ function testTypedef(const thing: Int64): Int64;
function testMapMap(hello: Integer): IThriftDictionary<Integer, IThriftDictionary<Integer, Integer>>;
- function testInsanity(argument: IInsanity): IThriftDictionary<Int64, IThriftDictionary<TNumberz, IInsanity>>;
- function testMulti(arg0: ShortInt; arg1: Integer; arg2: Int64; arg3: IThriftDictionary<SmallInt, string>; arg4: TNumberz; arg5: Int64): IXtruct;
- procedure testException(arg: string);
- function testMultiException(arg0: string; arg1: string): IXtruct;
+ function testInsanity(const argument: IInsanity): IThriftDictionary<Int64, IThriftDictionary<TNumberz, IInsanity>>;
+ function testMulti(arg0: ShortInt; arg1: Integer; const arg2: Int64; const arg3: IThriftDictionary<SmallInt, string>; arg4: TNumberz; const arg5: Int64): IXtruct;
+ procedure testException(const arg: string);
+ function testMultiException(const arg0: string; const arg1: string): IXtruct;
procedure testOneway(secondsToSleep: Integer);
procedure testStop;
- procedure SetServer( AServer : IServer );
+ procedure SetServer( const AServer : IServer );
end;
- class procedure Execute( args: array of string);
+ class procedure Execute( const args: array of string);
end;
implementation
{ TTestServer.TTestHandlerImpl }
-procedure TTestServer.TTestHandlerImpl.SetServer(AServer: IServer);
+procedure TTestServer.TTestHandlerImpl.SetServer( const AServer: IServer);
begin
FServer := AServer;
end;
Result := thing;
end;
-function TTestServer.TTestHandlerImpl.testDouble(thing: Double): Double;
+function TTestServer.TTestHandlerImpl.testDouble( const thing: Double): Double;
begin
Console.WriteLine('testDouble("' + FloatToStr( thing ) + '")');
Result := thing;
Result := thing;
end;
-procedure TTestServer.TTestHandlerImpl.testException(arg: string);
+procedure TTestServer.TTestHandlerImpl.testException(const arg: string);
begin
Console.WriteLine('testException(' + arg + ')');
if ( arg = 'Xception') then
Result := thing;
end;
-function TTestServer.TTestHandlerImpl.testI64(thing: Int64): Int64;
+function TTestServer.TTestHandlerImpl.testI64( const thing: Int64): Int64;
begin
Console.WriteLine('testI64("' + IntToStr( thing) + '")');
Result := thing;
end;
function TTestServer.TTestHandlerImpl.testInsanity(
- argument: IInsanity): IThriftDictionary<Int64, IThriftDictionary<TNumberz, IInsanity>>;
+ const argument: IInsanity): IThriftDictionary<Int64, IThriftDictionary<TNumberz, IInsanity>>;
var
hello, goodbye : IXtruct;
crazy : IInsanity;
end;
function TTestServer.TTestHandlerImpl.testList(
- thing: IThriftList<Integer>): IThriftList<Integer>;
+ const thing: IThriftList<Integer>): IThriftList<Integer>;
var
first : Boolean;
elem : Integer;
end;
function TTestServer.TTestHandlerImpl.testMap(
- thing: IThriftDictionary<Integer, Integer>): IThriftDictionary<Integer, Integer>;
+ const thing: IThriftDictionary<Integer, Integer>): IThriftDictionary<Integer, Integer>;
var
first : Boolean;
key : Integer;
end;
function TTestServer.TTestHandlerImpl.testMulti(arg0: ShortInt; arg1: Integer;
- arg2: Int64; arg3: IThriftDictionary<SmallInt, string>; arg4: TNumberz;
- arg5: Int64): IXtruct;
+ const arg2: Int64; const arg3: IThriftDictionary<SmallInt, string>;
+ arg4: TNumberz; const arg5: Int64): IXtruct;
var
hello : IXtruct;
begin
Result := hello;
end;
-function TTestServer.TTestHandlerImpl.testMultiException(arg0,
- arg1: string): IXtruct;
+function TTestServer.TTestHandlerImpl.testMultiException( const arg0, arg1: string): IXtruct;
var
x2 : TXception2;
begin
Result.String_thing := arg1;
end;
-function TTestServer.TTestHandlerImpl.testNest(thing: IXtruct2): IXtruct2;
+function TTestServer.TTestHandlerImpl.testNest( const thing: IXtruct2): IXtruct2;
var
temp : IXtruct;
begin
end;
function TTestServer.TTestHandlerImpl.testSet(
- thing: IHashSet<Integer>):IHashSet<Integer>;
+ const thing: IHashSet<Integer>):IHashSet<Integer>;
var
first : Boolean;
elem : Integer;
end;
end;
-function TTestServer.TTestHandlerImpl.testString(thing: string): string;
+function TTestServer.TTestHandlerImpl.testString( const thing: string): string;
begin
Console.WriteLine('teststring("' + thing + '")');
Result := thing;
end;
function TTestServer.TTestHandlerImpl.testStringMap(
- thing: IThriftDictionary<string, string>): IThriftDictionary<string, string>;
+ const thing: IThriftDictionary<string, string>): IThriftDictionary<string, string>;
begin
end;
-function TTestServer.TTestHandlerImpl.testTypedef(thing: Int64): Int64;
+function TTestServer.TTestHandlerImpl.testTypedef( const thing: Int64): Int64;
begin
Console.WriteLine('testTypedef(' + IntToStr( thing) + ')');
Result := thing;
Console.WriteLine('testVoid()');
end;
-function TTestServer.TTestHandlerImpl.testStruct(thing: IXtruct): IXtruct;
+function TTestServer.TTestHandlerImpl.testStruct( const thing: IXtruct): IXtruct;
begin
Console.WriteLine('testStruct({' +
'"' + thing.String_thing + '", ' +
{ TTestServer }
-class procedure TTestServer.Execute(args: array of string);
+class procedure TTestServer.Execute( const args: array of string);
var
UseBufferedSockets : Boolean;
UseFramed : Boolean;