+Object Collection support

All WST custom attributes are now namespace qualified
Correct XDS generator for complex type extending simple type

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@520 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa
2008-08-01 21:38:55 +00:00
parent 2c5517ee19
commit 639bde5376
46 changed files with 2352 additions and 720 deletions

View File

@@ -627,6 +627,51 @@ type
property mustUnderstand : Integer read FmustUnderstand write SetmustUnderstand stored HasmustUnderstand; property mustUnderstand : Integer read FmustUnderstand write SetmustUnderstand stored HasmustUnderstand;
end; end;
{ TObjectCollectionRemotable
An implementation for array handling. The array items are "owned" by
this class instance, so one has not to free them.
}
TObjectCollectionRemotable = class(TAbstractComplexRemotable)
private
FList : TObjectList;
protected
function GetItem(AIndex : PtrInt) : TBaseRemotable;{$IFDEF USE_INLINE}inline;{$ENDIF}
class function GetItemName():string;virtual;
class function GetStyle():TArrayStyle;virtual;
function GetLength : PtrInt;
public
class procedure Save(
AObject : TBaseRemotable;
AStore : IFormatterBase;
const AName : string;
const ATypeInfo : PTypeInfo
);override;
class procedure Load(
var AObject : TObject;
AStore : IFormatterBase;
var AName : string;
const ATypeInfo : PTypeInfo
);override;
class function GetItemClass():TBaseRemotableClass;virtual;abstract;
class function GetItemTypeInfo():PTypeInfo;{$IFDEF USE_INLINE}inline;{$ENDIF}
constructor Create();override;
destructor Destroy();override;
procedure Assign(Source: TPersistent); override;
function Equal(const ACompareTo : TBaseRemotable) : Boolean;override;
function Add(): TBaseRemotable;{$IFDEF USE_INLINE}inline;{$ENDIF}
function AddAt(const APosition : PtrInt): TBaseRemotable;{$IFDEF USE_INLINE}inline;{$ENDIF}
function Extract(const AIndex : PtrInt): TBaseRemotable;{$IFDEF USE_INLINE}inline;{$ENDIF}
procedure Delete(const AIndex : PtrInt);{$IFDEF USE_INLINE}inline;{$ENDIF}
procedure Exchange(const Index1,Index2 : PtrInt);{$IFDEF USE_INLINE}inline;{$ENDIF}
procedure Clear();{$IFDEF USE_INLINE}inline;{$ENDIF}
function IndexOf(AObject : TBaseRemotable) : PtrInt;{$IFDEF USE_INLINE}inline;{$ENDIF}
property Item[AIndex:PtrInt] : TBaseRemotable read GetItem;default;
property Length : PtrInt read GetLength;
end;
TBaseArrayRemotableClass = class of TBaseArrayRemotable; TBaseArrayRemotableClass = class of TBaseArrayRemotable;
{ TBaseArrayRemotable } { TBaseArrayRemotable }
@@ -2940,6 +2985,254 @@ begin
end; end;
end; end;
{ TObjectCollectionRemotable }
function TObjectCollectionRemotable.GetItem(AIndex : PtrInt) : TBaseRemotable;
begin
Result := TBaseRemotable(FList[AIndex]);
end;
function TObjectCollectionRemotable.GetLength : PtrInt;
begin
Result := FList.Count;
end;
class function TObjectCollectionRemotable.GetItemName() : string;
var
tri : TTypeRegistryItem;
begin
tri := GetTypeRegistry().Find(PTypeInfo(Self.ClassInfo),False);
if Assigned(tri) then
Result := Trim(tri.GetExternalPropertyName(sARRAY_ITEM));
if ( System.Length(Result) = 0 ) then
Result := sARRAY_ITEM;
end;
class function TObjectCollectionRemotable.GetStyle() : TArrayStyle;
var
tri : TTypeRegistryItem;
begin
tri := GetTypeRegistry().Find(PTypeInfo(Self.ClassInfo),False);
if Assigned(tri) and AnsiSameText(sEmbedded,Trim(tri.GetExternalPropertyName(sARRAY_STYLE))) then begin
Result := asEmbeded;
end else begin
Result := asScoped;
end;
end;
class procedure TObjectCollectionRemotable.Save(
AObject : TBaseRemotable;
AStore : IFormatterBase;
const AName : string;
const ATypeInfo : PTypeInfo
);
Var
itmTypInfo : PTypeInfo;
i,j : Integer;
nativObj : TObjectCollectionRemotable;
itm : TObject;
itmName : string;
styl : TArrayStyle;
begin
if Assigned(AObject) then begin
Assert(AObject.InheritsFrom(TObjectCollectionRemotable));
nativObj := AObject as TObjectCollectionRemotable;
j := nativObj.Length;
end else begin
j := 0;
end;
itmTypInfo := PTypeInfo(GetItemClass().ClassInfo);
styl := GetStyle();
AStore.BeginArray(AName,PTypeInfo(Self.ClassInfo),itmTypInfo,[0,Pred(j)],styl);
try
if ( styl = asScoped ) then begin
itmName := GetItemName();
end else begin
itmName := AName;
end;
for i := 0 to Pred(j) do begin
itm := nativObj.Item[i];
AStore.Put(itmName,itmTypInfo,itm);
end;
finally
AStore.EndScope();
end;
end;
class procedure TObjectCollectionRemotable.Load(
var AObject : TObject;
AStore : IFormatterBase;
var AName : String;
const ATypeInfo : PTypeInfo
);
Var
i, len : Integer;
nativObj : TObjectCollectionRemotable;
s : string;
itmTypInfo : PTypeInfo;
itm : TBaseRemotable;
itmName : string;
styl : TArrayStyle;
begin
styl := GetStyle();
if ( styl = asScoped ) then begin
itmName := GetItemName();
end else begin
itmName := AName;
end;
len := AStore.BeginArrayRead(AName,ATypeInfo,styl,itmName);
if ( len >= 0 ) then begin
Try
If Not Assigned(AObject) Then
AObject := Create();
itmTypInfo := PTypeInfo(GetItemClass().ClassInfo);
nativObj := AObject as TObjectCollectionRemotable;
If ( len > 0 ) Then Begin
s := '';
nativObj.Clear();
For i := 0 To Pred(len) Do Begin
itm := nativObj.Add();
AStore.Get(itmTypInfo,s,itm);
End;
End;
Finally
AStore.EndScopeRead();
End;
end;
end;
class function TObjectCollectionRemotable.GetItemTypeInfo() : PTypeInfo;
begin
Result := PTypeInfo(GetItemClass().ClassInfo);
end;
constructor TObjectCollectionRemotable.Create();
begin
inherited Create();
FList := TObjectList.Create(True);
end;
destructor TObjectCollectionRemotable.Destroy();
begin
FList.Free();
inherited Destroy();
end;
procedure TObjectCollectionRemotable.Assign(Source : TPersistent);
var
srcCol : TObjectCollectionRemotable;
src : TBaseObjectArrayRemotable;
i, c : PtrInt;
begin
if Assigned(Source) then begin
if Source.InheritsFrom(TObjectCollectionRemotable) then begin
srcCol := TObjectCollectionRemotable(Source);
c := srcCol.Length;
FList.Clear();
FList.Capacity := c;
for i := 0 to Pred(c) do begin
Add().Assign(srcCol.Item[i]);
end;
end else if Source.InheritsFrom(TBaseObjectArrayRemotable) then begin
src := TBaseObjectArrayRemotable(Source);
c := src.Length;
FList.Clear();
FList.Capacity := c;
for i := 0 to Pred(c) do begin
Add().Assign(src.Item[i]);
end;
end else begin
inherited Assign(Source);
end;
end else begin
FList.Clear();
end;
end;
function TObjectCollectionRemotable.Equal(const ACompareTo : TBaseRemotable) : Boolean;
var
i : PtrInt;
nativeCol : TObjectCollectionRemotable;
nativeArray : TBaseObjectArrayRemotable;
res : Boolean;
begin
res := False;
if ( ACompareTo <> nil ) then begin
if ACompareTo.InheritsFrom(TObjectCollectionRemotable) then begin
nativeCol := TObjectCollectionRemotable(ACompareTo);
if ( nativeCol.Length = Length ) then begin
res := True;
for i := 0 to Pred(Length) do begin
if not Item[i].Equal(nativeCol[i]) then begin
res := False;
Break;
end;
end;
end;
end else if ACompareTo.InheritsFrom(TBaseObjectArrayRemotable) then begin
nativeArray := TBaseObjectArrayRemotable(ACompareTo);
if ( nativeArray.Length = Length ) then begin
res := True;
for i := 0 to Pred(Length) do begin
if not Item[i].Equal(nativeArray[i]) then begin
res := False;
Break;
end;
end;
end;
end;
end;
Result := res;
end;
function TObjectCollectionRemotable.Add() : TBaseRemotable;
begin
Result := GetItemClass().Create();
try
FList.Add(Result);
except
Result.Free();
raise;
end;
end;
function TObjectCollectionRemotable.AddAt(const APosition : PtrInt) : TBaseRemotable;
begin
FList.Insert(APosition,nil);
try
Result := GetItemClass().Create();
except
FList.Delete(APosition);
raise;
end;
FList[APosition] := Result;
end;
function TObjectCollectionRemotable.Extract(const AIndex : PtrInt) : TBaseRemotable;
begin
Result := TBaseRemotable(FList.Extract(FList[AIndex]));
end;
procedure TObjectCollectionRemotable.Delete(const AIndex : PtrInt);
begin
FList.Delete(AIndex);
end;
procedure TObjectCollectionRemotable.Exchange(const Index1, Index2 : PtrInt);
begin
FList.Exchange(Index1,Index2);
end;
procedure TObjectCollectionRemotable.Clear();
begin
FList.Clear();
end;
function TObjectCollectionRemotable.IndexOf(AObject : TBaseRemotable) : PtrInt;
begin
Result := FList.IndexOf(AObject);
end;
{ TBaseArrayRemotable } { TBaseArrayRemotable }
class function TBaseArrayRemotable.GetItemName(): string; class function TBaseArrayRemotable.GetItemName(): string;

View File

@@ -1,7 +1,7 @@
object formImport: TformImport object formImport: TformImport
Left = 574 Left = 574
Height = 553 Height = 553
Top = 132 Top = 133
Width = 526 Width = 526
HorzScrollBar.Page = 525 HorzScrollBar.Page = 525
VertScrollBar.Page = 552 VertScrollBar.Page = 552
@@ -10,6 +10,7 @@ object formImport: TformImport
Caption = 'WSDL Importer' Caption = 'WSDL Importer'
ClientHeight = 553 ClientHeight = 553
ClientWidth = 526 ClientWidth = 526
LCLVersion = '0.9.25'
object Panel2: TPanel object Panel2: TPanel
Height = 505 Height = 505
Width = 526 Width = 526
@@ -226,7 +227,6 @@ object formImport: TformImport
end end
end end
object OD: TOpenDialog object OD: TOpenDialog
Title = 'Ouvrir un fichier existant'
Filter = 'WSDL Files ( *.wsdl )|*.wsdl' Filter = 'WSDL Files ( *.wsdl )|*.wsdl'
FilterIndex = 0 FilterIndex = 0
Options = [ofFileMustExist, ofEnableSizing, ofViewDetail] Options = [ofFileMustExist, ofEnableSizing, ofViewDetail]
@@ -234,7 +234,6 @@ object formImport: TformImport
top = 32 top = 32
end end
object SDD: TSelectDirectoryDialog object SDD: TSelectDirectoryDialog
Title = 'Choisir un r�pertoire'
FilterIndex = 0 FilterIndex = 0
left = 224 left = 224
top = 176 top = 176

View File

@@ -2,67 +2,66 @@
LazarusResources.Add('TformImport','FORMDATA',[ LazarusResources.Add('TformImport','FORMDATA',[
'TPF0'#11'TformImport'#10'formImport'#4'Left'#3'>'#2#6'Height'#3')'#2#3'Top'#3 'TPF0'#11'TformImport'#10'formImport'#4'Left'#3'>'#2#6'Height'#3')'#2#3'Top'#3
+#132#0#5'Width'#3#14#2#18'HorzScrollBar.Page'#3#13#2#18'VertScrollBar.Page'#3 +#133#0#5'Width'#3#14#2#18'HorzScrollBar.Page'#3#13#2#18'VertScrollBar.Page'#3
+'('#2#13'ActiveControl'#7#7'Button1'#11'BorderStyle'#7#13'bsSizeToolWin'#7'C' +'('#2#13'ActiveControl'#7#7'Button1'#11'BorderStyle'#7#13'bsSizeToolWin'#7'C'
+'aption'#6#13'WSDL Importer'#12'ClientHeight'#3')'#2#11'ClientWidth'#3#14#2#0 +'aption'#6#13'WSDL Importer'#12'ClientHeight'#3')'#2#11'ClientWidth'#3#14#2
+#6'TPanel'#6'Panel2'#6'Height'#3#249#1#5'Width'#3#14#2#5'Align'#7#8'alClient' +#10'LCLVersion'#6#6'0.9.25'#0#6'TPanel'#6'Panel2'#6'Height'#3#249#1#5'Width'
+#12'ClientHeight'#3#249#1#11'ClientWidth'#3#14#2#8'TabOrder'#2#1#0#9'TGroupB' +#3#14#2#5'Align'#7#8'alClient'#12'ClientHeight'#3#249#1#11'ClientWidth'#3#14
+'ox'#9'GroupBox1'#4'Left'#2#8#6'Height'#3#168#0#3'Top'#2#8#5'Width'#3#250#1#7 +#2#8'TabOrder'#2#1#0#9'TGroupBox'#9'GroupBox1'#4'Left'#2#8#6'Height'#3#168#0
+'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#12'ClientHeight'#3#150#0#11'Cli' +#3'Top'#2#8#5'Width'#3#250#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#12
+'entWidth'#3#246#1#8'TabOrder'#2#0#0#6'TLabel'#6'Label1'#4'Left'#2#9#6'Heigh' +'ClientHeight'#3#150#0#11'ClientWidth'#3#246#1#8'TabOrder'#2#0#0#6'TLabel'#6
+'t'#2#14#3'Top'#2#4#5'Width'#3#186#0#7'Caption'#6'&Web Services Description ' +'Label1'#4'Left'#2#9#6'Height'#2#14#3'Top'#2#4#5'Width'#3#186#0#7'Caption'#6
+'File ( WSDL )'#11'ParentColor'#8#0#0#6'TLabel'#6'Label2'#4'Left'#2#9#6'Heig' +'&Web Services Description File ( WSDL )'#11'ParentColor'#8#0#0#6'TLabel'#6
+'ht'#2#14#3'Top'#2'E'#5'Width'#2'Q'#7'Caption'#6#16'Output directory'#11'Par' +'Label2'#4'Left'#2#9#6'Height'#2#14#3'Top'#2'E'#5'Width'#2'Q'#7'Caption'#6#16
+'entColor'#8#0#0#5'TEdit'#12'edtInputFile'#4'Left'#2#9#6'Height'#2#23#3'Top' +'Output directory'#11'ParentColor'#8#0#0#5'TEdit'#12'edtInputFile'#4'Left'#2
+#2#31#5'Width'#3'|'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'TabOrd' +#9#6'Height'#2#23#3'Top'#2#31#5'Width'#3'|'#1#7'Anchors'#11#5'akTop'#6'akLef'
+'er'#2#0#0#0#7'TButton'#7'Button2'#4'Left'#3#151#1#6'Height'#2#25#3'Top'#2#31 +'t'#7'akRight'#0#8'TabOrder'#2#0#0#0#7'TButton'#7'Button2'#4'Left'#3#151#1#6
+#5'Width'#2'('#6'Action'#7#11'actOpenFile'#7'Anchors'#11#5'akTop'#7'akRight' +'Height'#2#25#3'Top'#2#31#5'Width'#2'('#6'Action'#7#11'actOpenFile'#7'Anchor'
+#0#25'BorderSpacing.InnerBorder'#2#4#8'TabOrder'#2#1#0#0#5'TEdit'#12'edtOutp' +'s'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#4#8'TabOrder'#2
+'utDir'#4'Left'#2#9#6'Height'#2#23#3'Top'#2'X'#5'Width'#3'|'#1#7'Anchors'#11 +#1#0#0#5'TEdit'#12'edtOutputDir'#4'Left'#2#9#6'Height'#2#23#3'Top'#2'X'#5'Wi'
+#5'akTop'#6'akLeft'#7'akRight'#0#8'TabOrder'#2#2#0#0#7'TButton'#7'Button3'#4 +'dth'#3'|'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'TabOrder'#2#2#0
+'Left'#3#151#1#6'Height'#2#25#3'Top'#2'X'#5'Width'#2'('#6'Action'#7#10'actOp' +#0#7'TButton'#7'Button3'#4'Left'#3#151#1#6'Height'#2#25#3'Top'#2'X'#5'Width'
+'enDir'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#4 +#2'('#6'Action'#7#10'actOpenDir'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'Bord'
+#8'TabOrder'#2#3#0#0#9'TCheckBox'#15'edtAddToProject'#4'Left'#2#9#6'Height'#2 +'erSpacing.InnerBorder'#2#4#8'TabOrder'#2#3#0#0#9'TCheckBox'#15'edtAddToProj'
+#19#3'Top'#3#128#0#5'Width'#3#182#0#7'Caption'#6'"Add the generated files to' +'ect'#4'Left'#2#9#6'Height'#2#19#3'Top'#3#128#0#5'Width'#3#182#0#7'Caption'#6
+' project'#8'TabOrder'#2#4#0#0#0#9'TGroupBox'#9'GroupBox2'#4'Left'#2#8#6'Hei' +'"Add the generated files to project'#8'TabOrder'#2#4#0#0#0#9'TGroupBox'#9'G'
+'ght'#3#161#0#3'Top'#3'P'#1#5'Width'#3#250#1#7'Anchors'#11#5'akTop'#6'akLeft' +'roupBox2'#4'Left'#2#8#6'Height'#3#161#0#3'Top'#3'P'#1#5'Width'#3#250#1#7'An'
+#7'akRight'#8'akBottom'#0#7'Caption'#6#12' Messages '#12'ClientHeight'#3 +'chors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#7'Caption'#6#12' Mes'
+#143#0#11'ClientWidth'#3#246#1#8'TabOrder'#2#2#0#5'TMemo'#6'mmoLog'#6'Height' +'sages '#12'ClientHeight'#3#143#0#11'ClientWidth'#3#246#1#8'TabOrder'#2#2#0
+#3#143#0#5'Width'#3#246#1#5'Align'#7#8'alClient'#8'ReadOnly'#9#10'ScrollBars' +#5'TMemo'#6'mmoLog'#6'Height'#3#143#0#5'Width'#3#246#1#5'Align'#7#8'alClient'
+#7#6'ssBoth'#8'TabOrder'#2#0#0#0#0#9'TGroupBox'#9'GroupBox3'#4'Left'#2#8#6'H' +#8'ReadOnly'#9#10'ScrollBars'#7#6'ssBoth'#8'TabOrder'#2#0#0#0#0#9'TGroupBox'
+'eight'#3#136#0#3'Top'#3#184#0#5'Width'#3#250#1#7'Anchors'#11#5'akTop'#6'akL' +#9'GroupBox3'#4'Left'#2#8#6'Height'#3#136#0#3'Top'#3#184#0#5'Width'#3#250#1#7
+'eft'#7'akRight'#0#7'Caption'#6#11' Options '#12'ClientHeight'#2'v'#11'Cli' +'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#7'Caption'#6#11' Options '#12
+'entWidth'#3#246#1#8'TabOrder'#2#1#0#9'TCheckBox'#13'edtOptionIntf'#4'Left'#2 +'ClientHeight'#2'v'#11'ClientWidth'#3#246#1#8'TabOrder'#2#1#0#9'TCheckBox'#13
+#9#6'Height'#2#19#3'Top'#2#8#5'Width'#2'T'#7'Caption'#6#14'Interface file'#7 +'edtOptionIntf'#4'Left'#2#9#6'Height'#2#19#3'Top'#2#8#5'Width'#2'T'#7'Captio'
+'Checked'#9#7'OnClick'#7#18'edtOptionIntfClick'#5'State'#7#9'cbChecked'#8'Ta' +'n'#6#14'Interface file'#7'Checked'#9#7'OnClick'#7#18'edtOptionIntfClick'#5
+'bOrder'#2#0#0#0#9'TCheckBox'#14'edtOptionProxy'#4'Left'#2#9#6'Height'#2#19#3 +'State'#7#9'cbChecked'#8'TabOrder'#2#0#0#0#9'TCheckBox'#14'edtOptionProxy'#4
+'Top'#2'8'#5'Width'#2'D'#7'Caption'#6#10'Proxy file'#7'Checked'#9#5'State'#7 +'Left'#2#9#6'Height'#2#19#3'Top'#2'8'#5'Width'#2'D'#7'Caption'#6#10'Proxy fi'
+#9'cbChecked'#8'TabOrder'#2#2#0#0#9'TCheckBox'#15'edtOptionBinder'#4'Left'#3 +'le'#7'Checked'#9#5'State'#7#9'cbChecked'#8'TabOrder'#2#2#0#0#9'TCheckBox'#15
+'&'#1#6'Height'#2#19#3'Top'#2#8#5'Width'#2'o'#7'Caption'#6#19'Service Binder' +'edtOptionBinder'#4'Left'#3'&'#1#6'Height'#2#19#3'Top'#2#8#5'Width'#2'o'#7'C'
+' file'#8'TabOrder'#2#3#0#0#9'TCheckBox'#12'edtOptionImp'#4'Left'#3'&'#1#6'H' +'aption'#6#19'Service Binder file'#8'TabOrder'#2#3#0#0#9'TCheckBox'#12'edtOp'
+'eight'#2#19#3'Top'#2'8'#5'Width'#3#158#0#7'Caption'#6#28'Implementation Ske' +'tionImp'#4'Left'#3'&'#1#6'Height'#2#19#3'Top'#2'8'#5'Width'#3#158#0#7'Capti'
+'leton file'#8'TabOrder'#2#4#0#0#9'TCheckBox'#16'edtOptionIntfALL'#4'Left'#2 +'on'#6#28'Implementation Skeleton file'#8'TabOrder'#2#4#0#0#9'TCheckBox'#16
+#30#6'Height'#2#19#3'Top'#2' '#5'Width'#2'^'#7'Caption'#6#15'Parse all types' +'edtOptionIntfALL'#4'Left'#2#30#6'Height'#2#19#3'Top'#2' '#5'Width'#2'^'#7'C'
+#7'OnClick'#7#21'edtOptionIntfALLClick'#8'TabOrder'#2#1#0#0#9'TCheckBox'#22 +'aption'#6#15'Parse all types'#7'OnClick'#7#21'edtOptionIntfALLClick'#8'TabO'
+'edtOptionWrappedParams'#4'Left'#2#9#6'Height'#2#19#3'Top'#2'`'#5'Width'#3'"' +'rder'#2#1#0#0#9'TCheckBox'#22'edtOptionWrappedParams'#4'Left'#2#9#6'Height'
+#1#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6'5Generate easy access ' +#2#19#3'Top'#2'`'#5'Width'#3'"'#1#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Ca'
+'interface for wrapped parameters'#8'TabOrder'#2#5#0#0#0#0#6'TPanel'#6'Panel' +'ption'#6'5Generate easy access interface for wrapped parameters'#8'TabOrder'
+'1'#6'Height'#2'0'#3'Top'#3#249#1#5'Width'#3#14#2#5'Align'#7#8'alBottom'#12 +#2#5#0#0#0#0#6'TPanel'#6'Panel1'#6'Height'#2'0'#3'Top'#3#249#1#5'Width'#3#14
+'ClientHeight'#2'0'#11'ClientWidth'#3#14#2#8'TabOrder'#2#0#0#7'TButton'#7'Bu' +#2#5'Align'#7#8'alBottom'#12'ClientHeight'#2'0'#11'ClientWidth'#3#14#2#8'Tab'
+'tton1'#4'Left'#3'_'#1#6'Height'#2#25#3'Top'#2#8#5'Width'#2'K'#6'Action'#7#5 +'Order'#2#0#0#7'TButton'#7'Button1'#4'Left'#3'_'#1#6'Height'#2#25#3'Top'#2#8
+'actOK'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#4 +#5'Width'#2'K'#6'Action'#7#5'actOK'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'B'
+#7'Default'#9#8'TabOrder'#2#0#0#0#7'TButton'#7'Button4'#4'Left'#3#183#1#6'He' +'orderSpacing.InnerBorder'#2#4#7'Default'#9#8'TabOrder'#2#0#0#0#7'TButton'#7
+'ight'#2#25#3'Top'#2#8#5'Width'#2'K'#7'Anchors'#11#5'akTop'#7'akRight'#0#25 +'Button4'#4'Left'#3#183#1#6'Height'#2#25#3'Top'#2#8#5'Width'#2'K'#7'Anchors'
+'BorderSpacing.InnerBorder'#2#4#6'Cancel'#9#7'Caption'#6#6'Cancel'#11'ModalR' +#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#4#6'Cancel'#9#7'Ca'
+'esult'#2#2#8'TabOrder'#2#1#0#0#0#11'TActionList'#2'AL'#4'left'#2'h'#3'top'#3 +'ption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#1#0#0#0#11'TActionList'
+'H'#1#0#7'TAction'#5'actOK'#7'Caption'#6#2'OK'#18'DisableIfNoHandler'#9#9'On' +#2'AL'#4'left'#2'h'#3'top'#3'H'#1#0#7'TAction'#5'actOK'#7'Caption'#6#2'OK'#18
+'Execute'#7#12'actOKExecute'#8'OnUpdate'#7#11'actOKUpdate'#0#0#7'TAction'#11 +'DisableIfNoHandler'#9#9'OnExecute'#7#12'actOKExecute'#8'OnUpdate'#7#11'actO'
+'actOpenFile'#7'Caption'#6#3'...'#18'DisableIfNoHandler'#9#9'OnExecute'#7#18 +'KUpdate'#0#0#7'TAction'#11'actOpenFile'#7'Caption'#6#3'...'#18'DisableIfNoH'
+'actOpenFileExecute'#0#0#7'TAction'#10'actOpenDir'#7'Caption'#6#3'...'#18'Di' +'andler'#9#9'OnExecute'#7#18'actOpenFileExecute'#0#0#7'TAction'#10'actOpenDi'
+'sableIfNoHandler'#9#9'OnExecute'#7#17'actOpenDirExecute'#0#0#0#11'TOpenDial' +'r'#7'Caption'#6#3'...'#18'DisableIfNoHandler'#9#9'OnExecute'#7#17'actOpenDi'
+'og'#2'OD'#5'Title'#6#26'Ouvrir un fichier existant'#6'Filter'#6#28'WSDL Fil' +'rExecute'#0#0#0#11'TOpenDialog'#2'OD'#6'Filter'#6#28'WSDL Files ( *.wsdl )|'
+'es ( *.wsdl )|*.wsdl'#11'FilterIndex'#2#0#7'Options'#11#15'ofFileMustExist' +'*.wsdl'#11'FilterIndex'#2#0#7'Options'#11#15'ofFileMustExist'#14'ofEnableSi'
+#14'ofEnableSizing'#12'ofViewDetail'#0#4'left'#3#16#1#3'top'#2' '#0#0#22'TSe' +'zing'#12'ofViewDetail'#0#4'left'#3#16#1#3'top'#2' '#0#0#22'TSelectDirectory'
+'lectDirectoryDialog'#3'SDD'#5'Title'#6#21'Choisir un r'#233'pertoire'#11'Fi' +'Dialog'#3'SDD'#11'FilterIndex'#2#0#4'left'#3#224#0#3'top'#3#176#0#0#0#0
+'lterIndex'#2#0#4'left'#3#224#0#3'top'#3#176#0#0#0#0
]); ]);

