ws_helper : option '-gC' to generate object collection instead of array.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@903 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa
2009-07-09 16:50:26 +00:00
parent eda0eb7910
commit b45faabcdc
3 changed files with 22 additions and 7 deletions

View File

@ -29,7 +29,7 @@ Type
TComandLineOption = ( TComandLineOption = (
cloInterface, cloProxy, cloImp, cloBinder, cloWsdl, cloXsd, cloInterface, cloProxy, cloImp, cloBinder, cloWsdl, cloXsd,
cloOutPutDirRelative, cloOutPutDirAbsolute, cloHandleWrappedParameters, cloOutPutDirRelative, cloOutPutDirAbsolute, cloHandleWrappedParameters,
cloGenerateDocAsComments cloGenerateDocAsComments, cloGenerateObjectCollection
); );
TComandLineOptions = set of TComandLineOption; TComandLineOptions = set of TComandLineOption;
@ -54,7 +54,7 @@ begin
AAppOptions := []; AAppOptions := [];
c := #0; c := #0;
repeat repeat
c := GetOpt('u:pibo:a:wxyd'); c := GetOpt('u:pibo:a:wxydg:');
case c of case c of
'u' : 'u' :
begin begin
@ -78,6 +78,11 @@ begin
'x' : Include(AAppOptions,cloXsd); 'x' : Include(AAppOptions,cloXsd);
'y' : Include(AAppOptions,cloHandleWrappedParameters); 'y' : Include(AAppOptions,cloHandleWrappedParameters);
'd' : Include(AAppOptions,cloGenerateDocAsComments); 'd' : Include(AAppOptions,cloGenerateDocAsComments);
'g' :
begin
Include(AAppOptions,cloGenerateObjectCollection);
OptionsArgsMAP[cloGenerateObjectCollection] := OptArg;
end;
end; end;
until ( c = EndOfOptions ); until ( c = EndOfOptions );
Result := OptInd; Result := OptInd;

View File

@ -34,7 +34,8 @@ type
TGeneratorOption = ( TGeneratorOption = (
goDocumentWrappedParameter { .Net style wrapped parameters }, goDocumentWrappedParameter { .Net style wrapped parameters },
goGenerateDocAsComments { Documentation include in the XSD/WSDL schema will be generated as comments } goGenerateDocAsComments { Documentation include in the XSD/WSDL schema will be generated as comments },
goGenerateObjectCollection { Generate object "collection" instead of "array" }
); );
TGeneratorOptions = set of TGeneratorOption; TGeneratorOptions = set of TGeneratorOption;
@ -2560,7 +2561,9 @@ begin
classItemArray := SymbolTable.IsOfType(eltType,TPasClassType) or SymbolTable.IsOfType(eltType,TPasArrayType); classItemArray := SymbolTable.IsOfType(eltType,TPasClassType) or SymbolTable.IsOfType(eltType,TPasArrayType);
if classItemArray then begin if classItemArray then begin
if FSymbolTable.IsCollection(ASymbol) then if ( goGenerateObjectCollection in Options ) or
FSymbolTable.IsCollection(ASymbol)
then
WriteObjectCollection(ASymbol) WriteObjectCollection(ASymbol)
else else
WriteObjectArray(ASymbol); WriteObjectArray(ASymbol);

View File

@ -1,8 +1,11 @@
resourcestring resourcestring
sUSAGE = 'ws_helper [-uMODE] [-p] [-b] [-i] [-w] [-x] [-y] [-d] [-oPATH] [-aPATH] inputFilename' + sNEW_LINE + sUSAGE = 'ws_helper [-uMODE] [-gOPTION] [-p] [-b] [-i] [-w] [-x] [-y] [-d] [-oPATH] [-aPATH] inputFilename' + sNEW_LINE +
' -u MODE Generate the pascal translation of the WSDL input file ' + sNEW_LINE + ' -u MODE Generate the pascal translation of the WSDL input file ' + sNEW_LINE +
' MODE value may be U for used types or A for all types' + sNEW_LINE + ' MODE value may be U for used types or A for all types' + sNEW_LINE +
' -g Code generation option, with the following options : ' + sNEW_LINE +
' A : object arrays are generated as "array" derived from TBaseObjectArrayRemotable' + sNEW_LINE +
' C : object arrays are generated as "collection" derived from TObjectCollectionRemotable' + sNEW_LINE +
' -p Generate service proxy' + sNEW_LINE + ' -p Generate service proxy' + sNEW_LINE +
' -b Generate service binder' + sNEW_LINE + ' -b Generate service binder' + sNEW_LINE +
' -i Generate service minimal implementation. This will erase any existing implementation file!' + sNEW_LINE + ' -i Generate service minimal implementation. This will erase any existing implementation file!' + sNEW_LINE +
@ -64,7 +67,9 @@ var
if AnsiSameText('A',Trim(GetOptionArg(cloInterface))) then begin if AnsiSameText('A',Trim(GetOptionArg(cloInterface))) then begin
parserMode := pmAllTypes; parserMode := pmAllTypes;
end; end;
if AnsiSameText('C',Trim(GetOptionArg(cloGenerateObjectCollection))) then begin
Include(AppOptions,cloGenerateObjectCollection);
end;
if ( sourceType = sftXsd ) then begin if ( sourceType = sftXsd ) then begin
AppOptions := AppOptions - [ cloProxy, cloImp, cloBinder, cloWsdl ]; AppOptions := AppOptions - [ cloProxy, cloImp, cloBinder, cloWsdl ];
end; end;
@ -185,6 +190,8 @@ var
g := TInftGenerator.Create(symtable,srcMngr); g := TInftGenerator.Create(symtable,srcMngr);
if wrappedParams then if wrappedParams then
g.Options := g.Options + [goDocumentWrappedParameter]; g.Options := g.Options + [goDocumentWrappedParameter];
if ( cloGenerateObjectCollection in AppOptions ) then
g.Options := g.Options + [goGenerateObjectCollection];
g.Execute(); g.Execute();
FreeAndNil(g); FreeAndNil(g);
end; end;