1
0
mirror of synced 2024-11-21 05:33:50 +00:00

Merged collections branch into trunk

This commit is contained in:
Mark van Renswoude 2008-04-14 19:28:57 +00:00
parent e1f35e9999
commit f453aea455
7 changed files with 1447 additions and 728 deletions

View File

@ -23,6 +23,15 @@
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="InlinePart" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="MultiCollection">
<xs:complexType>
<xs:sequence>
<xs:element name="MultiItemFirst" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="MultiItemSecond" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,8 @@ interface
type
TDelphiXMLSection = (dxsForward, dxsInterface, dxsClass, dxsImplementation);
TDelphiXMLMember = (dxmPropertyGet, dxmPropertySet, dxmPropertyDeclaration);
TDelphiAccessor = (daGet, daSet);
TDelphiNodeType = (dntElement, dntAttribute, dntCustom);
const
@ -18,6 +20,7 @@ const
UnitInterface = 'interface' + CrLf +
'uses' + CrLf +
'%<UsesClause>:s' +
' Classes,' + CrLf +
' XMLDoc,' + CrLf +
' XMLIntf;' + CrLf +
@ -25,6 +28,9 @@ const
'type' + CrLf;
UnitImplementation = 'implementation' + CrLf +
'uses' + CrLf +
' SysUtils;' + CrLf +
'' + CrLf +
'' + CrLf;
UnitFooter = '' + CrLf +
@ -110,6 +116,7 @@ const
PrefixInterface = 'IXML';
PrefixClass = 'TXML';
PrefixField = 'F';
InterfaceItemForward = ' IXML%<Name>:s = interface;';
@ -169,6 +176,7 @@ const
(SchemaName: 'int'; DelphiName: 'Integer'; Conversion: tcNone),
(SchemaName: 'integer'; DelphiName: 'Integer'; Conversion: tcNone),
(SchemaName: 'short'; DelphiName: 'Smallint'; Conversion: tcNone),
// #ToDo1 (MvR) 11-4-2008: differentiate date / time / dateTime
(SchemaName: 'date'; DelphiName: 'TDateTime'; Conversion: tcDateTime),
(SchemaName: 'time'; DelphiName: 'TDateTime'; Conversion: tcDateTime),
(SchemaName: 'dateTime'; DelphiName: 'TDateTime'; Conversion: tcDateTime),
@ -180,33 +188,180 @@ const
TypeConversionNone = ' %<Destination>:s := %<Source>:s;';
TypeConversionVariables: array[TTypeConversion] of String =
TypeConversionNone: array[TDelphiAccessor, TDelphiNodeType] of String =
(
{ tcNone } '',
{ tcBoolean } '',
{ tcFloat } '',
{ tcDateTime } ''
{ daGet }
(
{ dntElement } ' %<Destination>:s := ChildNodes[''%<Source>:s''].NodeValue;',
{ dntAttribute } ' %<Destination>:s := AttributeNodes[''%<Source>:s''].NodeValue;',
{ dntCustom } ' %<Destination>:s := %<Source>:s;'
),
{ daSet }
(
{ dntElement } ' ChildNodes[''%<Destination>:s''].NodeValue := %<Source>:s;',
{ dntAttribute } ' SetAttribute(''%<Destination>:s'', %<Source>:s);',
{ dntCustom } ' %<Destination>:s := %<Source>:s;'
)
);
TypeConversionToNative: array[TTypeConversion] of String =
TypeConversionHelpers: array[TTypeConversion] of String =
(
{ tcNone } TypeConversionNone,
{ tcBoolean } TypeConversionNone,
{ tcFloat } TypeConversionNone,
{ tcDateTime } TypeConversionNone
{ tcNone }
'',
{ tcBoolean }
'function BoolToXML(AValue: Boolean): WideString;' + CrLf +
'begin' + CrLf +
' Result := LowerCase(BoolToStr(AValue, True));' + CrLf +
'end;' + CrLf +
'' + CrLf,
{ tcFloat }
'function GetXMLFloatFormatSettings: TFormatSettings;' + CrLf +
'begin' + CrLf +
' Result.DecimalSeparator := ''.'';' + CrLf +
'end;' + CrLf +
'' + CrLf +
'function FloatToXML(AValue: Extended): WideString;' + CrLf +
'begin' + CrLf +
' Result := FloatToStr(AValue, GetXMLFloatFormatSettings);' + CrLf +
'end;' + CrLf +
'' + CrLf +
'function XMLToFloat(const AValue: String): Extended;' + CrLf +
'begin' + CrLf +
' Result := StrToFloat(AValue, GetXMLFloatFormatSettings);' + CrLf +
'end;' + CrLf +
'' + CrLf,
{ tcDate }
// #ToDo1 (MvR) 11-4-2008: handle time in XMLToDateTime
'function DateToXML(AValue: TDateTime): WideString;' + CrLf +
'begin' + CrLf +
' Result := FormatDateTime(''yyyy"-"mm"-"dd'', AValue);' + CrLf +
'end;' + CrLf +
'' + CrLf +
'function XMLToDate(const ADate: String): TDateTime;' + CrLf +
'begin' + CrLf +
' try' + CrLf +
' Result := EncodeDate(StrToInt(Copy(ADate, 1, 4)),' + CrLf +
' StrToInt(Copy(ADate, 6, 2)),' + CrLf +
' StrToInt(Copy(ADate, 9, 2)));' + CrLf +
' except' + CrLf +
' on E:EConvertError do' + CrLf +
' Result := 0;' + CrLf +
' end;' + CrLf +
'end;' + CrLf +
'' + CrLf
);
TypeConversionToXML: array[TTypeConversion] of String =
TypeConversion: array[TDelphiAccessor, TDelphiNodeType, TTypeConversion] of String =
(
{ tcNone } TypeConversionNone,
{ tcBoolean } ' %<Destination>:s := LowerCase(BoolToStr(%<Source>:s, True));',
{ tcFloat } TypeConversionNone,
{ tcDateTime } TypeConversionNone
{ daGet }
(
{ dntElement }
(
{ tcNone } '',
{ tcBoolean } '',
{ tcFloat } ' %<Destination>:s := XMLToFloat(ChildNodes[''%<Source>:s''].NodeValue);',
{ tcDateTime } ' %<Destination>:s := XMLToDate(ChildNodes[''%<Source>:s''].NodeValue);'
),
{ dntAttribute }
(
{ tcNone } '',
{ tcBoolean } '',
{ tcFloat } ' %<Destination>:s := XMLToFloat(AttributeNodes[''%<Source>:s''].NodeValue);',
{ tcDateTime } ' %<Destination>:s := XMLToDate(AttributeNodes[''%<Source>:s''].NodeValue);'
),
{ dntCustom}
(
{ tcNone } '',
{ tcBoolean } '',
{ tcFloat } ' %<Destination>:s := XMLToFloat(%<Source>:s);',
{ tcDateTime } ' %<Destination>:s := XMLToDate(%<Source>:s);'
)
),
{ daSet }
(
{ dntElement }
(
{ tcNone } '',
{ tcBoolean } ' ChildNodes[''%<Destination>:s''].NodeValue := BoolToXML(%<Source>:s);',
{ tcFloat } ' ChildNodes[''%<Destination>:s''].NodeValue := FloatToXML(%<Source>:s);',
{ tcDateTime } ' ChildNodes[''%<Destination>:s''].NodeValue := DateToXML(%<Source>:s);'
),
{ dntAttribute }
(
{ tcNone } '',
{ tcBoolean } ' SetAttribute(''%<Destination>:s'', BoolToXML(%<Source>:s));',
{ tcFloat } ' SetAttribute(''%<Destination>:s'', FloatToXML(%<Source>:s));',
{ tcDateTime } ' SetAttribute(''%<Destination>:s'', DateToXML(%<Source>:s));'
),
{ dntCustom}
(
{ tcNone } '',
{ tcBoolean } ' %<Destination>:s := BoolToXML(%<Source>:s);',
{ tcFloat } ' %<Destination>:s := FloatToXML(%<Source>:s);',
{ tcDateTime } ' %<Destination>:s := DateToXML(%<Source>:s);'
)
)
);
(*
TypeConversionVariables: array[TDelphiAccessor, TDelphiNodeType, TTypeConversion] of String =
(
{ daGet }
(
{ dntElement }
(
{ tcNone } '',
{ tcBoolean } '',
{ tcFloat } '',
{ tcDateTime } ''
),
{ dntAttribute }
(
{ tcNone } '',
{ tcBoolean } '',
{ tcFloat } '',
{ tcDateTime } ''
),
{ dntCustom}
(
{ tcNone } '',
{ tcBoolean } '',
{ tcFloat } '',
{ tcDateTime } ''
)
),
{ daSet }
(
{ dntElement }
(
{ tcNone } '',
{ tcBoolean } '',
{ tcFloat } '',
{ tcDateTime } ''
),
{ dntAttribute }
(
{ tcNone } '',
{ tcBoolean } '',
{ tcFloat } '',
{ tcDateTime } ''
),
{ dntCustom}
(
{ tcNone } '',
{ tcBoolean } '',
{ tcFloat } '',
{ tcDateTime } ''
)
)
);
*)
implementation
end.