View File

@@ -141,20 +141,21 @@ Item0=DUnit
Count=1 Count=1
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[HistoryLists\hlSearchPath] [HistoryLists\hlSearchPath]
Count=13 Count=14
Item0=..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;..\..\..\ws_helper;..\..\..\wst_rtti_filter;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src Item0=..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;..\..\..\ws_helper;..\..\..\wst_rtti_filter;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item1=..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src;..\..\..\ws_helper Item1=$(DELPHI)\Lib\Debug;C:\PROGRA~1\Borland\Delphi7\MyTools\JVCL\3.20\jcl\lib\d7\debug;..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;..\..\..\ws_helper;..\..\..\wst_rtti_filter;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item2=..\;..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src;..\..\..\fcl-units\fcl-passrc\src Item2=..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src;..\..\..\ws_helper
Item3=..\;..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src Item3=..\;..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src;..\..\..\fcl-units\fcl-passrc\src
Item4=..\;..\..\;..\..\..\;C:\Programmes\lazarus\wst\trunk\ws_helper;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src Item4=..\;..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item5=..\;..\..\;..\..\..\;..\..\ws_helper;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src Item5=..\;..\..\;..\..\..\;C:\Programmes\lazarus\wst\trunk\ws_helper;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item6=..\;..\..\;..\..\..\;..\..\ws_helper\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src Item6=..\;..\..\;..\..\..\;..\..\ws_helper;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item7=..\;..\..\;..\..\..\;..\..\ws_helper\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src;C:\Programmes\lazarus\wst\trunk\ws_helper Item7=..\;..\..\;..\..\..\;..\..\ws_helper\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item8=..\;..\..\;..\..\..\;..\..\..\ws_helper\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src Item8=..\;..\..\;..\..\..\;..\..\ws_helper\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src;C:\Programmes\lazarus\wst\trunk\ws_helper
Item9=..\;..\..\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src Item9=..\;..\..\;..\..\..\;..\..\..\ws_helper\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item10=..\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src Item10=..\;..\..\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item11=C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src Item11=..\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item12=..\ Item12=C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item13=..\
[HistoryLists\hlUnitOutputDirectory] [HistoryLists\hlUnitOutputDirectory]
Count=1 Count=1
Item0=obj Item0=obj

View File

@@ -20,7 +20,10 @@ uses
xsd_consts in '..\..\..\ws_helper\xsd_consts.pas', xsd_consts in '..\..\..\ws_helper\xsd_consts.pas',
xsd_generator in '..\..\..\ws_helper\xsd_generator.pas', xsd_generator in '..\..\..\ws_helper\xsd_generator.pas',
test_generators in '..\test_generators.pas', test_generators in '..\test_generators.pas',
test_suite_utils in '..\test_suite_utils.pas'; test_suite_utils in '..\test_suite_utils.pas',
test_std_cursors in '..\test_std_cursors.pas',
test_rtti_filter in '..\test_rtti_filter.pas',
test_wst_cursors in '..\test_wst_cursors.pas';
{$R *.res} {$R *.res}

View File

@@ -9,7 +9,10 @@ uses
testformatter_unit in '..\testformatter_unit.pas', testformatter_unit in '..\testformatter_unit.pas',
test_parsers in '..\test_parsers.pas', test_parsers in '..\test_parsers.pas',
testmetadata_unit, testmetadata_unit,
test_support in '..\test_support.pas'; test_support in '..\test_support.pas',
test_std_cursors in '..\test_std_cursors.pas',
test_rtti_filter in '..\test_rtti_filter.pas',
test_wst_cursors in '..\test_wst_cursors.pas';
{$R *.res} {$R *.res}

View File

@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<schema xmlns:tns="class_extent_native_type" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="class_extent_native_type">
<xsd:complexType name="TExtendString">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute use="required" name="intAtt" type="xsd:int"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="TExtendBase64String">
<xsd:simpleContent>
<xsd:extension base="xsd:base64Binary">
<xsd:attribute use="required" name="strAtt" type="xsd:string"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</schema>

View File

@@ -0,0 +1,47 @@
<?xml version="1.0"?>
<definitions name="wst_test"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="urn:wst-test"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
targetNamespace="urn:wst-test">
<types>
<xsd:schema xmlns:n="urn:wst-test"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="urn:wst-test"
xmlns:wst="urn:wst_base"
targetNamespace="urn:wst-test">
<xsd:complexType name="TComplexType" />
<xsd:complexType name="TCollectionComplexType">
<xsd:sequence>
<xsd:element name="field" type="tns:TComplexType" minOccurs="0" maxOccurs="unbounded" wst:wst_collection="true"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TCollectionItemType">
<xsd:sequence>
<xsd:element name="Item" minOccurs="0" maxOccurs="unbounded" wst:wst_collection="true" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="intField" type="xsd:int" />
<xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="floatField" type="xsd:float" minOccurs="0" maxOccurs="1"/>
<xsd:element name="byteField" type="xsd:byte" maxOccurs="1"/>
<xsd:element name="charField" type="xsd:char" minOccurs="1"/>
<xsd:element name="longField" type="xsd:long" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="strAtt" type="xsd:string"/>
<xsd:attribute name="intAtt" type="xsd:int"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>
</definitions>

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:n="urn:wst-test"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="urn:wst-test"
xmlns:wst="urn:wst_base"
targetNamespace="urn:wst-test">
<xsd:complexType name="TComplexType" />
<xsd:complexType name="TCollectionComplexType">
<xsd:sequence>
<xsd:element name="field" type="tns:TComplexType" minOccurs="0" maxOccurs="unbounded" wst:wst_collection="true"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TCollectionItemType">
<xsd:sequence>
<xsd:element name="Item" minOccurs="0" maxOccurs="unbounded" wst:wst_collection="true" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="intField" type="xsd:int" />
<xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="floatField" type="xsd:float" minOccurs="0" maxOccurs="1"/>
<xsd:element name="byteField" type="xsd:byte" maxOccurs="1"/>
<xsd:element name="charField" type="xsd:char" minOccurs="1"/>
<xsd:element name="longField" type="xsd:long" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="strAtt" type="xsd:string"/>
<xsd:attribute name="intAtt" type="xsd:int"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

View File

@@ -7,9 +7,9 @@
targetNamespace="urn:wst-test"> targetNamespace="urn:wst-test">
<types> <types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:wst-test" xmlns:n="urn:wst-test" > <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:wst="urn:wst_base" targetNamespace="urn:wst-test" xmlns:n="urn:wst-test" >
<xsd:complexType name="TRecordSampleType" wst_record="true"> <xsd:complexType name="TRecordSampleType" wst:wst_record="true">
<xsd:sequence> <xsd:sequence>
<xsd:element name="intField" type="xsd:int" /> <xsd:element name="intField" type="xsd:int" />
<xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/> <xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/>
@@ -24,7 +24,7 @@
<xsd:element name="TRecordSample" type="n:TRecordSampleType"/> <xsd:element name="TRecordSample" type="n:TRecordSampleType"/>
<xsd:complexType name="TRecordSampleTypeAll" wst_record="true"> <xsd:complexType name="TRecordSampleTypeAll" wst:wst_record="true">
<xsd:all> <xsd:all>
<xsd:element name="intField" type="xsd:int" /> <xsd:element name="intField" type="xsd:int" />
<xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/> <xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/>

View File

@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:n="urn:wst-test" <xsd:schema xmlns:n="urn:wst-test"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wst="urn:wst_base"
targetNamespace="urn:wst-test"> targetNamespace="urn:wst-test">
<xsd:complexType name="TRecordSampleType" wst_record="true"> <xsd:complexType name="TRecordSampleType" wst:wst_record="true">
<xsd:sequence> <xsd:sequence>
<xsd:element name="intField" type="xsd:int" /> <xsd:element name="intField" type="xsd:int" />
<xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/> <xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/>
@@ -18,7 +19,7 @@
<xsd:element name="TRecordSample" type="n:TRecordSampleType"/> <xsd:element name="TRecordSample" type="n:TRecordSampleType"/>
<xsd:complexType name="TRecordSampleTypeAll" wst_record="true"> <xsd:complexType name="TRecordSampleTypeAll" wst:wst_record="true">
<xsd:all> <xsd:all>
<xsd:element name="intField" type="xsd:int" /> <xsd:element name="intField" type="xsd:int" />
<xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/> <xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/>

View File

@@ -4,13 +4,14 @@
xmlns:tns="library1" xmlns:tns="library1"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wst="urn:wst_base"
targetNamespace="urn:wst-test"> targetNamespace="urn:wst-test">
<types> <types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:wst-test" xmlns:n="urn:wst-test" > <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:wst-test" xmlns:n="urn:wst-test" >
<xsd:element name="TRecordSampleType"> <xsd:element name="TRecordSampleType">
<xsd:complexType wst_record="true"> <xsd:complexType wst:wst_record="true">
<xsd:sequence> <xsd:sequence>
<xsd:element name="intField" type="xsd:int" /> <xsd:element name="intField" type="xsd:int" />
<xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/> <xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/>
@@ -25,7 +26,7 @@
</xsd:element> </xsd:element>
<xsd:element name="TRecordSampleTypeAll"> <xsd:element name="TRecordSampleTypeAll">
<xsd:complexType wst_record="true"> <xsd:complexType wst:wst_record="true">
<xsd:all> <xsd:all>
<xsd:element name="intField" type="xsd:int" /> <xsd:element name="intField" type="xsd:int" />
<xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/> <xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/>

View File

@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:n="urn:wst-test" <xsd:schema xmlns:n="urn:wst-test"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wst="urn:wst_base"
targetNamespace="urn:wst-test"> targetNamespace="urn:wst-test">
<xsd:element name="TRecordSampleType"> <xsd:element name="TRecordSampleType">
<xsd:complexType wst_record="true"> <xsd:complexType wst:wst_record="true">
<xsd:sequence> <xsd:sequence>
<xsd:element name="intField" type="xsd:int" /> <xsd:element name="intField" type="xsd:int" />
<xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/> <xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/>
@@ -19,7 +20,7 @@
</xsd:element> </xsd:element>
<xsd:element name="TRecordSampleTypeAll"> <xsd:element name="TRecordSampleTypeAll">
<xsd:complexType wst_record="true"> <xsd:complexType wst:wst_record="true">
<xsd:all> <xsd:all>
<xsd:element name="intField" type="xsd:int" /> <xsd:element name="intField" type="xsd:int" />
<xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/> <xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<definitions name="wst_test"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="library1"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
targetNamespace="urn:wst-test">
<types>
<xsd:schema xmlns:n="urn:wst-test"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:wst-test">
<xsd:complexType name="TClassSample" />
</xsd:schema>
</types>
</definitions>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:n="urn:wst-test"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:wst-test">
<xsd:complexType name="TClassSample" />
</xsd:schema>

View File

@@ -26,6 +26,8 @@ type
TPropertyType = ( ptField, ptAttribute ); TPropertyType = ( ptField, ptAttribute );
{ TTest_CustomXsdGenerator }
TTest_CustomXsdGenerator = class(TTestCase) TTest_CustomXsdGenerator = class(TTestCase)
protected protected
function CreateGenerator(const ADoc : TXMLDocument) : IXsdGenerator;virtual;abstract; function CreateGenerator(const ADoc : TXMLDocument) : IXsdGenerator;virtual;abstract;
@@ -33,6 +35,7 @@ type
published published
procedure class_properties_default(); procedure class_properties_default();
procedure class_properties_extended_metadata(); procedure class_properties_extended_metadata();
procedure class_extent_native_type();
end; end;
TTest_XsdGenerator = class(TTest_CustomXsdGenerator) TTest_XsdGenerator = class(TTest_CustomXsdGenerator)
@@ -181,6 +184,76 @@ begin
end; end;
end; end;
procedure TTest_CustomXsdGenerator.class_extent_native_type();
var
tr : TwstPasTreeContainer;
mdl : TPasModule;
cltyp : TPasClassType;
procedure AddProperty(
const AName,
ATypeName,
ADefault : string;
const AKind : TPropertyType
);
var
p : TPasProperty;
begin
p := TPasProperty(tr.CreateElement(TPasProperty,AName,cltyp,visDefault,'',0));
cltyp.Members.Add(p);
p.ReadAccessorName := 'F' + AName;
p.WriteAccessorName := 'F' + AName;
p.VarType := tr.FindElement(ATypeName) as TPasType;
Check( (p.VarType <> nil), Format('Type not found : "%s".',[ATypeName]));
p.VarType.AddRef();
p.DefaultValue := ADefault;
p.Visibility := visPublished;
p.StoredAccessorName := 'True';
if ( AKind = ptAttribute ) then
tr.SetPropertyAsAttribute(p,True);
end;
var
g : IGenerator;
locDoc, locExistDoc : TXMLDocument;
begin
locDoc := nil;
locExistDoc := nil;
tr := TwstPasTreeContainer.Create();
try
CreateWstInterfaceSymbolTable(tr);
mdl := TPasModule(tr.CreateElement(TPasModule,'class_extent_native_type',tr.Package,visDefault,'',0));
tr.Package.Modules.Add(mdl);
mdl.InterfaceSection := TPasSection(tr.CreateElement(TPasSection,'',mdl,visDefault,'',0));
cltyp := TPasClassType(tr.CreateElement(TPasClassType,'TExtendString',mdl.InterfaceSection,visDefault,'',0));
cltyp.ObjKind := okClass;
cltyp.AncestorType := tr.FindElementNS('TComplexStringContentRemotable',sXSD_NS) as TPasType;
cltyp.AncestorType.AddRef();
mdl.InterfaceSection.Declarations.Add(cltyp);
mdl.InterfaceSection.Types.Add(cltyp);
AddProperty('intAtt','integer','',ptAttribute);
cltyp := TPasClassType(tr.CreateElement(TPasClassType,'TExtendBase64String',mdl.InterfaceSection,visDefault,'',0));
cltyp.ObjKind := okClass;
cltyp.AncestorType := tr.FindElementNS('TBase64StringExtRemotable',sXSD_NS) as TPasType;
cltyp.AncestorType.AddRef();
mdl.InterfaceSection.Declarations.Add(cltyp);
mdl.InterfaceSection.Types.Add(cltyp);
AddProperty('strAtt','string','',ptAttribute);
locDoc := CreateDoc();
g := CreateGenerator(locDoc);
g.Execute(tr,mdl.Name);
WriteXMLFile(locDoc,'.\class_extent_native_type.xsd');
locExistDoc := LoadXmlFromFilesList('class_extent_native_type.xsd');
Check(CompareNodes(locExistDoc,locDoc),'generated document differs from the existent one.');
finally
ReleaseDomNode(locExistDoc);
ReleaseDomNode(locDoc);
FreeAndNil(tr);
end;
end;
function TTest_CustomXsdGenerator.LoadXmlFromFilesList(const AFileName: string): TXMLDocument; function TTest_CustomXsdGenerator.LoadXmlFromFilesList(const AFileName: string): TXMLDocument;
var var
locFileName : string; locFileName : string;

View File

@@ -45,6 +45,10 @@ type
function LoadComplexType_ArraySequence_Schema() : TwstPasTreeContainer;virtual;abstract; function LoadComplexType_ArraySequence_Schema() : TwstPasTreeContainer;virtual;abstract;
function LoadComplexType_ArraySequence_Embedded_Schema() : TwstPasTreeContainer;virtual;abstract; function LoadComplexType_ArraySequence_Embedded_Schema() : TwstPasTreeContainer;virtual;abstract;
function LoadComplexType_CollectionSequence_Schema() : TwstPasTreeContainer;virtual;abstract;
function LoadComplexType_pascal_class_parent() : TwstPasTreeContainer;virtual;abstract;
published published
procedure EmptySchema(); procedure EmptySchema();
@@ -63,6 +67,9 @@ type
procedure ComplexType_ArraySequence(); procedure ComplexType_ArraySequence();
procedure ComplexType_ArraySequence_Embedded(); procedure ComplexType_ArraySequence_Embedded();
procedure ComplexType_CollectionSequence();
procedure pascal_class_default_parent();
end; end;
{ TTest_XsdParser } { TTest_XsdParser }
@@ -88,6 +95,10 @@ type
function LoadComplexType_ArraySequence_Schema() : TwstPasTreeContainer;override; function LoadComplexType_ArraySequence_Schema() : TwstPasTreeContainer;override;
function LoadComplexType_ArraySequence_Embedded_Schema() : TwstPasTreeContainer;override; function LoadComplexType_ArraySequence_Embedded_Schema() : TwstPasTreeContainer;override;
function LoadComplexType_CollectionSequence_Schema() : TwstPasTreeContainer;override;
function LoadComplexType_pascal_class_parent() : TwstPasTreeContainer;override;
end; end;
{ TTest_WsdlParser } { TTest_WsdlParser }
@@ -113,6 +124,10 @@ type
function LoadComplexType_ArraySequence_Schema() : TwstPasTreeContainer;override; function LoadComplexType_ArraySequence_Schema() : TwstPasTreeContainer;override;
function LoadComplexType_ArraySequence_Embedded_Schema() : TwstPasTreeContainer;override; function LoadComplexType_ArraySequence_Embedded_Schema() : TwstPasTreeContainer;override;
function LoadComplexType_CollectionSequence_Schema() : TwstPasTreeContainer;override;
function LoadComplexType_pascal_class_parent() : TwstPasTreeContainer;override;
published published
procedure no_binding_style(); procedure no_binding_style();
end; end;
@@ -123,6 +138,11 @@ uses parserutils;
const const
x_complexType_SampleArrayIntFieldType = 'TArrayIntFieldType'; x_complexType_SampleArrayIntFieldType = 'TArrayIntFieldType';
x_complexType_SampleArrayItemType = 'TArrayItemType'; x_complexType_SampleArrayItemType = 'TArrayItemType';
x_complexType_SampleCollectionComplexType = 'TComplexType';
x_complexType_SampleCollectionCollectionComplexType = 'TCollectionComplexType';
x_complexType_SampleCollectionItemType = 'TCollectionItemType';
x_complexType_SampleDerivedType = 'TClassSampleDerivedType'; x_complexType_SampleDerivedType = 'TClassSampleDerivedType';
x_complexType_SampleClassType = 'TClassSampleType'; x_complexType_SampleClassType = 'TClassSampleType';
x_complexType_SampleClassTypeA = 'TClassSampleTypeA'; x_complexType_SampleClassTypeA = 'TClassSampleTypeA';
@@ -135,6 +155,8 @@ const
x_complexType_array_sequence = 'complex_array_sequence'; x_complexType_array_sequence = 'complex_array_sequence';
x_complexType_array_sequence_embedded = 'complex_array_sequence_embedded'; x_complexType_array_sequence_embedded = 'complex_array_sequence_embedded';
x_complexType_array_sequence_collection = 'complex_array_sequence_collection';
x_complexType_class = 'complex_class'; x_complexType_class = 'complex_class';
x_complexType_class_default = 'complex_class_default'; x_complexType_class_default = 'complex_class_default';
x_complexType_class_properties_extended_metadata = 'class_properties_extended_metadata'; x_complexType_class_properties_extended_metadata = 'class_properties_extended_metadata';
@@ -162,6 +184,7 @@ const
x_charField = 'charField'; x_charField = 'charField';
x_classField = 'classField'; x_classField = 'classField';
x_enumField = 'enumField'; x_enumField = 'enumField';
x_field = 'field';
x_floatField = 'floatField'; x_floatField = 'floatField';
x_intField = 'intField'; x_intField = 'intField';
x_longField = 'longField'; x_longField = 'longField';
@@ -586,6 +609,7 @@ var
i : Integer; i : Integer;
prpLs : TList; prpLs : TList;
begin begin
tr := nil;
prpLs := TList.Create(); prpLs := TList.Create();
try try
tr := LoadComplexType_Class_Extend_Simple_Schema(); tr := LoadComplexType_Class_Extend_Simple_Schema();
@@ -602,6 +626,9 @@ begin
CheckEquals(x_complexType_SampleClassType,tr.GetExternalName(elt)); CheckEquals(x_complexType_SampleClassType,tr.GetExternalName(elt));
CheckIs(elt,TPasClassType); CheckIs(elt,TPasClassType);
clsType := elt as TPasClassType; clsType := elt as TPasClassType;
CheckNotNull(clsType.AncestorType,'AncestorType is null');
CheckSame(tr.FindElementNS('TComplexStringContentRemotable',sXSD_NS),clsType.AncestorType);
prpLs.Clear(); prpLs.Clear();
for i := 0 to Pred(clsType.Members.Count) do begin for i := 0 to Pred(clsType.Members.Count) do begin
if TPasElement(clsType.Members[i]).InheritsFrom(TPasProperty) then if TPasElement(clsType.Members[i]).InheritsFrom(TPasProperty) then
@@ -617,6 +644,9 @@ begin
CheckEquals(x_complexType_SampleClassTypeA,tr.GetExternalName(elt)); CheckEquals(x_complexType_SampleClassTypeA,tr.GetExternalName(elt));
CheckIs(elt,TPasClassType); CheckIs(elt,TPasClassType);
clsType := elt as TPasClassType; clsType := elt as TPasClassType;
CheckNotNull(clsType.AncestorType,'AncestorType is null');
CheckSame(tr.FindElementNS('TBase64StringExtRemotable',sXSD_NS),clsType.AncestorType);
prpLs.Clear(); prpLs.Clear();
for i := 0 to Pred(clsType.Members.Count) do begin for i := 0 to Pred(clsType.Members.Count) do begin
if TPasElement(clsType.Members[i]).InheritsFrom(TPasProperty) then if TPasElement(clsType.Members[i]).InheritsFrom(TPasProperty) then
@@ -625,6 +655,7 @@ begin
CheckEquals(1,prpLs.Count); CheckEquals(1,prpLs.Count);
CheckProperty(x_floatField,'float',ptAttribute); CheckProperty(x_floatField,'float',ptAttribute);
finally finally
tr.Free();
FreeAndNil(prpLs); FreeAndNil(prpLs);
end; end;
end; end;
@@ -982,7 +1013,121 @@ begin
end; end;
end; end;
procedure TTest_CustomXsdParser.ComplexType_Class_default_values; procedure TTest_CustomXsdParser.ComplexType_CollectionSequence();
var
tr : TwstPasTreeContainer;
clsType : TPasClassType;
procedure CheckProperty(const AName,ATypeName : string; const AFieldType : TPropertyType);
var
prp : TPasProperty;
begin
prp := FindMember(clsType,AName) as TPasProperty;
CheckNotNull(prp);
CheckEquals(AName,prp.Name);
CheckEquals(AName,tr.GetExternalName(prp));
CheckNotNull(prp.VarType);
CheckEquals(ATypeName,tr.GetExternalName(prp.VarType));
CheckEquals(PropertyType_Att[AFieldType],tr.IsAttributeProperty(prp));
end;
var
mdl : TPasModule;
ls : TList;
elt : TPasElement;
arrayType : TPasArrayType;
aliasType : TPasAliasType;
i : Integer;
prpLs : TList;
nestedClassName : string;
begin
prpLs := TList.Create();
try
tr := LoadComplexType_CollectionSequence_Schema();
mdl := tr.FindModule(x_targetNamespace);
CheckNotNull(mdl);
CheckEquals(x_complexType_array_sequence_collection,mdl.Name);
CheckEquals(x_targetNamespace,tr.GetExternalName(mdl));
ls := mdl.InterfaceSection.Declarations;
CheckEquals(4,ls.Count);
elt := tr.FindElement(x_complexType_SampleCollectionCollectionComplexType);
CheckNotNull(elt,x_complexType_SampleCollectionCollectionComplexType);
CheckEquals(x_complexType_SampleCollectionCollectionComplexType,elt.Name);
CheckEquals(x_complexType_SampleCollectionCollectionComplexType,tr.GetExternalName(elt));
CheckIs(elt,TPasArrayType);
arrayType := elt as TPasArrayType;
Check(tr.IsCollection(arrayType));
CheckNotNull(arrayType.ElType);
CheckEquals(x_complexType_SampleCollectionComplexType,tr.GetExternalName(arrayType.ElType));
CheckEquals(x_field,tr.GetArrayItemName(arrayType));
CheckEquals(x_field,tr.GetArrayItemExternalName(arrayType));
nestedClassName := Format('%s_%s_Type',[x_complexType_SampleCollectionItemType,x_Item]);
elt := tr.FindElement(nestedClassName);
CheckNotNull(elt,nestedClassName);
CheckEquals(nestedClassName,elt.Name,'Item Name');
CheckEquals(nestedClassName,tr.GetExternalName(elt),'Item ExternalName');
CheckIs(elt,TPasClassType);
clsType := elt as TPasClassType;
prpLs.Clear();
for i := 0 to Pred(clsType.Members.Count) do begin
if TPasElement(clsType.Members[i]).InheritsFrom(TPasProperty) then
prpLs.Add(clsType.Members[i]);
end;
CheckEquals(8,prpLs.Count);
CheckProperty(x_intField,'int',ptField);
CheckProperty(x_strField,'string',ptField);
CheckProperty(x_floatField,'float',ptField);
CheckProperty(x_byteField,'byte',ptField);
CheckProperty(x_charField,'char',ptField);
CheckProperty(x_longField,'long',ptField);
CheckProperty(x_strAtt,'string',ptAttribute);
CheckProperty(x_intAtt,'int',ptAttribute);
elt := tr.FindElement(x_complexType_SampleCollectionItemType);
CheckNotNull(elt,x_complexType_SampleCollectionItemType);
CheckEquals(x_complexType_SampleCollectionItemType,elt.Name, 'Array name');
CheckEquals(x_complexType_SampleCollectionItemType,tr.GetExternalName(elt), 'Array external name');
CheckIs(elt,TPasArrayType);
arrayType := elt as TPasArrayType;
Check(tr.IsCollection(arrayType));
CheckNotNull(arrayType.ElType);
CheckEquals(nestedClassName,tr.GetExternalName(arrayType.ElType));
CheckEquals(x_Item,tr.GetArrayItemExternalName(arrayType));
finally
FreeAndNil(prpLs);
end;
end;
procedure TTest_CustomXsdParser.pascal_class_default_parent();
var
tr : TwstPasTreeContainer;
mdl : TPasModule;
clsType : TPasClassType;
elt : TPasElement;
begin
tr := LoadComplexType_pascal_class_parent();
try
mdl := tr.FindModule(x_targetNamespace);
CheckNotNull(mdl);
elt := tr.FindElement(x_complexType_SampleClass);
CheckNotNull(elt,x_complexType_SampleClass);
CheckEquals(x_complexType_SampleClass,elt.Name);
CheckEquals(x_complexType_SampleClass,tr.GetExternalName(elt));
CheckIs(elt,TPasClassType);
clsType := elt as TPasClassType;
CheckNotNull(clsType.AncestorType,'AncestorType is null');
CheckSame(tr.FindElementNS('TBaseComplexRemotable',sXSD_NS),clsType.AncestorType);
finally
tr.Free();
end;
end;
procedure TTest_CustomXsdParser.ComplexType_Class_default_values();
var var
tr : TwstPasTreeContainer; tr : TwstPasTreeContainer;
clsType : TPasClassType; clsType : TPasClassType;
@@ -1198,6 +1343,16 @@ begin
Result := ParseDoc(x_complexType_array_sequence_embedded); Result := ParseDoc(x_complexType_array_sequence_embedded);
end; end;
function TTest_XsdParser.LoadComplexType_CollectionSequence_Schema() : TwstPasTreeContainer;
begin
Result := ParseDoc(x_complexType_array_sequence_collection);
end;
function TTest_XsdParser.LoadComplexType_pascal_class_parent() : TwstPasTreeContainer;
begin
Result := ParseDoc('pascal_class_parent');
end;
function TTest_XsdParser.LoadComplexType_Class_default_values() : TwstPasTreeContainer; function TTest_XsdParser.LoadComplexType_Class_default_values() : TwstPasTreeContainer;
begin begin
Result := ParseDoc(x_complexType_class_default); Result := ParseDoc(x_complexType_class_default);
@@ -1286,6 +1441,16 @@ begin
Result := ParseDoc(x_complexType_array_sequence_embedded); Result := ParseDoc(x_complexType_array_sequence_embedded);
end; end;
function TTest_WsdlParser.LoadComplexType_CollectionSequence_Schema() : TwstPasTreeContainer;
begin
Result := ParseDoc(x_complexType_array_sequence_collection);
end;
function TTest_WsdlParser.LoadComplexType_pascal_class_parent() : TwstPasTreeContainer;
begin
Result := ParseDoc('pascal_class_parent');
end;
procedure TTest_WsdlParser.no_binding_style(); procedure TTest_WsdlParser.no_binding_style();
var var
symTable : TwstPasTreeContainer; symTable : TwstPasTreeContainer;

