diff --git a/wst/trunk/metadata_repository.pas b/wst/trunk/metadata_repository.pas index 859f1f976..be795bce8 100644 --- a/wst/trunk/metadata_repository.pas +++ b/wst/trunk/metadata_repository.pas @@ -102,7 +102,7 @@ type procedure ClearRepositoryData(var ARepository : PServiceRepository); implementation -uses LResources, binary_streamer; +uses wst_resources_imp, binary_streamer; procedure ClearProperties(var AProps : PPropertyData); var @@ -462,15 +462,19 @@ end; { TModuleMetadataMngr } procedure TModuleMetadataMngr.LoadRegisteredNames(); + var - i, c : Integer; - itm : TLResource; + i : Integer; + L : TStrings; + begin - c := LazarusResources.Count; - for i := 0 to Pred(c) do begin - itm := LazarusResources.Items[i]; - if AnsiSameText(sWST_META,itm.ValueType) then - RegisterRepository(itm.Name); + L:=TStringList.Create; + Try + GetWSTResourceManager.GetResourceList(L); + For I:=0 to L.Count-1 do + RegisterRepository(L[i]); + finally + L.Free; end; end; @@ -498,17 +502,16 @@ var tmpStrm : TMemoryStream; strBuffer : string; i : Integer; - rs : TLResource; tmpRes : PServiceRepository; + begin - rs := LazarusResources.Find(ARepName); - if not Assigned(rs) then + If not GetWSTResourceManager.HasResource(ARepName) then raise EMetadataException.CreateFmt('Repository not registered : "%s"',[ARepName]); Result := FindInnerListIndex(ARepName); if ( Result < 0 ) then begin tmpStrm := TMemoryStream.Create(); try - strBuffer := LazarusResources.Find(ARepName).Value; + strBuffer := GetWSTResourceManager.ResourceAsString(ARepName); i := Length(strBuffer); tmpStrm.Write(strBuffer[1],i); tmpStrm.Position := 0; diff --git a/wst/trunk/metadata_service.lrs b/wst/trunk/metadata_service.lrs deleted file mode 100644 index c4484ab57..000000000 --- a/wst/trunk/metadata_service.lrs +++ /dev/null @@ -1,7 +0,0 @@ -LazarusResources.Add('METADATA_SERVICE','wst_meta',[ - #0#0#0#20'WST_METADATA_0.2.2.0'#0#0#0#16'metadata_service'#1#0#0#0#19'IWSTMet' - +'adataService'#2#0#0#0#17'GetRepositoryList'#1#0#0#0#6'result'#0#0#0#23'TArr' - +'ayOfStringRemotable'#0#0#0#0#0#0#0#3#0#0#0#17'GetRepositoryInfo'#2#0#0#0#5 - +'AName'#0#0#0#6'string'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0#17'TWSTMtdRepo' - +'sitory'#0#0#0#0#0#0#0#3 -]); diff --git a/wst/trunk/metadata_service.wst b/wst/trunk/metadata_service.wst new file mode 100644 index 000000000..d8202b979 --- /dev/null +++ b/wst/trunk/metadata_service.wst @@ -0,0 +1,7 @@ + GetWSTResourceManager().AddResource('METADATA_SERVICE', + #0#0#0#20'WST_METADATA_0.2.2.0'#0#0#0#16'metadata_service'#1#0#0#0#19'IWSTMe' + +'tadataService'#2#0#0#0#17'GetRepositoryList'#1#0#0#0#6'result'#0#0#0#23'TAr' + +'rayOfStringRemotable'#0#0#0#0#0#0#0#3#0#0#0#17'GetRepositoryInfo'#2#0#0#0#5 + +'AName'#0#0#0#6'string'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0#17'TWSTMtdRepo' + +'sitory'#0#0#0#0#0#0#0#3'' + ); \ No newline at end of file diff --git a/wst/trunk/metadata_service_binder.pas b/wst/trunk/metadata_service_binder.pas index 4a87ffe5b..1c15ed0db 100644 --- a/wst/trunk/metadata_service_binder.pas +++ b/wst/trunk/metadata_service_binder.pas @@ -2,7 +2,7 @@ This unit has been produced by ws_helper. Input unit name : "metadata_service". This unit name : "metadata_service_binder". - Date : "31/07/2006 23:18". + Date : "12/11/2006 11:12". } unit metadata_service_binder; {$mode objfpc}{$H+} @@ -29,7 +29,7 @@ type procedure Server_service_RegisterWSTMetadataServiceService(); Implementation -uses TypInfo, LResources,metadata_repository; +uses TypInfo, wst_resources_imp,metadata_repository; { TWSTMetadataService_ServiceBinder implementation } procedure TWSTMetadataService_ServiceBinder.GetRepositoryListHandler(AFormatter:IFormatterResponse); @@ -124,6 +124,6 @@ initialization Register_metadata_service_NameSpace(); {$ENDIF} - {$i metadata_service.lrs} + {$i metadata_service.wst} End. diff --git a/wst/trunk/metadata_service_proxy.pas b/wst/trunk/metadata_service_proxy.pas index 0b045b660..f2b2d29f3 100644 --- a/wst/trunk/metadata_service_proxy.pas +++ b/wst/trunk/metadata_service_proxy.pas @@ -2,7 +2,7 @@ This unit has been produced by ws_helper. Input unit name : "metadata_service". This unit name : "metadata_service_proxy". - Date : "31/07/2006 23:11". + Date : "12/11/2006 11:12". } Unit metadata_service_proxy; {$mode objfpc}{$H+} @@ -23,7 +23,7 @@ Type End; Implementation -uses LResources, metadata_repository; +uses wst_resources_imp, metadata_repository; { TWSTMetadataService_Proxy implementation } @@ -82,7 +82,7 @@ End; initialization - {$i metadata_service.lrs} + {$i metadata_service.wst} {$IF DECLARED(Register_metadata_service_ServiceMetadata)} Register_metadata_service_ServiceMetadata(); diff --git a/wst/trunk/tests/apache_module/mod_wst.lpi b/wst/trunk/tests/apache_module/mod_wst.lpi index 47889313c..bd9f8c858 100644 --- a/wst/trunk/tests/apache_module/mod_wst.lpi +++ b/wst/trunk/tests/apache_module/mod_wst.lpi @@ -7,7 +7,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -122,8 +122,8 @@ - - + + @@ -149,7 +149,7 @@ - + @@ -158,9 +158,9 @@ - - - + + + @@ -201,130 +201,39 @@ - - + + + + + + + + + + + - + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/wst/trunk/tests/calculator/client/calc_client.lpi b/wst/trunk/tests/calculator/client/calc_client.lpi index c6708f850..6e1720966 100644 --- a/wst/trunk/tests/calculator/client/calc_client.lpi +++ b/wst/trunk/tests/calculator/client/calc_client.lpi @@ -12,7 +12,6 @@ - @@ -26,21 +25,14 @@ - - - - - - + - - + - @@ -48,9 +40,7 @@ - - @@ -111,9 +101,7 @@ - - @@ -186,47 +174,32 @@ - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + - + - + - + diff --git a/wst/trunk/tests/calculator/client/calculator.lrs b/wst/trunk/tests/calculator/client/calculator.lrs deleted file mode 100644 index 7fc82fd05..000000000 --- a/wst/trunk/tests/calculator/client/calculator.lrs +++ /dev/null @@ -1,13 +0,0 @@ -LazarusResources.Add('CALCULATOR','wst_meta',[ - #0#0#0#20'WST_METADATA_0.2.2.0'#0#0#0#10'calculator'#1#0#0#0#11'ICalculator'#4 - +#0#0#0#6'AddInt'#3#0#0#0#1'A'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#1'B'#0#0 - +#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0#17'TBinaryArgsResult'#0#0 - +#0#0#0#0#0#3#0#0#0#6'DivInt'#3#0#0#0#1'A'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0 - +#0#0#1'B'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0#7'Integer'#0 - +#0#0#0#0#0#0#3#0#0#0#15'DoAllOperations'#3#0#0#0#1'A'#0#0#0#7'Integer'#0#0#0 - +#0#0#0#0#1#0#0#0#1'B'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0 - +#22'TBinaryArgsResultArray'#0#0#0#0#0#0#0#3#0#0#0#11'DoOperation'#4#0#0#0#1 - +'A'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#1'B'#0#0#0#7'Integer'#0#0#0#0#0#0 - +#0#1#0#0#0#10'AOperation'#0#0#0#8'TCalc_Op'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0 - +#0#0#17'TBinaryArgsResult'#0#0#0#0#0#0#0#3 -]); diff --git a/wst/trunk/tests/calculator/client/calculator.wst b/wst/trunk/tests/calculator/client/calculator.wst new file mode 100644 index 000000000..8d987fa93 --- /dev/null +++ b/wst/trunk/tests/calculator/client/calculator.wst @@ -0,0 +1,13 @@ + GetWSTResourceManager().AddResource('CALCULATOR', + #0#0#0#20'WST_METADATA_0.2.2.0'#0#0#0#10'calculator'#1#0#0#0#11'ICalculator'#4 + +#0#0#0#6'AddInt'#3#0#0#0#1'A'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#1'B'#0#0 + +#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0#17'TBinaryArgsResult'#0#0 + +#0#0#0#0#0#3#0#0#0#6'DivInt'#3#0#0#0#1'A'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0 + +#0#0#1'B'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0#7'Integer'#0 + +#0#0#0#0#0#0#3#0#0#0#15'DoAllOperations'#3#0#0#0#1'A'#0#0#0#7'Integer'#0#0#0 + +#0#0#0#0#1#0#0#0#1'B'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0 + +#22'TBinaryArgsResultArray'#0#0#0#0#0#0#0#3#0#0#0#11'DoOperation'#4#0#0#0#1'A' + +#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#1'B'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1 + +#0#0#0#10'AOperation'#0#0#0#8'TCalc_Op'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0 + +#17'TBinaryArgsResult'#0#0#0#0#0#0#0#3'' + ); \ No newline at end of file diff --git a/wst/trunk/tests/calculator/client/calculator_proxy.pas b/wst/trunk/tests/calculator/client/calculator_proxy.pas index 7668378b8..f9aa10959 100644 --- a/wst/trunk/tests/calculator/client/calculator_proxy.pas +++ b/wst/trunk/tests/calculator/client/calculator_proxy.pas @@ -2,7 +2,7 @@ This unit has been produced by ws_helper. Input unit name : "calculator". This unit name : "calculator_proxy". - Date : "30/07/2006 01:54". + Date : "12/11/2006 11:21". } Unit calculator_proxy; {$mode objfpc}{$H+} @@ -36,7 +36,7 @@ Type End; Implementation -uses LResources, metadata_repository; +uses wst_resources_imp, metadata_repository; { TCalculator_Proxy implementation } @@ -156,7 +156,7 @@ End; initialization - {$i calculator.lrs} + {$i calculator.wst} {$IF DECLARED(Register_calculator_ServiceMetadata)} Register_calculator_ServiceMetadata(); diff --git a/wst/trunk/tests/calculator/gui_client/calculator.lrs b/wst/trunk/tests/calculator/gui_client/calculator.lrs deleted file mode 100644 index 7fc82fd05..000000000 --- a/wst/trunk/tests/calculator/gui_client/calculator.lrs +++ /dev/null @@ -1,13 +0,0 @@ -LazarusResources.Add('CALCULATOR','wst_meta',[ - #0#0#0#20'WST_METADATA_0.2.2.0'#0#0#0#10'calculator'#1#0#0#0#11'ICalculator'#4 - +#0#0#0#6'AddInt'#3#0#0#0#1'A'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#1'B'#0#0 - +#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0#17'TBinaryArgsResult'#0#0 - +#0#0#0#0#0#3#0#0#0#6'DivInt'#3#0#0#0#1'A'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0 - +#0#0#1'B'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0#7'Integer'#0 - +#0#0#0#0#0#0#3#0#0#0#15'DoAllOperations'#3#0#0#0#1'A'#0#0#0#7'Integer'#0#0#0 - +#0#0#0#0#1#0#0#0#1'B'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0 - +#22'TBinaryArgsResultArray'#0#0#0#0#0#0#0#3#0#0#0#11'DoOperation'#4#0#0#0#1 - +'A'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#1'B'#0#0#0#7'Integer'#0#0#0#0#0#0 - +#0#1#0#0#0#10'AOperation'#0#0#0#8'TCalc_Op'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0 - +#0#0#17'TBinaryArgsResult'#0#0#0#0#0#0#0#3 -]); diff --git a/wst/trunk/tests/calculator/gui_client/calculator.wst b/wst/trunk/tests/calculator/gui_client/calculator.wst new file mode 100644 index 000000000..8d987fa93 --- /dev/null +++ b/wst/trunk/tests/calculator/gui_client/calculator.wst @@ -0,0 +1,13 @@ + GetWSTResourceManager().AddResource('CALCULATOR', + #0#0#0#20'WST_METADATA_0.2.2.0'#0#0#0#10'calculator'#1#0#0#0#11'ICalculator'#4 + +#0#0#0#6'AddInt'#3#0#0#0#1'A'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#1'B'#0#0 + +#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0#17'TBinaryArgsResult'#0#0 + +#0#0#0#0#0#3#0#0#0#6'DivInt'#3#0#0#0#1'A'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0 + +#0#0#1'B'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0#7'Integer'#0 + +#0#0#0#0#0#0#3#0#0#0#15'DoAllOperations'#3#0#0#0#1'A'#0#0#0#7'Integer'#0#0#0 + +#0#0#0#0#1#0#0#0#1'B'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0 + +#22'TBinaryArgsResultArray'#0#0#0#0#0#0#0#3#0#0#0#11'DoOperation'#4#0#0#0#1'A' + +#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#1'B'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1 + +#0#0#0#10'AOperation'#0#0#0#8'TCalc_Op'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0 + +#17'TBinaryArgsResult'#0#0#0#0#0#0#0#3'' + ); \ No newline at end of file diff --git a/wst/trunk/tests/calculator/gui_client/calculator_proxy.pas b/wst/trunk/tests/calculator/gui_client/calculator_proxy.pas index 7668378b8..c6c76f55a 100644 --- a/wst/trunk/tests/calculator/gui_client/calculator_proxy.pas +++ b/wst/trunk/tests/calculator/gui_client/calculator_proxy.pas @@ -2,7 +2,7 @@ This unit has been produced by ws_helper. Input unit name : "calculator". This unit name : "calculator_proxy". - Date : "30/07/2006 01:54". + Date : "12/11/2006 11:22". } Unit calculator_proxy; {$mode objfpc}{$H+} @@ -36,7 +36,7 @@ Type End; Implementation -uses LResources, metadata_repository; +uses wst_resources_imp, metadata_repository; { TCalculator_Proxy implementation } @@ -156,7 +156,7 @@ End; initialization - {$i calculator.lrs} + {$i calculator.wst} {$IF DECLARED(Register_calculator_ServiceMetadata)} Register_calculator_ServiceMetadata(); diff --git a/wst/trunk/tests/calculator/gui_client/test_calc.lpi b/wst/trunk/tests/calculator/gui_client/test_calc.lpi index efb496135..c4a075345 100644 --- a/wst/trunk/tests/calculator/gui_client/test_calc.lpi +++ b/wst/trunk/tests/calculator/gui_client/test_calc.lpi @@ -7,7 +7,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -41,9 +41,11 @@ - - + + + + @@ -57,9 +59,11 @@ - - + + + + @@ -298,12 +302,30 @@ - - + + + + + + + - + + + + + + + + + + + + + + diff --git a/wst/trunk/tests/calculator/srv/calculator.lrs b/wst/trunk/tests/calculator/srv/calculator.lrs deleted file mode 100644 index 7fc82fd05..000000000 --- a/wst/trunk/tests/calculator/srv/calculator.lrs +++ /dev/null @@ -1,13 +0,0 @@ -LazarusResources.Add('CALCULATOR','wst_meta',[ - #0#0#0#20'WST_METADATA_0.2.2.0'#0#0#0#10'calculator'#1#0#0#0#11'ICalculator'#4 - +#0#0#0#6'AddInt'#3#0#0#0#1'A'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#1'B'#0#0 - +#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0#17'TBinaryArgsResult'#0#0 - +#0#0#0#0#0#3#0#0#0#6'DivInt'#3#0#0#0#1'A'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0 - +#0#0#1'B'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0#7'Integer'#0 - +#0#0#0#0#0#0#3#0#0#0#15'DoAllOperations'#3#0#0#0#1'A'#0#0#0#7'Integer'#0#0#0 - +#0#0#0#0#1#0#0#0#1'B'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0 - +#22'TBinaryArgsResultArray'#0#0#0#0#0#0#0#3#0#0#0#11'DoOperation'#4#0#0#0#1 - +'A'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#1'B'#0#0#0#7'Integer'#0#0#0#0#0#0 - +#0#1#0#0#0#10'AOperation'#0#0#0#8'TCalc_Op'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0 - +#0#0#17'TBinaryArgsResult'#0#0#0#0#0#0#0#3 -]); diff --git a/wst/trunk/tests/calculator/srv/calculator.wst b/wst/trunk/tests/calculator/srv/calculator.wst new file mode 100644 index 000000000..8d987fa93 --- /dev/null +++ b/wst/trunk/tests/calculator/srv/calculator.wst @@ -0,0 +1,13 @@ + GetWSTResourceManager().AddResource('CALCULATOR', + #0#0#0#20'WST_METADATA_0.2.2.0'#0#0#0#10'calculator'#1#0#0#0#11'ICalculator'#4 + +#0#0#0#6'AddInt'#3#0#0#0#1'A'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#1'B'#0#0 + +#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0#17'TBinaryArgsResult'#0#0 + +#0#0#0#0#0#3#0#0#0#6'DivInt'#3#0#0#0#1'A'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0 + +#0#0#1'B'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0#7'Integer'#0 + +#0#0#0#0#0#0#3#0#0#0#15'DoAllOperations'#3#0#0#0#1'A'#0#0#0#7'Integer'#0#0#0 + +#0#0#0#0#1#0#0#0#1'B'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0 + +#22'TBinaryArgsResultArray'#0#0#0#0#0#0#0#3#0#0#0#11'DoOperation'#4#0#0#0#1'A' + +#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#1'B'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1 + +#0#0#0#10'AOperation'#0#0#0#8'TCalc_Op'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0#0 + +#17'TBinaryArgsResult'#0#0#0#0#0#0#0#3'' + ); \ No newline at end of file diff --git a/wst/trunk/tests/calculator/srv/calculator_binder.pas b/wst/trunk/tests/calculator/srv/calculator_binder.pas index 62119c5cc..8ccc064fe 100644 --- a/wst/trunk/tests/calculator/srv/calculator_binder.pas +++ b/wst/trunk/tests/calculator/srv/calculator_binder.pas @@ -2,7 +2,7 @@ This unit has been produced by ws_helper. Input unit name : "calculator". This unit name : "calculator_binder". - Date : "30/07/2006 01:52". + Date : "12/11/2006 11:22". } unit calculator_binder; {$mode objfpc}{$H+} @@ -31,7 +31,7 @@ type procedure Server_service_RegisterCalculatorService(); Implementation -uses TypInfo, LResources,metadata_repository; +uses TypInfo, wst_resources_imp,metadata_repository; { TCalculator_ServiceBinder implementation } procedure TCalculator_ServiceBinder.AddIntHandler(AFormatter:IFormatterResponse); @@ -202,6 +202,6 @@ initialization Register_calculator_NameSpace(); {$ENDIF} - {$i calculator.lrs} + {$i calculator.wst} End. diff --git a/wst/trunk/tests/ebay/ebay.lrs b/wst/trunk/tests/ebay/ebay.lrs deleted file mode 100644 index 94084df70..000000000 --- a/wst/trunk/tests/ebay/ebay.lrs +++ /dev/null @@ -1,9 +0,0 @@ -LazarusResources.Add('EBAY','wst_meta',[ - #0#0#0#20'WST_METADATA_0.2.2.0'#0#0#0#4'ebay'#1#0#0#0#24'IeBayAPIInterfaceSer' - +'vice'#2#0#0#0#13'GetCategories'#2#0#0#0#20'GetCategoriesRequest'#0#0#0#25'T' - +'GetCategoriesRequestType'#0#0#0#0#0#0#0#1#0#0#0#21'GetCategoriesResponse'#0 - +#0#0#26'TGetCategoriesResponseType'#0#0#0#0#0#0#0#3#0#0#0#18'GetPopularKeywo' - +'rds'#2#0#0#0#25'GetPopularKeywordsRequest'#0#0#0#30'TGetPopularKeywordsRequ' - +'estType'#0#0#0#0#0#0#0#1#0#0#0#26'GetPopularKeywordsResponse'#0#0#0#31'TGet' - +'PopularKeywordsResponseType'#0#0#0#0#0#0#0#3 -]); diff --git a/wst/trunk/tests/ebay/ebay.pas b/wst/trunk/tests/ebay/ebay.pas index b435b966f..8dc59c9e4 100644 --- a/wst/trunk/tests/ebay/ebay.pas +++ b/wst/trunk/tests/ebay/ebay.pas @@ -8,7 +8,7 @@ uses Classes, SysUtils, base_service_intf; const - sAPP_ID = ''; + sAPP_ID = 'INOUSSAOUEU258CIC9Z5E83UXC1BE5';//''; sEBAY_VERSION = '467'; type diff --git a/wst/trunk/tests/ebay/ebay.wst b/wst/trunk/tests/ebay/ebay.wst new file mode 100644 index 000000000..bf79a1447 --- /dev/null +++ b/wst/trunk/tests/ebay/ebay.wst @@ -0,0 +1,9 @@ + GetWSTResourceManager().AddResource('EBAY', + #0#0#0#20'WST_METADATA_0.2.2.0'#0#0#0#4'ebay'#1#0#0#0#24'IeBayAPIInterfaceSe' + +'rvice'#2#0#0#0#13'GetCategories'#2#0#0#0#20'GetCategoriesRequest'#0#0#0#25'T' + +'GetCategoriesRequestType'#0#0#0#0#0#0#0#1#0#0#0#21'GetCategoriesResponse'#0 + +#0#0#26'TGetCategoriesResponseType'#0#0#0#0#0#0#0#3#0#0#0#18'GetPopularKeywo' + +'rds'#2#0#0#0#25'GetPopularKeywordsRequest'#0#0#0#30'TGetPopularKeywordsRequ' + +'estType'#0#0#0#0#0#0#0#1#0#0#0#26'GetPopularKeywordsResponse'#0#0#0#31'TGet' + +'PopularKeywordsResponseType'#0#0#0#0#0#0#0#3'' + ); \ No newline at end of file diff --git a/wst/trunk/tests/ebay/ebay_proxy.pas b/wst/trunk/tests/ebay/ebay_proxy.pas index 3eecc244b..af77049ba 100644 --- a/wst/trunk/tests/ebay/ebay_proxy.pas +++ b/wst/trunk/tests/ebay/ebay_proxy.pas @@ -2,7 +2,7 @@ This unit has been produced by ws_helper. Input unit name : "ebay". This unit name : "ebay_proxy". - Date : "30/07/2006 21:52". + Date : "12/11/2006 11:44". } Unit ebay_proxy; {$mode objfpc}{$H+} @@ -27,7 +27,7 @@ Type End; Implementation -uses LResources, metadata_repository; +uses wst_resources_imp, metadata_repository; { TeBayAPIInterfaceService_Proxy implementation } @@ -90,7 +90,7 @@ End; initialization - {$i ebay.lrs} + {$i ebay.wst} {$IF DECLARED(Register_ebay_ServiceMetadata)} Register_ebay_ServiceMetadata(); diff --git a/wst/trunk/tests/ebay/test_ebay.lpi b/wst/trunk/tests/ebay/test_ebay.lpi index 998f0e244..97e1757e3 100644 --- a/wst/trunk/tests/ebay/test_ebay.lpi +++ b/wst/trunk/tests/ebay/test_ebay.lpi @@ -21,29 +21,26 @@ - - - - - - + - + - + - - - + + + + + @@ -51,8 +48,8 @@ - - + + @@ -60,10 +57,8 @@ - - - - + + @@ -71,7 +66,7 @@ - + @@ -79,7 +74,7 @@ - + @@ -88,10 +83,10 @@ - - + + - + @@ -140,11 +135,9 @@ - - - - - + + + @@ -191,132 +184,38 @@ - - - - + + + + + + - + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/wst/trunk/tests/ebay/test_ebay.lpr b/wst/trunk/tests/ebay/test_ebay.lpr index c4cd639bc..c2108e3fd 100644 --- a/wst/trunk/tests/ebay/test_ebay.lpr +++ b/wst/trunk/tests/ebay/test_ebay.lpr @@ -26,37 +26,11 @@ begin rsp := nil; locHdr := TCustomSecurityHeaderType.Create(); try - locHdr.eBayAuthToken := { - 'AgAAAA**AQAAAA**aAAAAA**OeGvRA**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wJnY+lAZOE'+ - 'pgqdj6x9nY+seQ**uoUAAA**AAMAAA**z5djiOw1a7Tk12KGGPqSpvnxxNYOVUtaSbmQ7hYd4p'+ - 'X4XfafLKBtImKsW9SUsbmBS9fXOyBnXA3k0jLelpiMptvlZ8N52UQA/ePc6+JE7LJFrARMoBaW5l'+ - 'HEQOMESJLAdFJiGmLwrnagdeo6WRI89guRtDkydPyHwHUJ7aCFQvwzeD/b+1pnXelHQvQBRFtD3drU'+ - 'BV9FbAf1/d4w/C+x5EHrBHyA+/T9uBelb3wkI8Rk/jnwF+L1qZlSW90pcyi3uxoSuBGVolgihrL/IKE'+ - '2mPcK3GAtqROu6Tsasjzz/tqkSIuFLeJ9HphAzdB+LNhyR1NGbe+l+goY74saRbEb2iqYo5wCTTLELC2k3'+ - '9p0V1Fp7CWn3Fet+y6fz8PXMb1BfYKg6fLzHXaqCRaffHJCSkvhrWwIVEuxbot4o5T8/v'+ - 'TcmmAm3T78S4B6NBdLPv7f4WxbzYYRS8Y8k7Y9GZ1/8Jomfv+LlGNrs0/sN+PkCJATAJZ3W'+ - 'tIWqyg9GHnHVA+oKCdmItd2j6nEiNq7whNdJegMOWp3jI2BvJoauJc06lw6ZMHhuj4zDiDnEwP'+ - 'DCBmY6sHWMUx1xacahKYrRsvKYvE9/eOlEaQP7OCDmJm6VVwJIkSejOnmnMmUxLGMu6to17jruAj'+ - 'Wb4s0oXSKPg9J/M2rvgE0l0tWj3O6kt9jPH533K5Wj2I/i6s0blc9z9eY/WY4+HDHe+VFX9AqMmHuD'+ - 'yog//CUNDaG5HUSw10GM26gvswNpYWGih5Ju5ylvf9B';} - - 'AgAAAA**AQAAAA**aAAAAA**5Ca0RA**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wJnY+lAZSFpg'+ - 'Wdj6x9nY+seQ**uoUAAA**AAMAAA**CVYGMzI5zQ2Wh9dcHROrT0o6/BWlHNSzb+sPVl+W7UK8o0'+ - 'zpmispZNrnzXjlqd5m5nZjWfXzEGFTZVw7B+2k14tcQyiCQQn0nD6ft5KUWsxZ4Ugx/EgilEFNhT7l'+ - 'iQXBxblWq1K3CJJtyCRu1Q/eyW0c4cttutktG3c5wFGR20QUm8pFBaXVNEB11jAyzz2dB+Ij3efuSTZR'+ - 'umGNaVHeNXkLXTfaVuOzREjU5zye4bh1cHtw72pS+oTbmKB+Svflhtq7asqnfrsllRENP6fEpCzJSVqbMW'+ - 'Om+rulRa0qKOOpEGk2Mme8HDdccwtqHIq1MwT9WbcF2pV6aGKpllU4H+ii7SYwDTr8mwb45t7l26loyszoZo'+ - 'NelhXq3TS85KwmDqwgZzVlHoY+4yZVe8FRvOY7rYbtCJtZnwv7fx8+tdoogeE2eW5hNkXPvuS+Wh9yj+T1yexp'+ - '5szSfOVmn1Obik6Cz/qOxF+AIHpdO1N8qC6D/x85nlkxUbvVWBHkAVYsAxbQ1uZzpRIednc8wKLZ47cTUGPinP1B'+ - 'hgC9+l14Isquhsx5gx9t3vc79lzfRPMOaQ5k42vZaUFYTpQ2tYn7kQ9y850NPBdNVmUxLi5hCActWCHFplNrYVnnnm'+ - 'WOcuZT+DTUmh2OHiL59Av33CPhGNCGktEX0/I3FNTbM2OHCqet/eSRXNHM4JuuLhP2p7IyDfbowkXpwDZtanew64itUr'+ - 'iSInDbHpO9xlVK32t/+na6yNuCGqFEEtnl5gJ2OI1P'; + locHdr.eBayAuthToken := '...'; - //locHdr.Credentials.Username := 'inousa12'; - //locHdr.Credentials.Password := 'atou121076'; - locHdr.Credentials.AppId := 'INOUSSAOUEU258CIC9Z5E83UXC1BE5'; - locHdr.Credentials.DevId := 'L11ZDC63VDJ1FPLJL5EA161OQ2MS95'; - locHdr.Credentials.AuthCert := 'A266GKZC9F5$HI2HIH58A-D3JH2YA4';//'L11ZDC63VDJ1FPLJL5EA161OQ2MS95;INOUSSAOUEU258CIC9Z5E83UXC1BE5;A266GKZC9F5$HI2HIH58A-D3JH2YA4'; + locHdr.Credentials.AppId := '...'; + locHdr.Credentials.DevId := '...'; + locHdr.Credentials.AuthCert := '...'; locService := TeBayAPIInterfaceService_Proxy.Create( 'eBayAPIInterfaceService', 'SOAP:Style=Document;EncodingStyle=Litteral', diff --git a/wst/trunk/tests/ebay/test_ebay_gui.lpi b/wst/trunk/tests/ebay/test_ebay_gui.lpi index 20d61c3c6..9c48ff8e3 100644 --- a/wst/trunk/tests/ebay/test_ebay_gui.lpi +++ b/wst/trunk/tests/ebay/test_ebay_gui.lpi @@ -7,7 +7,7 @@ - + @@ -52,7 +52,7 @@ - + @@ -109,8 +109,8 @@ - - + + @@ -137,7 +137,7 @@ - + @@ -206,28 +206,7 @@ - - - - - - - - - - - - - - - - - - - - - - + @@ -248,7 +227,6 @@ - diff --git a/wst/trunk/tests/google_api/googlewebapi.lrs b/wst/trunk/tests/google_api/googlewebapi.lrs deleted file mode 100644 index 8e71e5f75..000000000 --- a/wst/trunk/tests/google_api/googlewebapi.lrs +++ /dev/null @@ -1,13 +0,0 @@ -LazarusResources.Add('GOOGLEWEBAPI','wst_meta',[ - #0#0#0#20'WST_METADATA_0.2.2.0'#0#0#0#12'googlewebapi'#1#0#0#0#13'IGoogleSear' - +'ch'#2#0#0#0#20'doSpellingSuggestion'#3#0#0#0#3'key'#0#0#0#6'string'#0#0#0#0 - +#0#0#0#1#0#0#0#6'phrase'#0#0#0#6'string'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0 - +#0#6'string'#0#0#0#0#0#0#0#3#0#0#0#14'doGoogleSearch'#11#0#0#0#3'key'#0#0#0#6 - +'string'#0#0#0#0#0#0#0#1#0#0#0#1'q'#0#0#0#6'string'#0#0#0#0#0#0#0#1#0#0#0#5 - +'start'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#10'maxResults'#0#0#0#7'Intege' - +'r'#0#0#0#0#0#0#0#1#0#0#0#6'filter'#0#0#0#7'Boolean'#0#0#0#0#0#0#0#1#0#0#0#8 - +'restrict'#0#0#0#6'string'#0#0#0#0#0#0#0#1#0#0#0#10'safeSearch'#0#0#0#7'Bool' - +'ean'#0#0#0#0#0#0#0#1#0#0#0#2'lr'#0#0#0#6'string'#0#0#0#0#0#0#0#1#0#0#0#2'ie' - +#0#0#0#6'string'#0#0#0#0#0#0#0#1#0#0#0#2'oe'#0#0#0#6'string'#0#0#0#0#0#0#0#1 - +#0#0#0#6'result'#0#0#0#19'TGoogleSearchResult'#0#0#0#0#0#0#0#3 -]); diff --git a/wst/trunk/tests/google_api/googlewebapi.meta b/wst/trunk/tests/google_api/googlewebapi.meta deleted file mode 100644 index 6d462d4e2..000000000 Binary files a/wst/trunk/tests/google_api/googlewebapi.meta and /dev/null differ diff --git a/wst/trunk/tests/google_api/googlewebapi.wst b/wst/trunk/tests/google_api/googlewebapi.wst new file mode 100644 index 000000000..1f85c9c84 --- /dev/null +++ b/wst/trunk/tests/google_api/googlewebapi.wst @@ -0,0 +1,13 @@ + GetWSTResourceManager().AddResource('GOOGLEWEBAPI', + #0#0#0#20'WST_METADATA_0.2.2.0'#0#0#0#12'googlewebapi'#1#0#0#0#13'IGoogleSea' + +'rch'#2#0#0#0#20'doSpellingSuggestion'#3#0#0#0#3'key'#0#0#0#6'string'#0#0#0#0 + +#0#0#0#1#0#0#0#6'phrase'#0#0#0#6'string'#0#0#0#0#0#0#0#1#0#0#0#6'result'#0#0 + +#0#6'string'#0#0#0#0#0#0#0#3#0#0#0#14'doGoogleSearch'#11#0#0#0#3'key'#0#0#0#6 + +'string'#0#0#0#0#0#0#0#1#0#0#0#1'q'#0#0#0#6'string'#0#0#0#0#0#0#0#1#0#0#0#5's' + +'tart'#0#0#0#7'Integer'#0#0#0#0#0#0#0#1#0#0#0#10'maxResults'#0#0#0#7'Integer' + +#0#0#0#0#0#0#0#1#0#0#0#6'filter'#0#0#0#7'Boolean'#0#0#0#0#0#0#0#1#0#0#0#8're' + +'strict'#0#0#0#6'string'#0#0#0#0#0#0#0#1#0#0#0#10'safeSearch'#0#0#0#7'Boolea' + +'n'#0#0#0#0#0#0#0#1#0#0#0#2'lr'#0#0#0#6'string'#0#0#0#0#0#0#0#1#0#0#0#2'ie'#0 + +#0#0#6'string'#0#0#0#0#0#0#0#1#0#0#0#2'oe'#0#0#0#6'string'#0#0#0#0#0#0#0#1#0 + +#0#0#6'result'#0#0#0#19'TGoogleSearchResult'#0#0#0#0#0#0#0#3'' + ); \ No newline at end of file diff --git a/wst/trunk/tests/google_api/googlewebapi_binder.pas b/wst/trunk/tests/google_api/googlewebapi_binder.pas index 756daf8c7..bb91a5188 100644 --- a/wst/trunk/tests/google_api/googlewebapi_binder.pas +++ b/wst/trunk/tests/google_api/googlewebapi_binder.pas @@ -2,15 +2,15 @@ This unit has been produced by ws_helper. Input unit name : "googlewebapi". This unit name : "googlewebapi_binder". - Date : "08/06/2006 23:28". + Date : "12/11/2006 00:24". } -Unit googlewebapi_binder; +unit googlewebapi_binder; {$mode objfpc}{$H+} -Interface +interface -Uses SysUtils, Classes, base_service_intf, server_service_intf, googlewebapi; +uses SysUtils, Classes, base_service_intf, server_service_intf, googlewebapi; -Type +type TGoogleSearch_ServiceBinder=class(TBaseServiceBinder) @@ -29,11 +29,12 @@ Type procedure Server_service_RegisterGoogleSearchService(); Implementation -uses TypInfo; +uses TypInfo, wst_resources_imp,metadata_repository; { TGoogleSearch_ServiceBinder implementation } procedure TGoogleSearch_ServiceBinder.doSpellingSuggestionHandler(AFormatter:IFormatterResponse); Var + cllCntrl : ICallControl; tmpObj : IGoogleSearch; callCtx : ICallContext; strPrmName : string; @@ -41,14 +42,15 @@ Var key : string; phrase : string; returnVal : string; - locTypeInfo : PTypeInfo; Begin - callCtx := CreateCallContext(); + callCtx := GetCallContext(); strPrmName := 'key'; AFormatter.Get(TypeInfo(string),strPrmName,key); strPrmName := 'phrase'; AFormatter.Get(TypeInfo(string),strPrmName,phrase); tmpObj := Self.GetFactory().CreateInstance() as IGoogleSearch; + if Supports(tmpObj,ICallControl,cllCntrl) then + cllCntrl.SetCallContext(GetCallContext()); returnVal := tmpObj.doSpellingSuggestion(key,phrase); @@ -64,6 +66,7 @@ End; procedure TGoogleSearch_ServiceBinder.doGoogleSearchHandler(AFormatter:IFormatterResponse); Var + cllCntrl : ICallControl; tmpObj : IGoogleSearch; callCtx : ICallContext; strPrmName : string; @@ -79,12 +82,9 @@ Var ie : string; oe : string; returnVal : TGoogleSearchResult; - locTypeInfo : PTypeInfo; Begin - callCtx := CreateCallContext(); - locTypeInfo := TypeInfo(TGoogleSearchResult); - If ( locTypeInfo^.Kind in [tkClass,tkInterface] ) Then - Pointer(returnVal) := Nil; + callCtx := GetCallContext(); + Pointer(returnVal) := Nil; strPrmName := 'key'; AFormatter.Get(TypeInfo(string),strPrmName,key); strPrmName := 'q'; AFormatter.Get(TypeInfo(string),strPrmName,q); @@ -98,11 +98,12 @@ Begin strPrmName := 'oe'; AFormatter.Get(TypeInfo(string),strPrmName,oe); tmpObj := Self.GetFactory().CreateInstance() as IGoogleSearch; + if Supports(tmpObj,ICallControl,cllCntrl) then + cllCntrl.SetCallContext(GetCallContext()); returnVal := tmpObj.doGoogleSearch(key,q,start,maxResults,filter,restrict,safeSearch,lr,ie,oe); - locTypeInfo := TypeInfo(TGoogleSearchResult); - If ( locTypeInfo^.Kind = tkClass ) And Assigned(Pointer(returnVal)) Then - callCtx.AddObject(TObject(returnVal)); + If Assigned(Pointer(returnVal)) Then + callCtx.AddObjectToFree(TObject(returnVal)); procName := AFormatter.GetCallProcedureName(); trgName := AFormatter.GetCallTarget(); @@ -117,7 +118,7 @@ End; constructor TGoogleSearch_ServiceBinder.Create(); Begin - Inherited Create(GetServiceImplementationRegistry().FindFactory('GoogleSearch')); + Inherited Create(GetServiceImplementationRegistry().FindFactory('IGoogleSearch')); RegisterVerbHandler('doSpellingSuggestion',@doSpellingSuggestionHandler); RegisterVerbHandler('doGoogleSearch',@doGoogleSearchHandler); End; @@ -132,7 +133,15 @@ End; procedure Server_service_RegisterGoogleSearchService(); Begin - GetServerServiceRegistry().Register('GoogleSearch',TGoogleSearch_ServiceBinderFactory.Create() as IItemFactory); + GetServerServiceRegistry().Register('IGoogleSearch',TGoogleSearch_ServiceBinderFactory.Create() as IItemFactory); End; +initialization + + {$IF DECLARED(Register_googlewebapi_NameSpace)} + Register_googlewebapi_NameSpace(); + {$ENDIF} + + {$i googlewebapi.wst} + End. diff --git a/wst/trunk/tests/google_api/googlewebapi_proxy.pas b/wst/trunk/tests/google_api/googlewebapi_proxy.pas index 640af8f97..c00cda864 100644 --- a/wst/trunk/tests/google_api/googlewebapi_proxy.pas +++ b/wst/trunk/tests/google_api/googlewebapi_proxy.pas @@ -2,7 +2,7 @@ This unit has been produced by ws_helper. Input unit name : "googlewebapi". This unit name : "googlewebapi_proxy". - Date : "29/10/2006 15:02". + Date : "12/11/2006 00:24". } Unit googlewebapi_proxy; {$mode objfpc}{$H+} @@ -35,7 +35,7 @@ Type End; Implementation -uses LResources, metadata_repository; +uses wst_resources_imp, metadata_repository; { TGoogleSearch_Proxy implementation } @@ -115,7 +115,7 @@ End; initialization - {$i googlewebapi.lrs} + {$i googlewebapi.wst} {$IF DECLARED(Register_googlewebapi_ServiceMetadata)} Register_googlewebapi_ServiceMetadata(); diff --git a/wst/trunk/tests/google_api/googlewebapi_stub.pas b/wst/trunk/tests/google_api/googlewebapi_stub.pas deleted file mode 100644 index 7d5331122..000000000 --- a/wst/trunk/tests/google_api/googlewebapi_stub.pas +++ /dev/null @@ -1,200 +0,0 @@ -{ -This unit has been produced by ws_helper. - Input unit name : "googlewebapi". - This unit name : "googlewebapi_stub". - Date : "17/05/2006 21:28". -} -Unit googlewebapi_stub; -{$mode objfpc}{$H+} -Interface - -Uses SysUtils, Classes, server_service_intf, googlewebapi; - -Type - - - TGoogleSearch_ServiceBinder=class(TBaseServiceBinder) - Protected - procedure doSpellingSuggestionHandler(AFormatter:IFormatterResponse); - procedure doGoogleSearchHandler(AFormatter:IFormatterResponse); - Public - constructor Create(); - End; - - TGoogleSearchServiceBinderFactory = class(TInterfacedObject,IItemFactory) - protected - function CreateInstance():IInterface; - End; - - procedure Server_service_RegisterGoogleSearchService(); - -Implementation -uses TypInfo, server_service_imputils; - -{ TGoogleSearch_ServiceBinder implementation } -procedure TGoogleSearch_ServiceBinder.doSpellingSuggestionHandler(AFormatter:IFormatterResponse); -Var - tmpObj : IGoogleSearch; - callCtx : ICallContext; - strPrmName : string; - procName,trgName : string; - key : string; - phrase : string; - returnVal : string; - locTypeInfo : PTypeInfo; -Begin - locTypeInfo := TypeInfo(string); - If ( locTypeInfo^.Kind in [tkClass,tkObject,tkInterface] ) Then - Pointer(returnVal) := Nil; - locTypeInfo := TypeInfo(string); - If ( locTypeInfo^.Kind in [tkClass,tkObject,tkInterface] ) Then - Pointer(key) := Nil; - locTypeInfo := TypeInfo(string); - If ( locTypeInfo^.Kind in [tkClass,tkObject,tkInterface] ) Then - Pointer(phrase) := Nil; - - strPrmName := 'key'; AFormatter.Get(TypeInfo(string),strPrmName,key); - locTypeInfo := TypeInfo(string); - If ( locTypeInfo^.Kind = tkClass ) And Assigned(Pointer(key)) Then - callCtx.AddObject(TObject(key)); - strPrmName := 'phrase'; AFormatter.Get(TypeInfo(string),strPrmName,phrase); - locTypeInfo := TypeInfo(string); - If ( locTypeInfo^.Kind = tkClass ) And Assigned(Pointer(phrase)) Then - callCtx.AddObject(TObject(phrase)); - - tmpObj := Self.GetFactory().CreateInstance() as IGoogleSearch; - - returnVal := tmpObj.doSpellingSuggestion(key,phrase); - locTypeInfo := TypeInfo(string); - If ( locTypeInfo^.Kind = tkClass ) And Assigned(Pointer(returnVal)) Then - callCtx.AddObject(TObject(returnVal)); - - procName := AFormatter.GetCallProcedureName(); - trgName := AFormatter.GetCallTarget(); - AFormatter.Clear(); - AFormatter.BeginCallResponse(procName,trgName); - AFormatter.Put('return',TypeInfo(string),returnVal); - AFormatter.EndCallResponse(); -End; - -procedure TGoogleSearch_ServiceBinder.doGoogleSearchHandler(AFormatter:IFormatterResponse); -Var - tmpObj : IGoogleSearch; - callCtx : ICallContext; - strPrmName : string; - procName,trgName : string; - key : string; - q : string; - start : Integer; - maxResults : Integer; - filter : Boolean; - restrict : string; - safeSearch : Boolean; - lr : string; - ie : string; - oe : string; - returnVal : TGoogleSearchResult; - locTypeInfo : PTypeInfo; -Begin - locTypeInfo := TypeInfo(TGoogleSearchResult); - If ( locTypeInfo^.Kind in [tkClass,tkObject,tkInterface] ) Then - Pointer(returnVal) := Nil; - locTypeInfo := TypeInfo(string); - If ( locTypeInfo^.Kind in [tkClass,tkObject,tkInterface] ) Then - Pointer(key) := Nil; - locTypeInfo := TypeInfo(string); - If ( locTypeInfo^.Kind in [tkClass,tkObject,tkInterface] ) Then - Pointer(q) := Nil; - locTypeInfo := TypeInfo(Integer); - If ( locTypeInfo^.Kind in [tkClass,tkObject,tkInterface] ) Then - Pointer(start) := Nil; - locTypeInfo := TypeInfo(Integer); - If ( locTypeInfo^.Kind in [tkClass,tkObject,tkInterface] ) Then - Pointer(maxResults) := Nil; - locTypeInfo := TypeInfo(Boolean); - If ( locTypeInfo^.Kind in [tkClass,tkObject,tkInterface] ) Then - Pointer(filter) := Nil; - locTypeInfo := TypeInfo(string); - If ( locTypeInfo^.Kind in [tkClass,tkObject,tkInterface] ) Then - Pointer(restrict) := Nil; - locTypeInfo := TypeInfo(Boolean); - If ( locTypeInfo^.Kind in [tkClass,tkObject,tkInterface] ) Then - Pointer(safeSearch) := Nil; - locTypeInfo := TypeInfo(string); - If ( locTypeInfo^.Kind in [tkClass,tkObject,tkInterface] ) Then - Pointer(lr) := Nil; - locTypeInfo := TypeInfo(string); - If ( locTypeInfo^.Kind in [tkClass,tkObject,tkInterface] ) Then - Pointer(ie) := Nil; - locTypeInfo := TypeInfo(string); - If ( locTypeInfo^.Kind in [tkClass,tkObject,tkInterface] ) Then - Pointer(oe) := Nil; - - strPrmName := 'key'; AFormatter.Get(TypeInfo(string),strPrmName,key); - locTypeInfo := TypeInfo(string); - If ( locTypeInfo^.Kind = tkClass ) And Assigned(Pointer(key)) Then - callCtx.AddObject(TObject(key)); - strPrmName := 'q'; AFormatter.Get(TypeInfo(string),strPrmName,q); - locTypeInfo := TypeInfo(string); - If ( locTypeInfo^.Kind = tkClass ) And Assigned(Pointer(q)) Then - callCtx.AddObject(TObject(q)); - strPrmName := 'start'; AFormatter.Get(TypeInfo(Integer),strPrmName,start); - locTypeInfo := TypeInfo(Integer); - If ( locTypeInfo^.Kind = tkClass ) And Assigned(Pointer(start)) Then - callCtx.AddObject(TObject(start)); - strPrmName := 'maxResults'; AFormatter.Get(TypeInfo(Integer),strPrmName,maxResults); - locTypeInfo := TypeInfo(Integer); - If ( locTypeInfo^.Kind = tkClass ) And Assigned(Pointer(maxResults)) Then - callCtx.AddObject(TObject(maxResults)); - strPrmName := 'filter'; AFormatter.Get(TypeInfo(Boolean),strPrmName,filter); - locTypeInfo := TypeInfo(Boolean); - If ( locTypeInfo^.Kind = tkClass ) And Assigned(Pointer(filter)) Then - callCtx.AddObject(TObject(filter)); - strPrmName := 'restrict'; AFormatter.Get(TypeInfo(string),strPrmName,restrict); - locTypeInfo := TypeInfo(string); - If ( locTypeInfo^.Kind = tkClass ) And Assigned(Pointer(restrict)) Then - callCtx.AddObject(TObject(restrict)); - strPrmName := 'safeSearch'; AFormatter.Get(TypeInfo(Boolean),strPrmName,safeSearch); - locTypeInfo := TypeInfo(Boolean); - If ( locTypeInfo^.Kind = tkClass ) And Assigned(Pointer(safeSearch)) Then - callCtx.AddObject(TObject(safeSearch)); - strPrmName := 'lr'; AFormatter.Get(TypeInfo(string),strPrmName,lr); - locTypeInfo := TypeInfo(string); - If ( locTypeInfo^.Kind = tkClass ) And Assigned(Pointer(lr)) Then - callCtx.AddObject(TObject(lr)); - strPrmName := 'ie'; AFormatter.Get(TypeInfo(string),strPrmName,ie); - locTypeInfo := TypeInfo(string); - If ( locTypeInfo^.Kind = tkClass ) And Assigned(Pointer(ie)) Then - callCtx.AddObject(TObject(ie)); - strPrmName := 'oe'; AFormatter.Get(TypeInfo(string),strPrmName,oe); - locTypeInfo := TypeInfo(string); - If ( locTypeInfo^.Kind = tkClass ) And Assigned(Pointer(oe)) Then - callCtx.AddObject(TObject(oe)); - - tmpObj := Self.GetFactory().CreateInstance() as IGoogleSearch; - - returnVal := tmpObj.doGoogleSearch(key,q,start,maxResults,filter,restrict,safeSearch,lr,ie,oe); - locTypeInfo := TypeInfo(TGoogleSearchResult); - If ( locTypeInfo^.Kind = tkClass ) And Assigned(Pointer(returnVal)) Then - callCtx.AddObject(TObject(returnVal)); - - procName := AFormatter.GetCallProcedureName(); - trgName := AFormatter.GetCallTarget(); - AFormatter.Clear(); - AFormatter.BeginCallResponse(procName,trgName); - AFormatter.Put('return',TypeInfo(TGoogleSearchResult),returnVal); - AFormatter.EndCallResponse(); -End; - - -{ TGoogleSearchServiceBinderFactory } -function TGoogleSearchServiceBinderFactory.CreateInstance():IInterface; -Begin - Result := TGoogleSearch_ServiceBinder.Create() as IInterface; -End; - - -procedure Server_service_RegisterGoogleSearchService(); -Begin - GetServerServiceRegistry().Register('GoogleSearch',TGoogleSearchServiceBinderFactory.Create() as IItemFactory); -End; diff --git a/wst/trunk/tests/google_api/test_google_api.lpi b/wst/trunk/tests/google_api/test_google_api.lpi index e07e1a546..49b7d121c 100644 --- a/wst/trunk/tests/google_api/test_google_api.lpi +++ b/wst/trunk/tests/google_api/test_google_api.lpi @@ -12,7 +12,7 @@ - + @@ -32,15 +32,15 @@ - + - - + + - + @@ -49,7 +49,7 @@ - + @@ -153,7 +153,7 @@ - + @@ -161,7 +161,7 @@ - + @@ -231,7 +231,7 @@ - + @@ -240,15 +240,17 @@ - + - - - + + + + + @@ -274,11 +276,9 @@ - - - - - + + + @@ -298,10 +298,8 @@ - - + - @@ -336,32 +334,53 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + diff --git a/wst/trunk/tests/google_api/test_google_api.pas b/wst/trunk/tests/google_api/test_google_api.pas index 787e723c2..38e1d6185 100644 --- a/wst/trunk/tests/google_api/test_google_api.pas +++ b/wst/trunk/tests/google_api/test_google_api.pas @@ -9,7 +9,7 @@ uses //indy_http_protocol, ics_http_protocol, synapse_http_protocol, - googlewebapi, googlewebapi_proxy; + googlewebapi, googlewebapi_proxy, wst_resources_imp; Const //sADRESS = 'http:Address=http://api.google.com/search/beta2;Proxy'; diff --git a/wst/trunk/tests/metadata_browser/metadata_browser.lpi b/wst/trunk/tests/metadata_browser/metadata_browser.lpi index 4e9059526..a0c3384d9 100644 --- a/wst/trunk/tests/metadata_browser/metadata_browser.lpi +++ b/wst/trunk/tests/metadata_browser/metadata_browser.lpi @@ -7,6 +7,7 @@ + @@ -43,9 +44,11 @@ - + + + diff --git a/wst/trunk/tests/tcp_server/tcp_gui_server.lpi b/wst/trunk/tests/tcp_server/tcp_gui_server.lpi index e9327f230..5b3c1c137 100644 --- a/wst/trunk/tests/tcp_server/tcp_gui_server.lpi +++ b/wst/trunk/tests/tcp_server/tcp_gui_server.lpi @@ -7,7 +7,7 @@ - + @@ -53,8 +53,8 @@ - - + + @@ -316,26 +316,22 @@ - + - - + + - - - - - + @@ -358,7 +354,8 @@ - + diff --git a/wst/trunk/tests/test_suite/testformatter_unit.pas b/wst/trunk/tests/test_suite/testformatter_unit.pas index 1f7f9661e..e51d63b82 100644 --- a/wst/trunk/tests/test_suite/testformatter_unit.pas +++ b/wst/trunk/tests/test_suite/testformatter_unit.pas @@ -876,7 +876,7 @@ begin try AssertEquals(0,a.Length); a.SetLength(0); - AssertEquals(0,a.Length); + AssertEquals('Length 1', 0,a.Length); a.SetLength(AR_LEN); AssertEquals(AR_LEN,a.Length); @@ -902,7 +902,7 @@ begin x := 'a'; f.Get(TypeInfo(TArrayOfStringRemotable),x,a); f.EndScopeRead(); - AssertEquals(AR_LEN,a.Length); + AssertEquals('Length 2', AR_LEN,a.Length); for i := 0 to Pred(AR_LEN) do AssertEquals(VAL_AR[i],a[i]); diff --git a/wst/trunk/tests/test_suite/wst_test_suite.lpi b/wst/trunk/tests/test_suite/wst_test_suite.lpi index 3147a7fdb..ee5306123 100644 --- a/wst/trunk/tests/test_suite/wst_test_suite.lpi +++ b/wst/trunk/tests/test_suite/wst_test_suite.lpi @@ -7,7 +7,7 @@ - + @@ -18,7 +18,7 @@ - + @@ -27,23 +27,23 @@ - + - + - - + + - + @@ -51,9 +51,9 @@ - + - + @@ -63,7 +63,7 @@ - + @@ -73,7 +73,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -93,7 +93,7 @@ - + @@ -103,7 +103,7 @@ - + @@ -112,7 +112,7 @@ - + @@ -120,7 +120,7 @@ - + @@ -181,7 +181,7 @@ - + @@ -197,7 +197,7 @@ - + @@ -206,7 +206,7 @@ - + @@ -214,7 +214,7 @@ - + @@ -254,7 +254,7 @@ - + @@ -315,7 +315,7 @@ - + @@ -374,8 +374,28 @@ + + + + + + + - + + + + + + + + + + + + + + @@ -403,7 +423,7 @@ - + @@ -477,17 +497,9 @@ - - - - - - - - - + diff --git a/wst/trunk/ws_helper/generator.pas b/wst/trunk/ws_helper/generator.pas index f3d576019..7091b364c 100644 --- a/wst/trunk/ws_helper/generator.pas +++ b/wst/trunk/ws_helper/generator.pas @@ -28,7 +28,10 @@ uses Classes, SysUtils, parserdefs, source_utils; -Type +const + sWST_EXTENSION = 'wst'; + +type { TBaseGenerator } @@ -185,7 +188,7 @@ begin SetCurrentStream(FImpStream); WriteLn(''); WriteLn('Implementation'); - WriteLn('uses LResources, metadata_repository;'); + WriteLn('uses wst_resources_imp, metadata_repository;'); end; procedure TProxyGenerator.GenerateUnitImplementationFooter(); @@ -195,7 +198,7 @@ begin SetCurrentStream(FImpStream); NewLine(); WriteLn('initialization'); - WriteLn(' {$i %s.lrs}',[SymbolTable.Name]); + WriteLn(' {$i %s.%s}',[SymbolTable.Name,sWST_EXTENSION]); NewLine(); s := Format('Register_%s_ServiceMetadata',[SymbolTable.Name]); WriteLn(' {$IF DECLARED(%s)}',[s]); @@ -590,7 +593,7 @@ begin SetCurrentStream(FImpStream); WriteLn(''); WriteLn('Implementation'); - WriteLn('uses TypInfo, LResources,metadata_repository;'); + WriteLn('uses TypInfo, wst_resources_imp,metadata_repository;'); end; procedure TBinderGenerator.GenerateUnitImplementationFooter(); @@ -605,7 +608,7 @@ begin WriteLn(' %s();',[s]); WriteLn(' {$ENDIF}'); NewLine(); - WriteLn(' {$i %s.lrs}',[SymbolTable.Name]); + WriteLn(' {$i %s.%s}',[SymbolTable.Name,sWST_EXTENSION]); NewLine(); WriteLn('End.'); end; diff --git a/wst/trunk/ws_helper/metadata_generator.pas b/wst/trunk/ws_helper/metadata_generator.pas index 1571d4e05..db7f49448 100644 --- a/wst/trunk/ws_helper/metadata_generator.pas +++ b/wst/trunk/ws_helper/metadata_generator.pas @@ -1,3 +1,22 @@ +{ + This unit is part of the Web Service Toolkit + Copyright (c) 2006 by Inoussa OUEDRAOGO + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +} + unit metadata_generator; {$mode objfpc}{$H+} diff --git a/wst/trunk/ws_helper/ws_helper.lpi b/wst/trunk/ws_helper/ws_helper.lpi index 1b431a89d..a0b73563f 100644 --- a/wst/trunk/ws_helper/ws_helper.lpi +++ b/wst/trunk/ws_helper/ws_helper.lpi @@ -27,42 +27,39 @@ - + - - - - + - + - - - + + + - - - + + + - - - + + + - - - + + + @@ -71,7 +68,7 @@ - + @@ -79,7 +76,7 @@ - + @@ -136,7 +133,7 @@ - + @@ -170,15 +167,15 @@ - + - - - + + + @@ -186,7 +183,7 @@ - + @@ -251,6 +248,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wst/trunk/ws_helper/ws_helper.pas b/wst/trunk/ws_helper/ws_helper.pas index b98abb2fb..f5ae99404 100644 --- a/wst/trunk/ws_helper/ws_helper.pas +++ b/wst/trunk/ws_helper/ws_helper.pas @@ -23,7 +23,7 @@ program ws_helper; {$mode objfpc}{$H+} uses - Classes, SysUtils, LResources, + Classes, SysUtils, wst_resources_utils, parserdefs, ws_parser, generator, parserutils, source_utils, command_line_parser, metadata_generator, binary_streamer; @@ -109,8 +109,9 @@ Var mtdaFS.SaveToFile(ChangeFileExt(inFileName,'.' + sWST_META)); rsrcStrm := TMemoryStream.Create(); mtdaFS.Position := 0; - BinaryToLazarusResourceCode(mtdaFS,rsrcStrm,UpperCase(p.SymbolTable.Name),sWST_META); - rsrcStrm.SaveToFile(outPath + ChangeFileExt(ExtractFileName(inFileName),'.lrs')); + //BinaryToLazarusResourceCode(mtdaFS,rsrcStrm,UpperCase(p.SymbolTable.Name),sWST_META); + BinToWstRessource(UpperCase(p.SymbolTable.Name),mtdaFS,rsrcStrm); + rsrcStrm.SaveToFile(outPath + ChangeFileExt(ExtractFileName(inFileName),'.' + sWST_EXTENSION)); end; Result := True; diff --git a/wst/trunk/ws_helper/ws_parser.pas b/wst/trunk/ws_helper/ws_parser.pas index 8ca0bff36..c15b56613 100644 --- a/wst/trunk/ws_helper/ws_parser.pas +++ b/wst/trunk/ws_helper/ws_parser.pas @@ -197,6 +197,7 @@ begin Tokenizer.CheckToken(toSymbol); If Tokenizer.TokenSymbolIs(GetPascalTokenStr(ptUses)) Then ParseUses(); + ReadUntil(GetPascalTokenStr(ptType),True); Tokenizer.CheckToken(toSymbol); If Tokenizer.TokenSymbolIs(GetPascalTokenStr(ptType)) Then Begin NextToken(); diff --git a/wst/trunk/ws_helper/wst_resources_utils.pas b/wst/trunk/ws_helper/wst_resources_utils.pas new file mode 100644 index 000000000..f429336ca --- /dev/null +++ b/wst/trunk/ws_helper/wst_resources_utils.pas @@ -0,0 +1,127 @@ +unit wst_resources_utils; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils; + + procedure BinToWstRessource( + const AResourceName : string; + ABinStream, + AWstRstream : TStream + ); + +implementation + +procedure BinToWstRessource( + const AResourceName : string; + ABinStream, + AWstRstream : TStream +); +const MAX_LINE_LEN = 80; READ_LEN = 1024; WRITE_LEN = 1024; +type TWritingState = ( wsBegin, wsInString, wsOutString); +var + locInBuffer, locOutBuffer : string; + locInBufferLen, locOutBufferLen, locLineLen, locInIdx : Integer; + locChar : Char; + locState : TWritingState; + locTotalRead : Integer; + + procedure FillInBuffer(); + begin + locInIdx := 1; + SetLength(locInBuffer,READ_LEN); + locInBufferLen := ABinStream.Read(Pointer(locInBuffer)^,READ_LEN); + SetLength(locInBuffer,locInBufferLen); + Inc(locTotalRead,locInBufferLen); + end; + + procedure FlushBuffer(); + begin + locOutBufferLen := Length(locOutBuffer); + if ( locOutBufferLen > 0 ) then begin + AWstRstream.Write(Pointer(locOutBuffer)^,locOutBufferLen); + locOutBuffer := ''; + locOutBufferLen := 0; + end; + end; + + function ReadChar():Boolean; + begin + if ( locInBufferLen = 0 ) or ( locInIdx > locInBufferLen ) then + FillInBuffer(); + Result := ( locInBufferLen > 0 ) and ( locInIdx <= locInBufferLen ); + if Result then begin + locChar := locInBuffer[locInIdx]; + Inc(locInIdx); + end; + end; + + procedure WriteChar(const AChar : Char); + begin + locOutBuffer := locOutBuffer + AChar; + Inc(locLineLen); + end; + +var + s : string; +begin + locTotalRead := 0; + locLineLen := 0; + locInBufferLen := 0; + locOutBufferLen := 0; + locInIdx := 0; + locState := wsBegin; + locInBuffer := ''; + locOutBuffer := Format(' GetWSTResourceManager().AddResource(''%s'','+sLineBreak + ' ',[AResourceName]); + while ReadChar() do begin + if ( Ord(locChar) in [32..127] ) then begin + case locState of + wsBegin : WriteChar(''''); + wsInString : ; + wsOutString : WriteChar(''''); + end; + WriteChar(locChar); + if ( locChar = '''' ) then + WriteChar(locChar); + locState := wsInString; + end else begin + case locState of + wsBegin : ; + wsInString : WriteChar(''''); + wsOutString : ; + end; + WriteChar('#'); + s := IntToStr(Ord(locChar)); + locOutBuffer := locOutBuffer + s; + Inc(locLineLen,Length(s)); + locState := wsOutString; + end; + if ( ( locLineLen + 4 ) >= MAX_LINE_LEN ) then begin + if ( locState = wsInString ) then + WriteChar(''''); + locOutBuffer := locOutBuffer + sLineBreak + ' +'; + locLineLen := 0; + locState := wsBegin; + end; + locOutBufferLen := Length(locOutBuffer); + if ( locOutBufferLen >= WRITE_LEN ) then begin + FlushBuffer(); + end; + end; + if ( locInBufferLen = 0 ) then begin + locState := wsInString; + WriteChar(''''); + end; + if ( locState = wsInString ) then + WriteChar(''''); + if ( locLineLen > 0 ) then + locOutBuffer := locOutBuffer + sLineBreak; + locOutBuffer := locOutBuffer + ' );'; + FlushBuffer(); +end; + +end. + diff --git a/wst/trunk/wst_resources_imp.pas b/wst/trunk/wst_resources_imp.pas new file mode 100644 index 000000000..017eb1fda --- /dev/null +++ b/wst/trunk/wst_resources_imp.pas @@ -0,0 +1,236 @@ +unit wst_resources_imp; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils; + +type + + EWSTResourceException = class(Exception) + end; + + TWSTResourceManager = Class(TPersistent) + Public + Procedure Assign(Source : TPersistent); override; + Function HasResource(Const AName : String) : Boolean; virtual; abstract; + Function ResourceAsString(Const AName : String) : String; virtual; abstract; + Procedure AddResource(Const AName,AValue : String); virtual; Abstract; + Procedure AddResource(const Name: AnsiString; Values: array of string); + Procedure GetResourceList(List : TStrings); virtual; abstract; + end; + + Function GetWSTResourceManager(Force : Boolean = True) : TWSTResourceManager; + Function SetWSTResourceManager(AValue : TWSTResourceManager) : TWSTResourceManager; + +implementation + +ResourceString + SErrNoSuchResource = 'No such resource in resource list: "%s"'; + +Type + { Default implementation of resource manager } + + TWSTResourceItem = Class(TCollectionItem) + Private + FName : String; + FValue : String; + Public + Property Name : String Read FName Write FName; + Property Value : String Read FValue Write FValue; + end; + + TWSTResourceItems = Class(TCollection) + Private + Function GetResource(AIndex : Integer) : TWSTResourceItem; + Procedure SetResource(AIndex : Integer; AValue : TWSTResourceItem); + Public + Function IndexOfResource(AName : String) : Integer; + Function FindResource(AName : String) : TWSTResourceItem; + Function ResourceByName(AName : String) : TWSTResourceItem; + Property Resources[Index : Integer] : TWSTResourceItem Read GetResource Write SetResource; default; + end; + + TCollectionResourceManager = Class(TWSTResourceManager) + FResources : TWSTResourceItems; + Public + Constructor Create; + Destructor Destroy; override; + Function HasResource(Const AName : String) : Boolean; override; + Function ResourceAsString(Const AName : String) : String; override; + Procedure AddResource(Const AName,AValue : String); override; + Procedure GetResourceList(List : TStrings); override; + end; + + +Function TWSTResourceItems.GetResource(AIndex : Integer) : TWSTResourceItem; + +begin + Result:=TWSTResourceItem(Items[AIndex]); +end; + +Procedure TWSTResourceItems.SetResource(AIndex : Integer; AValue : TWSTResourceItem); + +begin + Items[AIndex]:=AValue; +end; + +Function TWSTResourceItems.IndexOfResource(AName : String) : Integer; + +begin + Result:=Count-1; + While (Result>=0) and (CompareText(GetResource(Result).Name,AName)<>0) do + Dec(Result); +end; + +Function TWSTResourceItems.FindResource(AName : String) : TWSTResourceItem; + +Var + I : Integer; + +begin + I:=IndexOfResource(AName); + If (I=-1) then + Result:=Nil + else + Result:=GetResource(I); +end; + +Function TWSTResourceItems.ResourceByName(AName : String) : TWSTResourceItem; + +begin + Result:=FindResource(AName); + If (Result=Nil) then + Raise EWSTResourceException.CreateFmt(SErrNoSuchResource,[ANAme]); +end; + +Procedure TWSTResourceManager.Assign(Source : TPersistent); + +Var + I : integer; + L : TStringList; + S : String; + R : TWSTResourceManager; + +begin + If Source is TWSTResourceManager then + begin + L:=TStringList.Create; + try + R:=TWSTResourceManager(Source); + R.GetResourceList(L); + For I:=0 to L.Count-1 do + begin + S:=R.ResourceAsString(L[i]); + Self.AddResource(L[i],S); + end; + finally + L.free; + end; + end; +end; + +procedure TWSTResourceManager.AddResource(const Name: AnsiString; Values: array of string); + +var + i,L,TLen, p: integer; + S : String; + +begin + L:=High(Values)-Low(Values)+1; + If (L=1) then + S:=Values[0] + else if (L>1) then + begin + TLen:=0; + for I:=Low(Values) to High(Values) do + TLen:=TLen+Length(Values[i]); + SetLength(S,TLen); + p:=1; + for i:=Low(Values) to High(Values) do + begin + L:=length(Values[i]); + if (L>0) then + begin + Move(Values[i][1],S[p],l); + inc(p,l); + end; + end; + end; + If (S<>'') then + AddResource(Name,S); +end; + + +Function TCollectionResourceManager.HasResource(Const AName : String) : Boolean; + +begin + Result:=FResources.IndexOfResource(AName)<>-1; +end; + +Function TCollectionResourceManager.ResourceAsString(Const AName : String) : String; + +begin + Result:=FResources.ResourceByName(AName).Value; +end; + +Procedure TCollectionResourceManager.AddResource(Const AName,AValue : String); + +Var + R : TWSTResourceItem; + +begin + R:=FResources.Add as TWSTResourceItem; + R.Name:=AName; + R.Value:=AValue; +end; + +Procedure TCollectionResourceManager.GetResourceList(List : TStrings); + +Var + I : Integer; + +begin + For I:=0 to FResources.Count-1 do + List.Add(FResources[i].Name); +end; + +Constructor TCollectionResourceManager.Create; + +begin + FResources:=TWSTResourceItems.Create(TWSTResourceItem); +end; + +Destructor TCollectionResourceManager.Destroy; + +begin + FResources.Free; + Inherited; +end; + +Var + ResMGR : TWSTResourceManager; + +Function GetWSTResourceManager(Force : Boolean = True) : TWSTResourceManager; + +begin + Result:=ResMGR; + If (ResMgr=Nil) and Force then + ResMGr:=TCollectionResourceManager.Create; + Result:=ResMGR; +end; + +Function SetWSTResourceManager(AValue : TWSTResourceManager) : TWSTResourceManager; + +begin + // Copy resources if needed. + If Assigned(ResMGR) and Assigned(AValue) then + AValue.Assign(ResMGR); + FreeAndNil(ResMGR); + ResMGR:=AValue; +end; + +end. +