Added: support for a typed NodeValue property on typed elements with attributes
This commit is contained in:
parent
105c770a77
commit
cb781049c7
@ -62,7 +62,7 @@ type
|
|||||||
procedure feSchemaPropertiesChange(Sender: TObject);
|
procedure feSchemaPropertiesChange(Sender: TObject);
|
||||||
procedure btnHintsClick(Sender: TObject);
|
procedure btnHintsClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
function CheckValidSchemaFile(): Boolean;
|
function CheckValidSchemaFile: Boolean;
|
||||||
function CheckReadOnly(const AFileName: String): Boolean;
|
function CheckReadOnly(const AFileName: String): Boolean;
|
||||||
|
|
||||||
procedure GetFileName(Sender: TObject; const SchemaName: String; var Path, FileName: String);
|
procedure GetFileName(Sender: TObject; const SchemaName: String; var Path, FileName: String);
|
||||||
@ -123,7 +123,7 @@ var
|
|||||||
begin
|
begin
|
||||||
plOutput.ActivePageIndex := 0;
|
plOutput.ActivePageIndex := 0;
|
||||||
|
|
||||||
if ParamCount() > 0 then
|
if ParamCount > 0 then
|
||||||
begin
|
begin
|
||||||
schemaFile := ParamStr(1);
|
schemaFile := ParamStr(1);
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ var
|
|||||||
generator: THintsDelphiXMLDataBindingGenerator;
|
generator: THintsDelphiXMLDataBindingGenerator;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if not CheckValidSchemaFile() then
|
if not CheckValidSchemaFile then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
hintsFile := ChangeFileExt(feSchema.Text, '.hints.xml');
|
hintsFile := ChangeFileExt(feSchema.Text, '.hints.xml');
|
||||||
@ -164,7 +164,7 @@ begin
|
|||||||
hints := LoadDataBindingHints(hintsFile);
|
hints := LoadDataBindingHints(hintsFile);
|
||||||
|
|
||||||
try
|
try
|
||||||
generator := THintsDelphiXMLDataBindingGenerator.Create();
|
generator := THintsDelphiXMLDataBindingGenerator.Create;
|
||||||
try
|
try
|
||||||
generator.Hints := hints;
|
generator.Hints := hints;
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ end;
|
|||||||
|
|
||||||
procedure TMainForm.btnCloseClick(Sender: TObject);
|
procedure TMainForm.btnCloseClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Close();
|
Close;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ end;
|
|||||||
|
|
||||||
procedure TMainForm.feFilePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
procedure TMainForm.feFilePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||||||
begin
|
begin
|
||||||
if dlgOutputFile.Execute() then
|
if dlgOutputFile.Execute then
|
||||||
feFile.Text := dlgOutputFile.FileName;
|
feFile.Text := dlgOutputFile.FileName;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ end;
|
|||||||
|
|
||||||
procedure TMainForm.feSchemaPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
procedure TMainForm.feSchemaPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||||||
begin
|
begin
|
||||||
if dlgSchema.Execute() then
|
if dlgSchema.Execute then
|
||||||
feSchema.Text := dlgSchema.FileName;
|
feSchema.Text := dlgSchema.FileName;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -296,7 +296,7 @@ begin
|
|||||||
if FileExists(fileName) then
|
if FileExists(fileName) then
|
||||||
settings := LoadDataBindingSettings(fileName)
|
settings := LoadDataBindingSettings(fileName)
|
||||||
else
|
else
|
||||||
settings := NewDataBindingSettings();
|
settings := NewDataBindingSettings;
|
||||||
|
|
||||||
settings.Output.ChildNodes.Clear;
|
settings.Output.ChildNodes.Clear;
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TMainForm.CheckValidSchemaFile(): Boolean;
|
function TMainForm.CheckValidSchemaFile: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := FileExists(feSchema.Text);
|
Result := FileExists(feSchema.Text);
|
||||||
|
|
||||||
@ -356,7 +356,7 @@ var
|
|||||||
hints: IXMLDataBindingHints;
|
hints: IXMLDataBindingHints;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if CheckValidSchemaFile() then
|
if CheckValidSchemaFile then
|
||||||
begin
|
begin
|
||||||
hintsFile := ChangeFileExt(feSchema.Text, '.hints.xml');
|
hintsFile := ChangeFileExt(feSchema.Text, '.hints.xml');
|
||||||
if FileExists(hintsFile) then
|
if FileExists(hintsFile) then
|
||||||
@ -366,7 +366,7 @@ begin
|
|||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
hints := NewDataBindingHints();
|
hints := NewDataBindingHints;
|
||||||
hints.OwnerDocument.SaveToFile(hintsFile);
|
hints.OwnerDocument.SaveToFile(hintsFile);
|
||||||
ShowMessage('The hints file has been generated.');
|
ShowMessage('The hints file has been generated.');
|
||||||
end;
|
end;
|
||||||
@ -649,4 +649,3 @@ end;
|
|||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ type
|
|||||||
function GetItem(Index: Integer): TXMLDataBindingSchema;
|
function GetItem(Index: Integer): TXMLDataBindingSchema;
|
||||||
procedure SetItem(Index: Integer; const Value: TXMLDataBindingSchema);
|
procedure SetItem(Index: Integer; const Value: TXMLDataBindingSchema);
|
||||||
public
|
public
|
||||||
constructor Create();
|
constructor Create;
|
||||||
|
|
||||||
property Items[Index: Integer]: TXMLDataBindingSchema read GetItem write SetItem; default;
|
property Items[Index: Integer]: TXMLDataBindingSchema read GetItem write SetItem; default;
|
||||||
end;
|
end;
|
||||||
@ -35,7 +35,7 @@ type
|
|||||||
|
|
||||||
FOnGetFileName: TGetFileNameEvent;
|
FOnGetFileName: TGetFileNameEvent;
|
||||||
protected
|
protected
|
||||||
procedure GenerateDataBinding(); override;
|
procedure GenerateDataBinding; override;
|
||||||
procedure GenerateOutputFile(ASchemaList: TXMLSchemaList; const ASourceFileName, AUnitName: String);
|
procedure GenerateOutputFile(ASchemaList: TXMLSchemaList; const ASourceFileName, AUnitName: String);
|
||||||
function GenerateUsesClause(ASchemaList: TXMLSchemaList): String;
|
function GenerateUsesClause(ASchemaList: TXMLSchemaList): String;
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ type
|
|||||||
function GetDataTypeMapping(ADataType: IXMLTypeDef; out ATypeMapping: TTypeMapping): Boolean;
|
function GetDataTypeMapping(ADataType: IXMLTypeDef; out ATypeMapping: TTypeMapping): Boolean;
|
||||||
function GetDataTypeName(AProperty: TXMLDataBindingProperty; AInterfaceName: Boolean): String;
|
function GetDataTypeName(AProperty: TXMLDataBindingProperty; AInterfaceName: Boolean): String;
|
||||||
function TranslateDataType(ADataType: IXMLTypeDef): String;
|
function TranslateDataType(ADataType: IXMLTypeDef): String;
|
||||||
function CreateNewGUID(): String;
|
function CreateNewGUID: String;
|
||||||
|
|
||||||
procedure WriteUnitHeader(AStream: TStreamHelper; const ASourceFileName, AFileName: String);
|
procedure WriteUnitHeader(AStream: TStreamHelper; const ASourceFileName, AFileName: String);
|
||||||
procedure WriteSection(AStream: TStreamHelper; ASection: TDelphiXMLSection; ASchemaList: TXMLSchemaList);
|
procedure WriteSection(AStream: TStreamHelper; ASection: TDelphiXMLSection; ASchemaList: TXMLSchemaList);
|
||||||
@ -88,7 +88,7 @@ uses
|
|||||||
|
|
||||||
|
|
||||||
{ TDelphiXMLDataBindingGenerator }
|
{ TDelphiXMLDataBindingGenerator }
|
||||||
procedure TDelphiXMLDataBindingGenerator.GenerateDataBinding();
|
procedure TDelphiXMLDataBindingGenerator.GenerateDataBinding;
|
||||||
var
|
var
|
||||||
schemaList: TXMLSchemaList;
|
schemaList: TXMLSchemaList;
|
||||||
schemaIndex: Integer;
|
schemaIndex: Integer;
|
||||||
@ -96,7 +96,7 @@ var
|
|||||||
unitName: String;
|
unitName: String;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
schemaList := TXMLSchemaList.Create();
|
schemaList := TXMLSchemaList.Create;
|
||||||
try
|
try
|
||||||
case OutputType of
|
case OutputType of
|
||||||
otSingle:
|
otSingle:
|
||||||
@ -110,7 +110,7 @@ begin
|
|||||||
|
|
||||||
otMultiple:
|
otMultiple:
|
||||||
begin
|
begin
|
||||||
FUnitNames := TX2OSHash.Create();
|
FUnitNames := TX2OSHash.Create;
|
||||||
try
|
try
|
||||||
for schemaIndex := 0 to Pred(SchemaCount) do
|
for schemaIndex := 0 to Pred(SchemaCount) do
|
||||||
begin
|
begin
|
||||||
@ -122,7 +122,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
schema := Schemas[schemaIndex];
|
schema := Schemas[schemaIndex];
|
||||||
|
|
||||||
schemaList.Clear();
|
schemaList.Clear;
|
||||||
schemaList.Add(schema);
|
schemaList.Add(schema);
|
||||||
|
|
||||||
unitName := FUnitNames[schema];
|
unitName := FUnitNames[schema];
|
||||||
@ -158,12 +158,12 @@ begin
|
|||||||
['UsesClause', usesClause]);
|
['UsesClause', usesClause]);
|
||||||
WriteSection(unitStream, dxsForward, ASchemaList);
|
WriteSection(unitStream, dxsForward, ASchemaList);
|
||||||
|
|
||||||
FProcessedItems := TX2OIHash.Create();
|
FProcessedItems := TX2OIHash.Create;
|
||||||
try
|
try
|
||||||
FProcessedItems.Clear();
|
FProcessedItems.Clear;
|
||||||
WriteSection(unitStream, dxsInterface, ASchemaList);
|
WriteSection(unitStream, dxsInterface, ASchemaList);
|
||||||
|
|
||||||
FProcessedItems.Clear();
|
FProcessedItems.Clear;
|
||||||
WriteSection(unitStream, dxsClass, ASchemaList);
|
WriteSection(unitStream, dxsClass, ASchemaList);
|
||||||
finally
|
finally
|
||||||
FreeAndNil(FProcessedItems);
|
FreeAndNil(FProcessedItems);
|
||||||
@ -441,7 +441,7 @@ begin
|
|||||||
hasItem := True;
|
hasItem := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
with TNamedFormatStringList.Create() do
|
with TNamedFormatStringList.Create do
|
||||||
try
|
try
|
||||||
case ASection of
|
case ASection of
|
||||||
dxsInterface: Add(DocumentFunctionsInterface);
|
dxsInterface: Add(DocumentFunctionsInterface);
|
||||||
@ -451,10 +451,10 @@ begin
|
|||||||
AStream.Write(Format(['SourceName', interfaceItem.Name,
|
AStream.Write(Format(['SourceName', interfaceItem.Name,
|
||||||
'Name', interfaceItem.TranslatedName]));
|
'Name', interfaceItem.TranslatedName]));
|
||||||
finally
|
finally
|
||||||
Free();
|
Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
AStream.WriteLn();
|
AStream.WriteLn;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -464,8 +464,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
AStream.WriteLn('const');
|
AStream.WriteLn('const');
|
||||||
AStream.WriteLnFmt(' TargetNamespace = ''%s'';', [nameSpace]);
|
AStream.WriteLnFmt(' TargetNamespace = ''%s'';', [nameSpace]);
|
||||||
AStream.WriteLn();
|
AStream.WriteLn;
|
||||||
AStream.WriteLn();
|
AStream.WriteLn;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -529,7 +529,7 @@ begin
|
|||||||
if ASection = dxsInterface then
|
if ASection = dxsInterface then
|
||||||
indent := ' ';
|
indent := ' ';
|
||||||
|
|
||||||
sourceCode := TNamedFormatStringList.Create();
|
sourceCode := TNamedFormatStringList.Create;
|
||||||
try
|
try
|
||||||
sourceCode.Add(indent + 'function StringTo%<ItemName>:s(const AValue: WideString): %<DataType>:s;');
|
sourceCode.Add(indent + 'function StringTo%<ItemName>:s(const AValue: WideString): %<DataType>:s;');
|
||||||
|
|
||||||
@ -640,7 +640,7 @@ begin
|
|||||||
if not AItem.HasDocumentation then
|
if not AItem.HasDocumentation then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
lines := TStringList.Create();
|
lines := TStringList.Create;
|
||||||
try
|
try
|
||||||
documentation := AItem.Documentation;
|
documentation := AItem.Documentation;
|
||||||
|
|
||||||
@ -708,12 +708,12 @@ begin
|
|||||||
AStream.WriteLnNamedFmt(InterfaceItemInterface,
|
AStream.WriteLnNamedFmt(InterfaceItemInterface,
|
||||||
['Name', AItem.TranslatedName,
|
['Name', AItem.TranslatedName,
|
||||||
'ParentName', parent]);
|
'ParentName', parent]);
|
||||||
AStream.WriteLn(' ' + CreateNewGUID());
|
AStream.WriteLn(' ' + CreateNewGUID);
|
||||||
|
|
||||||
WriteSchemaInterfaceProperties(AStream, AItem, ASection);
|
WriteSchemaInterfaceProperties(AStream, AItem, ASection);
|
||||||
|
|
||||||
AStream.WriteLn(' end;');
|
AStream.WriteLn(' end;');
|
||||||
AStream.WriteLn();
|
AStream.WriteLn;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
dxsClass:
|
dxsClass:
|
||||||
@ -733,7 +733,7 @@ begin
|
|||||||
WriteSchemaInterfaceProperties(AStream, AItem, ASection);
|
WriteSchemaInterfaceProperties(AStream, AItem, ASection);
|
||||||
|
|
||||||
AStream.WriteLn(' end;');
|
AStream.WriteLn(' end;');
|
||||||
AStream.WriteLn();
|
AStream.WriteLn;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
dxsImplementation:
|
dxsImplementation:
|
||||||
@ -749,7 +749,7 @@ var
|
|||||||
hasPrototype: Boolean;
|
hasPrototype: Boolean;
|
||||||
|
|
||||||
|
|
||||||
procedure WritePrototype();
|
procedure WritePrototype;
|
||||||
begin
|
begin
|
||||||
if not hasPrototype then
|
if not hasPrototype then
|
||||||
begin
|
begin
|
||||||
@ -977,7 +977,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
sourceCode := TNamedFormatStringList.Create();
|
sourceCode := TNamedFormatStringList.Create;
|
||||||
try
|
try
|
||||||
case ASection of
|
case ASection of
|
||||||
dxsInterface,
|
dxsInterface,
|
||||||
@ -1149,7 +1149,7 @@ begin
|
|||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
|
|
||||||
sourceCode := TNamedFormatStringList.Create();
|
sourceCode := TNamedFormatStringList.Create;
|
||||||
try
|
try
|
||||||
case ASection of
|
case ASection of
|
||||||
dxsInterface,
|
dxsInterface,
|
||||||
@ -1235,7 +1235,10 @@ begin
|
|||||||
sourceCode.Add(PropertyImplMethodGetNil);
|
sourceCode.Add(PropertyImplMethodGetNil);
|
||||||
|
|
||||||
if writeTextProp then
|
if writeTextProp then
|
||||||
sourceCode.Add(PropertyImplMethodGetText);
|
if AProperty.IsAttribute then
|
||||||
|
sourceCode.Add(PropertyImplMethodGetTextAttr)
|
||||||
|
else
|
||||||
|
sourceCode.Add(PropertyImplMethodGetText);
|
||||||
|
|
||||||
sourceCode.Add('function TXML%<Name>:s.Get%<PropertyName>:s: %<DataType>:s;');
|
sourceCode.Add('function TXML%<Name>:s.Get%<PropertyName>:s: %<DataType>:s;');
|
||||||
|
|
||||||
@ -1294,7 +1297,10 @@ begin
|
|||||||
sourceCode.Add(PropertyImplMethodSetNil);
|
sourceCode.Add(PropertyImplMethodSetNil);
|
||||||
|
|
||||||
if writeTextProp then
|
if writeTextProp then
|
||||||
sourceCode.Add(PropertyImplMethodSetText);
|
if AProperty.IsAttribute then
|
||||||
|
sourceCode.Add(PropertyImplMethodSetTextAttr)
|
||||||
|
else
|
||||||
|
sourceCode.Add(PropertyImplMethodSetText);
|
||||||
|
|
||||||
sourceCode.Add('procedure TXML%<Name>:s.Set%<PropertyName>:s(const Value: %<DataType>:s);');
|
sourceCode.Add('procedure TXML%<Name>:s.Set%<PropertyName>:s(const Value: %<DataType>:s);');
|
||||||
value := '%<PropertySourceName>:s';
|
value := '%<PropertySourceName>:s';
|
||||||
@ -1394,11 +1400,11 @@ begin
|
|||||||
if memberIndex < Pred(AItem.MemberCount) then
|
if memberIndex < Pred(AItem.MemberCount) then
|
||||||
AStream.WriteLn(',')
|
AStream.WriteLn(',')
|
||||||
else
|
else
|
||||||
AStream.WriteLn();
|
AStream.WriteLn;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
AStream.WriteLn(lineIndent + ');');
|
AStream.WriteLn(lineIndent + ');');
|
||||||
AStream.WriteLn();
|
AStream.WriteLn;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1406,6 +1412,8 @@ function TDelphiXMLDataBindingGenerator.GetDelphiNodeType(AProperty: TXMLDataBin
|
|||||||
begin
|
begin
|
||||||
if AProperty.IsAttribute then
|
if AProperty.IsAttribute then
|
||||||
Result := dntAttribute
|
Result := dntAttribute
|
||||||
|
else if AProperty.IsNodeValue then
|
||||||
|
Result := dntNodeValue
|
||||||
else
|
else
|
||||||
Result := dntElement;
|
Result := dntElement;
|
||||||
end;
|
end;
|
||||||
@ -1417,7 +1425,7 @@ var
|
|||||||
conversion: String;
|
conversion: String;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
with TNamedFormatStringList.Create() do
|
with TNamedFormatStringList.Create do
|
||||||
try
|
try
|
||||||
if not (Assigned(ADataType) and GetDataTypeMapping(ADataType, typeMapping)) then
|
if not (Assigned(ADataType) and GetDataTypeMapping(ADataType, typeMapping)) then
|
||||||
typeMapping.Conversion := tcNone;
|
typeMapping.Conversion := tcNone;
|
||||||
@ -1440,7 +1448,7 @@ begin
|
|||||||
Result := Trim(Format(['Destination', ADestination,
|
Result := Trim(Format(['Destination', ADestination,
|
||||||
'Source', ASource]));
|
'Source', ASource]));
|
||||||
finally
|
finally
|
||||||
Free();
|
Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1457,7 +1465,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TDelphiXMLDataBindingGenerator.CreateNewGUID(): String;
|
function TDelphiXMLDataBindingGenerator.CreateNewGUID: String;
|
||||||
var
|
var
|
||||||
guid: TGUID;
|
guid: TGUID;
|
||||||
|
|
||||||
@ -1489,7 +1497,7 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
{ TXMLSchemaList }
|
{ TXMLSchemaList }
|
||||||
constructor TXMLSchemaList.Create();
|
constructor TXMLSchemaList.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create(False);
|
inherited Create(False);
|
||||||
end;
|
end;
|
||||||
@ -1509,4 +1517,3 @@ end;
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ type
|
|||||||
TDelphiXMLSection = (dxsForward, dxsInterface, dxsClass, dxsImplementation);
|
TDelphiXMLSection = (dxsForward, dxsInterface, dxsClass, dxsImplementation);
|
||||||
TDelphiXMLMember = (dxmPropertyGet, dxmPropertySet, dxmPropertyDeclaration);
|
TDelphiXMLMember = (dxmPropertyGet, dxmPropertySet, dxmPropertyDeclaration);
|
||||||
TDelphiAccessor = (daGet, daSet);
|
TDelphiAccessor = (daGet, daSet);
|
||||||
TDelphiNodeType = (dntElement, dntAttribute, dntCustom);
|
TDelphiNodeType = (dntElement, dntAttribute, dntNodeValue, dntCustom);
|
||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -116,12 +116,24 @@ const
|
|||||||
'end;' + CrLf +
|
'end;' + CrLf +
|
||||||
'' + CrLf;
|
'' + CrLf;
|
||||||
|
|
||||||
|
PropertyImplMethodGetTextAttr = 'function TXML%<Name>:s.Get%<PropertyName>:sText: WideString;' + CrLf +
|
||||||
|
'begin' + CrLf +
|
||||||
|
' Result := AttributeNodes[''%<PropertySourceName>:s''].Text;' + CrLf +
|
||||||
|
'end;' + CrLf +
|
||||||
|
'' + CrLf;
|
||||||
|
|
||||||
PropertyImplMethodSetText = 'procedure TXML%<Name>:s.Set%<PropertyName>:sText(const Value: WideString);' + CrLf +
|
PropertyImplMethodSetText = 'procedure TXML%<Name>:s.Set%<PropertyName>:sText(const Value: WideString);' + CrLf +
|
||||||
'begin' + CrLf +
|
'begin' + CrLf +
|
||||||
' ChildNodes[''%<PropertySourceName>:s''].NodeValue := Value;' + CrLf +
|
' ChildNodes[''%<PropertySourceName>:s''].NodeValue := Value;' + CrLf +
|
||||||
'end;' + CrLf +
|
'end;' + CrLf +
|
||||||
'' + CrLf;
|
'' + CrLf;
|
||||||
|
|
||||||
|
PropertyImplMethodSetTextAttr = 'procedure TXML%<Name>:s.Set%<PropertyName>:sText(const Value: WideString);' + CrLf +
|
||||||
|
'begin' + CrLf +
|
||||||
|
' AttributeNodes[''%<PropertySourceName>:s''].NodeValue := Value;' + CrLf +
|
||||||
|
'end;' + CrLf +
|
||||||
|
'' + CrLf;
|
||||||
|
|
||||||
|
|
||||||
SectionComments: array[TDelphiXMLSection] of String =
|
SectionComments: array[TDelphiXMLSection] of String =
|
||||||
(
|
(
|
||||||
@ -236,12 +248,14 @@ const
|
|||||||
(
|
(
|
||||||
{ dntElement } ' %<Destination>:s := ChildNodes[''%<Source>:s''].NodeValue;',
|
{ dntElement } ' %<Destination>:s := ChildNodes[''%<Source>:s''].NodeValue;',
|
||||||
{ dntAttribute } ' %<Destination>:s := AttributeNodes[''%<Source>:s''].NodeValue;',
|
{ dntAttribute } ' %<Destination>:s := AttributeNodes[''%<Source>:s''].NodeValue;',
|
||||||
|
{ dntNodeValue } ' %<Destination>:s := NodeValue;',
|
||||||
{ dntCustom } ' %<Destination>:s := %<Source>:s;'
|
{ dntCustom } ' %<Destination>:s := %<Source>:s;'
|
||||||
),
|
),
|
||||||
{ daSet }
|
{ daSet }
|
||||||
(
|
(
|
||||||
{ dntElement } ' ChildNodes[''%<Destination>:s''].NodeValue := %<Source>:s;',
|
{ dntElement } ' ChildNodes[''%<Destination>:s''].NodeValue := %<Source>:s;',
|
||||||
{ dntAttribute } ' SetAttribute(''%<Destination>:s'', %<Source>:s);',
|
{ dntAttribute } ' SetAttribute(''%<Destination>:s'', %<Source>:s);',
|
||||||
|
{ dntNodeValue } ' NodeValue := %<Source>:s;',
|
||||||
{ dntCustom } ' %<Destination>:s := %<Source>:s;'
|
{ dntCustom } ' %<Destination>:s := %<Source>:s;'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -273,6 +287,17 @@ const
|
|||||||
{ tcString } ' %<Destination>:s := AttributeNodes[''%<Source>:s''].Text;',
|
{ tcString } ' %<Destination>:s := AttributeNodes[''%<Source>:s''].Text;',
|
||||||
{ tcBase64 } ' %<Destination>:s := Base64Decode(Trim(AttributeNodes[''%<Source>:s''].Text));'
|
{ tcBase64 } ' %<Destination>:s := Base64Decode(Trim(AttributeNodes[''%<Source>:s''].Text));'
|
||||||
),
|
),
|
||||||
|
{ dntNodeValue }
|
||||||
|
(
|
||||||
|
{ tcNone } '',
|
||||||
|
{ tcBoolean } '',
|
||||||
|
{ tcFloat } ' %<Destination>:s := XMLToFloat(NodeValue);',
|
||||||
|
{ tcDateTime } ' %<Destination>:s := XMLToDateTime(NodeValue, xdtDateTime);',
|
||||||
|
{ tcDate } ' %<Destination>:s := XMLToDateTime(NodeValue, xdtDate);',
|
||||||
|
{ tcTime } ' %<Destination>:s := XMLToDateTime(NodeValue, xdtTime);',
|
||||||
|
{ tcString } ' %<Destination>:s := NodeValue;',
|
||||||
|
{ tcBase64 } ' %<Destination>:s := Base64Decode(Trim(NodeValue));'
|
||||||
|
),
|
||||||
{ dntCustom}
|
{ dntCustom}
|
||||||
(
|
(
|
||||||
{ tcNone } '',
|
{ tcNone } '',
|
||||||
@ -309,6 +334,17 @@ const
|
|||||||
{ tcString } '',
|
{ tcString } '',
|
||||||
{ tcBase64 } ' SetAttribute(''%<Destination>:s'', Base64Encode(%<Source>:s));'
|
{ tcBase64 } ' SetAttribute(''%<Destination>:s'', Base64Encode(%<Source>:s));'
|
||||||
),
|
),
|
||||||
|
{ dntNodeValue }
|
||||||
|
(
|
||||||
|
{ tcNone } '',
|
||||||
|
{ tcBoolean } ' NodeValue := BoolToXML(%<Source>:s);',
|
||||||
|
{ tcFloat } ' NodeValue := FloatToXML(%<Source>:s);',
|
||||||
|
{ tcDateTime } ' NodeValue := DateTimeToXML(%<Source>:s, xdtDateTime);',
|
||||||
|
{ tcDate } ' NodeValue := DateTimeToXML(%<Source>:s, xdtDate);',
|
||||||
|
{ tcTime } ' NodeValue := DateTimeToXML(%<Source>:s, xdtTime);',
|
||||||
|
{ tcString } '',
|
||||||
|
{ tcBase64 } ' NodeValue := Base64Encode(%<Source>:s);'
|
||||||
|
),
|
||||||
{ dntCustom}
|
{ dntCustom}
|
||||||
(
|
(
|
||||||
{ tcNone } '',
|
{ tcNone } '',
|
||||||
|
@ -44,7 +44,7 @@ type
|
|||||||
|
|
||||||
FOnPostProcessItem: TXMLDataBindingPostProcessItemEvent;
|
FOnPostProcessItem: TXMLDataBindingPostProcessItemEvent;
|
||||||
|
|
||||||
function GetSchemaCount(): Integer;
|
function GetSchemaCount: Integer;
|
||||||
function GetSchemas(Index: Integer): TXMLDataBindingSchema;
|
function GetSchemas(Index: Integer): TXMLDataBindingSchema;
|
||||||
protected
|
protected
|
||||||
function LoadSchema(const AStream: TStream; const ASchemaName: String): TXMLDataBindingSchema;
|
function LoadSchema(const AStream: TStream; const ASchemaName: String): TXMLDataBindingSchema;
|
||||||
@ -61,7 +61,8 @@ type
|
|||||||
function IsElementRepeating(AElement: IXMLElementDef): Boolean;
|
function IsElementRepeating(AElement: IXMLElementDef): Boolean;
|
||||||
function IsChoice(AElement: IXMLElementDef): Boolean;
|
function IsChoice(AElement: IXMLElementDef): Boolean;
|
||||||
|
|
||||||
function ProcessElement(ASchema: TXMLDataBindingSchema; AElement: IXMLElementDef): TXMLDataBindingItem;
|
function ProcessElement(ASchema: TXMLDataBindingSchema; AElement: IXMLElementDef): TXMLDataBindingItem; overload;
|
||||||
|
function ProcessElement(ASchema: TXMLDataBindingSchema; AAttribute: IXMLAttributeDef): TXMLDataBindingItem; overload;
|
||||||
procedure ProcessChildElement(ASchema: TXMLDataBindingSchema; AElement: IXMLElementDef; AInterface: TXMLDataBindingInterface);
|
procedure ProcessChildElement(ASchema: TXMLDataBindingSchema; AElement: IXMLElementDef; AInterface: TXMLDataBindingInterface);
|
||||||
procedure ProcessAttribute(ASchema: TXMLDataBindingSchema; AAttribute: IXMLAttributeDef; AInterface: TXMLDataBindingInterface);
|
procedure ProcessAttribute(ASchema: TXMLDataBindingSchema; AAttribute: IXMLAttributeDef; AInterface: TXMLDataBindingInterface);
|
||||||
|
|
||||||
@ -78,20 +79,20 @@ type
|
|||||||
procedure ResolveSchema(ASchema: TXMLDataBindingSchema);
|
procedure ResolveSchema(ASchema: TXMLDataBindingSchema);
|
||||||
procedure ResolveAlias(ASchema: TXMLDataBindingSchema);
|
procedure ResolveAlias(ASchema: TXMLDataBindingSchema);
|
||||||
procedure ResolveItem(ASchema: TXMLDataBindingSchema; AItem: TXMLDataBindingUnresolvedItem);
|
procedure ResolveItem(ASchema: TXMLDataBindingSchema; AItem: TXMLDataBindingUnresolvedItem);
|
||||||
procedure ResolveNameConflicts();
|
procedure ResolveNameConflicts;
|
||||||
|
|
||||||
procedure PostProcessSchema(ASchema: TXMLDataBindingSchema);
|
procedure PostProcessSchema(ASchema: TXMLDataBindingSchema);
|
||||||
procedure PostProcessItem(ASchema: TXMLDataBindingSchema; AItem: TXMLDataBindingItem);
|
procedure PostProcessItem(ASchema: TXMLDataBindingSchema; AItem: TXMLDataBindingItem);
|
||||||
function TranslateItemName(AItem: TXMLDataBindingItem): String; virtual;
|
function TranslateItemName(AItem: TXMLDataBindingItem): String; virtual;
|
||||||
|
|
||||||
procedure GenerateDataBinding(); virtual; abstract;
|
procedure GenerateDataBinding; virtual; abstract;
|
||||||
|
|
||||||
property SourceFileName: String read FSourceFileName write FSourceFileName;
|
property SourceFileName: String read FSourceFileName write FSourceFileName;
|
||||||
property SchemaCount: Integer read GetSchemaCount;
|
property SchemaCount: Integer read GetSchemaCount;
|
||||||
property Schemas[Index: Integer]: TXMLDataBindingSchema read GetSchemas;
|
property Schemas[Index: Integer]: TXMLDataBindingSchema read GetSchemas;
|
||||||
public
|
public
|
||||||
constructor Create();
|
constructor Create;
|
||||||
destructor Destroy(); override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
procedure Execute(const AStream: TStream; const ASchemaName: String); overload;
|
procedure Execute(const AStream: TStream; const ASchemaName: String); overload;
|
||||||
procedure Execute(const AFileName: String); overload;
|
procedure Execute(const AFileName: String); overload;
|
||||||
@ -125,9 +126,9 @@ type
|
|||||||
FSchemaName: String;
|
FSchemaName: String;
|
||||||
FSourceFileName: String;
|
FSourceFileName: String;
|
||||||
|
|
||||||
function GetItemCount(): Integer;
|
function GetItemCount: Integer;
|
||||||
function GetItems(Index: Integer): TXMLDataBindingItem;
|
function GetItems(Index: Integer): TXMLDataBindingItem;
|
||||||
function GetIncludeCount(): Integer;
|
function GetIncludeCount: Integer;
|
||||||
function GetIncludes(Index: Integer): TXMLDataBindingSchema;
|
function GetIncludes(Index: Integer): TXMLDataBindingSchema;
|
||||||
function GetTargetNamespace: String;
|
function GetTargetNamespace: String;
|
||||||
protected
|
protected
|
||||||
@ -140,7 +141,7 @@ type
|
|||||||
property ItemsGenerated: Boolean read FItemsGenerated write FItemsGenerated;
|
property ItemsGenerated: Boolean read FItemsGenerated write FItemsGenerated;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TXMLDataBindingGenerator);
|
constructor Create(AOwner: TXMLDataBindingGenerator);
|
||||||
destructor Destroy(); override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
property TargetNamespace: String read GetTargetNamespace;
|
property TargetNamespace: String read GetTargetNamespace;
|
||||||
|
|
||||||
@ -165,11 +166,11 @@ type
|
|||||||
FSchemaItem: IXMLSchemaItem;
|
FSchemaItem: IXMLSchemaItem;
|
||||||
FTranslatedName: String;
|
FTranslatedName: String;
|
||||||
|
|
||||||
function GetDocumentation(): String;
|
function GetDocumentation: String;
|
||||||
function GetHasDocumentation(): Boolean;
|
function GetHasDocumentation: Boolean;
|
||||||
function GetIsCollection: Boolean;
|
function GetIsCollection: Boolean;
|
||||||
protected
|
protected
|
||||||
function GetItemType(): TXMLDataBindingItemType; virtual; abstract;
|
function GetItemType: TXMLDataBindingItemType; virtual; abstract;
|
||||||
procedure SetName(const Value: String);
|
procedure SetName(const Value: String);
|
||||||
|
|
||||||
property SchemaItem: IXMLSchemaItem read FSchemaItem;
|
property SchemaItem: IXMLSchemaItem read FSchemaItem;
|
||||||
@ -200,7 +201,7 @@ type
|
|||||||
function GetProperties(Index: Integer): TXMLDataBindingProperty;
|
function GetProperties(Index: Integer): TXMLDataBindingProperty;
|
||||||
function GetPropertyCount: Integer;
|
function GetPropertyCount: Integer;
|
||||||
protected
|
protected
|
||||||
function GetItemType(): TXMLDataBindingItemType; override;
|
function GetItemType: TXMLDataBindingItemType; override;
|
||||||
|
|
||||||
procedure ReplaceItem(const AOldItem: TXMLDataBindingItem; const ANewItem: TXMLDataBindingItem); override;
|
procedure ReplaceItem(const AOldItem: TXMLDataBindingItem; const ANewItem: TXMLDataBindingItem); override;
|
||||||
|
|
||||||
@ -223,7 +224,7 @@ type
|
|||||||
private
|
private
|
||||||
FEnumeration: TXMLDataBindingEnumeration;
|
FEnumeration: TXMLDataBindingEnumeration;
|
||||||
protected
|
protected
|
||||||
function GetItemType(): TXMLDataBindingItemType; override;
|
function GetItemType: TXMLDataBindingItemType; override;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TXMLDataBindingGenerator; AEnumeration: TXMLDataBindingEnumeration; const AName: String);
|
constructor Create(AOwner: TXMLDataBindingGenerator; AEnumeration: TXMLDataBindingEnumeration; const AName: String);
|
||||||
|
|
||||||
@ -235,13 +236,13 @@ type
|
|||||||
private
|
private
|
||||||
FMembers: TObjectList;
|
FMembers: TObjectList;
|
||||||
|
|
||||||
function GetMemberCount(): Integer;
|
function GetMemberCount: Integer;
|
||||||
function GetMembers(Index: Integer): TXMLDataBindingEnumerationMember;
|
function GetMembers(Index: Integer): TXMLDataBindingEnumerationMember;
|
||||||
protected
|
protected
|
||||||
function GetItemType(): TXMLDataBindingItemType; override;
|
function GetItemType: TXMLDataBindingItemType; override;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TXMLDataBindingGenerator; ASchemaItem: IXMLSchemaItem; AEnumerations: IXMLEnumerationCollection; const AName: String);
|
constructor Create(AOwner: TXMLDataBindingGenerator; ASchemaItem: IXMLSchemaItem; AEnumerations: IXMLEnumerationCollection; const AName: String);
|
||||||
destructor Destroy(); override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
property MemberCount: Integer read GetMemberCount;
|
property MemberCount: Integer read GetMemberCount;
|
||||||
property Members[Index: Integer]: TXMLDataBindingEnumerationMember read GetMembers;
|
property Members[Index: Integer]: TXMLDataBindingEnumerationMember read GetMembers;
|
||||||
@ -254,18 +255,20 @@ type
|
|||||||
FIsOptional: Boolean;
|
FIsOptional: Boolean;
|
||||||
FIsNillable: Boolean;
|
FIsNillable: Boolean;
|
||||||
FIsRepeating: Boolean;
|
FIsRepeating: Boolean;
|
||||||
|
FIsNodeValue: Boolean;
|
||||||
FCollection: TXMLDataBindingInterface;
|
FCollection: TXMLDataBindingInterface;
|
||||||
protected
|
protected
|
||||||
function GetIsReadOnly(): Boolean; virtual; abstract;
|
function GetIsReadOnly: Boolean; virtual; abstract;
|
||||||
|
|
||||||
function GetItemType(): TXMLDataBindingItemType; override;
|
function GetItemType: TXMLDataBindingItemType; override;
|
||||||
function GetPropertyType(): TXMLDataBindingPropertyType; virtual; abstract;
|
function GetPropertyType: TXMLDataBindingPropertyType; virtual; abstract;
|
||||||
public
|
public
|
||||||
property IsAttribute: Boolean read FIsAttribute write FIsAttribute;
|
property IsAttribute: Boolean read FIsAttribute write FIsAttribute;
|
||||||
property IsOptional: Boolean read FIsOptional write FIsOptional;
|
property IsOptional: Boolean read FIsOptional write FIsOptional;
|
||||||
property IsNillable: Boolean read FIsNillable write FIsNillable;
|
property IsNillable: Boolean read FIsNillable write FIsNillable;
|
||||||
property IsReadOnly: Boolean read GetIsReadOnly;
|
property IsReadOnly: Boolean read GetIsReadOnly;
|
||||||
property IsRepeating: Boolean read FIsRepeating write FIsRepeating;
|
property IsRepeating: Boolean read FIsRepeating write FIsRepeating;
|
||||||
|
property IsNodeValue: Boolean read FIsNodeValue write FIsNodeValue;
|
||||||
property PropertyType: TXMLDataBindingPropertyType read GetPropertyType;
|
property PropertyType: TXMLDataBindingPropertyType read GetPropertyType;
|
||||||
|
|
||||||
property Collection: TXMLDataBindingInterface read FCollection write FCollection;
|
property Collection: TXMLDataBindingInterface read FCollection write FCollection;
|
||||||
@ -276,8 +279,8 @@ type
|
|||||||
private
|
private
|
||||||
FDataType: IXMLTypeDef;
|
FDataType: IXMLTypeDef;
|
||||||
protected
|
protected
|
||||||
function GetIsReadOnly(): Boolean; override;
|
function GetIsReadOnly: Boolean; override;
|
||||||
function GetPropertyType(): TXMLDataBindingPropertyType; override;
|
function GetPropertyType: TXMLDataBindingPropertyType; override;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TXMLDataBindingGenerator; ASchemaItem: IXMLSchemaItem; const AName: String; ADataType: IXMLTypeDef);
|
constructor Create(AOwner: TXMLDataBindingGenerator; ASchemaItem: IXMLSchemaItem; const AName: String; ADataType: IXMLTypeDef);
|
||||||
constructor CreateFromAlias(AOwner: TXMLDataBindingGenerator; AProperty: TXMLDataBindingItemProperty; ADataType: IXMLTypeDef);
|
constructor CreateFromAlias(AOwner: TXMLDataBindingGenerator; AProperty: TXMLDataBindingItemProperty; ADataType: IXMLTypeDef);
|
||||||
@ -290,8 +293,8 @@ type
|
|||||||
private
|
private
|
||||||
FItem: TXMLDataBindingItem;
|
FItem: TXMLDataBindingItem;
|
||||||
protected
|
protected
|
||||||
function GetIsReadOnly(): Boolean; override;
|
function GetIsReadOnly: Boolean; override;
|
||||||
function GetPropertyType(): TXMLDataBindingPropertyType; override;
|
function GetPropertyType: TXMLDataBindingPropertyType; override;
|
||||||
|
|
||||||
procedure ReplaceItem(const AOldItem, ANewItem: TXMLDataBindingItem); override;
|
procedure ReplaceItem(const AOldItem, ANewItem: TXMLDataBindingItem); override;
|
||||||
public
|
public
|
||||||
@ -305,7 +308,7 @@ type
|
|||||||
private
|
private
|
||||||
FInterfaceType: TXMLDataBindingInterfaceType;
|
FInterfaceType: TXMLDataBindingInterfaceType;
|
||||||
protected
|
protected
|
||||||
function GetItemType(): TXMLDataBindingItemType; override;
|
function GetItemType: TXMLDataBindingItemType; override;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TXMLDataBindingGenerator; ASchemaItem: IXMLSchemaItem; const AName: String; AInterfaceType: TXMLDataBindingInterfaceType);
|
constructor Create(AOwner: TXMLDataBindingGenerator; ASchemaItem: IXMLSchemaItem; const AName: String; AInterfaceType: TXMLDataBindingInterfaceType);
|
||||||
|
|
||||||
@ -317,7 +320,7 @@ type
|
|||||||
private
|
private
|
||||||
FItem: TXMLDataBindingItem;
|
FItem: TXMLDataBindingItem;
|
||||||
protected
|
protected
|
||||||
function GetItemType(): TXMLDataBindingItemType; override;
|
function GetItemType: TXMLDataBindingItemType; override;
|
||||||
|
|
||||||
procedure ReplaceItem(const AOldItem, ANewItem: TXMLDataBindingItem); override;
|
procedure ReplaceItem(const AOldItem, ANewItem: TXMLDataBindingItem); override;
|
||||||
public
|
public
|
||||||
@ -329,7 +332,7 @@ type
|
|||||||
private
|
private
|
||||||
FDataType: IXMLTypeDef;
|
FDataType: IXMLTypeDef;
|
||||||
protected
|
protected
|
||||||
function GetItemType(): TXMLDataBindingItemType; override;
|
function GetItemType: TXMLDataBindingItemType; override;
|
||||||
public
|
public
|
||||||
property DataType: IXMLTypeDef read FDataType write FDataType;
|
property DataType: IXMLTypeDef read FDataType write FDataType;
|
||||||
end;
|
end;
|
||||||
@ -354,7 +357,6 @@ const
|
|||||||
AttributeNillable = 'nillable';
|
AttributeNillable = 'nillable';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function GetInterfaceType(ASchemaItem: IXMLSchemaItem): TXMLDataBindingInterfaceType;
|
function GetInterfaceType(ASchemaItem: IXMLSchemaItem): TXMLDataBindingInterfaceType;
|
||||||
begin
|
begin
|
||||||
if Supports(ASchemaItem, IXMLComplexTypeDef) then
|
if Supports(ASchemaItem, IXMLComplexTypeDef) then
|
||||||
@ -366,11 +368,11 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
{ TXMLDataBindingGenerator }
|
{ TXMLDataBindingGenerator }
|
||||||
constructor TXMLDataBindingGenerator.Create();
|
constructor TXMLDataBindingGenerator.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create();
|
inherited Create;
|
||||||
|
|
||||||
FIncludePaths := TStringList.Create();
|
FIncludePaths := TStringList.Create;
|
||||||
FSchemas := TObjectList.Create(True);
|
FSchemas := TObjectList.Create(True);
|
||||||
|
|
||||||
with TStringList(FIncludePaths) do
|
with TStringList(FIncludePaths) do
|
||||||
@ -381,7 +383,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
destructor TXMLDataBindingGenerator.Destroy();
|
destructor TXMLDataBindingGenerator.Destroy;
|
||||||
begin
|
begin
|
||||||
FreeAndNil(FSchemas);
|
FreeAndNil(FSchemas);
|
||||||
FreeAndNil(FIncludePaths);
|
FreeAndNil(FIncludePaths);
|
||||||
@ -396,7 +398,7 @@ var
|
|||||||
schema: TXMLDataBindingSchema;
|
schema: TXMLDataBindingSchema;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FSchemas.Clear();
|
FSchemas.Clear;
|
||||||
schema := LoadSchema(AStream, ASchemaName);
|
schema := LoadSchema(AStream, ASchemaName);
|
||||||
if Assigned(schema) then
|
if Assigned(schema) then
|
||||||
schema.SourceFileName := SourceFileName;
|
schema.SourceFileName := SourceFileName;
|
||||||
@ -419,7 +421,7 @@ begin
|
|||||||
|
|
||||||
|
|
||||||
{ Resolve naming conflicts }
|
{ Resolve naming conflicts }
|
||||||
ResolveNameConflicts();
|
ResolveNameConflicts;
|
||||||
|
|
||||||
|
|
||||||
{ Perform final post-processing (translating names, generating collections) }
|
{ Perform final post-processing (translating names, generating collections) }
|
||||||
@ -428,7 +430,7 @@ begin
|
|||||||
|
|
||||||
|
|
||||||
{ Output }
|
{ Output }
|
||||||
GenerateDataBinding();
|
GenerateDataBinding;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -439,7 +441,7 @@ var
|
|||||||
fileStream: TFileStream;
|
fileStream: TFileStream;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
currentDir := GetCurrentDir();
|
currentDir := GetCurrentDir;
|
||||||
try
|
try
|
||||||
ChDir(ExtractFilePath(AFileName));
|
ChDir(ExtractFilePath(AFileName));
|
||||||
|
|
||||||
@ -816,6 +818,97 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TXMLDataBindingGenerator.ProcessElement(ASchema: TXMLDataBindingSchema; AAttribute: IXMLAttributeDef): TXMLDataBindingItem;
|
||||||
|
var
|
||||||
|
enumerationObject: TXMLDataBindingEnumeration;
|
||||||
|
interfaceObject: TXMLDataBindingInterface;
|
||||||
|
complexAliasItem: TXMLDataBindingComplexTypeAliasItem;
|
||||||
|
simpleAliasItem: TXMLDataBindingSimpleTypeAliasItem;
|
||||||
|
simpleTypeDef: IXMLSimpleTypeDef;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result := nil;
|
||||||
|
|
||||||
|
if Assigned(AAttribute.Ref) then
|
||||||
|
begin
|
||||||
|
{ Find reference. If not found, mark as "resolve later". }
|
||||||
|
Result := FindInterface(ASchema, AAttribute.Ref.Name, ifElement);
|
||||||
|
|
||||||
|
if not Assigned(Result) then
|
||||||
|
begin
|
||||||
|
Result := TXMLDataBindingUnresolvedItem.Create(Self, AAttribute, AAttribute.Ref.Name, ifElement);
|
||||||
|
ASchema.AddItem(Result);
|
||||||
|
end;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
if not AAttribute.DataType.IsAnonymous then
|
||||||
|
begin
|
||||||
|
if AAttribute.DataType.IsComplex then
|
||||||
|
begin
|
||||||
|
{ Find data type. If not found, mark as "resolve later". }
|
||||||
|
Result := FindInterface(ASchema, AAttribute.DataTypeName, ifComplexType);
|
||||||
|
|
||||||
|
if not Assigned(Result) then
|
||||||
|
begin
|
||||||
|
Result := TXMLDataBindingUnresolvedItem.Create(Self, AAttribute, AAttribute.DataTypeName, ifComplexType);
|
||||||
|
ASchema.AddItem(Result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
if AAttribute.IsGlobal then
|
||||||
|
begin
|
||||||
|
{ The element is global, but only references a complex type. Keep track
|
||||||
|
to properly resolve references to the element. }
|
||||||
|
complexAliasItem := TXMLDataBindingComplexTypeAliasItem.Create(Self, AAttribute, AAttribute.Name);
|
||||||
|
complexAliasItem.Item := Result;
|
||||||
|
ASchema.AddItem(complexAliasItem);
|
||||||
|
end;
|
||||||
|
end else if Supports(AAttribute.DataType, IXMLSimpleTypeDef, simpleTypeDef) then
|
||||||
|
begin
|
||||||
|
if simpleTypeDef.Enumerations.Count > 0 then
|
||||||
|
begin
|
||||||
|
{ References enumeration. }
|
||||||
|
Result := FindEnumeration(ASchema, AAttribute.DataTypeName);
|
||||||
|
|
||||||
|
if not Assigned(Result) then
|
||||||
|
begin
|
||||||
|
Result := TXMLDataBindingUnresolvedItem.Create(Self, AAttribute, AAttribute.DataTypeName, ifEnumeration);
|
||||||
|
ASchema.AddItem(Result);
|
||||||
|
end;
|
||||||
|
end else if simpleTypeDef.IsBuiltInType and AAttribute.IsGlobal then
|
||||||
|
begin
|
||||||
|
{ The element is global, but only references a simple type. }
|
||||||
|
simpleAliasItem := TXMLDataBindingSimpleTypeAliasItem.Create(Self, AAttribute, AAttribute.Name);
|
||||||
|
simpleAliasItem.DataType := AAttribute.DataType;
|
||||||
|
ASchema.AddItem(simpleAliasItem);
|
||||||
|
|
||||||
|
Result := simpleAliasItem;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if not Assigned(Result) then
|
||||||
|
begin
|
||||||
|
if AAttribute.DataType.Enumerations.Count > 0 then
|
||||||
|
begin
|
||||||
|
{ Enumeration }
|
||||||
|
enumerationObject := TXMLDataBindingEnumeration.Create(Self, AAttribute, AAttribute.DataType.Enumerations, AAttribute.Name);
|
||||||
|
ASchema.AddItem(enumerationObject);
|
||||||
|
Result := enumerationObject;
|
||||||
|
end else if AAttribute.DataType.IsComplex then
|
||||||
|
begin
|
||||||
|
{ Interface }
|
||||||
|
interfaceObject := TXMLDataBindingInterface.Create(Self, AAttribute, AAttribute.Name);
|
||||||
|
if Assigned(AAttribute.DataType.BaseType) then
|
||||||
|
interfaceObject.BaseName := AAttribute.DataType.BaseTypeName;
|
||||||
|
|
||||||
|
ASchema.AddItem(interfaceObject);
|
||||||
|
Result := interfaceObject;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TXMLDataBindingGenerator.ProcessChildElement(ASchema: TXMLDataBindingSchema; AElement: IXMLElementDef; AInterface: TXMLDataBindingInterface);
|
procedure TXMLDataBindingGenerator.ProcessChildElement(ASchema: TXMLDataBindingSchema; AElement: IXMLElementDef; AInterface: TXMLDataBindingInterface);
|
||||||
var
|
var
|
||||||
actualElement: IXMLElementDef;
|
actualElement: IXMLElementDef;
|
||||||
@ -858,12 +951,19 @@ end;
|
|||||||
procedure TXMLDataBindingGenerator.ProcessAttribute(ASchema: TXMLDataBindingSchema; AAttribute: IXMLAttributeDef; AInterface: TXMLDataBindingInterface);
|
procedure TXMLDataBindingGenerator.ProcessAttribute(ASchema: TXMLDataBindingSchema; AAttribute: IXMLAttributeDef; AInterface: TXMLDataBindingInterface);
|
||||||
var
|
var
|
||||||
propertyItem: TXMLDataBindingProperty;
|
propertyItem: TXMLDataBindingProperty;
|
||||||
|
propertyType: TXMLDataBindingItem;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
// #ToDo2 (MvR) 10-4-2008: complex attributes (enumerations)
|
propertyType := ProcessElement(ASchema, AAttribute);
|
||||||
propertyItem := TXMLDataBindingSimpleProperty.Create(Self, AAttribute,
|
|
||||||
|
if Assigned(propertyType) then
|
||||||
|
propertyItem := TXMLDataBindingItemProperty.Create(Self, AAttribute,
|
||||||
AAttribute.Name,
|
AAttribute.Name,
|
||||||
AAttribute.DataType);
|
propertyType)
|
||||||
|
else
|
||||||
|
propertyItem := TXMLDataBindingSimpleProperty.Create(Self, AAttribute,
|
||||||
|
AAttribute.Name,
|
||||||
|
AAttribute.DataType);
|
||||||
|
|
||||||
propertyItem.IsOptional := (AAttribute.Use = UseOptional);
|
propertyItem.IsOptional := (AAttribute.Use = UseOptional);
|
||||||
propertyItem.IsAttribute := True;
|
propertyItem.IsAttribute := True;
|
||||||
@ -1073,7 +1173,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TXMLDataBindingGenerator.ResolveNameConflicts();
|
procedure TXMLDataBindingGenerator.ResolveNameConflicts;
|
||||||
var
|
var
|
||||||
itemNames: TX2SOHash;
|
itemNames: TX2SOHash;
|
||||||
|
|
||||||
@ -1159,9 +1259,9 @@ begin
|
|||||||
|
|
||||||
|
|
||||||
{ Find conflicts }
|
{ Find conflicts }
|
||||||
itemNames.First();
|
itemNames.First;
|
||||||
|
|
||||||
while itemNames.Next() do
|
while itemNames.Next do
|
||||||
begin
|
begin
|
||||||
items := TObjectList(itemNames.CurrentValue);
|
items := TObjectList(itemNames.CurrentValue);
|
||||||
|
|
||||||
@ -1221,6 +1321,7 @@ var
|
|||||||
propertyIndex: Integer;
|
propertyIndex: Integer;
|
||||||
propertyItem: TXMLDataBindingProperty;
|
propertyItem: TXMLDataBindingProperty;
|
||||||
repeatingItems: TObjectList;
|
repeatingItems: TObjectList;
|
||||||
|
typedSchemaItem: IXMLTypedSchemaItem;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{ Translate name }
|
{ Translate name }
|
||||||
@ -1288,6 +1389,21 @@ begin
|
|||||||
begin
|
begin
|
||||||
interfaceItem := TXMLDataBindingInterface(AItem);
|
interfaceItem := TXMLDataBindingInterface(AItem);
|
||||||
|
|
||||||
|
if (not Assigned(interfaceItem.BaseItem)) and
|
||||||
|
(Length(interfaceItem.BaseName) > 0) then
|
||||||
|
begin
|
||||||
|
{ Assume this is a reference to a simple type }
|
||||||
|
if Supports(interfaceItem.SchemaItem, IXMLTypedSchemaItem, typedSchemaItem) then
|
||||||
|
begin
|
||||||
|
propertyItem := TXMLDataBindingSimpleProperty.Create(Self, interfaceItem.SchemaItem, 'NodeValue',
|
||||||
|
typedSchemaItem.DataType.BaseType);
|
||||||
|
propertyItem.IsNodeValue := True;
|
||||||
|
|
||||||
|
interfaceItem.AddProperty(propertyItem);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
for propertyIndex := 0 to Pred(interfaceItem.PropertyCount) do
|
for propertyIndex := 0 to Pred(interfaceItem.PropertyCount) do
|
||||||
PostProcessItem(ASchema, interfaceItem.Properties[propertyIndex]);
|
PostProcessItem(ASchema, interfaceItem.Properties[propertyIndex]);
|
||||||
end;
|
end;
|
||||||
@ -1308,7 +1424,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TXMLDataBindingGenerator.GetSchemaCount(): Integer;
|
function TXMLDataBindingGenerator.GetSchemaCount: Integer;
|
||||||
begin
|
begin
|
||||||
Result := FSchemas.Count;
|
Result := FSchemas.Count;
|
||||||
end;
|
end;
|
||||||
@ -1323,7 +1439,7 @@ end;
|
|||||||
{ TXMLDataBindingGeneratorItem }
|
{ TXMLDataBindingGeneratorItem }
|
||||||
constructor TXMLDataBindingGeneratorItem.Create(AOwner: TXMLDataBindingGenerator);
|
constructor TXMLDataBindingGeneratorItem.Create(AOwner: TXMLDataBindingGenerator);
|
||||||
begin
|
begin
|
||||||
inherited Create();
|
inherited Create;
|
||||||
|
|
||||||
FOwner := AOwner;
|
FOwner := AOwner;
|
||||||
end;
|
end;
|
||||||
@ -1344,7 +1460,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
destructor TXMLDataBindingSchema.Destroy();
|
destructor TXMLDataBindingSchema.Destroy;
|
||||||
begin
|
begin
|
||||||
FreeAndNil(FItems);
|
FreeAndNil(FItems);
|
||||||
FreeAndNil(FIncludes);
|
FreeAndNil(FIncludes);
|
||||||
@ -1403,7 +1519,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TXMLDataBindingSchema.GetIncludeCount(): Integer;
|
function TXMLDataBindingSchema.GetIncludeCount: Integer;
|
||||||
begin
|
begin
|
||||||
Result := FIncludes.Count;
|
Result := FIncludes.Count;
|
||||||
end;
|
end;
|
||||||
@ -1415,7 +1531,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TXMLDataBindingSchema.GetItemCount(): Integer;
|
function TXMLDataBindingSchema.GetItemCount: Integer;
|
||||||
begin
|
begin
|
||||||
Result := FItems.Count;
|
Result := FItems.Count;
|
||||||
end;
|
end;
|
||||||
@ -1427,7 +1543,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TXMLDataBindingSchema.GetTargetNamespace(): String;
|
function TXMLDataBindingSchema.GetTargetNamespace: String;
|
||||||
begin
|
begin
|
||||||
Result := '';
|
Result := '';
|
||||||
if Assigned(FSchemaDef) and (not VarIsNull(FSchemaDef.TargetNamespace)) then
|
if Assigned(FSchemaDef) and (not VarIsNull(FSchemaDef.TargetNamespace)) then
|
||||||
@ -1446,7 +1562,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TXMLDataBindingItem.GetDocumentation(): String;
|
function TXMLDataBindingItem.GetDocumentation: String;
|
||||||
var
|
var
|
||||||
documentationIndex: Integer;
|
documentationIndex: Integer;
|
||||||
|
|
||||||
@ -1462,14 +1578,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TXMLDataBindingItem.GetHasDocumentation(): Boolean;
|
function TXMLDataBindingItem.GetHasDocumentation: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := Assigned(SchemaItem) and
|
Result := Assigned(SchemaItem) and
|
||||||
(SchemaItem.Documentation.Count > 0);
|
(SchemaItem.Documentation.Count > 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TXMLDataBindingItem.GetIsCollection(): Boolean;
|
function TXMLDataBindingItem.GetIsCollection: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := Assigned(FCollectionItem);
|
Result := Assigned(FCollectionItem);
|
||||||
end;
|
end;
|
||||||
@ -1544,13 +1660,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TXMLDataBindingInterface.GetItemType(): TXMLDataBindingItemType;
|
function TXMLDataBindingInterface.GetItemType: TXMLDataBindingItemType;
|
||||||
begin
|
begin
|
||||||
Result := itInterface;
|
Result := itInterface;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TXMLDataBindingInterface.GetPropertyCount(): Integer;
|
function TXMLDataBindingInterface.GetPropertyCount: Integer;
|
||||||
begin
|
begin
|
||||||
Result := FProperties.Count;
|
Result := FProperties.Count;
|
||||||
end;
|
end;
|
||||||
@ -1571,7 +1687,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TXMLDataBindingEnumerationMember.GetItemType(): TXMLDataBindingItemType;
|
function TXMLDataBindingEnumerationMember.GetItemType: TXMLDataBindingItemType;
|
||||||
begin
|
begin
|
||||||
Result := itEnumerationMember;
|
Result := itEnumerationMember;
|
||||||
end;
|
end;
|
||||||
@ -1585,14 +1701,14 @@ var
|
|||||||
begin
|
begin
|
||||||
inherited Create(AOwner, ASchemaItem, AName);
|
inherited Create(AOwner, ASchemaItem, AName);
|
||||||
|
|
||||||
FMembers := TObjectList.Create();
|
FMembers := TObjectList.Create;
|
||||||
|
|
||||||
for memberIndex := 0 to Pred(AEnumerations.Count) do
|
for memberIndex := 0 to Pred(AEnumerations.Count) do
|
||||||
FMembers.Add(TXMLDataBindingEnumerationMember.Create(Owner, Self, AEnumerations.Items[memberIndex].Value));
|
FMembers.Add(TXMLDataBindingEnumerationMember.Create(Owner, Self, AEnumerations.Items[memberIndex].Value));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
destructor TXMLDataBindingEnumeration.Destroy();
|
destructor TXMLDataBindingEnumeration.Destroy;
|
||||||
begin
|
begin
|
||||||
FreeAndNil(FMembers);
|
FreeAndNil(FMembers);
|
||||||
|
|
||||||
@ -1600,13 +1716,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TXMLDataBindingEnumeration.GetItemType(): TXMLDataBindingItemType;
|
function TXMLDataBindingEnumeration.GetItemType: TXMLDataBindingItemType;
|
||||||
begin
|
begin
|
||||||
Result := itEnumeration;
|
Result := itEnumeration;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TXMLDataBindingEnumeration.GetMemberCount(): Integer;
|
function TXMLDataBindingEnumeration.GetMemberCount: Integer;
|
||||||
begin
|
begin
|
||||||
Result := FMembers.Count;
|
Result := FMembers.Count;
|
||||||
end;
|
end;
|
||||||
@ -1619,7 +1735,7 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
{ TXMLDataBindingProperty }
|
{ TXMLDataBindingProperty }
|
||||||
function TXMLDataBindingProperty.GetItemType(): TXMLDataBindingItemType;
|
function TXMLDataBindingProperty.GetItemType: TXMLDataBindingItemType;
|
||||||
begin
|
begin
|
||||||
Result := itProperty;
|
Result := itProperty;
|
||||||
end;
|
end;
|
||||||
@ -1645,13 +1761,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TXMLDataBindingSimpleProperty.GetIsReadOnly(): Boolean;
|
function TXMLDataBindingSimpleProperty.GetIsReadOnly: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TXMLDataBindingSimpleProperty.GetPropertyType(): TXMLDataBindingPropertyType;
|
function TXMLDataBindingSimpleProperty.GetPropertyType: TXMLDataBindingPropertyType;
|
||||||
begin
|
begin
|
||||||
Result := ptSimple;
|
Result := ptSimple;
|
||||||
end;
|
end;
|
||||||
@ -1675,13 +1791,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TXMLDataBindingItemProperty.GetIsReadOnly(): Boolean;
|
function TXMLDataBindingItemProperty.GetIsReadOnly: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := Assigned(Item) and (Item.ItemType <> itEnumeration);
|
Result := Assigned(Item) and (Item.ItemType <> itEnumeration);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TXMLDataBindingItemProperty.GetPropertyType(): TXMLDataBindingPropertyType;
|
function TXMLDataBindingItemProperty.GetPropertyType: TXMLDataBindingPropertyType;
|
||||||
begin
|
begin
|
||||||
Result := ptItem;
|
Result := ptItem;
|
||||||
end;
|
end;
|
||||||
@ -1696,7 +1812,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TXMLDataBindingUnresolvedItem.GetItemType(): TXMLDataBindingItemType;
|
function TXMLDataBindingUnresolvedItem.GetItemType: TXMLDataBindingItemType;
|
||||||
begin
|
begin
|
||||||
Result := itUnresolved;
|
Result := itUnresolved;
|
||||||
end;
|
end;
|
||||||
@ -1712,7 +1828,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TXMLDataBindingComplexTypeAliasItem.GetItemType(): TXMLDataBindingItemType;
|
function TXMLDataBindingComplexTypeAliasItem.GetItemType: TXMLDataBindingItemType;
|
||||||
begin
|
begin
|
||||||
Result := itComplexTypeAlias;
|
Result := itComplexTypeAlias;
|
||||||
end;
|
end;
|
||||||
@ -1728,4 +1844,3 @@ end.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,12 +11,12 @@ type
|
|||||||
FStream: TStream;
|
FStream: TStream;
|
||||||
public
|
public
|
||||||
constructor Create(AStream: TStream; AOwnership: TStreamOwnership = soReference);
|
constructor Create(AStream: TStream; AOwnership: TStreamOwnership = soReference);
|
||||||
destructor Destroy(); override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
function ReadString(ASize: Integer = -1): String;
|
function ReadString(ASize: Integer = -1): String;
|
||||||
function ReadInteger(): Integer;
|
function ReadInteger: Integer;
|
||||||
function ReadDateTime(): TDateTime;
|
function ReadDateTime: TDateTime;
|
||||||
function ReadBoolean(): Boolean;
|
function ReadBoolean: Boolean;
|
||||||
|
|
||||||
procedure Write(const ASource: String);
|
procedure Write(const ASource: String);
|
||||||
procedure WriteLn(const ASource: String = '');
|
procedure WriteLn(const ASource: String = '');
|
||||||
@ -47,11 +47,11 @@ begin
|
|||||||
FOwnership := AOwnership;
|
FOwnership := AOwnership;
|
||||||
FStream := AStream;
|
FStream := AStream;
|
||||||
|
|
||||||
inherited Create();
|
inherited Create;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
destructor TStreamHelper.Destroy();
|
destructor TStreamHelper.Destroy;
|
||||||
begin
|
begin
|
||||||
if FOwnership = soOwned then
|
if FOwnership = soOwned then
|
||||||
FreeAndNil(FStream);
|
FreeAndNil(FStream);
|
||||||
@ -66,7 +66,7 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
if ASize = -1 then
|
if ASize = -1 then
|
||||||
iSize := ReadInteger()
|
iSize := ReadInteger
|
||||||
else
|
else
|
||||||
iSize := ASize;
|
iSize := ASize;
|
||||||
|
|
||||||
@ -75,19 +75,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TStreamHelper.ReadInteger(): Integer;
|
function TStreamHelper.ReadInteger: Integer;
|
||||||
begin
|
begin
|
||||||
FStream.Read(Result, SizeOf(Integer));
|
FStream.Read(Result, SizeOf(Integer));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TStreamHelper.ReadDateTime(): TDateTime;
|
function TStreamHelper.ReadDateTime: TDateTime;
|
||||||
begin
|
begin
|
||||||
FStream.Read(Result, SizeOf(TDateTime));
|
FStream.Read(Result, SizeOf(TDateTime));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TStreamHelper.ReadBoolean(): Boolean;
|
function TStreamHelper.ReadBoolean: Boolean;
|
||||||
begin
|
begin
|
||||||
FStream.Read(Result, SizeOf(Boolean));
|
FStream.Read(Result, SizeOf(Boolean));
|
||||||
end;
|
end;
|
||||||
@ -159,4 +159,3 @@ end;
|
|||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ program X2XMLDataBinding;
|
|||||||
{$WARN SYMBOL_PLATFORM OFF}
|
{$WARN SYMBOL_PLATFORM OFF}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
VistaManAsInvoker,
|
||||||
Forms,
|
Forms,
|
||||||
MainFrm in 'Forms\MainFrm.pas' {MainForm},
|
MainFrm in 'Forms\MainFrm.pas' {MainForm},
|
||||||
XMLDataBindingGenerator in 'Units\XMLDataBindingGenerator.pas',
|
XMLDataBindingGenerator in 'Units\XMLDataBindingGenerator.pas',
|
||||||
|
@ -24,43 +24,7 @@
|
|||||||
<Borland.Personality>Delphi.Personality</Borland.Personality>
|
<Borland.Personality>Delphi.Personality</Borland.Personality>
|
||||||
<Borland.ProjectType />
|
<Borland.ProjectType />
|
||||||
<BorlandProject>
|
<BorlandProject>
|
||||||
<BorlandProject xmlns=""> <Delphi.Personality> <Parameters>
|
<BorlandProject><Delphi.Personality><Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters><Parameters Name="RunParams">"P:\test\XMLDataBinding\Tests\Data\04. Type with attributes.xsd"</Parameters></Parameters><VersionInfo><VersionInfo Name="IncludeVerInfo">False</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">1</VersionInfo><VersionInfo Name="MinorVer">0</VersionInfo><VersionInfo Name="Release">0</VersionInfo><VersionInfo Name="Build">0</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1043</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName"></VersionInfoKeys><VersionInfoKeys Name="FileDescription"></VersionInfoKeys><VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName"></VersionInfoKeys><VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="Comments"></VersionInfoKeys></VersionInfoKeys><Source><Source Name="MainSource">X2XMLDataBinding.dpr</Source></Source></Delphi.Personality></BorlandProject></BorlandProject>
|
||||||
|
|
||||||
<Parameters Name="UseLauncher">False</Parameters>
|
|
||||||
<Parameters Name="LoadAllSymbols">True</Parameters>
|
|
||||||
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
|
|
||||||
</Parameters>
|
|
||||||
<VersionInfo>
|
|
||||||
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
|
|
||||||
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
|
|
||||||
<VersionInfo Name="MajorVer">1</VersionInfo>
|
|
||||||
<VersionInfo Name="MinorVer">0</VersionInfo>
|
|
||||||
<VersionInfo Name="Release">0</VersionInfo>
|
|
||||||
<VersionInfo Name="Build">0</VersionInfo>
|
|
||||||
<VersionInfo Name="Debug">False</VersionInfo>
|
|
||||||
<VersionInfo Name="PreRelease">False</VersionInfo>
|
|
||||||
<VersionInfo Name="Special">False</VersionInfo>
|
|
||||||
<VersionInfo Name="Private">False</VersionInfo>
|
|
||||||
<VersionInfo Name="DLL">False</VersionInfo>
|
|
||||||
<VersionInfo Name="Locale">1043</VersionInfo>
|
|
||||||
<VersionInfo Name="CodePage">1252</VersionInfo>
|
|
||||||
</VersionInfo>
|
|
||||||
<VersionInfoKeys>
|
|
||||||
<VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
|
|
||||||
<VersionInfoKeys Name="FileDescription"></VersionInfoKeys>
|
|
||||||
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
|
|
||||||
<VersionInfoKeys Name="InternalName"></VersionInfoKeys>
|
|
||||||
<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
|
|
||||||
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
|
|
||||||
<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
|
|
||||||
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
|
|
||||||
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
|
||||||
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
|
|
||||||
</VersionInfoKeys>
|
|
||||||
<Source>
|
|
||||||
<Source Name="MainSource">X2XMLDataBinding.dpr</Source>
|
|
||||||
</Source>
|
|
||||||
</Delphi.Personality> </BorlandProject></BorlandProject>
|
|
||||||
</ProjectExtensions>
|
</ProjectExtensions>
|
||||||
<Import Project="$(MSBuildBinPath)\Borland.Delphi.Targets" />
|
<Import Project="$(MSBuildBinPath)\Borland.Delphi.Targets" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
Loading…
Reference in New Issue
Block a user