View File

@@ -52,7 +52,7 @@ type
property BoolProp : Boolean read FBoolProp write FBoolProp; property BoolProp : Boolean read FBoolProp write FBoolProp;
end; end;
TClass_AClass = class of TClass_A; TClass_AClass = class of TClass_A;
{ TRttiExpIntegerNodeItem_Test } { TRttiExpIntegerNodeItem_Test }
TRttiExpIntegerNodeItem_Test = class(TTestCase) TRttiExpIntegerNodeItem_Test = class(TTestCase)
@@ -60,7 +60,9 @@ type
procedure Create_Test(); procedure Create_Test();
procedure Evaluate_Equal(); procedure Evaluate_Equal();
procedure Evaluate_Lesser(); procedure Evaluate_Lesser();
procedure Evaluate_LesserOrEqual();
procedure Evaluate_Greater(); procedure Evaluate_Greater();
procedure Evaluate_GreaterOrEqual();
end; end;
{ TRttiExpEnumNodeItem_Test } { TRttiExpEnumNodeItem_Test }
@@ -71,7 +73,9 @@ type
procedure Evaluate_Equal(); procedure Evaluate_Equal();
procedure Evaluate_Equal_bool(); procedure Evaluate_Equal_bool();
procedure Evaluate_Lesser(); procedure Evaluate_Lesser();
procedure Evaluate_LesserOrEqual();
procedure Evaluate_Greater(); procedure Evaluate_Greater();
procedure Evaluate_GreaterOrEqual();
end; end;
{ TRttiExpAnsiStringNodeItem_Test } { TRttiExpAnsiStringNodeItem_Test }
@@ -203,6 +207,31 @@ begin
end; end;
end; end;
procedure TRttiExpIntegerNodeItem_Test.Evaluate_LesserOrEqual();
const VAL_1 : Integer = 1210;
var
x : TRttiExpIntegerNodeItem;
t : TClass_A;
begin
x := nil;
t := TClass_A.Create();
try
x := TRttiExpIntegerNodeItem.Create(GetPropInfo(t,'IntProp'),nfoLesserOrEqual,VAL_1);
t.IntProp := 0;
Check( x.Evaluate(t) = True ,'True');
t.IntProp := -VAL_1;
Check( x.Evaluate(t) = True ,'True');
t.IntProp := VAL_1 + 1;
Check( x.Evaluate(t) = False, 'False' );
finally
x.Free();
t.Free();
end;
end;
procedure TRttiExpIntegerNodeItem_Test.Evaluate_Greater(); procedure TRttiExpIntegerNodeItem_Test.Evaluate_Greater();
const VAL_1 : Integer = 1210; const VAL_1 : Integer = 1210;
var var
@@ -225,6 +254,31 @@ begin
end; end;
end; end;
procedure TRttiExpIntegerNodeItem_Test.Evaluate_GreaterOrEqual();
const VAL_1 : Integer = 1210;
var
x : TRttiExpIntegerNodeItem;
t : TClass_A;
begin
x := nil;
t := TClass_A.Create();
try
x := TRttiExpIntegerNodeItem.Create(GetPropInfo(t,'IntProp'),nfoGreaterOrEqual,VAL_1);
t.IntProp := 0;
Check( x.Evaluate(t) = False, 'False' );
t.IntProp := VAL_1;
Check( x.Evaluate(t) = True ,'True');
t.IntProp := VAL_1 + 1;
Check( x.Evaluate(t) = True ,'True');
finally
x.Free();
t.Free();
end;
end;
{ TRttiExpNode_Test } { TRttiExpNode_Test }
@@ -1250,6 +1304,31 @@ begin
end; end;
end; end;
procedure TRttiExpEnumNodeItem_Test.Evaluate_LesserOrEqual();
const VAL_1 : TSampleEnum = SampleEnum_C;
var
x : TRttiExpEnumNodeItem;
t : TClass_A;
begin
x := nil;
t := TClass_A.Create();
try
x := TRttiExpEnumNodeItem.Create(GetPropInfo(t,'EnumProp'),nfoLesserOrEqual,GetEnumName(TypeInfo(TSampleEnum),Ord(VAL_1)));
t.EnumProp := SampleEnum_D;
Check( x.Evaluate(t) = False ,'False');
t.EnumProp := SampleEnum_B;
Check( x.Evaluate(t) = True, 'True' );
t.EnumProp := VAL_1;
Check( x.Evaluate(t) = True, 'True' );
finally
x.Free();
t.Free();
end;
end;
procedure TRttiExpEnumNodeItem_Test.Evaluate_Greater(); procedure TRttiExpEnumNodeItem_Test.Evaluate_Greater();
const VAL_1 : TSampleEnum = SampleEnum_C; const VAL_1 : TSampleEnum = SampleEnum_C;
var var
@@ -1272,6 +1351,31 @@ begin
end; end;
end; end;
procedure TRttiExpEnumNodeItem_Test.Evaluate_GreaterOrEqual();
const VAL_1 : TSampleEnum = SampleEnum_C;
var
x : TRttiExpEnumNodeItem;
t : TClass_A;
begin
x := nil;
t := TClass_A.Create();
try
x := TRttiExpEnumNodeItem.Create(GetPropInfo(t,'EnumProp'),nfoGreaterOrEqual,GetEnumName(TypeInfo(TSampleEnum),Ord(VAL_1)));
t.EnumProp := SampleEnum_A;
Check( x.Evaluate(t) = False ,'False');
t.EnumProp := SampleEnum_D;
Check( x.Evaluate(t) = True, 'True' );
t.EnumProp := VAL_1;
Check( x.Evaluate(t) = True, 'True' );
finally
x.Free();
t.Free();
end;
end;
Initialization Initialization
RegisterTest('Cursors',TRttiExpIntegerNodeItem_Test.Suite); RegisterTest('Cursors',TRttiExpIntegerNodeItem_Test.Suite);
RegisterTest('Cursors',TRttiExpEnumNodeItem_Test.Suite); RegisterTest('Cursors',TRttiExpEnumNodeItem_Test.Suite);

View File

@@ -351,6 +351,31 @@ type
procedure SetEncodedString(); procedure SetEncodedString();
end; end;
{ TClass_A_CollectionRemotable }
TClass_A_CollectionRemotable = class(TObjectCollectionRemotable)
private
function GetItem(AIndex : PtrInt) : TClass_A;
public
class function GetItemClass():TBaseRemotableClass;override;
function Add(): TClass_A;{$IFDEF USE_INLINE}inline;{$ENDIF}
function AddAt(const APosition : PtrInt): TClass_A;{$IFDEF USE_INLINE}inline;{$ENDIF}
property Item[AIndex:PtrInt] : TClass_A read GetItem;default;
end;
{ TTest_TObjectCollectionRemotable }
TTest_TObjectCollectionRemotable = class(TTestCase)
published
procedure GetItemTypeInfo();
procedure Add();
procedure Delete();
procedure Equal();
procedure test_Assign();
procedure Exchange();
procedure IndexOf();
end;
implementation implementation
uses Math, basex_encode; uses Math, basex_encode;
@@ -2541,7 +2566,235 @@ begin
end; end;
end; end;
{ TClass_A_CollectionRemotable }
function TClass_A_CollectionRemotable.GetItem(AIndex : PtrInt) : TClass_A;
begin
Result := TClass_A(inherited Item[AIndex]);
end;
class function TClass_A_CollectionRemotable.GetItemClass() : TBaseRemotableClass;
begin
Result := TClass_A;
end;
function TClass_A_CollectionRemotable.Add() : TClass_A;
begin
Result := TClass_A(inherited Add());
end;
function TClass_A_CollectionRemotable.AddAt(const APosition : PtrInt) : TClass_A;
begin
Result := TClass_A(inherited AddAt(APosition));
end;
{ TTest_TObjectCollectionRemotable }
procedure TTest_TObjectCollectionRemotable.GetItemTypeInfo();
begin
CheckEquals(
PtrUInt(TClass_A_CollectionRemotable.GetItemClass().ClassInfo),
PtrUInt(TClass_A_CollectionRemotable.GetItemTypeInfo())
);
end;
procedure TTest_TObjectCollectionRemotable.Add();
var
ls : TClass_A_CollectionRemotable;
aa,ab : TClass_A;
begin
ls := TClass_A_CollectionRemotable.Create();
try
aa := ls.Add();
CheckNotNull(aa);
CheckEquals(1,ls.Length);
CheckSame(aa, ls[0]);
ab := ls.Add();
CheckNotNull(ab);
CheckEquals(2,ls.Length);
CheckSame(ab, ls[1]);
finally
ls.Free();
end;
end;
procedure TTest_TObjectCollectionRemotable.Delete();
var
ls : TClass_A_CollectionRemotable;
aa,ab : TClass_A;
ok : Boolean;
begin
ls := TClass_A_CollectionRemotable.Create();
try
ok := False;
try
ls.Delete(-112);
except
ok := True;
end;
Check(ok);
ok := False;
try
ls.Delete(0);
except
ok := True;
end;
Check(ok);
ok := False;
try
ls.Delete(112);
except
ok := True;
end;
Check(ok);
aa := ls.Add();
ls.Delete(0);
CheckEquals(0,ls.Length);
aa := ls.Add();
ab := ls.Add();
ls.Delete(0);
CheckEquals(1,ls.Length);
CheckSame(ab,ls[0]);
FreeAndNil(ls);
ls := TClass_A_CollectionRemotable.Create();
aa := ls.Add();
ab := ls.Add();
ls.Delete(1);
CheckEquals(1,ls.Length);
CheckSame(aa,ls[0]);
finally
ls.Free();
end;
end;
procedure TTest_TObjectCollectionRemotable.Equal();
var
a, b : TClass_A_CollectionRemotable;
begin
b := nil;
a := TClass_A_CollectionRemotable.Create();
try
b := TClass_A_CollectionRemotable.Create();
Check(a.Equal(b));
Check(b.Equal(a));
a.Add().Val_16S := 1;
a.Add().Val_16S := 2;
Check(not a.Equal(nil));
Check(a.Equal(a));
Check(not a.Equal(b));
Check(not b.Equal(a));
b.Add().Val_16S := 1;
Check(not a.Equal(b));
Check(not b.Equal(a));
b.Add().Val_16S := 2;
Check(a.Equal(b));
Check(b.Equal(a));
finally
b.Free();
a.Free();
end;
end;
procedure TTest_TObjectCollectionRemotable.test_Assign();
procedure Check_List(Aa, Ab : TClass_A_CollectionRemotable);
var
k : PtrInt;
begin
if ( Aa = nil ) then begin
CheckNull(Ab);
end else begin
CheckNotNull(Ab);
CheckEquals(Aa.Length,Ab.Length);
if ( Aa.Length > 0 ) then begin
for k := 0 to Pred(Aa.Length) do begin
Check(Aa[k].Equal(Ab[k]));
end;
end;
end;
end;
var
a, b : TClass_A_CollectionRemotable;
begin
b := nil;
a := TClass_A_CollectionRemotable.Create();
try
b := TClass_A_CollectionRemotable.Create();
Check_List(a,b);
a.Add().Val_16S := 1;
a.Add().Val_16S := 2;
b.Assign(a);
Check_List(a,b);
b.Add().Val_16S := 3;
a.Assign(b);
Check_List(a,b);
a.Clear();
b.Assign(a);
Check_List(a,b);
finally
b.Free();
a.Free();
end;
end;
procedure TTest_TObjectCollectionRemotable.Exchange();
var
ls : TClass_A_CollectionRemotable;
a, b, c : TClass_A;
begin
ls := TClass_A_CollectionRemotable.Create();
try
a := ls.Add();
ls.Exchange(0,0);
CheckSame(a,ls[0]);
b := ls.Add();
ls.Exchange(0,1);
CheckSame(a,ls[1]);
CheckSame(b,ls[0]);
c := ls.Add();
ls.Exchange(0,2);
CheckSame(c,ls[0]);
CheckSame(b,ls[2]);
finally
ls.Free();
end;
end;
procedure TTest_TObjectCollectionRemotable.IndexOf();
var
ls : TClass_A_CollectionRemotable;
begin
ls := TClass_A_CollectionRemotable.Create();
try
CheckEquals(-1, ls.IndexOf(nil));
ls.Add();
CheckEquals(-1, ls.IndexOf(nil));
CheckEquals(0, ls.IndexOf(ls[0]));
ls.Add();
CheckEquals(-1, ls.IndexOf(nil));
CheckEquals(0, ls.IndexOf(ls[0]));
CheckEquals(1, ls.IndexOf(ls[1]));
ls.Add();
CheckEquals(-1, ls.IndexOf(nil));
CheckEquals(0, ls.IndexOf(ls[0]));
CheckEquals(1, ls.IndexOf(ls[1]));
CheckEquals(2, ls.IndexOf(ls[2]));
finally
ls.Free();
end;
end;
initialization initialization
RegisterTest('Support',TTest_TObjectCollectionRemotable.Suite);
RegisterTest('Support',TTest_TBaseComplexRemotable.Suite); RegisterTest('Support',TTest_TBaseComplexRemotable.Suite);
RegisterTest('Support',TTest_TStringBufferRemotable.Suite); RegisterTest('Support',TTest_TStringBufferRemotable.Suite);
RegisterTest('Support-Date',TTest_TDateRemotable.Suite); RegisterTest('Support-Date',TTest_TDateRemotable.Suite);

View File

@@ -34,6 +34,13 @@ type
public public
class function GetItemClass():TBaseRemotableClass;override; class function GetItemClass():TBaseRemotableClass;override;
end; end;
{ TTClass_A_CollectionRemotable }
TTClass_A_CollectionRemotable = class(TObjectCollectionRemotable)
public
class function GetItemClass():TBaseRemotableClass;override;
end;
{ TClass_B } { TClass_B }
@@ -69,12 +76,21 @@ type
procedure All(); procedure All();
end; end;
{ TObjectCollectionRemotableCursor_Test }
TObjectCollectionRemotableCursor_Test = class(TTestCase)
published
procedure All();
end;
{ TUtilsProcs_Test } { TUtilsProcs_Test }
TUtilsProcs_Test = class(TTestCase) TUtilsProcs_Test = class(TTestCase)
published published
procedure test_Find(); procedure test_Find_array();
procedure test_Filter(); procedure test_Find_collection();
procedure test_Filter_array();
procedure test_Filter_collection();
end; end;
implementation implementation
@@ -277,7 +293,7 @@ end;
{ TUtilsProcs_Test } { TUtilsProcs_Test }
procedure TUtilsProcs_Test.test_Find(); procedure TUtilsProcs_Test.test_Find_array();
const O_COUNT : PtrInt = 10; const O_COUNT : PtrInt = 10;
var var
ls : TTClass_A_ArrayRemotable; ls : TTClass_A_ArrayRemotable;
@@ -306,14 +322,43 @@ begin
end; end;
end; end;
procedure TUtilsProcs_Test.test_Filter(); procedure TUtilsProcs_Test.test_Find_collection();
const O_COUNT : PtrInt = 10;
var
ls : TTClass_A_CollectionRemotable;
i : PtrInt;
begin
ls := TTClass_A_CollectionRemotable.Create();
try
CheckNull(Find(ls,''));
CheckNull(Find(ls,'IntProp = 12'));
ls.Add();
CheckSame(ls[0], Find(ls,''));
CheckSame(ls[0], Find(ls,'IntProp = 0'));
CheckNull(Find(ls,'IntProp = 12'));
ls.Clear();
for i := 0 to ( O_COUNT - 1 ) do
TClass_A(ls.Add()).FIntProp := i;
CheckSame(ls[0], Find(ls,''));
CheckSame(ls[0], Find(ls,'IntProp = 0'));
CheckNull(Find(ls,Format('IntProp = %d',[2*O_COUNT])));
for i := 0 to ( O_COUNT - 1 ) do
CheckSame(ls[i],Find(ls,Format('IntProp = %d',[i])));
finally
ls.Free();
end;
end;
procedure TUtilsProcs_Test.test_Filter_array();
const O_COUNT : PtrInt = 10; const O_COUNT : PtrInt = 10;
var var
ls : TTClass_A_ArrayRemotable; ls : TTClass_A_ArrayRemotable;
i : PtrInt; i : PtrInt;
crs : IObjectCursor; crs : IObjectCursor;
begin begin
CheckNull(Filter(nil,''), 'filter(nil) = nil'); CheckNull(Filter(TTClass_A_ArrayRemotable(nil),''), 'filter(nil) = nil');
ls := TTClass_A_ArrayRemotable.Create(); ls := TTClass_A_ArrayRemotable.Create();
try try
crs := Filter(ls,''); crs := Filter(ls,'');
@@ -346,9 +391,120 @@ begin
end; end;
end; end;
procedure TUtilsProcs_Test.test_Filter_collection();
const O_COUNT : PtrInt = 10;
var
ls : TTClass_A_CollectionRemotable;
i : PtrInt;
crs : IObjectCursor;
begin
CheckNull(Filter(TTClass_A_CollectionRemotable(nil),''), 'filter(nil) = nil');
ls := TTClass_A_CollectionRemotable.Create();
try
crs := Filter(ls,'');
Check( ( crs <> nil ) );
crs.Reset();
Check(not crs.MoveNext());
ls.Clear();
for i := 0 to ( O_COUNT - 1 ) do
TClass_A(ls.Add()).FIntProp := i;
crs := Filter(ls,'');
Check( ( crs <> nil ) );
crs.Reset();
for i := 0 to ( O_COUNT - 1 ) do begin
Check(crs.MoveNext());
CheckSame(ls[i], crs.GetCurrent());
end;
Check(not crs.MoveNext());
for i := 0 to ( O_COUNT - 1 ) do begin
crs := Filter(ls,Format('IntProp = %d',[i]));
Check( ( crs <> nil ) );
crs.Reset();
Check(crs.MoveNext());
CheckSame(ls[i], crs.GetCurrent());
Check(not crs.MoveNext());
end;
finally
ls.Free();
end;
end;
{ TTClass_A_CollectionRemotable }
class function TTClass_A_CollectionRemotable.GetItemClass() : TBaseRemotableClass;
begin
Result := TClass_A;
end;
{ TObjectCollectionRemotableCursor_Test }
procedure TObjectCollectionRemotableCursor_Test.All();
const O_COUNT = 100;
var
x : IObjectCursor;
ls : TObjectCollectionRemotable;
c, i : PtrInt;
begin
ls := TTClass_A_CollectionRemotable.Create();
try
x := TObjectCollectionRemotableCursor.Create(ls);
x.Reset();
CheckEquals(False,x.MoveNext());
x.Reset();
CheckEquals(False,x.MoveNext());
CheckEquals(False,x.MoveNext());
try
x.GetCurrent();
Check(False);
except
on e : ECursorException do begin
// GOOD
end;
end;
ls.Add();
x.Reset();
CheckEquals(True,x.MoveNext());
CheckSame(ls[0],x.GetCurrent());
CheckEquals(False,x.MoveNext());
try
x.GetCurrent();
Check(False);
except
on e : ECursorException do begin
// GOOD
end;
end;
x.Reset();
CheckEquals(True,x.MoveNext());
CheckSame(ls[0],x.GetCurrent());
CheckEquals(False,x.MoveNext());
ls.Clear();
for i := 0 to Pred(O_COUNT) do
TClass_A(ls.Add()).FIntProp := i;
x.Reset();
for i := 0 to Pred(O_COUNT) do begin
CheckEquals(True,x.MoveNext());
CheckSame(ls[i],x.GetCurrent());
end;
CheckEquals(False,x.MoveNext());
x.Reset();
for i := 0 to Pred(O_COUNT) do begin
CheckEquals(True,x.MoveNext());
CheckSame(ls[i],x.GetCurrent());
end;
finally
ls.Free();
end;
end;
initialization initialization
RegisterTest('Cursors',TBaseObjectArrayRemotableCursor_Test.Suite); RegisterTest('Cursors',TBaseObjectArrayRemotableCursor_Test.Suite);
RegisterTest('Cursors',TBaseObjectArrayRemotableFilterableCursor_Test.Suite); RegisterTest('Cursors',TBaseObjectArrayRemotableFilterableCursor_Test.Suite);
RegisterTest('Cursors',TObjectCollectionRemotableCursor_Test.Suite);
RegisterTest('Cursors',TUtilsProcs_Test.Suite); RegisterTest('Cursors',TUtilsProcs_Test.Suite);
end. end.

View File

@@ -26,7 +26,7 @@
<PackageName Value="FPCUnitTestRunner"/> <PackageName Value="FPCUnitTestRunner"/>
</Item1> </Item1>
</RequiredPackages> </RequiredPackages>
<Units Count="35"> <Units Count="38">
<Unit0> <Unit0>
<Filename Value="wst_test_suite.lpr"/> <Filename Value="wst_test_suite.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
@@ -202,6 +202,21 @@
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="test_suite_utils"/> <UnitName Value="test_suite_utils"/>
</Unit34> </Unit34>
<Unit35>
<Filename Value="test_std_cursors.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_std_cursors"/>
</Unit35>
<Unit36>
<Filename Value="test_rtti_filter.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_rtti_filter"/>
</Unit36>
<Unit37>
<Filename Value="test_wst_cursors.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_wst_cursors"/>
</Unit37>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View File

@@ -1,7 +1,6 @@
{$INCLUDE wst_global.inc}
program wst_test_suite; program wst_test_suite;
{$mode objfpc}{$H+}
{$DEFINE UseCThreads} {$DEFINE UseCThreads}
uses uses
@@ -19,7 +18,8 @@ uses
server_service_xmlrpc, test_parsers, wsdl_generator, xsd_generator, server_service_xmlrpc, test_parsers, wsdl_generator, xsd_generator,
xsd_consts, base_json_formatter, wsdl_parser, test_support, basex_encode, xsd_consts, base_json_formatter, wsdl_parser, test_support, basex_encode,
test_basex_encode, json_formatter, server_service_json, test_json, test_basex_encode, json_formatter, server_service_json, test_json,
test_suite_utils, test_generators; test_suite_utils, test_generators, test_std_cursors, test_rtti_filter,
test_wst_cursors;
Const Const
ShortOpts = 'alh'; ShortOpts = 'alh';

View File

@@ -34,7 +34,7 @@
<PackageName Value="fpcunittestrunner"/> <PackageName Value="fpcunittestrunner"/>
</Item3> </Item3>
</RequiredPackages> </RequiredPackages>
<Units Count="10"> <Units Count="16">
<Unit0> <Unit0>
<Filename Value="wst_test_suite_gui.lpr"/> <Filename Value="wst_test_suite_gui.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
@@ -85,6 +85,36 @@
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="test_suite_utils"/> <UnitName Value="test_suite_utils"/>
</Unit9> </Unit9>
<Unit10>
<Filename Value="test_std_cursors.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_std_cursors"/>
</Unit10>
<Unit11>
<Filename Value="test_rtti_filter.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_rtti_filter"/>
</Unit11>
<Unit12>
<Filename Value="..\..\wst_rtti_filter\rtti_filters.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="rtti_filters"/>
</Unit12>
<Unit13>
<Filename Value="..\..\wst_rtti_filter\wst_cursors.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="wst_cursors"/>
</Unit13>
<Unit14>
<Filename Value="test_wst_cursors.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_wst_cursors"/>
</Unit14>
<Unit15>
<Filename Value="wst_collections.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="wst_collections"/>
</Unit15>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View File

