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

View File

@ -34,7 +34,8 @@ type
TGeneratorOption = (
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;
@ -2560,7 +2561,9 @@ begin
classItemArray := SymbolTable.IsOfType(eltType,TPasClassType) or SymbolTable.IsOfType(eltType,TPasArrayType);
if classItemArray then begin
if FSymbolTable.IsCollection(ASymbol) then
if ( goGenerateObjectCollection in Options ) or
FSymbolTable.IsCollection(ASymbol)
then
WriteObjectCollection(ASymbol)
else
WriteObjectArray(ASymbol);

View File

@ -1,8 +1,11 @@
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 +
' 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 +
' -b Generate service binder' + 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
parserMode := pmAllTypes;
end;
if AnsiSameText('C',Trim(GetOptionArg(cloGenerateObjectCollection))) then begin
Include(AppOptions,cloGenerateObjectCollection);
end;
if ( sourceType = sftXsd ) then begin
AppOptions := AppOptions - [ cloProxy, cloImp, cloBinder, cloWsdl ];
end;
@ -185,6 +190,8 @@ var
g := TInftGenerator.Create(symtable,srcMngr);
if wrappedParams then
g.Options := g.Options + [goDocumentWrappedParameter];
if ( cloGenerateObjectCollection in AppOptions ) then
g.Options := g.Options + [goGenerateObjectCollection];
g.Execute();
FreeAndNil(g);
end;