File diff suppressed because it is too large Load Diff

View File

@ -32,9 +32,13 @@
-M
-$M16384,1048576
-K$00400000
-N0"Lib"
-LE"C:\Documents and Settings\PsychoMark\My Documents\Borland Studio Projects\Bpl"
-LN"C:\Documents and Settings\PsychoMark\My Documents\Borland Studio Projects\Bpl"
-N"Lib"
-LE"c:\program files\borland\delphi7\Projects\Bpl"
-LN"c:\program files\borland\delphi7\Projects\Bpl"
-U"P:\xtx\xtx\xsd"
-O"P:\xtx\xtx\xsd"
-I"P:\xtx\xtx\xsd"
-R"P:\xtx\xtx\xsd"
-w-UNSAFE_TYPE
-w-UNSAFE_CODE
-w-UNSAFE_CAST

View File

@ -94,13 +94,13 @@ OutputDir=
UnitOutputDir=Lib
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
SearchPath=P:\xtx\xtx\xsd
Packages=vcl;rtl;vclx;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;vcldb;dsnapcon;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;CLXIB;ibxpress;VCLIB;teeui;teedb;tee;dss;vclactnband;vclshlctrls;dclOfficeXP;Indy70;cxLibraryVCLD7;dxBarD7;dxComnD7;dxBarDBNavD7;dxBarExtDBItemsD7;dxBarExtItemsD7;dxDockingD7;dxsbD7;cxEditorsVCLD7;dxThemeD7;cxDataD7;cxExtEditorsVCLD7;cxPageControlVCLD7;cxGridVCLD7;cxSchedulerVCLD7;cxTreeListVCLD7;cxVerticalGridVCLD7;cxSpreadSheetVCLD7;dxNavBarD7;cxWebD7;cxWebPascalScriptD7;cxWebSnapD7;cxWebTeeChartD7;dxMasterViewD7;dxmdsD7;dxdbtrD7;dxtrmdD7;dxorgcD7;dxdborD7;dxFlowChartD7;dxLayoutControlD7;dxLayoutControlcxEditAdaptersD7;dxPSCoreD7;dxPSTeeChartD7;dxPsPrVwAdvD7;dxPSLnksD7;dxPSdxOCLnkD7;dxPSdxMVLnkD7;dxPSdxLCLnkD7;dxPSdxFCLnkD7;dxPSdxDBTVLnkD7;dxPSdxDBOCLnkD7;dxPSDBTeeChartD7;dxPScxCommonD7;dxPScxTLLnkD7;dxPScxSSLnkD7;dxPScxPCProdD7;dxPScxGridLnkD7;dxPScxExtCommonD7;dxPScxVGridLnkD7;fo_d7;xtx_d7;Rave50CLX;Rave50VCL;pngimaged7;dxGDIPlusD7;UnRegDxPNG
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams="P:\xtx\xtx\xsd\Offerte.xsd" "P:\xtx\xtx\xsd\xml_Offerte.pas"
RunParams="P:\xtx\xtx\xsd\Offerte.xsd" "P:\xtx\xtx\xsd\"
HostApplication=
Launcher=
UseLauncher=0
@ -135,22 +135,23 @@ ProductName=
ProductVersion=
Comments=
[Excluded Packages]
P:\Algemeen\bin\unageneral_d7_design.bpl=UnameIT's General Components - Design-time Editors
C:\Program Files\Borland\Indy\D7\dclIndy70.bpl=Internet Direct (Indy) for D7 Property and Component Editors
[HistoryLists\hlUnitAliases]
Count=1
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[HistoryLists\hlSearchPath]
Count=2
Item0=..\..
Item1=F:\Development\VDarts\Packages
Count=3
Item0=P:\xtx\xtx\xsd
Item1=..\..
Item2=F:\Development\VDarts\Packages
[HistoryLists\hlUnitOutputDirectory]
Count=5
Item0=P:\Algemeen\lib
Item1=..\..\Lib\D7
Item2=..\..\Dcu
Item3=..\..\..\Dcu
Item4=Dcu
Count=6
Item0=Lib
Item1=P:\Algemeen\lib
Item2=..\..\Lib\D7
Item3=..\..\Dcu
Item4=..\..\..\Dcu
Item5=Dcu
[HistoryLists\hlBPLOutput]
Count=3
Item0=..\..\Lib\D7

View File

@ -6,7 +6,10 @@ uses
DelphiXMLDataBindingGenerator in 'Units\DelphiXMLDataBindingGenerator.pas',
XMLDataBindingGenerator in 'Units\XMLDataBindingGenerator.pas',
XMLDataBindingHelpers in 'Units\XMLDataBindingHelpers.pas',
DelphiXMLDataBindingResources in 'Units\DelphiXMLDataBindingResources.pas';
DelphiXMLDataBindingResources in 'Units\DelphiXMLDataBindingResources.pas',
xml_ExternalLeadFeed in '..\xml_ExternalLeadFeed.pas',
xml_Offerte in '..\..\xtx\xtx\xsd\xml_Offerte.pas';
begin
CoInitialize(nil);
@ -16,6 +19,11 @@ begin
OutputType := otSingle;
OutputPath := ParamStr(2);
if DirectoryExists(OutputPath) then
OutputType := otMultiple
else
OutputType := otSingle;
Execute(ParamStr(1));
finally
Free();