@@ -16,7 +16,8 @@ uses
server_service_xmlrpc, test_parsers, wsdl_generator, xsd_generator, server_service_xmlrpc, test_parsers, wsdl_generator, xsd_generator,
xsd_consts, base_json_formatter, wsdl_parser, test_support, basex_encode, xsd_consts, base_json_formatter, wsdl_parser, test_support, basex_encode,
test_basex_encode, json_formatter, server_service_json, test_json, test_basex_encode, json_formatter, server_service_json, test_json,
test_suite_utils, test_generators, fpcunittestrunner; test_suite_utils, test_generators, fpcunittestrunner, test_std_cursors,
test_rtti_filter, rtti_filters, wst_cursors, test_wst_cursors;
begin begin
Application.Initialize; Application.Initialize;

View File

@@ -25,10 +25,10 @@
</RunParams> </RunParams>
<RequiredPackages Count="2"> <RequiredPackages Count="2">
<Item1> <Item1>
<PackageName Value="LCL"/> <PackageName Value="SynEdit"/>
</Item1> </Item1>
<Item2> <Item2>
<PackageName Value="SynEdit"/> <PackageName Value="LCL"/>
</Item2> </Item2>
</RequiredPackages> </RequiredPackages>
<Units Count="24"> <Units Count="24">

View File

@@ -1,19 +1,24 @@
object fBindingEdit: TfBindingEdit object fBindingEdit: TfBindingEdit
Left = 759 Left = 759
Height = 354 Height = 335
Top = 90 Top = 91
Width = 400 Width = 400
HorzScrollBar.Page = 399 HorzScrollBar.Page = 399
VertScrollBar.Page = 353 VertScrollBar.Page = 334
ActiveControl = edtName ActiveControl = edtName
BorderStyle = bsSizeToolWin BorderStyle = bsSizeToolWin
Caption = 'fBindingEdit' Caption = 'fBindingEdit'
ClientHeight = 335
ClientWidth = 400
Position = poMainFormCenter Position = poMainFormCenter
LCLVersion = '0.9.25'
object Panel1: TPanel object Panel1: TPanel
Height = 50 Height = 50
Top = 304 Top = 285
Width = 400 Width = 400
Align = alBottom Align = alBottom
ClientHeight = 50
ClientWidth = 400
TabOrder = 0 TabOrder = 0
object Button1: TButton object Button1: TButton
Left = 224 Left = 224
@@ -40,7 +45,7 @@ object fBindingEdit: TfBindingEdit
end end
end end
object PageControl1: TPageControl object PageControl1: TPageControl
Height = 304 Height = 285
Width = 400 Width = 400
ActivePage = TabSheet1 ActivePage = TabSheet1
Align = alClient Align = alClient
@@ -48,13 +53,14 @@ object fBindingEdit: TfBindingEdit
TabOrder = 1 TabOrder = 1
object TabSheet1: TTabSheet object TabSheet1: TTabSheet
Caption = 'Interface Binding' Caption = 'Interface Binding'
ClientHeight = 259
ClientWidth = 392
object Label1: TLabel object Label1: TLabel
Left = 12 Left = 12
Height = 14 Height = 14
Top = 26 Top = 26
Width = 28 Width = 28
Caption = 'Name' Caption = 'Name'
Color = clNone
ParentColor = False ParentColor = False
end end
object Label2: TLabel object Label2: TLabel
@@ -63,14 +69,13 @@ object fBindingEdit: TfBindingEdit
Top = 98 Top = 98
Width = 40 Width = 40
Caption = 'Address' Caption = 'Address'
Color = clNone
ParentColor = False ParentColor = False
end end
object edtName: TEdit object edtName: TEdit
Left = 12 Left = 12
Height = 23 Height = 23
Top = 50 Top = 50
Width = 356 Width = 348
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
TabOrder = 0 TabOrder = 0
Text = 'edtName' Text = 'edtName'
@@ -79,16 +84,17 @@ object fBindingEdit: TfBindingEdit
Left = 12 Left = 12
Height = 23 Height = 23
Top = 114 Top = 114
Width = 356 Width = 348
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
TabOrder = 1 TabOrder = 1
Text = 'edtAddress' Text = 'edtAddress'
end end
object edtStyle: TRadioGroup object edtStyle: TRadioGroup
Left = 12 Left = 12
Height = 92 Height = 81
Top = 165 Top = 165
Width = 360 Width = 352
Anchors = [akTop, akLeft, akRight, akBottom]
AutoFill = True AutoFill = True
Caption = ' Style ' Caption = ' Style '
ChildSizing.LeftRightSpacing = 6 ChildSizing.LeftRightSpacing = 6
@@ -99,6 +105,8 @@ object fBindingEdit: TfBindingEdit
ChildSizing.ShrinkVertical = crsScaleChilds ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2 ChildSizing.ControlsPerLine = 2
ClientHeight = 63
ClientWidth = 348
Columns = 2 Columns = 2
Items.Strings = ( Items.Strings = (
'Document' 'Document'

View File

@@ -1,37 +1,40 @@
{ Ceci est un fichier ressource g�n�r� automatiquement par Lazarus } { Ceci est un fichier ressource g�n�r� automatiquement par Lazarus }
LazarusResources.Add('TfBindingEdit','FORMDATA',[ LazarusResources.Add('TfBindingEdit','FORMDATA',[
'TPF0'#13'TfBindingEdit'#12'fBindingEdit'#4'Left'#3#247#2#6'Height'#3'b'#1#3 'TPF0'#13'TfBindingEdit'#12'fBindingEdit'#4'Left'#3#247#2#6'Height'#3'O'#1#3
+'Top'#2'Z'#5'Width'#3#144#1#18'HorzScrollBar.Page'#3#143#1#18'VertScrollBar.' +'Top'#2'['#5'Width'#3#144#1#18'HorzScrollBar.Page'#3#143#1#18'VertScrollBar.'
+'Page'#3'a'#1#13'ActiveControl'#7#7'edtName'#11'BorderStyle'#7#13'bsSizeTool' +'Page'#3'N'#1#13'ActiveControl'#7#7'edtName'#11'BorderStyle'#7#13'bsSizeTool'
+'Win'#7'Caption'#6#12'fBindingEdit'#8'Position'#7#16'poMainFormCenter'#0#6'T' +'Win'#7'Caption'#6#12'fBindingEdit'#12'ClientHeight'#3'O'#1#11'ClientWidth'#3
+'Panel'#6'Panel1'#6'Height'#2'2'#3'Top'#3'0'#1#5'Width'#3#144#1#5'Align'#7#8 +#144#1#8'Position'#7#16'poMainFormCenter'#10'LCLVersion'#6#6'0.9.25'#0#6'TPa'
+'alBottom'#8'TabOrder'#2#0#0#7'TButton'#7'Button1'#4'Left'#3#224#0#6'Height' +'nel'#6'Panel1'#6'Height'#2'2'#3'Top'#3#29#1#5'Width'#3#144#1#5'Align'#7#8'a'
+#2#25#3'Top'#2#10#5'Width'#2'K'#6'Action'#7#5'actOK'#7'Anchors'#11#5'akTop'#7 +'lBottom'#12'ClientHeight'#2'2'#11'ClientWidth'#3#144#1#8'TabOrder'#2#0#0#7
+'akRight'#0#25'BorderSpacing.InnerBorder'#2#4#7'Default'#9#8'TabOrder'#2#0#0 +'TButton'#7'Button1'#4'Left'#3#224#0#6'Height'#2#25#3'Top'#2#10#5'Width'#2'K'
+#0#7'TButton'#7'Button2'#4'Left'#3'8'#1#6'Height'#2#25#3'Top'#2#10#5'Width'#2 +#6'Action'#7#5'actOK'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.I'
+'K'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#4#6 +'nnerBorder'#2#4#7'Default'#9#8'TabOrder'#2#0#0#0#7'TButton'#7'Button2'#4'Le'
+'Cancel'#9#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#1#0#0#0 +'ft'#3'8'#1#6'Height'#2#25#3'Top'#2#10#5'Width'#2'K'#7'Anchors'#11#5'akTop'#7
+#12'TPageControl'#12'PageControl1'#6'Height'#3'0'#1#5'Width'#3#144#1#10'Acti' +'akRight'#0#25'BorderSpacing.InnerBorder'#2#4#6'Cancel'#9#7'Caption'#6#6'Can'
+'vePage'#7#9'TabSheet1'#5'Align'#7#8'alClient'#8'TabIndex'#2#0#8'TabOrder'#2 +'cel'#11'ModalResult'#2#2#8'TabOrder'#2#1#0#0#0#12'TPageControl'#12'PageCont'
+#1#0#9'TTabSheet'#9'TabSheet1'#7'Caption'#6#17'Interface Binding'#0#6'TLabel' +'rol1'#6'Height'#3#29#1#5'Width'#3#144#1#10'ActivePage'#7#9'TabSheet1'#5'Ali'
+#6'Label1'#4'Left'#2#12#6'Height'#2#14#3'Top'#2#26#5'Width'#2#28#7'Caption'#6 +'gn'#7#8'alClient'#8'TabIndex'#2#0#8'TabOrder'#2#1#0#9'TTabSheet'#9'TabSheet'
+#4'Name'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#6'Label2'#4'Le' +'1'#7'Caption'#6#17'Interface Binding'#12'ClientHeight'#3#3#1#11'ClientWidth'
+'ft'#2#12#6'Height'#2#14#3'Top'#2'b'#5'Width'#2'('#7'Caption'#6#7'Address'#5 +#3#136#1#0#6'TLabel'#6'Label1'#4'Left'#2#12#6'Height'#2#14#3'Top'#2#26#5'Wid'
+'Color'#7#6'clNone'#11'ParentColor'#8#0#0#5'TEdit'#7'edtName'#4'Left'#2#12#6 +'th'#2#28#7'Caption'#6#4'Name'#11'ParentColor'#8#0#0#6'TLabel'#6'Label2'#4'L'
+'Height'#2#23#3'Top'#2'2'#5'Width'#3'd'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7 +'eft'#2#12#6'Height'#2#14#3'Top'#2'b'#5'Width'#2'('#7'Caption'#6#7'Address'
+'akRight'#0#8'TabOrder'#2#0#4'Text'#6#7'edtName'#0#0#5'TEdit'#10'edtAddress' +#11'ParentColor'#8#0#0#5'TEdit'#7'edtName'#4'Left'#2#12#6'Height'#2#23#3'Top'
+#4'Left'#2#12#6'Height'#2#23#3'Top'#2'r'#5'Width'#3'd'#1#7'Anchors'#11#5'akT' +#2'2'#5'Width'#3'\'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'TabOrd'
+'op'#6'akLeft'#7'akRight'#0#8'TabOrder'#2#1#4'Text'#6#10'edtAddress'#0#0#11 +'er'#2#0#4'Text'#6#7'edtName'#0#0#5'TEdit'#10'edtAddress'#4'Left'#2#12#6'Hei'
+'TRadioGroup'#8'edtStyle'#4'Left'#2#12#6'Height'#2'\'#3'Top'#3#165#0#5'Width' +'ght'#2#23#3'Top'#2'r'#5'Width'#3'\'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'ak'
+#3'h'#1#8'AutoFill'#9#7'Caption'#6#9' Style '#28'ChildSizing.LeftRightSpac' +'Right'#0#8'TabOrder'#2#1#4'Text'#6#10'edtAddress'#0#0#11'TRadioGroup'#8'edt'
+'ing'#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29'ChildSizing.EnlargeHorizon' +'Style'#4'Left'#2#12#6'Height'#2'Q'#3'Top'#3#165#0#5'Width'#3'`'#1#7'Anchors'
+'tal'#7#24'crsHomogenousChildResize'#27'ChildSizing.EnlargeVertical'#7#24'cr' +#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'AutoFill'#9#7'Caption'#6#9
+'sHomogenousChildResize'#28'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChild' +' Style '#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizing.TopBottomSpa'
+'s'#26'ChildSizing.ShrinkVertical'#7#14'crsScaleChilds'#18'ChildSizing.Layou' +'cing'#2#6#29'ChildSizing.EnlargeHorizontal'#7#24'crsHomogenousChildResize'
+'t'#7#29'cclLeftToRightThenTopToBottom'#27'ChildSizing.ControlsPerLine'#2#2#7 +#27'ChildSizing.EnlargeVertical'#7#24'crsHomogenousChildResize'#28'ChildSizi'
+'Columns'#2#2#13'Items.Strings'#1#6#8'Document'#6#3'RPC'#0#8'TabOrder'#2#2#0 +'ng.ShrinkHorizontal'#7#14'crsScaleChilds'#26'ChildSizing.ShrinkVertical'#7
+#0#0#0#11'TActionList'#2'AL'#4'left'#2'U'#3'top'#2'd'#0#7'TAction'#5'actOK'#7 +#14'crsScaleChilds'#18'ChildSizing.Layout'#7#29'cclLeftToRightThenTopToBotto'
+'Caption'#6#2'OK'#18'DisableIfNoHandler'#9#9'OnExecute'#7#12'actOKExecute'#8 +'m'#27'ChildSizing.ControlsPerLine'#2#2#12'ClientHeight'#2'?'#11'ClientWidth'
+'OnUpdate'#7#11'actOKUpdate'#0#0#0#0 +#3'\'#1#7'Columns'#2#2#13'Items.Strings'#1#6#8'Document'#6#3'RPC'#0#8'TabOrd'
+'er'#2#2#0#0#0#0#11'TActionList'#2'AL'#4'left'#2'U'#3'top'#2'd'#0#7'TAction'
+#5'actOK'#7'Caption'#6#2'OK'#18'DisableIfNoHandler'#9#9'OnExecute'#7#12'actO'
+'KExecute'#8'OnUpdate'#7#11'actOKUpdate'#0#0#0#0
]); ]);

View File

@@ -1,19 +1,24 @@
object fArrayEdit: TfArrayEdit object fArrayEdit: TfArrayEdit
Left = 327 Left = 327
Height = 361 Height = 375
Top = 131 Top = 132
Width = 392 Width = 392
HorzScrollBar.Page = 391 HorzScrollBar.Page = 391
VertScrollBar.Page = 360 VertScrollBar.Page = 374
ActiveControl = Button1 ActiveControl = Button1
BorderStyle = bsSizeToolWin BorderStyle = bsSizeToolWin
Caption = 'fArrayEdit' Caption = 'fArrayEdit'
ClientHeight = 375
ClientWidth = 392
Position = poMainFormCenter Position = poMainFormCenter
LCLVersion = '0.9.25'
object Panel1: TPanel object Panel1: TPanel
Height = 50 Height = 50
Top = 311 Top = 325
Width = 392 Width = 392
Align = alBottom Align = alBottom
ClientHeight = 50
ClientWidth = 392
TabOrder = 0 TabOrder = 0
object Button1: TButton object Button1: TButton
Left = 216 Left = 216
@@ -39,7 +44,7 @@ object fArrayEdit: TfArrayEdit
end end
end end
object PageControl1: TPageControl object PageControl1: TPageControl
Height = 311 Height = 325
Width = 392 Width = 392
ActivePage = TabSheet1 ActivePage = TabSheet1
Align = alClient Align = alClient
@@ -47,46 +52,45 @@ object fArrayEdit: TfArrayEdit
TabOrder = 1 TabOrder = 1
object TabSheet1: TTabSheet object TabSheet1: TTabSheet
Caption = 'Array definition' Caption = 'Array definition'
ClientHeight = 299
ClientWidth = 384
object Label1: TLabel object Label1: TLabel
Left = 19 Left = 20
Height = 14 Height = 14
Top = 21 Top = 21
Width = 28 Width = 28
Caption = 'Name' Caption = 'Name'
Color = clNone
ParentColor = False ParentColor = False
end end
object Label2: TLabel object Label2: TLabel
Left = 19 Left = 20
Height = 14 Height = 14
Top = 102 Top = 102
Width = 66 Width = 66
Caption = 'Element Type' Caption = 'Element Type'
Color = clNone
ParentColor = False ParentColor = False
end end
object Label3: TLabel object Label3: TLabel
Left = 19 Left = 20
Height = 14 Height = 14
Top = 170 Top = 170
Width = 69 Width = 69
Caption = 'Element Name' Caption = 'Element Name'
Color = clNone
ParentColor = False ParentColor = False
end end
object edtName: TEdit object edtName: TEdit
Left = 20 Left = 20
Height = 23 Height = 23
Top = 42 Top = 42
Width = 345 Width = 337
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
TabOrder = 0 TabOrder = 0
end end
object edtElementType: TComboBox object edtElementType: TComboBox
Left = 19 Left = 20
Height = 21 Height = 21
Top = 122 Top = 122
Width = 345 Width = 337
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending] AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
ItemHeight = 13 ItemHeight = 13
@@ -95,22 +99,30 @@ object fArrayEdit: TfArrayEdit
TabOrder = 1 TabOrder = 1
end end
object edtEmbedded: TCheckBox object edtEmbedded: TCheckBox
Left = 19 Left = 20
Height = 13 Height = 19
Top = 242 Top = 226
Width = 71 Width = 337
Caption = 'Embedded' Caption = 'Embedded ( items are expanded directly in the enclosing element )'
TabOrder = 2 TabOrder = 3
end end
object edtElementName: TEdit object edtElementName: TEdit
Left = 19 Left = 20
Height = 23 Height = 23
Top = 186 Top = 186
Width = 345 Width = 337
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
TabOrder = 3 TabOrder = 2
Text = 'Item' Text = 'Item'
end end
object edtCollection: TCheckBox
Left = 20
Height = 19
Top = 258
Width = 352
Caption = 'Collection ( Pascal type will derive from TObjectCollectionRemotable )'
TabOrder = 4
end
end end
end end
object AL: TActionList object AL: TActionList

View File

@@ -1,36 +1,41 @@
{ Ceci est un fichier ressource g�n�r� automatiquement par Lazarus } { Ceci est un fichier ressource g�n�r� automatiquement par Lazarus }
LazarusResources.Add('TfArrayEdit','FORMDATA',[ LazarusResources.Add('TfArrayEdit','FORMDATA',[
'TPF0'#11'TfArrayEdit'#10'fArrayEdit'#4'Left'#3'G'#1#6'Height'#3'i'#1#3'Top'#3 'TPF0'#11'TfArrayEdit'#10'fArrayEdit'#4'Left'#3'G'#1#6'Height'#3'w'#1#3'Top'#3
+#131#0#5'Width'#3#136#1#18'HorzScrollBar.Page'#3#135#1#18'VertScrollBar.Page' +#132#0#5'Width'#3#136#1#18'HorzScrollBar.Page'#3#135#1#18'VertScrollBar.Page'
+#3'h'#1#13'ActiveControl'#7#7'Button1'#11'BorderStyle'#7#13'bsSizeToolWin'#7 +#3'v'#1#13'ActiveControl'#7#7'Button1'#11'BorderStyle'#7#13'bsSizeToolWin'#7
+'Caption'#6#10'fArrayEdit'#8'Position'#7#16'poMainFormCenter'#0#6'TPanel'#6 +'Caption'#6#10'fArrayEdit'#12'ClientHeight'#3'w'#1#11'ClientWidth'#3#136#1#8
+'Panel1'#6'Height'#2'2'#3'Top'#3'7'#1#5'Width'#3#136#1#5'Align'#7#8'alBottom' +'Position'#7#16'poMainFormCenter'#10'LCLVersion'#6#6'0.9.25'#0#6'TPanel'#6'P'
+#8'TabOrder'#2#0#0#7'TButton'#7'Button1'#4'Left'#3#216#0#6'Height'#2#25#3'To' +'anel1'#6'Height'#2'2'#3'Top'#3'E'#1#5'Width'#3#136#1#5'Align'#7#8'alBottom'
+'p'#2#9#5'Width'#2'K'#6'Action'#7#5'actOK'#7'Anchors'#11#5'akTop'#7'akRight' +#12'ClientHeight'#2'2'#11'ClientWidth'#3#136#1#8'TabOrder'#2#0#0#7'TButton'#7
+#0#25'BorderSpacing.InnerBorder'#2#4#8'TabOrder'#2#0#0#0#7'TButton'#7'Button' +'Button1'#4'Left'#3#216#0#6'Height'#2#25#3'Top'#2#9#5'Width'#2'K'#6'Action'#7
+'2'#4'Left'#3'0'#1#6'Height'#2#25#3'Top'#2#9#5'Width'#2'K'#7'Anchors'#11#5'a' +#5'actOK'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2
+'kTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#4#6'Cancel'#9#7'Caption' +#4#8'TabOrder'#2#0#0#0#7'TButton'#7'Button2'#4'Left'#3'0'#1#6'Height'#2#25#3
+#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#1#0#0#0#12'TPageControl'#12'P' +'Top'#2#9#5'Width'#2'K'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing'
+'ageControl1'#6'Height'#3'7'#1#5'Width'#3#136#1#10'ActivePage'#7#9'TabSheet1' +'.InnerBorder'#2#4#6'Cancel'#9#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8
+#5'Align'#7#8'alClient'#8'TabIndex'#2#0#8'TabOrder'#2#1#0#9'TTabSheet'#9'Tab' +'TabOrder'#2#1#0#0#0#12'TPageControl'#12'PageControl1'#6'Height'#3'E'#1#5'Wi'
+'Sheet1'#7'Caption'#6#16'Array definition'#0#6'TLabel'#6'Label1'#4'Left'#2#19 +'dth'#3#136#1#10'ActivePage'#7#9'TabSheet1'#5'Align'#7#8'alClient'#8'TabInde'
+#6'Height'#2#14#3'Top'#2#21#5'Width'#2#28#7'Caption'#6#4'Name'#5'Color'#7#6 +'x'#2#0#8'TabOrder'#2#1#0#9'TTabSheet'#9'TabSheet1'#7'Caption'#6#16'Array de'
+'clNone'#11'ParentColor'#8#0#0#6'TLabel'#6'Label2'#4'Left'#2#19#6'Height'#2 +'finition'#12'ClientHeight'#3'+'#1#11'ClientWidth'#3#128#1#0#6'TLabel'#6'Lab'
+#14#3'Top'#2'f'#5'Width'#2'B'#7'Caption'#6#12'Element Type'#5'Color'#7#6'clN' +'el1'#4'Left'#2#20#6'Height'#2#14#3'Top'#2#21#5'Width'#2#28#7'Caption'#6#4'N'
+'one'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Left'#2#19#6'Height'#2#14#3 +'ame'#11'ParentColor'#8#0#0#6'TLabel'#6'Label2'#4'Left'#2#20#6'Height'#2#14#3
+'Top'#3#170#0#5'Width'#2'E'#7'Caption'#6#12'Element Name'#5'Color'#7#6'clNon' +'Top'#2'f'#5'Width'#2'B'#7'Caption'#6#12'Element Type'#11'ParentColor'#8#0#0
+'e'#11'ParentColor'#8#0#0#5'TEdit'#7'edtName'#4'Left'#2#20#6'Height'#2#23#3 +#6'TLabel'#6'Label3'#4'Left'#2#20#6'Height'#2#14#3'Top'#3#170#0#5'Width'#2'E'
+'Top'#2'*'#5'Width'#3'Y'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'T' +#7'Caption'#6#12'Element Name'#11'ParentColor'#8#0#0#5'TEdit'#7'edtName'#4'L'
+'abOrder'#2#0#0#0#9'TComboBox'#14'edtElementType'#4'Left'#2#19#6'Height'#2#21 +'eft'#2#20#6'Height'#2#23#3'Top'#2'*'#5'Width'#3'Q'#1#7'Anchors'#11#5'akTop'
+#3'Top'#2'z'#5'Width'#3'Y'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#16 +#6'akLeft'#7'akRight'#0#8'TabOrder'#2#0#0#0#9'TComboBox'#14'edtElementType'#4
+'AutoCompleteText'#11#22'cbactEndOfLineComplete'#20'cbactSearchAscending'#0 +'Left'#2#20#6'Height'#2#21#3'Top'#2'z'#5'Width'#3'Q'#1#7'Anchors'#11#5'akTop'
+#10'ItemHeight'#2#13#9'MaxLength'#2#0#5'Style'#7#14'csDropDownList'#8'TabOrd' +#6'akLeft'#7'akRight'#0#16'AutoCompleteText'#11#22'cbactEndOfLineComplete'#20
+'er'#2#1#0#0#9'TCheckBox'#11'edtEmbedded'#4'Left'#2#19#6'Height'#2#13#3'Top' +'cbactSearchAscending'#0#10'ItemHeight'#2#13#9'MaxLength'#2#0#5'Style'#7#14
+#3#242#0#5'Width'#2'G'#7'Caption'#6#8'Embedded'#8'TabOrder'#2#2#0#0#5'TEdit' +'csDropDownList'#8'TabOrder'#2#1#0#0#9'TCheckBox'#11'edtEmbedded'#4'Left'#2
+#14'edtElementName'#4'Left'#2#19#6'Height'#2#23#3'Top'#3#186#0#5'Width'#3'Y' +#20#6'Height'#2#19#3'Top'#3#226#0#5'Width'#3'Q'#1#7'Caption'#6'AEmbedded ( i'
+#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'TabOrder'#2#3#4'Text'#6#4 +'tems are expanded directly in the enclosing element )'#8'TabOrder'#2#3#0#0#5
+'Item'#0#0#0#0#11'TActionList'#2'AL'#4'left'#3#215#0#3'top'#3#185#0#0#7'TAct' +'TEdit'#14'edtElementName'#4'Left'#2#20#6'Height'#2#23#3'Top'#3#186#0#5'Widt'
+'ion'#5'actOK'#7'Caption'#6#2'OK'#18'DisableIfNoHandler'#9#9'OnExecute'#7#12 +'h'#3'Q'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'TabOrder'#2#2#4'T'
+'actOKExecute'#8'OnUpdate'#7#11'actOKUpdate'#0#0#0#0 +'ext'#6#4'Item'#0#0#9'TCheckBox'#13'edtCollection'#4'Left'#2#20#6'Height'#2
+#19#3'Top'#3#2#1#5'Width'#3'`'#1#7'Caption'#6'FCollection ( Pascal type will'
+' derive from TObjectCollectionRemotable )'#8'TabOrder'#2#4#0#0#0#0#11'TActi'
+'onList'#2'AL'#4'left'#3#215#0#3'top'#3#185#0#0#7'TAction'#5'actOK'#7'Captio'
+'n'#6#2'OK'#18'DisableIfNoHandler'#9#9'OnExecute'#7#12'actOKExecute'#8'OnUpd'
+'ate'#7#11'actOKUpdate'#0#0#0#0
]); ]);

View File

@@ -18,6 +18,7 @@ type
AL : TActionList; AL : TActionList;
Button1 : TButton; Button1 : TButton;
Button2 : TButton; Button2 : TButton;
edtCollection : TCheckBox;
edtEmbedded : TCheckBox; edtEmbedded : TCheckBox;
edtElementName : TEdit; edtElementName : TEdit;
edtElementType : TComboBox; edtElementType : TComboBox;
@@ -67,8 +68,22 @@ begin
end; end;
procedure TfArrayEdit.actOKExecute(Sender : TObject); procedure TfArrayEdit.actOKExecute(Sender : TObject);
var
eltType : TPasType;
ok : Boolean;
begin begin
ModalResult := mrOK; ok := True;
if edtCollection.Checked then begin
eltType := edtElementType.Items.Objects[edtElementType.ItemIndex] as TPasType;
if eltType.InheritsFrom(TPasUnresolvedTypeRef) then
eltType := FSymbolTable.FindElement(FSymbolTable.GetExternalName(eltType)) as TPasType;
if eltType.InheritsFrom(TPasNativeSimpleType) or eltType.InheritsFrom(TPasNativeSimpleContentClassType) then begin
ok := False;
ShowMessage('Collections for simple types are not supported.');
end;
end;
if ok then
ModalResult := mrOK;
end; end;
procedure TfArrayEdit.LoadFromObject(); procedure TfArrayEdit.LoadFromObject();
@@ -87,6 +102,7 @@ begin
edtElementName.Text := FSymbolTable.GetArrayItemExternalName(FObject); edtElementName.Text := FSymbolTable.GetArrayItemExternalName(FObject);
edtElementType.ItemIndex := edtElementType.Items.IndexOf(FSymbolTable.GetExternalName(FObject.ElType)); edtElementType.ItemIndex := edtElementType.Items.IndexOf(FSymbolTable.GetExternalName(FObject.ElType));
edtEmbedded.Checked := ( FSymbolTable.GetArrayStyle(FObject) = asEmbeded ); edtEmbedded.Checked := ( FSymbolTable.GetArrayStyle(FObject) = asEmbeded );
edtCollection.Checked:= FSymbolTable.IsCollection(FObject);
end else begin end else begin
Self.Caption := 'NewArray'; Self.Caption := 'NewArray';
end; end;
@@ -129,6 +145,8 @@ begin
FSymbolTable.SetArrayStyle(locObj,arrStyle); FSymbolTable.SetArrayStyle(locObj,arrStyle);
FSymbolTable.SetArrayItemExternalName(locObj,eltExtName); FSymbolTable.SetArrayItemExternalName(locObj,eltExtName);
end; end;
if ( edtCollection.Checked <> FSymbolTable.IsCollection(FObject) ) then
FSymbolTable.SetCollectionFlag(FObject,edtCollection.Checked);
FSymbolTable.RegisterExternalAlias(locObj,typExtName); FSymbolTable.RegisterExternalAlias(locObj,typExtName);
end; end;

View File

@@ -11,6 +11,7 @@ object fClassEdit: TfClassEdit
ClientHeight = 547 ClientHeight = 547
ClientWidth = 518 ClientWidth = 518
Position = poDesktopCenter Position = poDesktopCenter
LCLVersion = '0.9.25'
object Panel1: TPanel object Panel1: TPanel
Height = 50 Height = 50
Top = 497 Top = 497

View File

@@ -5,54 +5,55 @@ LazarusResources.Add('TfClassEdit','FORMDATA',[
+'*'#5'Width'#3#6#2#18'HorzScrollBar.Page'#3#5#2#18'VertScrollBar.Page'#3'"'#2 +'*'#5'Width'#3#6#2#18'HorzScrollBar.Page'#3#5#2#18'VertScrollBar.Page'#3'"'#2
+#13'ActiveControl'#7#7'Button1'#11'BorderStyle'#7#13'bsSizeToolWin'#7'Captio' +#13'ActiveControl'#7#7'Button1'#11'BorderStyle'#7#13'bsSizeToolWin'#7'Captio'
+'n'#6#10'fClassEdit'#12'ClientHeight'#3'#'#2#11'ClientWidth'#3#6#2#8'Positio' +'n'#6#10'fClassEdit'#12'ClientHeight'#3'#'#2#11'ClientWidth'#3#6#2#8'Positio'
+'n'#7#15'poDesktopCenter'#0#6'TPanel'#6'Panel1'#6'Height'#2'2'#3'Top'#3#241#1 +'n'#7#15'poDesktopCenter'#10'LCLVersion'#6#6'0.9.25'#0#6'TPanel'#6'Panel1'#6
+#5'Width'#3#6#2#5'Align'#7#8'alBottom'#12'ClientHeight'#2'2'#11'ClientWidth' +'Height'#2'2'#3'Top'#3#241#1#5'Width'#3#6#2#5'Align'#7#8'alBottom'#12'Client'
+#3#6#2#8'TabOrder'#2#0#0#7'TButton'#7'Button1'#4'Left'#3#174#1#6'Height'#2#25 +'Height'#2'2'#11'ClientWidth'#3#6#2#8'TabOrder'#2#0#0#7'TButton'#7'Button1'#4
+#3'Top'#2#10#5'Width'#2'K'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpac' +'Left'#3#174#1#6'Height'#2#25#3'Top'#2#10#5'Width'#2'K'#7'Anchors'#11#5'akTo'
+'ing.InnerBorder'#2#4#6'Cancel'#9#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2 +'p'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#4#6'Cancel'#9#7'Caption'#6#6
+#8'TabOrder'#2#0#0#0#7'TButton'#7'Button2'#4'Left'#3'T'#1#6'Height'#2#25#3'T' +'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#0#0#0#7'TButton'#7'Button2'#4'Lef'
+'op'#2#10#5'Width'#2'K'#6'Action'#7#5'actOK'#7'Anchors'#11#5'akTop'#7'akRigh' +'t'#3'T'#1#6'Height'#2#25#3'Top'#2#10#5'Width'#2'K'#6'Action'#7#5'actOK'#7'A'
+'t'#0#25'BorderSpacing.InnerBorder'#2#4#7'Default'#9#8'TabOrder'#2#1#0#0#0#12 +'nchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#4#7'Defaul'
+'TPageControl'#2'PC'#6'Height'#3#241#1#5'Width'#3#6#2#10'ActivePage'#7#9'Tab' +'t'#9#8'TabOrder'#2#1#0#0#0#12'TPageControl'#2'PC'#6'Height'#3#241#1#5'Width'
+'Sheet1'#5'Align'#7#8'alClient'#8'TabIndex'#2#0#8'TabOrder'#2#1#0#9'TTabShee' +#3#6#2#10'ActivePage'#7#9'TabSheet1'#5'Align'#7#8'alClient'#8'TabIndex'#2#0#8
+'t'#9'TabSheet1'#7'Caption'#6#15'Compound Object'#12'ClientHeight'#3#215#1#11 +'TabOrder'#2#1#0#9'TTabSheet'#9'TabSheet1'#7'Caption'#6#15'Compound Object'
+'ClientWidth'#3#254#1#0#6'TLabel'#6'Label1'#4'Left'#2#4#6'Height'#2#14#3'Top' +#12'ClientHeight'#3#215#1#11'ClientWidth'#3#254#1#0#6'TLabel'#6'Label1'#4'Le'
+#2#18#5'Width'#2#28#7'Caption'#6#4'Name'#11'ParentColor'#8#0#0#6'TLabel'#6'L' +'ft'#2#4#6'Height'#2#14#3'Top'#2#18#5'Width'#2#28#7'Caption'#6#4'Name'#11'Pa'
+'abel2'#4'Left'#2#4#6'Height'#2#14#3'Top'#2';'#5'Width'#2'C'#7'Caption'#6#14 +'rentColor'#8#0#0#6'TLabel'#6'Label2'#4'Left'#2#4#6'Height'#2#14#3'Top'#2';'
+'Inheritts from'#11'ParentColor'#8#0#0#5'TEdit'#7'edtName'#4'Left'#2'\'#6'He' +#5'Width'#2'C'#7'Caption'#6#14'Inheritts from'#11'ParentColor'#8#0#0#5'TEdit'
+'ight'#2#23#3'Top'#2#18#5'Width'#3#150#1#7'Anchors'#11#5'akTop'#6'akLeft'#7 +#7'edtName'#4'Left'#2'\'#6'Height'#2#23#3'Top'#2#18#5'Width'#3#150#1#7'Ancho'
+'akRight'#0#8'TabOrder'#2#0#0#0#9'TGroupBox'#9'GroupBox1'#4'Left'#2#4#6'Heig' +'rs'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'TabOrder'#2#0#0#0#9'TGroupBox'#9'G'
+'ht'#3'8'#1#3'Top'#2'b'#5'Width'#3#239#1#7'Anchors'#11#5'akTop'#6'akLeft'#7 +'roupBox1'#4'Left'#2#4#6'Height'#3'8'#1#3'Top'#2'b'#5'Width'#3#239#1#7'Ancho'
+'akRight'#8'akBottom'#0#7'Caption'#6#14' Properties '#12'ClientHeight'#3'&' +'rs'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#7'Caption'#6#14' Proper'
+#1#11'ClientWidth'#3#235#1#8'TabOrder'#2#1#0#9'TListView'#7'edtProp'#6'Heigh' +'ties '#12'ClientHeight'#3'&'#1#11'ClientWidth'#3#235#1#8'TabOrder'#2#1#0#9
+'t'#3'&'#1#5'Width'#3#235#1#5'Align'#7#8'alClient'#11'BorderWidth'#2#2#7'Col' +'TListView'#7'edtProp'#6'Height'#3'&'#1#5'Width'#3#235#1#5'Align'#7#8'alClie'
+'umns'#14#1#8'AutoSize'#9#7'Caption'#6#4'Name'#5'Width'#3#210#0#0#1#7'Captio' +'nt'#11'BorderWidth'#2#2#7'Columns'#14#1#8'AutoSize'#9#7'Caption'#6#4'Name'#5
+'n'#6#4'Type'#5'Width'#3#200#0#0#1#7'Caption'#6#9'Attribute'#5'Width'#2'<'#0 +'Width'#3#210#0#0#1#7'Caption'#6#4'Type'#5'Width'#3#200#0#0#1#7'Caption'#6#9
+#0#9'PopupMenu'#7#10'PopupMenu1'#9'RowSelect'#9#8'TabOrder'#2#0#9'ViewStyle' +'Attribute'#5'Width'#2'<'#0#0#9'PopupMenu'#7#10'PopupMenu1'#9'RowSelect'#9#8
+#7#8'vsReport'#10'OnDblClick'#7#15'edtPropDblClick'#0#0#0#7'TButton'#7'Butto' +'TabOrder'#2#0#9'ViewStyle'#7#8'vsReport'#10'OnDblClick'#7#15'edtPropDblClic'
+'n3'#4'Left'#2#4#6'Height'#2#25#3'Top'#3#165#1#5'Width'#2'd'#6'Action'#7#10 +'k'#0#0#0#7'TButton'#7'Button3'#4'Left'#2#4#6'Height'#2#25#3'Top'#3#165#1#5
+'actPropAdd'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#25'BorderSpacing.InnerBor' +'Width'#2'd'#6'Action'#7#10'actPropAdd'#7'Anchors'#11#6'akLeft'#8'akBottom'#0
+'der'#2#4#8'TabOrder'#2#2#0#0#7'TButton'#7'Button4'#4'Left'#2't'#6'Height'#2 +#25'BorderSpacing.InnerBorder'#2#4#8'TabOrder'#2#2#0#0#7'TButton'#7'Button4'
+#25#3'Top'#3#165#1#5'Width'#2'd'#6'Action'#7#11'actPropEdit'#7'Anchors'#11#6 +#4'Left'#2't'#6'Height'#2#25#3'Top'#3#165#1#5'Width'#2'd'#6'Action'#7#11'act'
+'akLeft'#8'akBottom'#0#25'BorderSpacing.InnerBorder'#2#4#8'TabOrder'#2#3#0#0 +'PropEdit'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#25'BorderSpacing.InnerBorde'
+#7'TButton'#7'Button5'#4'Left'#3#228#0#6'Height'#2#25#3'Top'#3#165#1#5'Width' +'r'#2#4#8'TabOrder'#2#3#0#0#7'TButton'#7'Button5'#4'Left'#3#228#0#6'Height'#2
+#2'd'#6'Action'#7#13'actPropDelete'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#25 +#25#3'Top'#3#165#1#5'Width'#2'd'#6'Action'#7#13'actPropDelete'#7'Anchors'#11
+'BorderSpacing.InnerBorder'#2#4#8'TabOrder'#2#4#0#0#9'TComboBox'#9'edtParent' +#6'akLeft'#8'akBottom'#0#25'BorderSpacing.InnerBorder'#2#4#8'TabOrder'#2#4#0
+#4'Left'#2'\'#6'Height'#2#21#3'Top'#2':'#5'Width'#3#150#1#7'Anchors'#11#5'ak' +#0#9'TComboBox'#9'edtParent'#4'Left'#2'\'#6'Height'#2#21#3'Top'#2':'#5'Width'
+'Top'#6'akLeft'#7'akRight'#0#16'AutoCompleteText'#11#22'cbactEndOfLineComple' +#3#150#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#16'AutoCompleteText'
+'te'#20'cbactSearchAscending'#0#10'ItemHeight'#2#13#9'MaxLength'#2#0#5'Style' +#11#22'cbactEndOfLineComplete'#20'cbactSearchAscending'#0#10'ItemHeight'#2#13
+#7#14'csDropDownList'#8'TabOrder'#2#5#0#0#0#0#11'TActionList'#11'ActionList1' +#9'MaxLength'#2#0#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#5#0#0#0#0#11'T'
+#4'left'#3#232#0#3'top'#3#200#0#0#7'TAction'#5'actOK'#7'Caption'#6#2'OK'#18 +'ActionList'#11'ActionList1'#4'left'#3#232#0#3'top'#3#200#0#0#7'TAction'#5'a'
+'DisableIfNoHandler'#9#9'OnExecute'#7#12'actOKExecute'#8'OnUpdate'#7#11'actO' +'ctOK'#7'Caption'#6#2'OK'#18'DisableIfNoHandler'#9#9'OnExecute'#7#12'actOKEx'
+'KUpdate'#0#0#7'TAction'#10'actPropAdd'#7'Caption'#6#12'New Property'#18'Dis' +'ecute'#8'OnUpdate'#7#11'actOKUpdate'#0#0#7'TAction'#10'actPropAdd'#7'Captio'
+'ableIfNoHandler'#9#9'OnExecute'#7#17'actPropAddExecute'#0#0#7'TAction'#11'a' +'n'#6#12'New Property'#18'DisableIfNoHandler'#9#9'OnExecute'#7#17'actPropAdd'
+'ctPropEdit'#7'Caption'#6#13'Edit Property'#18'DisableIfNoHandler'#9#9'OnExe' +'Execute'#0#0#7'TAction'#11'actPropEdit'#7'Caption'#6#13'Edit Property'#18'D'
+'cute'#7#18'actPropEditExecute'#8'OnUpdate'#7#17'actPropEditUpdate'#0#0#7'TA' +'isableIfNoHandler'#9#9'OnExecute'#7#18'actPropEditExecute'#8'OnUpdate'#7#17
+'ction'#13'actPropDelete'#7'Caption'#6#15'Delete Property'#18'DisableIfNoHan' +'actPropEditUpdate'#0#0#7'TAction'#13'actPropDelete'#7'Caption'#6#15'Delete '
+'dler'#9#9'OnExecute'#7#20'actPropDeleteExecute'#8'OnUpdate'#7#17'actPropEdi' +'Property'#18'DisableIfNoHandler'#9#9'OnExecute'#7#20'actPropDeleteExecute'#8
+'tUpdate'#0#0#0#10'TPopupMenu'#10'PopupMenu1'#4'left'#2'i'#3'top'#3#186#0#0#9 +'OnUpdate'#7#17'actPropEditUpdate'#0#0#0#10'TPopupMenu'#10'PopupMenu1'#4'lef'
+'TMenuItem'#9'MenuItem1'#6'Action'#7#10'actPropAdd'#7'OnClick'#7#17'actPropA' +'t'#2'i'#3'top'#3#186#0#0#9'TMenuItem'#9'MenuItem1'#6'Action'#7#10'actPropAd'
+'ddExecute'#0#0#9'TMenuItem'#9'MenuItem2'#6'Action'#7#11'actPropEdit'#7'OnCl' +'d'#7'OnClick'#7#17'actPropAddExecute'#0#0#9'TMenuItem'#9'MenuItem2'#6'Actio'
+'ick'#7#18'actPropEditExecute'#0#0#9'TMenuItem'#9'MenuItem3'#6'Action'#7#13 +'n'#7#11'actPropEdit'#7'OnClick'#7#18'actPropEditExecute'#0#0#9'TMenuItem'#9
+'actPropDelete'#7'OnClick'#7#20'actPropDeleteExecute'#0#0#0#0 +'MenuItem3'#6'Action'#7#13'actPropDelete'#7'OnClick'#7#20'actPropDeleteExecu'
+'te'#0#0#0#0
]); ]);

