Added: support for SaveToStream for Base64 encoded types
Fixed: global simple type mappings referenced by non-global elements
This commit is contained in:
parent
8a5fa4af6d
commit
25bdcc74c5
@ -1068,6 +1068,8 @@ var
|
|||||||
value: String;
|
value: String;
|
||||||
propertyItemName: String;
|
propertyItemName: String;
|
||||||
fieldName: String;
|
fieldName: String;
|
||||||
|
writeStream: Boolean;
|
||||||
|
typeMapping: TTypeMapping;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
@ -1084,6 +1086,15 @@ begin
|
|||||||
writeOptional := not Assigned(AProperty.Collection) and
|
writeOptional := not Assigned(AProperty.Collection) and
|
||||||
AProperty.IsOptional;
|
AProperty.IsOptional;
|
||||||
|
|
||||||
|
writeStream := False;
|
||||||
|
if (AMember = dxmPropertyGet) and (AProperty.PropertyType = ptSimple) then
|
||||||
|
begin
|
||||||
|
if GetDataTypeMapping(TXMLDataBindingSimpleProperty(AProperty).DataType, typeMapping) then
|
||||||
|
writeStream := (typeMapping.Conversion = tcBase64);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dataTypeName := '';
|
dataTypeName := '';
|
||||||
propertyItem := nil;
|
propertyItem := nil;
|
||||||
@ -1146,6 +1157,9 @@ begin
|
|||||||
if writeTextProp then
|
if writeTextProp then
|
||||||
sourceCode.Add(PropertyIntfMethodGetText);
|
sourceCode.Add(PropertyIntfMethodGetText);
|
||||||
|
|
||||||
|
if writeStream then
|
||||||
|
sourceCode.Add(PropertyIntfMethodStream);
|
||||||
|
|
||||||
sourceCode.Add(PropertyIntfMethodGet);
|
sourceCode.Add(PropertyIntfMethodGet);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1216,6 +1230,9 @@ begin
|
|||||||
else
|
else
|
||||||
sourceCode.Add(PropertyImplMethodGetText[GetDelphiElementType(AProperty)]);
|
sourceCode.Add(PropertyImplMethodGetText[GetDelphiElementType(AProperty)]);
|
||||||
|
|
||||||
|
if writeStream then
|
||||||
|
sourceCode.Add(PropertyImplMethodStream[GetDelphiElementType(AProperty)]);
|
||||||
|
|
||||||
sourceCode.Add('function TXML%<Name>:s.Get%<PropertyName>:s: %<DataType>:s;');
|
sourceCode.Add('function TXML%<Name>:s.Get%<PropertyName>:s: %<DataType>:s;');
|
||||||
|
|
||||||
case AProperty.PropertyType of
|
case AProperty.PropertyType of
|
||||||
|
@ -105,6 +105,7 @@ const
|
|||||||
PropertyIntfMethodSetNil = ' procedure Set%<PropertyName>:sIsNil(const Value: Boolean);';
|
PropertyIntfMethodSetNil = ' procedure Set%<PropertyName>:sIsNil(const Value: Boolean);';
|
||||||
PropertyIntfMethodSetText = ' procedure Set%<PropertyName>:sText(const Value: WideString);';
|
PropertyIntfMethodSetText = ' procedure Set%<PropertyName>:sText(const Value: WideString);';
|
||||||
PropertyIntfMethodSet = ' procedure Set%<PropertyName>:s(const Value: %<DataType>:s);';
|
PropertyIntfMethodSet = ' procedure Set%<PropertyName>:s(const Value: %<DataType>:s);';
|
||||||
|
PropertyIntfMethodStream = ' procedure Save%<PropertyName>:sToStream(AStream: TStream);';
|
||||||
|
|
||||||
PropertyInterfaceOptional = ' property Has%<PropertyName>:s: Boolean read GetHas%<PropertyName>:s;';
|
PropertyInterfaceOptional = ' property Has%<PropertyName>:s: Boolean read GetHas%<PropertyName>:s;';
|
||||||
PropertyInterfaceNilReadOnly = ' property %<PropertyName>:sIsNil: Boolean read Get%<PropertyName>:sIsNil;';
|
PropertyInterfaceNilReadOnly = ' property %<PropertyName>:sIsNil: Boolean read Get%<PropertyName>:sIsNil;';
|
||||||
@ -217,6 +218,23 @@ const
|
|||||||
'end;' + CrLf +
|
'end;' + CrLf +
|
||||||
'' + CrLf;
|
'' + CrLf;
|
||||||
|
|
||||||
|
PropertyImplMethodStream: array[TDelphiElementType] of string =
|
||||||
|
(
|
||||||
|
{ dntElement }
|
||||||
|
'procedure TXML%<Name>:s.Save%<PropertyName>:sToStream(AStream: TStream);' + CrLf +
|
||||||
|
'begin' + CrLf +
|
||||||
|
' Base64DecodeToStream(Trim(ChildNodes[''%<PropertySourceName>:s''].Text), AStream);' + CrLf +
|
||||||
|
'end;' + CrLf +
|
||||||
|
'' + CrLf,
|
||||||
|
|
||||||
|
{ dntElementNS }
|
||||||
|
'procedure TXML%<Name>:s.Save%<PropertyName>:sToStream(AStream: TStream);' + CrLf +
|
||||||
|
'begin' + CrLf +
|
||||||
|
' Base64DecodeToStream(Trim(ChildNodes.FindNode(''%<PropertySourceName>:s'', ''%<Namespace>:s'').Text), AStream);' + CrLf +
|
||||||
|
'end;' + CrLf +
|
||||||
|
'' + CrLf
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
SectionComments: array[TDelphiXMLSection] of String =
|
SectionComments: array[TDelphiXMLSection] of String =
|
||||||
(
|
(
|
||||||
|
@ -658,6 +658,7 @@ var
|
|||||||
simpleTypeIndex: Integer;
|
simpleTypeIndex: Integer;
|
||||||
simpleType: IXMLSimpleTypeDef;
|
simpleType: IXMLSimpleTypeDef;
|
||||||
enumerationObject: TXMLDataBindingEnumeration;
|
enumerationObject: TXMLDataBindingEnumeration;
|
||||||
|
baseType: IXMLTypeDef;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
schemaDef := ASchema.SchemaDef;
|
schemaDef := ASchema.SchemaDef;
|
||||||
@ -670,6 +671,15 @@ begin
|
|||||||
begin
|
begin
|
||||||
enumerationObject := TXMLDataBindingEnumeration.Create(Self, simpleType, simpleType.Enumerations, simpleType.Name, False);
|
enumerationObject := TXMLDataBindingEnumeration.Create(Self, simpleType, simpleType.Enumerations, simpleType.Name, False);
|
||||||
ASchema.AddItem(enumerationObject);
|
ASchema.AddItem(enumerationObject);
|
||||||
|
end else if simpleType.DerivationMethod = sdmRestriction then
|
||||||
|
begin
|
||||||
|
baseType := simpleType.BaseType;
|
||||||
|
|
||||||
|
while Assigned(baseType.BaseType) do
|
||||||
|
baseType := baseType.BaseType;
|
||||||
|
|
||||||
|
if not baseType.IsComplex then
|
||||||
|
ASchema.AddItem(TXMLDataBindingSimpleTypeAliasItem.Create(Self, baseType, simpleType.Name));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -837,7 +847,7 @@ begin
|
|||||||
|
|
||||||
for attributeIndex := 0 to Pred(AElement.AttributeDefs.Count) do
|
for attributeIndex := 0 to Pred(AElement.AttributeDefs.Count) do
|
||||||
ProcessAttribute(ASchema, AElement.AttributeDefs[attributeIndex], interfaceObject);
|
ProcessAttribute(ASchema, AElement.AttributeDefs[attributeIndex], interfaceObject);
|
||||||
end else if AElement.IsGlobal then
|
end else {if AElement.IsGlobal then}
|
||||||
begin
|
begin
|
||||||
{ Non-anonymous non-complex type. Assume somewhere in there is a
|
{ Non-anonymous non-complex type. Assume somewhere in there is a
|
||||||
built-in type.
|
built-in type.
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<Borland.Personality>Delphi.Personality</Borland.Personality>
|
<Borland.Personality>Delphi.Personality</Borland.Personality>
|
||||||
<Borland.ProjectType />
|
<Borland.ProjectType />
|
||||||
<BorlandProject>
|
<BorlandProject>
|
||||||
<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\01. Basic simple and complex types.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>
|
<BorlandProject><Delphi.Personality><Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters><Parameters Name="RunParams">P:\hyundai\DealerAccessoryMsg_v0101.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>
|
||||||
</ProjectExtensions>
|
</ProjectExtensions>
|
||||||
<Import Project="$(MSBuildBinPath)\Borland.Delphi.Targets" />
|
<Import Project="$(MSBuildBinPath)\Borland.Delphi.Targets" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
Loading…
Reference in New Issue
Block a user