View File

@@ -298,7 +298,8 @@ begin
trueParent := TPasNativeSimpleType(trueParent).ExtendableType; trueParent := TPasNativeSimpleType(trueParent).ExtendableType;
end; end;
end else begin end else begin
trueParent := nil; //trueParent := nil;
trueParent := FSymbolTable.FindElementNS('TBaseComplexRemotable',sXSD_NS) as TPasType;
end; end;
if ( trueParent <> FOldAncestor ) then begin if ( trueParent <> FOldAncestor ) then begin
if ( FOldAncestor <> nil ) then if ( FOldAncestor <> nil ) then

View File

@@ -1,7 +1,7 @@
object fInterfaceEdit: TfInterfaceEdit object fInterfaceEdit: TfInterfaceEdit
Left = 361 Left = 361
Height = 564 Height = 564
Top = 373 Top = 293
Width = 531 Width = 531
HorzScrollBar.Page = 530 HorzScrollBar.Page = 530
VertScrollBar.Page = 563 VertScrollBar.Page = 563
@@ -12,6 +12,7 @@ object fInterfaceEdit: TfInterfaceEdit
ClientWidth = 531 ClientWidth = 531
OnCreate = FormCreate OnCreate = FormCreate
Position = poDesktopCenter Position = poDesktopCenter
LCLVersion = '0.9.25'
object Panel1: TPanel object Panel1: TPanel
Height = 50 Height = 50
Top = 514 Top = 514

View File

@@ -2,56 +2,56 @@
LazarusResources.Add('TfInterfaceEdit','FORMDATA',[ LazarusResources.Add('TfInterfaceEdit','FORMDATA',[
'TPF0'#15'TfInterfaceEdit'#14'fInterfaceEdit'#4'Left'#3'i'#1#6'Height'#3'4'#2 'TPF0'#15'TfInterfaceEdit'#14'fInterfaceEdit'#4'Left'#3'i'#1#6'Height'#3'4'#2
+#3'Top'#3'u'#1#5'Width'#3#19#2#18'HorzScrollBar.Page'#3#18#2#18'VertScrollBa' +#3'Top'#3'%'#1#5'Width'#3#19#2#18'HorzScrollBar.Page'#3#18#2#18'VertScrollBa'
+'r.Page'#3'3'#2#13'ActiveControl'#7#7'Button1'#11'BorderStyle'#7#13'bsSizeTo' +'r.Page'#3'3'#2#13'ActiveControl'#7#7'Button1'#11'BorderStyle'#7#13'bsSizeTo'
+'olWin'#7'Caption'#6#14'fInterfaceEdit'#12'ClientHeight'#3'4'#2#11'ClientWid' +'olWin'#7'Caption'#6#14'fInterfaceEdit'#12'ClientHeight'#3'4'#2#11'ClientWid'
+'th'#3#19#2#8'OnCreate'#7#10'FormCreate'#8'Position'#7#15'poDesktopCenter'#0 +'th'#3#19#2#8'OnCreate'#7#10'FormCreate'#8'Position'#7#15'poDesktopCenter'#10
+#6'TPanel'#6'Panel1'#6'Height'#2'2'#3'Top'#3#2#2#5'Width'#3#19#2#5'Align'#7#8 +'LCLVersion'#6#6'0.9.25'#0#6'TPanel'#6'Panel1'#6'Height'#2'2'#3'Top'#3#2#2#5
+'alBottom'#12'ClientHeight'#2'2'#11'ClientWidth'#3#19#2#8'TabOrder'#2#0#0#7 +'Width'#3#19#2#5'Align'#7#8'alBottom'#12'ClientHeight'#2'2'#11'ClientWidth'#3
+'TButton'#7'Button1'#4'Left'#3#180#1#6'Height'#2#25#3'Top'#2#10#5'Width'#2'K' +#19#2#8'TabOrder'#2#0#0#7'TButton'#7'Button1'#4'Left'#3#180#1#6'Height'#2#25
+#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#4#6'Can' +#3'Top'#2#10#5'Width'#2'K'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpac'
+'cel'#9#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#0#0#0#7'TBu' +'ing.InnerBorder'#2#4#6'Cancel'#9#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2
+'tton'#7'Button2'#4'Left'#3'Z'#1#6'Height'#2#25#3'Top'#2#10#5'Width'#2'K'#6 +#8'TabOrder'#2#0#0#0#7'TButton'#7'Button2'#4'Left'#3'Z'#1#6'Height'#2#25#3'T'
+'Action'#7#5'actOK'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.Inn' +'op'#2#10#5'Width'#2'K'#6'Action'#7#5'actOK'#7'Anchors'#11#5'akTop'#7'akRigh'
+'erBorder'#2#4#7'Default'#9#8'TabOrder'#2#1#0#0#0#12'TPageControl'#2'PC'#6'H' +'t'#0#25'BorderSpacing.InnerBorder'#2#4#7'Default'#9#8'TabOrder'#2#1#0#0#0#12
+'eight'#3#2#2#5'Width'#3#19#2#10'ActivePage'#7#9'TabSheet1'#5'Align'#7#8'alC' +'TPageControl'#2'PC'#6'Height'#3#2#2#5'Width'#3#19#2#10'ActivePage'#7#9'TabS'
+'lient'#8'TabIndex'#2#0#8'TabOrder'#2#1#0#9'TTabSheet'#9'TabSheet1'#7'Captio' +'heet1'#5'Align'#7#8'alClient'#8'TabIndex'#2#0#8'TabOrder'#2#1#0#9'TTabSheet'
+'n'#6#20'Interface definition'#12'ClientHeight'#3#232#1#11'ClientWidth'#3#11 +#9'TabSheet1'#7'Caption'#6#20'Interface definition'#12'ClientHeight'#3#232#1
+#2#0#6'TLabel'#6'Label1'#4'Left'#2#20#6'Height'#2#14#3'Top'#2#26#5'Width'#2 +#11'ClientWidth'#3#11#2#0#6'TLabel'#6'Label1'#4'Left'#2#20#6'Height'#2#14#3
+#28#7'Caption'#6#4'Name'#11'ParentColor'#8#0#0#5'TEdit'#7'edtName'#4'Left'#2 +'Top'#2#26#5'Width'#2#28#7'Caption'#6#4'Name'#11'ParentColor'#8#0#0#5'TEdit'
+'<'#6'Height'#2#23#3'Top'#2#26#5'Width'#3#187#1#7'Anchors'#11#5'akTop'#6'akL' +#7'edtName'#4'Left'#2'<'#6'Height'#2#23#3'Top'#2#26#5'Width'#3#187#1#7'Ancho'
+'eft'#7'akRight'#0#8'TabOrder'#2#0#0#0#9'TGroupBox'#9'GroupBox1'#4'Left'#2#20 +'rs'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'TabOrder'#2#0#0#0#9'TGroupBox'#9'G'
+#6'Height'#3'p'#1#3'Top'#2'J'#5'Width'#3#228#1#7'Anchors'#11#5'akTop'#6'akLe' +'roupBox1'#4'Left'#2#20#6'Height'#3'p'#1#3'Top'#2'J'#5'Width'#3#228#1#7'Anch'
+'ft'#7'akRight'#8'akBottom'#0#7'Caption'#6#11' Methods '#12'ClientHeight'#3 +'ors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#7'Caption'#6#11' Metho'
+'^'#1#11'ClientWidth'#3#224#1#8'TabOrder'#2#1#0#9'TTreeView'#10'trvMethods'#6 +'ds '#12'ClientHeight'#3'^'#1#11'ClientWidth'#3#224#1#8'TabOrder'#2#1#0#9'T'
+'Height'#3'^'#1#5'Width'#3#224#1#5'Align'#7#8'alClient'#17'DefaultItemHeight' +'TreeView'#10'trvMethods'#6'Height'#3'^'#1#5'Width'#3#224#1#5'Align'#7#8'alC'
+#2#15#9'PopupMenu'#7#10'PopupMenu1'#8'TabOrder'#2#0#0#0#0#7'TButton'#7'Butto' +'lient'#17'DefaultItemHeight'#2#15#9'PopupMenu'#7#10'PopupMenu1'#8'TabOrder'
+'n3'#4'Left'#2#20#6'Height'#2#25#3'Top'#3#194#1#5'Width'#2'c'#6'Action'#7#12 +#2#0#0#0#0#7'TButton'#7'Button3'#4'Left'#2#20#6'Height'#2#25#3'Top'#3#194#1#5
+'actNewMethod'#25'BorderSpacing.InnerBorder'#2#4#8'TabOrder'#2#2#0#0#7'TButt' +'Width'#2'c'#6'Action'#7#12'actNewMethod'#25'BorderSpacing.InnerBorder'#2#4#8
+'on'#7'Button4'#4'Left'#3#132#0#6'Height'#2#25#3'Top'#3#194#1#5'Width'#2'k'#6 +'TabOrder'#2#2#0#0#7'TButton'#7'Button4'#4'Left'#3#132#0#6'Height'#2#25#3'To'
+'Action'#7#18'actUpdateOperation'#25'BorderSpacing.InnerBorder'#2#4#8'TabOrd' +'p'#3#194#1#5'Width'#2'k'#6'Action'#7#18'actUpdateOperation'#25'BorderSpacin'
+'er'#2#3#0#0#7'TButton'#7'Button5'#4'Left'#3#252#0#6'Height'#2#25#3'Top'#3 +'g.InnerBorder'#2#4#8'TabOrder'#2#3#0#0#7'TButton'#7'Button5'#4'Left'#3#252#0
+#194#1#5'Width'#2'h'#6'Action'#7#18'actDeleteOperation'#25'BorderSpacing.Inn' +#6'Height'#2#25#3'Top'#3#194#1#5'Width'#2'h'#6'Action'#7#18'actDeleteOperati'
+'erBorder'#2#4#8'TabOrder'#2#4#0#0#7'TButton'#7'Button6'#4'Left'#3#140#1#6'H' +'on'#25'BorderSpacing.InnerBorder'#2#4#8'TabOrder'#2#4#0#0#7'TButton'#7'Butt'
+'eight'#2#25#3'Top'#3#194#1#5'Width'#2'k'#6'Action'#7#14'actBindingEdit'#7'A' +'on6'#4'Left'#3#140#1#6'Height'#2#25#3'Top'#3#194#1#5'Width'#2'k'#6'Action'#7
+'nchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#4#8'TabOrd' +#14'actBindingEdit'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.Inn'
+'er'#2#5#0#0#0#0#11'TActionList'#2'AL'#4'left'#3#130#0#3'top'#3#200#0#0#7'TA' +'erBorder'#2#4#8'TabOrder'#2#5#0#0#0#0#11'TActionList'#2'AL'#4'left'#3#130#0
+'ction'#5'actOK'#7'Caption'#6#2'OK'#18'DisableIfNoHandler'#9#9'OnExecute'#7 +#3'top'#3#200#0#0#7'TAction'#5'actOK'#7'Caption'#6#2'OK'#18'DisableIfNoHandl'
+#12'actOKExecute'#8'OnUpdate'#7#11'actOKUpdate'#0#0#7'TAction'#12'actNewMeth' +'er'#9#9'OnExecute'#7#12'actOKExecute'#8'OnUpdate'#7#11'actOKUpdate'#0#0#7'T'
+'od'#7'Caption'#6#13'New operation'#18'DisableIfNoHandler'#9#9'OnExecute'#7 +'Action'#12'actNewMethod'#7'Caption'#6#13'New operation'#18'DisableIfNoHandl'
+#19'actNewMethodExecute'#0#0#7'TAction'#18'actUpdateOperation'#7'Caption'#6 +'er'#9#9'OnExecute'#7#19'actNewMethodExecute'#0#0#7'TAction'#18'actUpdateOpe'
+#14'Edit Operation'#18'DisableIfNoHandler'#9#9'OnExecute'#7#25'actUpdateOper' +'ration'#7'Caption'#6#14'Edit Operation'#18'DisableIfNoHandler'#9#9'OnExecut'
+'ationExecute'#8'OnUpdate'#7#24'actUpdateOperationUpdate'#0#0#7'TAction'#18 +'e'#7#25'actUpdateOperationExecute'#8'OnUpdate'#7#24'actUpdateOperationUpdat'
+'actDeleteOperation'#7'Caption'#6#16'Delete Operation'#18'DisableIfNoHandler' +'e'#0#0#7'TAction'#18'actDeleteOperation'#7'Caption'#6#16'Delete Operation'
+#9#9'OnExecute'#7#25'actDeleteOperationExecute'#8'OnUpdate'#7#24'actUpdateOp' +#18'DisableIfNoHandler'#9#9'OnExecute'#7#25'actDeleteOperationExecute'#8'OnU'
+'erationUpdate'#0#0#7'TAction'#14'actBindingEdit'#7'Caption'#6#12'Edit Bindi' +'pdate'#7#24'actUpdateOperationUpdate'#0#0#7'TAction'#14'actBindingEdit'#7'C'
+'ng'#18'DisableIfNoHandler'#9#9'OnExecute'#7#21'actBindingEditExecute'#8'OnU' +'aption'#6#12'Edit Binding'#18'DisableIfNoHandler'#9#9'OnExecute'#7#21'actBi'
+'pdate'#7#20'actBindingEditUpdate'#0#0#0#10'TPopupMenu'#10'PopupMenu1'#4'lef' +'ndingEditExecute'#8'OnUpdate'#7#20'actBindingEditUpdate'#0#0#0#10'TPopupMen'
+'t'#2'T'#3'top'#3#233#0#0#9'TMenuItem'#9'MenuItem1'#6'Action'#7#12'actNewMet' +'u'#10'PopupMenu1'#4'left'#2'T'#3'top'#3#233#0#0#9'TMenuItem'#9'MenuItem1'#6
+'hod'#7'OnClick'#7#19'actNewMethodExecute'#0#0#9'TMenuItem'#9'MenuItem2'#6'A' +'Action'#7#12'actNewMethod'#7'OnClick'#7#19'actNewMethodExecute'#0#0#9'TMenu'
+'ction'#7#18'actUpdateOperation'#7'OnClick'#7#25'actUpdateOperationExecute'#0 +'Item'#9'MenuItem2'#6'Action'#7#18'actUpdateOperation'#7'OnClick'#7#25'actUp'
+#0#9'TMenuItem'#9'MenuItem3'#6'Action'#7#18'actDeleteOperation'#7'OnClick'#7 +'dateOperationExecute'#0#0#9'TMenuItem'#9'MenuItem3'#6'Action'#7#18'actDelet'
+#25'actDeleteOperationExecute'#0#0#9'TMenuItem'#9'MenuItem4'#7'Caption'#6#1 +'eOperation'#7'OnClick'#7#25'actDeleteOperationExecute'#0#0#9'TMenuItem'#9'M'
+'-'#0#0#9'TMenuItem'#9'MenuItem5'#6'Action'#7#14'actBindingEdit'#7'OnClick'#7 +'enuItem4'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#9'MenuItem5'#6'Action'#7#14'ac'
+#21'actBindingEditExecute'#0#0#0#0 +'tBindingEdit'#7'OnClick'#7#21'actBindingEditExecute'#0#0#0#0
]); ]);

View File

@@ -1,19 +1,24 @@
object fModuleEdit: TfModuleEdit object fModuleEdit: TfModuleEdit
Left = 750 Left = 750
Height = 300 Height = 300
Top = 92 Top = 93
Width = 400 Width = 400
HorzScrollBar.Page = 399 HorzScrollBar.Page = 399
VertScrollBar.Page = 299 VertScrollBar.Page = 299
ActiveControl = Button1 ActiveControl = Button1
BorderStyle = bsSizeToolWin BorderStyle = bsSizeToolWin
Caption = 'fModuleEdit' Caption = 'Module properties'
ClientHeight = 300
ClientWidth = 400
Position = poMainFormCenter Position = poMainFormCenter
LCLVersion = '0.9.25'
object Panel1: TPanel object Panel1: TPanel
Height = 50 Height = 50
Top = 250 Top = 250
Width = 400 Width = 400
Align = alBottom Align = alBottom
ClientHeight = 50
ClientWidth = 400
TabOrder = 0 TabOrder = 0
object Button1: TButton object Button1: TButton
Left = 224 Left = 224
@@ -46,13 +51,14 @@ object fModuleEdit: TfModuleEdit
TabOrder = 1 TabOrder = 1
object TabSheet1: TTabSheet object TabSheet1: TTabSheet
Caption = 'Module' Caption = 'Module'
ClientHeight = 224
ClientWidth = 392
object Label1: TLabel object Label1: TLabel
Left = 20 Left = 20
Height = 14 Height = 14
Top = 39 Top = 39
Width = 28 Width = 28
Caption = 'Name' Caption = 'Name'
Color = clNone
ParentColor = False ParentColor = False
end end
object Label2: TLabel object Label2: TLabel
@@ -61,14 +67,13 @@ object fModuleEdit: TfModuleEdit
Top = 127 Top = 127
Width = 56 Width = 56
Caption = 'Namespace' Caption = 'Namespace'
Color = clNone
ParentColor = False ParentColor = False
end end
object edtName: TEdit object edtName: TEdit
Left = 20 Left = 20
Height = 23 Height = 23
Top = 55 Top = 55
Width = 352 Width = 344
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
TabOrder = 0 TabOrder = 0
Text = 'edtName' Text = 'edtName'
@@ -77,7 +82,7 @@ object fModuleEdit: TfModuleEdit
Left = 20 Left = 20
Height = 23 Height = 23
Top = 143 Top = 143
Width = 352 Width = 344
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
TabOrder = 1 TabOrder = 1
Text = 'edtNamespace' Text = 'edtNamespace'

View File

@@ -2,27 +2,29 @@
LazarusResources.Add('TfModuleEdit','FORMDATA',[ LazarusResources.Add('TfModuleEdit','FORMDATA',[
'TPF0'#12'TfModuleEdit'#11'fModuleEdit'#4'Left'#3#238#2#6'Height'#3','#1#3'To' 'TPF0'#12'TfModuleEdit'#11'fModuleEdit'#4'Left'#3#238#2#6'Height'#3','#1#3'To'
+'p'#2'\'#5'Width'#3#144#1#18'HorzScrollBar.Page'#3#143#1#18'VertScrollBar.Pa' +'p'#2']'#5'Width'#3#144#1#18'HorzScrollBar.Page'#3#143#1#18'VertScrollBar.Pa'
+'ge'#3'+'#1#13'ActiveControl'#7#7'Button1'#11'BorderStyle'#7#13'bsSizeToolWi' +'ge'#3'+'#1#13'ActiveControl'#7#7'Button1'#11'BorderStyle'#7#13'bsSizeToolWi'
+'n'#7'Caption'#6#11'fModuleEdit'#8'Position'#7#16'poMainFormCenter'#0#6'TPan' +'n'#7'Caption'#6#17'Module properties'#12'ClientHeight'#3','#1#11'ClientWidt'
+'el'#6'Panel1'#6'Height'#2'2'#3'Top'#3#250#0#5'Width'#3#144#1#5'Align'#7#8'a' +'h'#3#144#1#8'Position'#7#16'poMainFormCenter'#10'LCLVersion'#6#6'0.9.25'#0#6
+'lBottom'#8'TabOrder'#2#0#0#7'TButton'#7'Button1'#4'Left'#3#224#0#6'Height'#2 +'TPanel'#6'Panel1'#6'Height'#2'2'#3'Top'#3#250#0#5'Width'#3#144#1#5'Align'#7
+#25#3'Top'#2#14#5'Width'#2'K'#6'Action'#7#5'actOK'#25'BorderSpacing.InnerBor' +#8'alBottom'#12'ClientHeight'#2'2'#11'ClientWidth'#3#144#1#8'TabOrder'#2#0#0
+'der'#2#4#7'Default'#9#8'TabOrder'#2#0#0#0#7'TButton'#7'Button2'#4'Left'#3'8' +#7'TButton'#7'Button1'#4'Left'#3#224#0#6'Height'#2#25#3'Top'#2#14#5'Width'#2
+#1#6'Height'#2#25#3'Top'#2#14#5'Width'#2'K'#25'BorderSpacing.InnerBorder'#2#4 +'K'#6'Action'#7#5'actOK'#25'BorderSpacing.InnerBorder'#2#4#7'Default'#9#8'Ta'
+#6'Cancel'#9#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#1#0#0#0 +'bOrder'#2#0#0#0#7'TButton'#7'Button2'#4'Left'#3'8'#1#6'Height'#2#25#3'Top'#2
+#12'TPageControl'#12'PageControl1'#6'Height'#3#250#0#5'Width'#3#144#1#10'Act' +#14#5'Width'#2'K'#25'BorderSpacing.InnerBorder'#2#4#6'Cancel'#9#7'Caption'#6
+'ivePage'#7#9'TabSheet1'#5'Align'#7#8'alClient'#8'TabIndex'#2#0#8'TabOrder'#2 +#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#1#0#0#0#12'TPageControl'#12'Pag'
+#1#0#9'TTabSheet'#9'TabSheet1'#7'Caption'#6#6'Module'#0#6'TLabel'#6'Label1'#4 +'eControl1'#6'Height'#3#250#0#5'Width'#3#144#1#10'ActivePage'#7#9'TabSheet1'
+'Left'#2#20#6'Height'#2#14#3'Top'#2''''#5'Width'#2#28#7'Caption'#6#4'Name'#5 +#5'Align'#7#8'alClient'#8'TabIndex'#2#0#8'TabOrder'#2#1#0#9'TTabSheet'#9'Tab'
+'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#6'Label2'#4'Left'#2#20#6 +'Sheet1'#7'Caption'#6#6'Module'#12'ClientHeight'#3#224#0#11'ClientWidth'#3
+'Height'#2#14#3'Top'#2''#5'Width'#2'8'#7'Caption'#6#9'Namespace'#5'Color'#7 +#136#1#0#6'TLabel'#6'Label1'#4'Left'#2#20#6'Height'#2#14#3'Top'#2''''#5'Widt'
+#6'clNone'#11'ParentColor'#8#0#0#5'TEdit'#7'edtName'#4'Left'#2#20#6'Height'#2 +'h'#2#28#7'Caption'#6#4'Name'#11'ParentColor'#8#0#0#6'TLabel'#6'Label2'#4'Le'
+#23#3'Top'#2'7'#5'Width'#3'`'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0 +'ft'#2#20#6'Height'#2#14#3'Top'#2''#5'Width'#2'8'#7'Caption'#6#9'Namespace'
+#8'TabOrder'#2#0#4'Text'#6#7'edtName'#0#0#5'TEdit'#12'edtNamespace'#4'Left'#2 +#11'ParentColor'#8#0#0#5'TEdit'#7'edtName'#4'Left'#2#20#6'Height'#2#23#3'Top'
+#20#6'Height'#2#23#3'Top'#3#143#0#5'Width'#3'`'#1#7'Anchors'#11#5'akTop'#6'a' +#2'7'#5'Width'#3'X'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'TabOrd'
+'kLeft'#7'akRight'#0#8'TabOrder'#2#1#4'Text'#6#12'edtNamespace'#0#0#0#0#11'T' +'er'#2#0#4'Text'#6#7'edtName'#0#0#5'TEdit'#12'edtNamespace'#4'Left'#2#20#6'H'
+'ActionList'#2'AL'#4'left'#2's'#3'top'#2'~'#0#7'TAction'#5'actOK'#7'Caption' +'eight'#2#23#3'Top'#3#143#0#5'Width'#3'X'#1#7'Anchors'#11#5'akTop'#6'akLeft'
+#6#2'OK'#18'DisableIfNoHandler'#9#9'OnExecute'#7#12'actOKExecute'#8'OnUpdate' +#7'akRight'#0#8'TabOrder'#2#1#4'Text'#6#12'edtNamespace'#0#0#0#0#11'TActionL'
+#7#11'actOKUpdate'#0#0#0#0 +'ist'#2'AL'#4'left'#2's'#3'top'#2'~'#0#7'TAction'#5'actOK'#7'Caption'#6#2'OK'
+#18'DisableIfNoHandler'#9#9'OnExecute'#7#12'actOKExecute'#8'OnUpdate'#7#11'a'
+'ctOKUpdate'#0#0#0#0
]); ]);

View File

@@ -153,6 +153,11 @@ type
FImpTempStream : ISourceStream; FImpTempStream : ISourceStream;
FImpLastStream : ISourceStream; FImpLastStream : ISourceStream;
FRttiFunc : ISourceStream; FRttiFunc : ISourceStream;
private
// Array handling helper routines
procedure WriteObjectArray(ASymbol : TPasArrayType);
procedure WriteSimpleTypeArray(ASymbol : TPasArrayType);
procedure WriteObjectCollection(ASymbol : TPasArrayType);
private private
function GenerateIntfName(AIntf : TPasElement):string; function GenerateIntfName(AIntf : TPasElement):string;
@@ -1756,6 +1761,230 @@ end;
{ TInftGenerator } { TInftGenerator }
procedure TInftGenerator.WriteObjectArray(ASymbol : TPasArrayType);
begin
SetCurrentStream(FDecStream);
NewLine();
IncIndent();
BeginAutoIndent();
try
WriteLn('%s = class(TBaseObjectArrayRemotable)',[ASymbol.Name]);
WriteLn('private');
Indent();WriteLn('function GetItem(AIndex: Integer): %s;',[ASymbol.ElType.Name]);
WriteLn('public');
Indent();WriteLn('class function GetItemClass():TBaseRemotableClass;override;');
Indent();WriteLn('property Item[AIndex:Integer] : %s Read GetItem;Default;',[ASymbol.ElType.Name]);
WriteLn('end;');
finally
EndAutoIndent();
DecIndent();
end;
SetCurrentStream(FImpStream);
NewLine();
WriteLn('{ %s }',[ASymbol.Name]);
NewLine();
WriteLn('function %s.GetItem(AIndex: Integer): %s;',[ASymbol.Name,ASymbol.ElType.Name]);
WriteLn('begin');
IncIndent();
Indent();WriteLn('Result := %s(Inherited GetItem(AIndex));',[ASymbol.ElType.Name]);
DecIndent();
WriteLn('end;');
NewLine();
WriteLn('class function %s.GetItemClass(): TBaseRemotableClass;',[ASymbol.Name]);
WriteLn('begin');
IncIndent();
Indent();WriteLn('Result:= %s;',[ASymbol.ElType.Name]);
DecIndent();
WriteLn('end;');
end;
procedure TInftGenerator.WriteSimpleTypeArray(ASymbol : TPasArrayType);
begin
SetCurrentStream(FDecStream);
NewLine();
IncIndent();
BeginAutoIndent();
try
WriteLn('%s = class(TBaseSimpleTypeArrayRemotable)',[ASymbol.Name]);
WriteLn('private');
Indent();WriteLn('FData : array of %s;',[ASymbol.ElType.Name]);
WriteLn('private');
Indent();WriteLn('function GetItem(AIndex: Integer): %s;',[ASymbol.ElType.Name]);
Indent();WriteLn('procedure SetItem(AIndex: Integer; const AValue: %s);',[ASymbol.ElType.Name]);
WriteLn('protected');
Indent();WriteLn('function GetLength():Integer;override;');
Indent();WriteLn('procedure SaveItem(AStore : IFormatterBase;const AName : String;const AIndex : Integer);override;');
Indent();WriteLn('procedure LoadItem(AStore : IFormatterBase;const AIndex : Integer);override;');
WriteLn('public');
Indent();WriteLn('class function GetItemTypeInfo():PTypeInfo;override;');
Indent();WriteLn('procedure SetLength(const ANewSize : Integer);override;');
Indent();WriteLn('procedure Assign(Source: TPersistent); override;');
Indent();WriteLn('property Item[AIndex:Integer] : %s read GetItem write SetItem; default;',[ASymbol.ElType.Name]);
WriteLn('end;');
finally
EndAutoIndent();
DecIndent();
end;
SetCurrentStream(FImpStream);
NewLine();
WriteLn('{ %s }',[ASymbol.Name]);
NewLine();
WriteLn('function %s.GetItem(AIndex: Integer): %s;',[ASymbol.Name,ASymbol.ElType.Name]);
WriteLn('begin');
IncIndent();
Indent();WriteLn('CheckIndex(AIndex);');
Indent();WriteLn('Result := FData[AIndex];');
DecIndent();
WriteLn('end;');
NewLine();
WriteLn('procedure %s.SetItem(AIndex: Integer;const AValue: %S);',[ASymbol.Name,ASymbol.ElType.Name]);
WriteLn('begin');
IncIndent();
Indent();WriteLn('CheckIndex(AIndex);');
Indent();WriteLn('FData[AIndex] := AValue;');
DecIndent();
WriteLn('end;');
NewLine();
WriteLn('function %s.GetLength(): Integer;',[ASymbol.Name]);
WriteLn('begin');
IncIndent();
Indent();WriteLn('Result := System.Length(FData);');
DecIndent();
WriteLn('end;');
NewLine();
WriteLn('procedure %s.SaveItem(AStore: IFormatterBase;const AName: String; const AIndex: Integer);',[ASymbol.Name]);
WriteLn('begin');
IncIndent();
Indent();WriteLn('AStore.Put(%s,TypeInfo(%s),FData[AIndex]);',[QuotedStr(SymbolTable.GetArrayItemName(ASymbol)),ASymbol.ElType.Name]);
DecIndent();
WriteLn('end;');
NewLine();
IncIndent();
WriteLn('procedure %s.LoadItem(AStore: IFormatterBase;const AIndex: Integer);',[ASymbol.Name]);
WriteLn('var');
Indent();WriteLn('sName : string;');
WriteLn('begin');
Indent();WriteLn('sName := %s;',[QuotedStr(SymbolTable.GetArrayItemName(ASymbol))]);
Indent();WriteLn('AStore.Get(TypeInfo(%s),sName,FData[AIndex]);',[ASymbol.ElType.Name]);
DecIndent();
WriteLn('end;');
NewLine();
WriteLn('class function %s.GetItemTypeInfo(): PTypeInfo;',[ASymbol.Name]);
WriteLn('begin');
IncIndent();
Indent();WriteLn('Result := TypeInfo(%s);',[ASymbol.ElType.Name]);
DecIndent();
WriteLn('end;');
NewLine();
IncIndent();
WriteLn('procedure %s.SetLength(const ANewSize: Integer);',[ASymbol.Name]);
WriteLn('var');
Indent();WriteLn('i : Integer;');
WriteLn('begin');
Indent();WriteLn('if ( ANewSize < 0 ) then');
Indent();Indent();WriteLn('i := 0');
Indent();WriteLn('else');
Indent();Indent();WriteLn('i := ANewSize;');
Indent();WriteLn('System.SetLength(FData,i);');
DecIndent();
WriteLn('end;');
NewLine();
IncIndent();
WriteLn('procedure %s.Assign(Source: TPersistent);',[ASymbol.Name]);
WriteLn('var');
Indent();WriteLn('src : %s;',[ASymbol.Name]);
Indent();WriteLn('i, c : PtrInt;');
WriteLn('begin');
Indent();WriteLn('if Assigned(Source) and Source.InheritsFrom(%s) then begin',[ASymbol.Name]);
IncIndent();
Indent();WriteLn('src := %s(Source);',[ASymbol.Name]);
Indent();WriteLn('c := src.Length;');
Indent();WriteLn('Self.SetLength(c);');
Indent();WriteLn('if ( c > 0 ) then begin');
IncIndent();
Indent();WriteLn('for i := 0 to Pred(c) do begin');
IncIndent(); Indent(); WriteLn('Self[i] := src[i];'); DecIndent();
Indent();WriteLn('end;');
DecIndent();
Indent();WriteLn('end;');
DecIndent();
Indent();WriteLn('end else begin');
IncIndent(); Indent(); WriteLn('inherited Assign(Source);'); DecIndent();
Indent();WriteLn('end;');
DecIndent();
WriteLn('end;');
end;
procedure TInftGenerator.WriteObjectCollection(ASymbol : TPasArrayType);
begin
SetCurrentStream(FDecStream);
NewLine();
IncIndent();
BeginAutoIndent();
try
WriteLn('%s = class(TObjectCollectionRemotable)',[ASymbol.Name]);
WriteLn('private');
Indent();WriteLn('function GetItem(AIndex: Integer): %s;',[ASymbol.ElType.Name]);
WriteLn('public');
Indent();WriteLn('class function GetItemClass():TBaseRemotableClass;override;');
Indent();WriteLn('function Add(): %s; {$IFDEF USE_INLINE}inline;{$ENDIF}',[ASymbol.ElType.Name]);
Indent();WriteLn('function AddAt(const APosition : Integer) : %s; {$IFDEF USE_INLINE}inline;{$ENDIF}',[ASymbol.ElType.Name]);
Indent();WriteLn('property Item[AIndex:Integer] : %s Read GetItem;Default;',[ASymbol.ElType.Name]);
WriteLn('end;');
finally
EndAutoIndent();
DecIndent();
end;
SetCurrentStream(FImpStream);
NewLine();
WriteLn('{ %s }',[ASymbol.Name]);
NewLine();
WriteLn('function %s.GetItem(AIndex: Integer): %s;',[ASymbol.Name,ASymbol.ElType.Name]);
WriteLn('begin');
IncIndent();
Indent();WriteLn('Result := %s(Inherited GetItem(AIndex));',[ASymbol.ElType.Name]);
DecIndent();
WriteLn('end;');
NewLine();
WriteLn('class function %s.GetItemClass(): TBaseRemotableClass;',[ASymbol.Name]);
WriteLn('begin');
IncIndent();
Indent();WriteLn('Result:= %s;',[ASymbol.ElType.Name]);
DecIndent();
WriteLn('end;');
NewLine();
WriteLn('function %s.Add() : %s;',[ASymbol.Name,ASymbol.ElType.Name]);
WriteLn('begin');
IncIndent();
Indent();WriteLn('Result := %s(inherited Add());',[ASymbol.ElType.Name]);
DecIndent();
WriteLn('end;');
NewLine();
WriteLn('function %s.AddAt(const APosition : Integer) : %s;',[ASymbol.Name,ASymbol.ElType.Name]);
WriteLn('begin');
IncIndent();
Indent();WriteLn('Result := %s(inherited AddAt(APosition));',[ASymbol.ElType.Name]);
DecIndent();
WriteLn('end;');
end;
function TInftGenerator.GenerateIntfName(AIntf: TPasElement): string; function TInftGenerator.GenerateIntfName(AIntf: TPasElement): string;
begin begin
Result := ExtractserviceName(AIntf); Result := ExtractserviceName(AIntf);
@@ -2240,173 +2469,6 @@ begin
end; end;
procedure TInftGenerator.GenerateArray(ASymbol: TPasArrayType); procedure TInftGenerator.GenerateArray(ASymbol: TPasArrayType);
procedure WriteObjectArray();
begin
SetCurrentStream(FDecStream);
NewLine();
IncIndent();
BeginAutoIndent();
try
WriteLn('%s = class(TBaseObjectArrayRemotable)',[ASymbol.Name]);
WriteLn('private');
Indent();WriteLn('function GetItem(AIndex: Integer): %s;',[ASymbol.ElType.Name]);
WriteLn('public');
Indent();WriteLn('class function GetItemClass():TBaseRemotableClass;override;');
Indent();WriteLn('property Item[AIndex:Integer] : %s Read GetItem;Default;',[ASymbol.ElType.Name]);
WriteLn('end;');
finally
EndAutoIndent();
DecIndent();
end;
SetCurrentStream(FImpStream);
NewLine();
WriteLn('{ %s }',[ASymbol.Name]);
NewLine();
WriteLn('function %s.GetItem(AIndex: Integer): %s;',[ASymbol.Name,ASymbol.ElType.Name]);
WriteLn('begin');
IncIndent();
Indent();WriteLn('Result := Inherited GetItem(AIndex) As %s;',[ASymbol.ElType.Name]);
DecIndent();
WriteLn('end;');
NewLine();
WriteLn('class function %s.GetItemClass(): TBaseRemotableClass;',[ASymbol.Name]);
WriteLn('begin');
IncIndent();
Indent();WriteLn('Result:= %s;',[ASymbol.ElType.Name]);
DecIndent();
WriteLn('end;');
end;
procedure WriteSimpleTypeArray();
begin
SetCurrentStream(FDecStream);
NewLine();
IncIndent();
BeginAutoIndent();
try
WriteLn('%s = class(TBaseSimpleTypeArrayRemotable)',[ASymbol.Name]);
WriteLn('private');
Indent();WriteLn('FData : array of %s;',[ASymbol.ElType.Name]);
WriteLn('private');
Indent();WriteLn('function GetItem(AIndex: Integer): %s;',[ASymbol.ElType.Name]);
Indent();WriteLn('procedure SetItem(AIndex: Integer; const AValue: %s);',[ASymbol.ElType.Name]);
WriteLn('protected');
Indent();WriteLn('function GetLength():Integer;override;');
Indent();WriteLn('procedure SaveItem(AStore : IFormatterBase;const AName : String;const AIndex : Integer);override;');
Indent();WriteLn('procedure LoadItem(AStore : IFormatterBase;const AIndex : Integer);override;');
WriteLn('public');
Indent();WriteLn('class function GetItemTypeInfo():PTypeInfo;override;');
Indent();WriteLn('procedure SetLength(const ANewSize : Integer);override;');
Indent();WriteLn('procedure Assign(Source: TPersistent); override;');
Indent();WriteLn('property Item[AIndex:Integer] : %s read GetItem write SetItem; default;',[ASymbol.ElType.Name]);
WriteLn('end;');
finally
EndAutoIndent();
DecIndent();
end;
SetCurrentStream(FImpStream);
NewLine();
WriteLn('{ %s }',[ASymbol.Name]);
NewLine();
WriteLn('function %s.GetItem(AIndex: Integer): %s;',[ASymbol.Name,ASymbol.ElType.Name]);
WriteLn('begin');
IncIndent();
Indent();WriteLn('CheckIndex(AIndex);');
Indent();WriteLn('Result := FData[AIndex];');
DecIndent();
WriteLn('end;');
NewLine();
WriteLn('procedure %s.SetItem(AIndex: Integer;const AValue: %S);',[ASymbol.Name,ASymbol.ElType.Name]);
WriteLn('begin');
IncIndent();
Indent();WriteLn('CheckIndex(AIndex);');
Indent();WriteLn('FData[AIndex] := AValue;');
DecIndent();
WriteLn('end;');
NewLine();
WriteLn('function %s.GetLength(): Integer;',[ASymbol.Name]);
WriteLn('begin');
IncIndent();
Indent();WriteLn('Result := System.Length(FData);');
DecIndent();
WriteLn('end;');
NewLine();
WriteLn('procedure %s.SaveItem(AStore: IFormatterBase;const AName: String; const AIndex: Integer);',[ASymbol.Name]);
WriteLn('begin');
IncIndent();
Indent();WriteLn('AStore.Put(%s,TypeInfo(%s),FData[AIndex]);',[QuotedStr(SymbolTable.GetArrayItemName(ASymbol)),ASymbol.ElType.Name]);
DecIndent();
WriteLn('end;');
NewLine();
IncIndent();
WriteLn('procedure %s.LoadItem(AStore: IFormatterBase;const AIndex: Integer);',[ASymbol.Name]);
WriteLn('var');
Indent();WriteLn('sName : string;');
WriteLn('begin');
Indent();WriteLn('sName := %s;',[QuotedStr(SymbolTable.GetArrayItemName(ASymbol))]);
Indent();WriteLn('AStore.Get(TypeInfo(%s),sName,FData[AIndex]);',[ASymbol.ElType.Name]);
DecIndent();
WriteLn('end;');
NewLine();
WriteLn('class function %s.GetItemTypeInfo(): PTypeInfo;',[ASymbol.Name]);
WriteLn('begin');
IncIndent();
Indent();WriteLn('Result := TypeInfo(%s);',[ASymbol.ElType.Name]);
DecIndent();
WriteLn('end;');
NewLine();
IncIndent();
WriteLn('procedure %s.SetLength(const ANewSize: Integer);',[ASymbol.Name]);
WriteLn('var');
Indent();WriteLn('i : Integer;');
WriteLn('begin');
Indent();WriteLn('if ( ANewSize < 0 ) then');
Indent();Indent();WriteLn('i := 0');
Indent();WriteLn('else');
Indent();Indent();WriteLn('i := ANewSize;');
Indent();WriteLn('System.SetLength(FData,i);');
DecIndent();
WriteLn('end;');
NewLine();
IncIndent();
WriteLn('procedure %s.Assign(Source: TPersistent);',[ASymbol.Name]);
WriteLn('var');
Indent();WriteLn('src : %s;',[ASymbol.Name]);
Indent();WriteLn('i, c : PtrInt;');
WriteLn('begin');
Indent();WriteLn('if Assigned(Source) and Source.InheritsFrom(%s) then begin',[ASymbol.Name]);
IncIndent();
Indent();WriteLn('src := %s(Source);',[ASymbol.Name]);
Indent();WriteLn('c := src.Length;');
Indent();WriteLn('Self.SetLength(c);');
Indent();WriteLn('if ( c > 0 ) then begin');
IncIndent();
Indent();WriteLn('for i := 0 to Pred(c) do begin');
IncIndent(); Indent(); WriteLn('Self[i] := src[i];'); DecIndent();
Indent();WriteLn('end;');
DecIndent();
Indent();WriteLn('end;');
DecIndent();
Indent();WriteLn('end else begin');
IncIndent(); Indent(); WriteLn('inherited Assign(Source);'); DecIndent();
Indent();WriteLn('end;');
DecIndent();
WriteLn('end;');
end;
var var
classItemArray : Boolean; classItemArray : Boolean;
eltType : TPasType; eltType : TPasType;
@@ -2418,9 +2480,12 @@ 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
WriteObjectArray(); if FSymbolTable.IsCollection(ASymbol) then
WriteObjectCollection(ASymbol)
else
WriteObjectArray(ASymbol);
end else begin end else begin
WriteSimpleTypeArray(); WriteSimpleTypeArray(ASymbol);
end; end;
FImpTempStream.Indent(); FImpTempStream.Indent();

View File

@@ -282,7 +282,7 @@ var
begin begin
Result := False; Result := False;
if Assigned(ANode) and ( ANode.Attributes <> nil ) then begin if Assigned(ANode) and ( ANode.Attributes <> nil ) then begin
nd := ANode.Attributes.GetNamedItem(AAttribute); nd := ANode.Attributes.GetNamedItem(Format('%s:%s',[s_WST,AAttribute]));
if Assigned(nd) then begin if Assigned(nd) then begin
Result := True; Result := True;
AValue := nd.NodeValue; AValue := nd.NodeValue;

View File

@@ -27,7 +27,8 @@ const
sARRAY_STYLE = 'ARRAY_STYLE'; sARRAY_STYLE = 'ARRAY_STYLE';
sARRAY_STYLE_SCOPED = 'ARRAY_STYLE_SCOPED'; sARRAY_STYLE_SCOPED = 'ARRAY_STYLE_SCOPED';
sARRAY_STYLE_EMBEDDED = 'ARRAY_STYLE_EMBEDDED'; sARRAY_STYLE_EMBEDDED = 'ARRAY_STYLE_EMBEDDED';
sARRAY_IS_COLLECTION = 'ARRAY_COLLECTION';
sXSD_NS = 'http://www.w3.org/2001/XMLSchema'; sXSD_NS = 'http://www.w3.org/2001/XMLSchema';
type type
@@ -112,6 +113,8 @@ type
function GetArrayStyle(AArray : TPasArrayType) : TArrayStyle; function GetArrayStyle(AArray : TPasArrayType) : TArrayStyle;
procedure SetArrayStyle(AArray : TPasArrayType; const AStyle : TArrayStyle); procedure SetArrayStyle(AArray : TPasArrayType; const AStyle : TArrayStyle);
procedure SetArrayItemExternalName(AArray : TPasArrayType; const AExternalName : string); procedure SetArrayItemExternalName(AArray : TPasArrayType; const AExternalName : string);
function IsCollection(AArray : TPasArrayType) : Boolean;
procedure SetCollectionFlag(AArray : TPasArrayType; const AFlag : Boolean);
function FindElement(const AName: String): TPasElement; override; function FindElement(const AName: String): TPasElement; override;
function FindElementNS(const AName, ANameSpace : string): TPasElement; function FindElementNS(const AName, ANameSpace : string): TPasElement;
function FindElementInModule(const AName: String; AModule: TPasModule): TPasElement; function FindElementInModule(const AName: String; AModule: TPasModule): TPasElement;
@@ -605,6 +608,22 @@ begin
Properties.SetValue(AArray,sARRAY_ITEM_EXT_NAME,AExternalName); Properties.SetValue(AArray,sARRAY_ITEM_EXT_NAME,AExternalName);
end; end;
function TwstPasTreeContainer.IsCollection(AArray : TPasArrayType) : Boolean;
begin
Result := AnsiSameText('true',Properties.GetValue(AArray,sARRAY_IS_COLLECTION));
end;
procedure TwstPasTreeContainer.SetCollectionFlag(
AArray : TPasArrayType;
const AFlag : Boolean
);
begin
if AFlag then
Properties.SetValue(AArray,sARRAY_IS_COLLECTION,'true')
else
Properties.SetValue(AArray,sARRAY_IS_COLLECTION,'false');
end;
function TwstPasTreeContainer.FindElementInModule(const AName: String; AModule : TPasModule): TPasElement; function TwstPasTreeContainer.FindElementInModule(const AName: String; AModule : TPasModule): TPasElement;
var var
decs : TList; decs : TList;

View File

@@ -148,8 +148,10 @@
</CodeGeneration> </CodeGeneration>
<Linking> <Linking>
<Debugging> <Debugging>
<GenerateDebugInfo Value="True"/> <UseLineInfoUnit Value="False"/>
<StripSymbols Value="True"/>
</Debugging> </Debugging>
<LinkSmart Value="True"/>
</Linking> </Linking>
<Other> <Other>
<CustomOptions Value="-Xi <CustomOptions Value="-Xi

View File

@@ -15,7 +15,7 @@ unit ws_parser_imp;
interface interface
uses uses
Classes, SysUtils, Classes, SysUtils, Contnrs,
{$IFNDEF FPC}xmldom, wst_delphi_xml{$ELSE}DOM, wst_fpc_xml{$ENDIF}, {$IFNDEF FPC}xmldom, wst_delphi_xml{$ELSE}DOM, wst_fpc_xml{$ENDIF},
cursor_intf, rtti_filters, cursor_intf, rtti_filters,
pastree, pascal_parser_intf, logger_intf, pastree, pascal_parser_intf, logger_intf,
@@ -69,6 +69,31 @@ type
TDerivationMode = ( dmNone, dmExtension, dmRestriction ); TDerivationMode = ( dmNone, dmExtension, dmRestriction );
TSequenceType = ( stElement, stAll ); TSequenceType = ( stElement, stAll );
{ TPropInfoReference }
TPropInfoReference = class
private
FIsCollection : Boolean;
FProp : TPasProperty;
public
property Prop : TPasProperty read FProp;
property IsCollection : Boolean read FIsCollection;
end;
{ TPropInfoReferenceList }
TPropInfoReferenceList = class
private
FList : TObjectList;
public
constructor Create();
destructor Destroy();override;
function Add(AProp : TPasProperty) : TPropInfoReference;
function GetItem(const AIndex : PtrInt) : TPropInfoReference;{$IFDEF USE_INLINE}inline;{$ENDIF}
function IndexOf(const AProp : TPasProperty) : PtrInt;
function GetCount() : PtrInt;{$IFDEF USE_INLINE}inline;{$ENDIF}
end;
{ TComplexTypeParser } { TComplexTypeParser }
TComplexTypeParser = class(TAbstractTypeParser) TComplexTypeParser = class(TAbstractTypeParser)
@@ -81,6 +106,19 @@ type
FDerivationMode : TDerivationMode; FDerivationMode : TDerivationMode;
FDerivationNode : TDOMNode; FDerivationNode : TDOMNode;
FSequenceType : TSequenceType; FSequenceType : TSequenceType;
private
//helper routines
function ExtractElementCursor(out AAttCursor : IObjectCursor):IObjectCursor;
procedure ExtractExtendedMetadata(const AItem : TPasElement; const ANode : TDOMNode);
procedure GenerateArrayTypes(
const AClassName : string;
AArrayPropList : TPropInfoReferenceList
);
function ExtractSoapArray(
const ATypeName : string;
const AInternalName : string;
const AHasInternalName : Boolean
) : TPasArrayType;
private private
procedure CreateNodeCursors(); procedure CreateNodeCursors();
procedure ExtractTypeName(); procedure ExtractTypeName();
@@ -119,7 +157,7 @@ type
SResolveError = 'Unable to resolve this namespace : "%s".'; SResolveError = 'Unable to resolve this namespace : "%s".';
implementation implementation
uses dom_cursors, parserutils, StrUtils, Contnrs, xsd_consts; uses dom_cursors, parserutils, StrUtils, xsd_consts;
{ TAbstractTypeParser } { TAbstractTypeParser }
@@ -273,6 +311,194 @@ end;
{ TComplexTypeParser } { TComplexTypeParser }
function TComplexTypeParser.ExtractElementCursor(out AAttCursor : IObjectCursor) : IObjectCursor;
var
frstCrsr, tmpCursor : IObjectCursor;
parentNode, tmpNode : TDOMNode;
begin
Result := nil;
AAttCursor := nil;
case FDerivationMode of
dmNone : parentNode := FContentNode;
dmRestriction,
dmExtension : parentNode := FDerivationNode;
end;
if parentNode.HasChildNodes() then begin;
AAttCursor := CreateCursorOn(
CreateChildrenCursor(parentNode,cetRttiNode),
ParseFilter(CreateQualifiedNameFilterStr(s_attribute,FContext.GetXsShortNames()),TDOMNodeRttiExposer)
);
frstCrsr := CreateChildrenCursor(parentNode,cetRttiNode);
tmpCursor := CreateCursorOn(
frstCrsr.Clone() as IObjectCursor,
ParseFilter(CreateQualifiedNameFilterStr(s_sequence,FContext.GetXsShortNames()),TDOMNodeRttiExposer)
);
tmpCursor.Reset();
if tmpCursor.MoveNext() then begin
FSequenceType := stElement;
tmpNode := (tmpCursor.GetCurrent() as TDOMNodeRttiExposer).InnerObject;
if tmpNode.HasChildNodes() then begin
tmpCursor := CreateCursorOn(
CreateChildrenCursor(tmpNode,cetRttiNode),
ParseFilter(CreateQualifiedNameFilterStr(s_element,FContext.GetXsShortNames()),TDOMNodeRttiExposer)
);
Result := tmpCursor;
end;
end else begin
tmpCursor := CreateCursorOn(
frstCrsr.Clone() as IObjectCursor,
ParseFilter(CreateQualifiedNameFilterStr(s_all,FContext.GetXsShortNames()),TDOMNodeRttiExposer)
);
tmpCursor.Reset();
if tmpCursor.MoveNext() then begin
FSequenceType := stElement;
tmpNode := (tmpCursor.GetCurrent() as TDOMNodeRttiExposer).InnerObject;
if tmpNode.HasChildNodes() then begin
tmpCursor := CreateCursorOn(
CreateChildrenCursor(tmpNode,cetRttiNode),
ParseFilter(CreateQualifiedNameFilterStr(s_element,FContext.GetXsShortNames()),TDOMNodeRttiExposer)
);
Result := tmpCursor;
end;
end;
end
end else begin
Result := nil;
end;
end;
procedure TComplexTypeParser.ExtractExtendedMetadata(
const AItem : TPasElement;
const ANode : TDOMNode
);
var
ls : TDOMNamedNodeMap;
e : TDOMNode;
k, q : PtrInt;
ns_short, ns_long, localName, locBuffer, locBufferNS, locBufferNS_long, locBufferLocalName : string;
begin
if ( ANode.Attributes <> nil ) and ( GetNodeListCount(ANode.Attributes) > 0 ) then begin
ls := ANode.Attributes;
q := GetNodeListCount(ANode.Attributes);
for k := 0 to ( q - 1 ) do begin
e := ls.Item[k];
if ( Pos(':', e.NodeName) > 1 ) then begin
ExplodeQName(e.NodeName,localName,ns_short);
if FContext.FindNameSpace(ns_short, ns_long) then begin
locBuffer := e.NodeValue;
ExplodeQName(locBuffer,locBufferLocalName,locBufferNS);
if IsStrEmpty(locBufferNS) then
locBuffer := locBufferLocalName
else if FContext.FindNameSpace(locBufferNS, locBufferNS_long) then
locBuffer := Format('%s#%s',[locBufferNS_long,locBufferLocalName]);
FSymbols.Properties.SetValue(AItem,Format('%s#%s',[ns_long,localName]),locBuffer);
end;
end;
end;
end;
end;
procedure TComplexTypeParser.GenerateArrayTypes(
const AClassName : string;
AArrayPropList : TPropInfoReferenceList
);
var
propRef : TPropInfoReference;
locPropTyp : TPasProperty;
k : Integer;
locString : string;
locSym : TPasElement;
begin
for k := 0 to Pred(AArrayPropList.GetCount()) do begin
propRef := AArrayPropList.GetItem(k);
locPropTyp := propRef.Prop;
locString := Format('%s_%sArray',[AClassName,locPropTyp.Name]);
locSym := FSymbols.FindElement(locString);
if ( locSym = nil ) then begin
locSym := FSymbols.CreateArray(
locString,
locPropTyp.VarType,
locPropTyp.Name,
FSymbols.GetExternalName(locPropTyp),
asEmbeded
);
Self.Module.InterfaceSection.Declarations.Add(locSym);
Self.Module.InterfaceSection.Types.Add(locSym);
if propRef.IsCollection then
FSymbols.SetCollectionFlag(TPasArrayType(locSym),True);
end;
end;
end;
function TComplexTypeParser.ExtractSoapArray(
const ATypeName : string;
const AInternalName : string;
const AHasInternalName : Boolean
) : TPasArrayType;
var
ls : TStringList;
crs, locCrs : IObjectCursor;
s : string;
i : Integer;
locSym : TPasElement;
ok : Boolean;
nd : TDOMNode;
begin
if not FDerivationNode.HasChildNodes then begin
raise EXsdInvalidTypeDefinitionException.CreateFmt('Invalid type definition, attributes not found : "%s".',[FTypeName]);
end;
crs := CreateCursorOn(
CreateChildrenCursor(FDerivationNode,cetRttiNode),
ParseFilter(CreateQualifiedNameFilterStr(s_attribute,FContext.GetXsShortNames()),TDOMNodeRttiExposer)
);
ls := TStringList.Create();
try
ok := False;
crs.Reset();
while crs.MoveNext() do begin
nd := (crs.GetCurrent() as TDOMNodeRttiExposer).InnerObject;
if Assigned(nd.Attributes) and ( nd.Attributes.Length > 0 ) then begin
ls.Clear();
ExtractNameSpaceShortNamesNested(nd,ls,s_wsdl);
locCrs := CreateAttributesCursor(nd,cetRttiNode);
locCrs := CreateCursorOn(
locCrs,
ParseFilter(CreateQualifiedNameFilterStr(s_arrayType,ls),TDOMNodeRttiExposer)
);
if Assigned(locCrs) then begin
locCrs.Reset();
if locCrs.MoveNext() then begin
ok := True;
Break;
end;
end;
end;
end;
finally
FreeAndNil(ls);
end;
if not ok then begin
raise EXsdInvalidTypeDefinitionException.CreateFmt('Invalid type definition, unable to find the "%s" attribute : "%s".',[s_arrayType,FTypeName]);
end;
s := ExtractNameFromQName((locCrs.GetCurrent() as TDOMNodeRttiExposer).InnerObject.NodeValue);
i := Pos('[',s);
if ( i < 1 ) then begin
i := MaxInt;
end;
s := Copy(s,1,Pred(i));
locSym := FSymbols.FindElement(s);
if not Assigned(locSym) then begin
locSym := TPasUnresolvedTypeRef(FSymbols.CreateElement(TPasUnresolvedTypeRef,s,Self.Module.InterfaceSection,visDefault,'',0));
Self.Module.InterfaceSection.Declarations.Add(locSym);
Self.Module.InterfaceSection.Types.Add(locSym);
end;
if not locSym.InheritsFrom(TPasType) then
raise EXsdInvalidTypeDefinitionException.CreateFmt('Invalid array type definition, invalid item type definition : "%s".',[FTypeName]);
Result := FSymbols.CreateArray(AInternalName,locSym as TPasType,s_item,s_item,asScoped);
if AHasInternalName then
FSymbols.RegisterExternalAlias(Result,ATypeName);
end;
procedure TComplexTypeParser.CreateNodeCursors(); procedure TComplexTypeParser.CreateNodeCursors();
begin begin
FAttCursor := CreateAttributesCursor(FTypeNode,cetRttiNode); FAttCursor := CreateAttributesCursor(FTypeNode,cetRttiNode);
@@ -402,96 +628,18 @@ begin
end; end;
function TComplexTypeParser.ParseComplexContent(const ATypeName : string) : TPasType; function TComplexTypeParser.ParseComplexContent(const ATypeName : string) : TPasType;
function ExtractElementCursor(out AAttCursor : IObjectCursor):IObjectCursor;
var
frstCrsr, tmpCursor : IObjectCursor;
parentNode, tmpNode : TDOMNode;
begin
Result := nil;
AAttCursor := nil;
case FDerivationMode of
dmNone : parentNode := FContentNode;
dmRestriction,
dmExtension : parentNode := FDerivationNode;
end;
if parentNode.HasChildNodes() then begin;
AAttCursor := CreateCursorOn(
CreateChildrenCursor(parentNode,cetRttiNode),
ParseFilter(CreateQualifiedNameFilterStr(s_attribute,FContext.GetXsShortNames()),TDOMNodeRttiExposer)
);
frstCrsr := CreateChildrenCursor(parentNode,cetRttiNode);
tmpCursor := CreateCursorOn(
frstCrsr.Clone() as IObjectCursor,
ParseFilter(CreateQualifiedNameFilterStr(s_sequence,FContext.GetXsShortNames()),TDOMNodeRttiExposer)
);
tmpCursor.Reset();
if tmpCursor.MoveNext() then begin
FSequenceType := stElement;
tmpNode := (tmpCursor.GetCurrent() as TDOMNodeRttiExposer).InnerObject;
if tmpNode.HasChildNodes() then begin
tmpCursor := CreateCursorOn(
CreateChildrenCursor(tmpNode,cetRttiNode),
ParseFilter(CreateQualifiedNameFilterStr(s_element,FContext.GetXsShortNames()),TDOMNodeRttiExposer)
);
Result := tmpCursor;
end;
end else begin
tmpCursor := CreateCursorOn(
frstCrsr.Clone() as IObjectCursor,
ParseFilter(CreateQualifiedNameFilterStr(s_all,FContext.GetXsShortNames()),TDOMNodeRttiExposer)
);
tmpCursor.Reset();
if tmpCursor.MoveNext() then begin
FSequenceType := stElement;
tmpNode := (tmpCursor.GetCurrent() as TDOMNodeRttiExposer).InnerObject;
if tmpNode.HasChildNodes() then begin
tmpCursor := CreateCursorOn(
CreateChildrenCursor(tmpNode,cetRttiNode),
ParseFilter(CreateQualifiedNameFilterStr(s_element,FContext.GetXsShortNames()),TDOMNodeRttiExposer)
);
Result := tmpCursor;
end;
end;
end
end else begin
Result := nil;
end;
end;
var var
classDef : TPasClassType; classDef : TPasClassType;
isArrayDef : Boolean; isArrayDef : Boolean;
arrayItems : TObjectList; arrayItems : TPropInfoReferenceList;
procedure ExtractExtendedMetadata(const AItem : TPasElement; const ANode : TDOMNode); function IsCollectionArray(AElement : TDOMNode) : Boolean;
var var
ls : TDOMNamedNodeMap; strBuffer : string;
e : TDOMNode;
k, q : PtrInt;
ns_short, ns_long, localName, locBuffer, locBufferNS, locBufferNS_long, locBufferLocalName : string;
begin begin
if ( ANode.Attributes <> nil ) and ( GetNodeListCount(ANode.Attributes) > 0 ) then begin Result := wst_findCustomAttributeXsd(FContext.GetXsShortNames(),AElement,s_WST_collection,strBuffer) and AnsiSameText('true',Trim(strBuffer));
ls := ANode.Attributes;
q := GetNodeListCount(ANode.Attributes);
for k := 0 to ( q - 1 ) do begin
e := ls.Item[k];
if ( Pos(':', e.NodeName) > 1 ) then begin
ExplodeQName(e.NodeName,localName,ns_short);
if FContext.FindNameSpace(ns_short, ns_long) then begin
locBuffer := e.NodeValue;
ExplodeQName(locBuffer,locBufferLocalName,locBufferNS);
if IsStrEmpty(locBufferNS) then
locBuffer := locBufferLocalName
else if FContext.FindNameSpace(locBufferNS, locBufferNS_long) then
locBuffer := Format('%s#%s',[locBufferNS_long,locBufferLocalName]);
FSymbols.Properties.SetValue(AItem,Format('%s#%s',[ns_long,localName]),locBuffer);
end;
end;
end;
end;
end; end;
procedure ParseElement(AElement : TDOMNode); procedure ParseElement(AElement : TDOMNode);
var var
locAttCursor, locPartCursor : IObjectCursor; locAttCursor, locPartCursor : IObjectCursor;
@@ -641,7 +789,7 @@ var
end; end;
isArrayDef := locMaxOccurUnbounded or ( locMaxOccur > 1 ); isArrayDef := locMaxOccurUnbounded or ( locMaxOccur > 1 );
if isArrayDef then begin if isArrayDef then begin
arrayItems.Add(locProp); arrayItems.Add(locProp).FIsCollection := IsCollectionArray(AElement);
end; end;
if AnsiSameText(s_attribute,ExtractNameFromQName(AElement.NodeName)) then begin if AnsiSameText(s_attribute,ExtractNameFromQName(AElement.NodeName)) then begin
FSymbols.SetPropertyAsAttribute(locProp,True); FSymbols.SetPropertyAsAttribute(locProp,True);
@@ -652,100 +800,7 @@ var
locProp.DefaultValue := (locPartCursor.GetCurrent() as TDOMNodeRttiExposer).NodeValue; locProp.DefaultValue := (locPartCursor.GetCurrent() as TDOMNodeRttiExposer).NodeValue;
ExtractExtendedMetadata(locProp,AElement); ExtractExtendedMetadata(locProp,AElement);
end; end;
procedure GenerateArrayTypes(
const AClassName : string;
AArrayPropList : TObjectList
);
var
locPropTyp : TPasProperty;
k : Integer;
locString : string;
locSym : TPasElement;
begin
for k := 0 to Pred(AArrayPropList.Count) do begin
locPropTyp := AArrayPropList[k] as TPasProperty;
locString := Format('%s_%sArray',[AClassName,locPropTyp.Name]);
locSym := FSymbols.FindElement(locString);
if ( locSym = nil ) then begin
locSym := FSymbols.CreateArray(
locString,
locPropTyp.VarType,
locPropTyp.Name,
FSymbols.GetExternalName(locPropTyp),
asEmbeded
);
Self.Module.InterfaceSection.Declarations.Add(locSym);
Self.Module.InterfaceSection.Types.Add(locSym);
end;
end;
end;
function ExtractSoapArray(const AInternalName : string; const AHasInternalName : Boolean) : TPasArrayType;
var
ls : TStringList;
crs, locCrs : IObjectCursor;
s : string;
i : Integer;
locSym : TPasElement;
ok : Boolean;
nd : TDOMNode;
begin
if not FDerivationNode.HasChildNodes then begin
raise EXsdInvalidTypeDefinitionException.CreateFmt('Invalid type definition, attributes not found : "%s".',[FTypeName]);
end;
crs := CreateCursorOn(
CreateChildrenCursor(FDerivationNode,cetRttiNode),
ParseFilter(CreateQualifiedNameFilterStr(s_attribute,FContext.GetXsShortNames()),TDOMNodeRttiExposer)
);
ls := TStringList.Create();
try
ok := False;
crs.Reset();
while crs.MoveNext() do begin
nd := (crs.GetCurrent() as TDOMNodeRttiExposer).InnerObject;
if Assigned(nd.Attributes) and ( nd.Attributes.Length > 0 ) then begin
ls.Clear();
ExtractNameSpaceShortNamesNested(nd,ls,s_wsdl);
locCrs := CreateAttributesCursor(nd,cetRttiNode);
locCrs := CreateCursorOn(
locCrs,
ParseFilter(CreateQualifiedNameFilterStr(s_arrayType,ls),TDOMNodeRttiExposer)
);
if Assigned(locCrs) then begin
locCrs.Reset();
if locCrs.MoveNext() then begin
ok := True;
Break;
end;
end;
end;
end;
finally
FreeAndNil(ls);
end;
if not ok then begin
raise EXsdInvalidTypeDefinitionException.CreateFmt('Invalid type definition, unable to find the "%s" attribute : "%s".',[s_arrayType,FTypeName]);
end;
s := ExtractNameFromQName((locCrs.GetCurrent() as TDOMNodeRttiExposer).InnerObject.NodeValue);
i := Pos('[',s);
if ( i < 1 ) then begin
i := MaxInt;
end;
s := Copy(s,1,Pred(i));
locSym := FSymbols.FindElement(s);
if not Assigned(locSym) then begin
locSym := TPasUnresolvedTypeRef(FSymbols.CreateElement(TPasUnresolvedTypeRef,s,Self.Module.InterfaceSection,visDefault,'',0));
Self.Module.InterfaceSection.Declarations.Add(locSym);
Self.Module.InterfaceSection.Types.Add(locSym);
end;
if not locSym.InheritsFrom(TPasType) then
raise EXsdInvalidTypeDefinitionException.CreateFmt('Invalid array type definition, invalid item type definition : "%s".',[FTypeName]);
Result := FSymbols.CreateArray(AInternalName,locSym as TPasType,s_item,s_item,asScoped);
if AHasInternalName then
FSymbols.RegisterExternalAlias(Result,ATypeName);
end;
function IsHeaderBlock() : Boolean; function IsHeaderBlock() : Boolean;
var var
strBuffer : string; strBuffer : string;
@@ -801,9 +856,9 @@ begin
end; end;
if ( FDerivationMode = dmRestriction ) and FSymbols.SameName(FBaseType,s_array) then begin if ( FDerivationMode = dmRestriction ) and FSymbols.SameName(FBaseType,s_array) then begin
Result := ExtractSoapArray(internalName,hasInternalName); Result := ExtractSoapArray(ATypeName,internalName,hasInternalName);
end else begin end else begin
arrayItems := TObjectList.Create(False); arrayItems := TPropInfoReferenceList.Create();
try try
classDef := TPasClassType(FSymbols.CreateElement(TPasClassType,internalName,Self.Module.InterfaceSection,visDefault,'',0)); classDef := TPasClassType(FSymbols.CreateElement(TPasClassType,internalName,Self.Module.InterfaceSection,visDefault,'',0));
try try
@@ -824,16 +879,18 @@ begin
if Assigned(eltCrs) or Assigned(eltAttCrs) then begin if Assigned(eltCrs) or Assigned(eltAttCrs) then begin
isArrayDef := False; isArrayDef := False;
ParseElementsAndAttributes(eltCrs,eltAttCrs); ParseElementsAndAttributes(eltCrs,eltAttCrs);
if ( arrayItems.Count > 0 ) then begin if ( arrayItems.GetCount() > 0 ) then begin
if ( arrayItems.Count = 1 ) and ( GetElementCount(classDef.Members,TPasProperty) = 1 ) then begin if ( arrayItems.GetCount() = 1 ) and ( GetElementCount(classDef.Members,TPasProperty) = 1 ) then begin
Result := nil; Result := nil;
propTyp := arrayItems[0] as TPasProperty; propTyp := arrayItems.GetItem(0).Prop;
arrayDef := FSymbols.CreateArray(internalName,propTyp.VarType,propTyp.Name,FSymbols.GetExternalName(propTyp),asScoped); arrayDef := FSymbols.CreateArray(internalName,propTyp.VarType,propTyp.Name,FSymbols.GetExternalName(propTyp),asScoped);
FSymbols.FreeProperties(classDef); FSymbols.FreeProperties(classDef);
FreeAndNil(classDef); FreeAndNil(classDef);
Result := arrayDef; Result := arrayDef;
if hasInternalName then if hasInternalName then
FSymbols.RegisterExternalAlias(arrayDef,ATypeName); FSymbols.RegisterExternalAlias(arrayDef,ATypeName);
if arrayItems.GetItem(0).IsCollection then
FSymbols.SetCollectionFlag(arrayDef,True);
end else begin end else begin
GenerateArrayTypes(internalName,arrayItems); GenerateArrayTypes(internalName,arrayItems);
tmpClassDef := classDef; tmpClassDef := classDef;
@@ -1338,6 +1395,56 @@ begin
end; end;
end; end;
{ TPropInfoReferenceList }
constructor TPropInfoReferenceList.Create();
begin
FList := TObjectList.Create(False);
end;
destructor TPropInfoReferenceList.Destroy();
begin
FList.Free();
inherited Destroy();
end;
function TPropInfoReferenceList.Add(AProp : TPasProperty) : TPropInfoReference;
var
i : PtrInt;
begin
i := IndexOf(AProp);
if ( i = -1 ) then begin
Result := TPropInfoReference.Create();
Result.FProp := AProp;
FList.Add(Result);
end else begin
Result := TPropInfoReference(FList[i]);
end;
end;
function TPropInfoReferenceList.GetItem(const AIndex : PtrInt) : TPropInfoReference;
begin
Result := TPropInfoReference(FList[AIndex]);
end;
function TPropInfoReferenceList.IndexOf(const AProp : TPasProperty) : PtrInt;
var
i : PtrInt;
begin
Result := -1;
for i := 0 to Pred(FList.Count) do begin
if ( TPropInfoReference(FList[i]).Prop = AProp ) then begin
Result := i;
Break;
end;
end;
end;
function TPropInfoReferenceList.GetCount() : PtrInt;
begin
Result := FList.Count;
end;
initialization initialization
TAbstractTypeParser.RegisterParser(TSimpleTypeParser); TAbstractTypeParser.RegisterParser(TSimpleTypeParser);
TAbstractTypeParser.RegisterParser(TComplexTypeParser); TAbstractTypeParser.RegisterParser(TComplexTypeParser);

View File

@@ -92,9 +92,13 @@ const
s_xmlns = 'xmlns'; s_xmlns = 'xmlns';
s_WST = 'wst';
s_WST_base_namespace = 'urn:wst_base';
s_WST_collection = 'wst_collection';
s_WST_headerBlock = 'wst_headerBlock'; s_WST_headerBlock = 'wst_headerBlock';
s_WST_record = 'wst_record'; s_WST_record = 'wst_record';
s_WST_storeType = 'StoreType'; s_WST_storeType = 'StoreType';
implementation implementation

View File

@@ -123,6 +123,9 @@ type
);virtual;abstract; );virtual;abstract;
function GetOwner() : IXsdGenerator; function GetOwner() : IXsdGenerator;
class function CanHandle(ASymbol : TObject) : Boolean;virtual;abstract; class function CanHandle(ASymbol : TObject) : Boolean;virtual;abstract;
function GetSchemaNode(ADocument : TDOMDocument) : TDOMNode;
procedure DeclareNameSpaceOf_WST(ADocument : TDOMDocument);
procedure DeclareAttributeOf_WST(AElement : TDOMElement; const AAttName, AAttValue : DOMString);
public public
constructor Create(AOwner : IGenerator);virtual; constructor Create(AOwner : IGenerator);virtual;
end; end;
@@ -171,7 +174,6 @@ type
ADocument : TDOMDocument ADocument : TDOMDocument
);override; );override;
class function CanHandle(ASymbol : TObject) : Boolean;override; class function CanHandle(ASymbol : TObject) : Boolean;override;
function GetSchemaNode(ADocument : TDOMDocument) : TDOMNode;
end; end;
{ TTypeAliasDefinition_TypeHandler } { TTypeAliasDefinition_TypeHandler }
@@ -390,6 +392,29 @@ begin
Result := IXsdGenerator(FOwner); Result := IXsdGenerator(FOwner);
end; end;
function TBaseTypeHandler.GetSchemaNode(ADocument : TDOMDocument) : TDOMNode;
begin
Result := GetOwner().GetSchemaNode(ADocument);
end;
procedure TBaseTypeHandler.DeclareNameSpaceOf_WST(ADocument : TDOMDocument);
var
defSchemaNode : TDOMElement;
strBuffer : string;
begin
defSchemaNode := GetSchemaNode(ADocument) as TDOMElement;
if not FindAttributeByValueInNode(s_WST_base_namespace,defSchemaNode,strBuffer) then
defSchemaNode.SetAttribute(Format('%s:%s',[s_xmlns,s_WST]),s_WST_base_namespace);
end;
procedure TBaseTypeHandler.DeclareAttributeOf_WST(
AElement : TDOMElement;
const AAttName, AAttValue : DOMString
);
begin
AElement.SetAttribute(Format('%s:%s',[s_WST,AAttName]),AAttvalue);
end;
constructor TBaseTypeHandler.Create(AOwner: IGenerator); constructor TBaseTypeHandler.Create(AOwner: IGenerator);
begin begin
Assert(Assigned(AOwner)); Assert(Assigned(AOwner));
@@ -412,11 +437,6 @@ begin
Result := Assigned(ASymbol) and ASymbol.InheritsFrom(TPasType); Result := Assigned(ASymbol) and ASymbol.InheritsFrom(TPasType);
end; end;
function TTypeDefinition_TypeHandler.GetSchemaNode(ADocument : TDOMDocument) : TDOMNode;
begin
Result := GetOwner().GetSchemaNode(ADocument);
end;
{ TTypeAliasDefinition_TypeHandler } { TTypeAliasDefinition_TypeHandler }
procedure TTypeAliasDefinition_TypeHandler.Generate( procedure TTypeAliasDefinition_TypeHandler.Generate(
@@ -612,12 +632,13 @@ var
end else begin end else begin
if AnsiSameText('Has',Copy(p.StoredAccessorName,1,3)) then if AnsiSameText('Has',Copy(p.StoredAccessorName,1,3)) then
propNode.SetAttribute(s_minOccurs,'0'); propNode.SetAttribute(s_minOccurs,'0');
{else if isEmbeddedArray then begin
propNode.SetAttribute(s_minOccurs,'1');} propNode.SetAttribute(s_maxOccurs,s_unbounded);
if isEmbeddedArray then if AContainer.IsCollection(TPasArrayType(propItmUltimeType)) then begin
propNode.SetAttribute(s_maxOccurs,s_unbounded) DeclareNameSpaceOf_WST(ADocument);
{else DeclareAttributeOf_WST(propNode,s_WST_collection,'true');
propNode.SetAttribute(s_maxOccurs,'1');} end;
end;
end; end;
end; end;
ProcessPropertyExtendedMetadata(p,propNode); ProcessPropertyExtendedMetadata(p,propNode);
@@ -649,7 +670,8 @@ begin
if Assigned(typItm.AncestorType) then begin if Assigned(typItm.AncestorType) then begin
trueParent := typItm.AncestorType; trueParent := typItm.AncestorType;
if trueParent.InheritsFrom(TPasNativeClassType) and AnsiSameText('THeaderBlock',trueParent.Name) then begin if trueParent.InheritsFrom(TPasNativeClassType) and AnsiSameText('THeaderBlock',trueParent.Name) then begin
cplxNode.SetAttribute(s_WST_headerBlock,'true'); DeclareNameSpaceOf_WST(ADocument);
DeclareAttributeOf_WST(cplxNode,s_WST_headerBlock,'true');
end; end;
if trueParent.InheritsFrom(TPasAliasType) then if trueParent.InheritsFrom(TPasAliasType) then
trueParent := GetUltimeType(trueParent); trueParent := GetUltimeType(trueParent);
@@ -658,12 +680,21 @@ begin
then begin then begin
typeCategory := tcSimpleContent; typeCategory := tcSimpleContent;
end; end;
derivationNode := CreateElement(Format('%s:%s',[s_xs_short,s_extension]),cplxNode,ADocument); if trueParent.InheritsFrom(TPasNativeSimpleContentClassType) or
s := Trim(GetNameSpaceShortName(GetTypeNameSpace(AContainer,trueParent),ADocument,GetOwner().GetPreferedShortNames())); ( not trueParent.InheritsFrom(TPasNativeClassType) )
if ( Length(s) > 0 ) then then begin
s := s + ':'; if ( typeCategory = tcSimpleContent ) then begin
s := s + AContainer.GetExternalName(trueParent); derivationNode := CreateElement(Format('%s:%s',[s_xs_short,s_simpleContent]),cplxNode,ADocument);
derivationNode.SetAttribute(s_base,s); derivationNode := CreateElement(Format('%s:%s',[s_xs_short,s_extension]),derivationNode,ADocument);
end else begin
derivationNode := CreateElement(Format('%s:%s',[s_xs_short,s_extension]),cplxNode,ADocument);
end;
s := Trim(GetNameSpaceShortName(GetTypeNameSpace(AContainer,trueParent),ADocument,GetOwner().GetPreferedShortNames()));
if ( Length(s) > 0 ) then
s := s + ':';
s := s + AContainer.GetExternalName(trueParent);
derivationNode.SetAttribute(s_base,s);
end;
hasSequence := False; hasSequence := False;
end; end;
if ( typItm.Members.Count > 0 ) then if ( typItm.Members.Count > 0 ) then
@@ -719,7 +750,8 @@ begin
cplxNode := CreateElement(s,defSchemaNode,ADocument); cplxNode := CreateElement(s,defSchemaNode,ADocument);
cplxNode.SetAttribute(s_name, AContainer.GetExternalName(typItm)) ; cplxNode.SetAttribute(s_name, AContainer.GetExternalName(typItm)) ;
cplxNode.SetAttribute(s_WST_record,'true'); DeclareNameSpaceOf_WST(ADocument);
DeclareAttributeOf_WST(cplxNode,s_WST_record,'true');
hasSequence := False; hasSequence := False;
for i := 0 to Pred(typItm.Members.Count) do begin for i := 0 to Pred(typItm.Members.Count) do begin
@@ -791,7 +823,7 @@ procedure TBaseArrayRemotable_TypeHandler.Generate(
ADocument : TDOMDocument ADocument : TDOMDocument
); );
function GetNameSpaceShortName(const ANameSpace : string):string;//inline; function GetNameSpaceShortName(const ANameSpace : string):string;
begin begin
if FindAttributeByValueInNode(ANameSpace,ADocument.DocumentElement,Result,0,s_xmlns) then begin if FindAttributeByValueInNode(ANameSpace,ADocument.DocumentElement,Result,0,s_xmlns) then begin
Result := Copy(Result,Length(s_xmlns+':')+1,MaxInt); Result := Copy(Result,Length(s_xmlns+':')+1,MaxInt);
@@ -827,6 +859,10 @@ begin
s := Format('%s:%s',[s_xs_short,s_element]); s := Format('%s:%s',[s_xs_short,s_element]);
propNode := CreateElement(s,sqcNode,ADocument); propNode := CreateElement(s,sqcNode,ADocument);
propNode.SetAttribute(s_name,s_item); propNode.SetAttribute(s_name,s_item);
if AContainer.IsCollection(typItm) then begin
DeclareNameSpaceOf_WST(ADocument);
DeclareAttributeOf_WST(propNode,s_WST_collection,'true');
end;
if Assigned(propTypItm) then begin if Assigned(propTypItm) then begin
prop_ns_shortName := GetNameSpaceShortName(GetTypeNameSpace(AContainer,propTypItm));// AContainer.GetExternalName(propTypItm.Parent.Parent)); prop_ns_shortName := GetNameSpaceShortName(GetTypeNameSpace(AContainer,propTypItm));// AContainer.GetExternalName(propTypItm.Parent.Parent));
propNode.SetAttribute(s_type,Format('%s:%s',[prop_ns_shortName,AContainer.GetExternalName(propTypItm)])); propNode.SetAttribute(s_type,Format('%s:%s',[prop_ns_shortName,AContainer.GetExternalName(propTypItm)]));

View File

@@ -514,10 +514,14 @@ end;
function TRttiExpIntegerNodeItem.Evaluate(AInstance: TRttiFilterCreatorTarget): Boolean; function TRttiExpIntegerNodeItem.Evaluate(AInstance: TRttiFilterCreatorTarget): Boolean;
begin begin
case Operation of case Operation of
nfoEqual : Result := ( GetOrdProp(AInstance,PropInfo) = ComparedValue ); nfoEqual : Result := ( GetOrdProp(AInstance,PropInfo) = ComparedValue );
nfoGreater : Result := ( GetOrdProp(AInstance,PropInfo) > ComparedValue ); nfoGreater : Result := ( GetOrdProp(AInstance,PropInfo) > ComparedValue );
nfoLesser : Result := ( GetOrdProp(AInstance,PropInfo) < ComparedValue ); nfoLesser : Result := ( GetOrdProp(AInstance,PropInfo) < ComparedValue );
nfoNotEqual : Result := ( GetOrdProp(AInstance,PropInfo) <> ComparedValue ); nfoNotEqual : Result := ( GetOrdProp(AInstance,PropInfo) <> ComparedValue );
nfoGreaterOrEqual : Result := ( GetOrdProp(AInstance,PropInfo) >= ComparedValue );
nfoLesserOrEqual : Result := ( GetOrdProp(AInstance,PropInfo) <= ComparedValue );
else
Assert(False);
end; end;
end; end;
@@ -737,6 +741,8 @@ begin
sfoEqualCaseSensitive : Result := ( GetStrProp(AInstance,PropInfo) = ComparedValue ); sfoEqualCaseSensitive : Result := ( GetStrProp(AInstance,PropInfo) = ComparedValue );
sfoEqualCaseInsensitive : Result := AnsiSameText(GetStrProp(AInstance,PropInfo),ComparedValue); sfoEqualCaseInsensitive : Result := AnsiSameText(GetStrProp(AInstance,PropInfo),ComparedValue);
sfoNotEqual : Result := ( GetStrProp(AInstance,PropInfo) <> ComparedValue); sfoNotEqual : Result := ( GetStrProp(AInstance,PropInfo) <> ComparedValue);
else
Assert(False);
end; end;
end; end;
@@ -761,6 +767,8 @@ begin
sfoEqualCaseSensitive : Result := AnsiSameStr(GetStrProp(AInstance,PropInfo),ComparedValue); sfoEqualCaseSensitive : Result := AnsiSameStr(GetStrProp(AInstance,PropInfo),ComparedValue);
sfoEqualCaseInsensitive : Result := AnsiSameText(GetStrProp(AInstance,PropInfo),ComparedValue); sfoEqualCaseInsensitive : Result := AnsiSameText(GetStrProp(AInstance,PropInfo),ComparedValue);
sfoNotEqual : Result := not AnsiSameText(GetStrProp(AInstance,PropInfo),ComparedValue); sfoNotEqual : Result := not AnsiSameText(GetStrProp(AInstance,PropInfo),ComparedValue);
else
Assert(False);
end; end;
end; end;

View File

@@ -50,16 +50,40 @@ type
destructor Destroy();override; destructor Destroy();override;
end; end;
{ TObjectCollectionRemotableCursor }
TObjectCollectionRemotableCursor = class(TInterfacedObject,ICursor,IObjectCursor)
private
FList : TObjectCollectionRemotable;
FCurrentIndex : PtrInt;
protected
procedure Reset();
function MoveNext() : Boolean;virtual;
function Clone():ICursor;
function GetCount() : PtrInt;
function GetCurrent() : TObject;
public
constructor Create(ADataList : TObjectCollectionRemotable);
end;
function Find( function Find(
const AList : TBaseObjectArrayRemotable; const AList : TBaseObjectArrayRemotable;
const AFilter : string const AFilter : string
) : TBaseRemotable; ) : TBaseRemotable;overload;
function Find(
const AList : TObjectCollectionRemotable;
const AFilter : string
) : TBaseRemotable;overload;
function Filter( function Filter(
const AList : TBaseObjectArrayRemotable; const AList : TBaseObjectArrayRemotable;
const AFilter : string const AFilter : string
) : IFilterableObjectCursor; ) : IFilterableObjectCursor;overload;
function Filter(
const AList : TObjectCollectionRemotable;
const AFilter : string
) : IFilterableObjectCursor;overload;
implementation implementation
uses uses
imp_utils, rtti_filters; imp_utils, rtti_filters;
@@ -88,6 +112,30 @@ begin
Result := locRes; Result := locRes;
end; end;
function Find(
const AList : TObjectCollectionRemotable;
const AFilter : string
) : TBaseRemotable ;
var
locRes : TBaseRemotable;
crs : IObjectCursor;
fltr : IObjectFilter;
begin
locRes := nil;
if ( AList <> nil ) and ( AList.Length > 0 ) then begin
if IsStrEmpty(AFilter) then begin
locRes := AList[0];
end else begin
fltr := ParseFilter(AFilter,AList.GetItemClass());
crs := CreateCursorOn(TObjectCollectionRemotableCursor.Create(AList),fltr);
crs.Reset();
if crs.MoveNext() then
locRes := TBaseRemotable(crs.GetCurrent());
end;
end;
Result := locRes;
end;
function Filter( function Filter(
const AList : TBaseObjectArrayRemotable; const AList : TBaseObjectArrayRemotable;
const AFilter : string const AFilter : string
@@ -109,6 +157,27 @@ begin
Result := crs; Result := crs;
end; end;
function Filter(
const AList : TObjectCollectionRemotable;
const AFilter : string
) : IFilterableObjectCursor ;
var
crs : IFilterableObjectCursor;
fltr : IObjectFilter;
begin
crs := nil;
if ( AList <> nil ) then begin
if IsStrEmpty(AFilter) then begin
crs := CreateCursorOn(TObjectCollectionRemotableCursor.Create(AList),nil);
end else begin
fltr := ParseFilter(AFilter,AList.GetItemClass());
crs := CreateCursorOn(TObjectCollectionRemotableCursor.Create(AList),fltr);
crs.Reset();
end;
end;
Result := crs;
end;
{ TBaseObjectArrayRemotableCursor } { TBaseObjectArrayRemotableCursor }
procedure TBaseObjectArrayRemotableCursor.Reset(); procedure TBaseObjectArrayRemotableCursor.Reset();
@@ -182,5 +251,42 @@ begin
inherited Destroy(); inherited Destroy();
end; end;
{ TObjectCollectionRemotableCursor }
procedure TObjectCollectionRemotableCursor.Reset();
begin
FCurrentIndex := -1;
end;
function TObjectCollectionRemotableCursor.MoveNext() : Boolean;
begin
Inc(FCurrentIndex);
Result := ( FCurrentIndex < FList.Length );
end;
function TObjectCollectionRemotableCursor.Clone() : ICursor;
begin
Result := TObjectCollectionRemotableCursor.Create(FList) as ICursor;
end;
function TObjectCollectionRemotableCursor.GetCount() : PtrInt;
begin
Result := FList.Length;
end;
function TObjectCollectionRemotableCursor.GetCurrent() : TObject;
begin
if ( FCurrentIndex < 0 ) or ( FCurrentIndex >= FList.Length ) then
raise ECursorException.Create('Invalid cursor state.');
Result := FList[FCurrentIndex];
end;
constructor TObjectCollectionRemotableCursor.Create(ADataList : TObjectCollectionRemotable);
begin
Assert(Assigned(ADataList));
FList := ADataList;
Reset();
end;
end. end.