Changed: using NamedFormat instead of Format for output building
This commit is contained in:
parent
478551716c
commit
3c09f6c331
@ -58,28 +58,30 @@ type
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
uses
|
uses
|
||||||
SysUtils, Dialogs;
|
SysUtils,
|
||||||
|
|
||||||
|
X2UtNamedFormat;
|
||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
SectionComments: array[TDelphiXMLSection] of String =
|
SectionComments: array[TDelphiXMLSection] of String =
|
||||||
(
|
(
|
||||||
' { Forward declarations for %s }',
|
' { Forward declarations for %SchemaName:s }',
|
||||||
' { Interfaces for %s }',
|
' { Interfaces for %SchemaName:s }',
|
||||||
' { Classes for %s }',
|
' { Classes for %SchemaName:s }',
|
||||||
'{ Implementation for %s }'
|
'{ Implementation for %SchemaName:s }'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
PrefixInterface = 'IXML';
|
PrefixInterface2 = 'IXML';
|
||||||
PrefixClass = 'TXML';
|
PrefixClass2 = 'TXML';
|
||||||
PrefixOptional = 'Has';
|
PrefixOptional2 = 'Has';
|
||||||
PostfixText = 'Text';
|
PostfixText2 = 'Text';
|
||||||
|
|
||||||
|
|
||||||
InterfaceItemForward = ' ' + PrefixInterface + '%0:s = interface;';
|
InterfaceItemForward = ' IXML%Name:s = interface;';
|
||||||
InterfaceItemInterface = ' ' + PrefixInterface + '%0:s = interface(%1:s)';
|
InterfaceItemInterface = ' IXML%Name:s = interface(%ParentName:s)';
|
||||||
InterfaceItemClass = ' ' + PrefixClass + '%0:s = class(%1:s, ' + PrefixInterface + '%0:s)';
|
InterfaceItemClass = ' TXML%Name:s = class(%ParentName:s, IXML%Name:s)';
|
||||||
|
|
||||||
|
|
||||||
CollectionInterface = 'IXMLNodeCollection';
|
CollectionInterface = 'IXMLNodeCollection';
|
||||||
@ -89,10 +91,10 @@ const
|
|||||||
ItemClass = 'TXMLNode';
|
ItemClass = 'TXMLNode';
|
||||||
|
|
||||||
|
|
||||||
MemberPropertyGet = ' function Get%0:s: %1:s;';
|
MemberPropertyGet = ' function Get%Name:s: %DataType:s;';
|
||||||
MemberPropertySet = ' procedure Set%0:s(const Value: %1:s);';
|
MemberPropertySet = ' procedure Set%Name:s(const Value: %DataType:s);';
|
||||||
MemberProperty = ' property %0:s: %1:s read Get%0:s write Set%0:s;';
|
MemberProperty = ' property %Name:s: %DataType:s read Get%Name:s write Set%Name:s;';
|
||||||
MemberPropertyReadOnly = ' property %0:s: %1:s read Get%0:s;';
|
MemberPropertyReadOnly = ' property %Name:s: %DataType:s read Get%Name:s;';
|
||||||
|
|
||||||
|
|
||||||
// #ToDo1 (MvR) 9-3-2008: document / node / etc
|
// #ToDo1 (MvR) 9-3-2008: document / node / etc
|
||||||
@ -136,56 +138,16 @@ type
|
|||||||
const
|
const
|
||||||
SimpleTypeMapping: array[0..9] of TTypeMapping =
|
SimpleTypeMapping: array[0..9] of TTypeMapping =
|
||||||
(
|
(
|
||||||
(
|
(SchemaName: 'int'; DelphiName: 'Integer'; Handling: thNone),
|
||||||
SchemaName: 'int';
|
(SchemaName: 'integer'; DelphiName: 'Integer'; Handling: thNone),
|
||||||
DelphiName: 'Integer';
|
(SchemaName: 'short'; DelphiName: 'Smallint'; Handling: thNone),
|
||||||
Handling: thNone
|
(SchemaName: 'date'; DelphiName: 'TDateTime'; Handling: thDateTime),
|
||||||
),
|
(SchemaName: 'time'; DelphiName: 'TDateTime'; Handling: thDateTime),
|
||||||
(
|
(SchemaName: 'dateTime'; DelphiName: 'TDateTime'; Handling: thDateTime),
|
||||||
SchemaName: 'integer';
|
(SchemaName: 'float'; DelphiName: 'Double'; Handling: thNone),
|
||||||
DelphiName: 'Integer';
|
(SchemaName: 'double'; DelphiName: 'Extended'; Handling: thNone),
|
||||||
Handling: thNone
|
(SchemaName: 'boolean'; DelphiName: 'Boolean'; Handling: thNone),
|
||||||
),
|
(SchemaName: 'string'; DelphiName: 'WideString'; Handling: thNone)
|
||||||
(
|
|
||||||
SchemaName: 'short';
|
|
||||||
DelphiName: 'Smallint';
|
|
||||||
Handling: thNone
|
|
||||||
),
|
|
||||||
(
|
|
||||||
SchemaName: 'date';
|
|
||||||
DelphiName: 'TDateTime';
|
|
||||||
Handling: thDateTime
|
|
||||||
),
|
|
||||||
(
|
|
||||||
SchemaName: 'time';
|
|
||||||
DelphiName: 'TDateTime';
|
|
||||||
Handling: thDateTime
|
|
||||||
),
|
|
||||||
(
|
|
||||||
SchemaName: 'dateTime';
|
|
||||||
DelphiName: 'TDateTime';
|
|
||||||
Handling: thDateTime
|
|
||||||
),
|
|
||||||
(
|
|
||||||
SchemaName: 'float';
|
|
||||||
DelphiName: 'Double';
|
|
||||||
Handling: thNone
|
|
||||||
),
|
|
||||||
(
|
|
||||||
SchemaName: 'double';
|
|
||||||
DelphiName: 'Extended';
|
|
||||||
Handling: thNone
|
|
||||||
),
|
|
||||||
(
|
|
||||||
SchemaName: 'boolean';
|
|
||||||
DelphiName: 'Boolean';
|
|
||||||
Handling: thNone
|
|
||||||
),
|
|
||||||
(
|
|
||||||
SchemaName: 'string';
|
|
||||||
DelphiName: 'WideString';
|
|
||||||
Handling: thNone
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -350,7 +312,8 @@ begin
|
|||||||
for schemaIndex := 0 to Pred(SchemaCount) do
|
for schemaIndex := 0 to Pred(SchemaCount) do
|
||||||
begin
|
begin
|
||||||
schema := Schemas[schemaIndex];
|
schema := Schemas[schemaIndex];
|
||||||
AStream.WriteLnFmt(SectionComments[ASection], [schema.SchemaName]);
|
AStream.WriteLnNamedFmt(SectionComments[ASection],
|
||||||
|
['SchemaName', schema.SchemaName]);
|
||||||
|
|
||||||
for itemIndex := 0 to Pred(schema.ItemCount) do
|
for itemIndex := 0 to Pred(schema.ItemCount) do
|
||||||
WriteSchemaItem(AStream, schema.Items[itemIndex], ASection);
|
WriteSchemaItem(AStream, schema.Items[itemIndex], ASection);
|
||||||
@ -367,8 +330,8 @@ procedure TDelphiXMLDataBindingGenerator.WriteDocumentFunctions(AStream: TStream
|
|||||||
if ASection = dxsInterface then
|
if ASection = dxsInterface then
|
||||||
AStream.Write(' ');
|
AStream.Write(' ');
|
||||||
|
|
||||||
AStream.WriteLnFmt('function ' + AFunction + ': %1:s%0:s;',
|
AStream.WriteLnNamedFmt('function ' + AFunction + ': IXML%Name:s;',
|
||||||
[AItemName, PrefixInterface]);
|
['Name', AItemName]);
|
||||||
|
|
||||||
if ASection = dxsImplementation then
|
if ASection = dxsImplementation then
|
||||||
begin
|
begin
|
||||||
@ -422,28 +385,26 @@ begin
|
|||||||
hasItem := True;
|
hasItem := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
docBinding := Format('GetDocBinding(''%0:s'', %1:s%0:s, TargetNamespace) as %2:s%0:s',
|
docBinding := NamedFormat('GetDocBinding(''%Name:s'', TXML%Name:s, TargetNamespace) as IXML%Name:s',
|
||||||
[interfaceItem.TranslatedName,
|
['Name', interfaceItem.TranslatedName]);
|
||||||
PrefixClass,
|
|
||||||
PrefixInterface]);
|
|
||||||
|
|
||||||
WriteFunction(interfaceItem.TranslatedName,
|
WriteFunction(interfaceItem.TranslatedName,
|
||||||
'Get%0:s(ADocument: IXMLDocument)',
|
'Get%Name:s(ADocument: IXMLDocument)',
|
||||||
' Result := ADocument.' + docBinding);
|
' Result := ADocument.' + docBinding);
|
||||||
|
|
||||||
WriteFunction(interfaceItem.TranslatedName,
|
WriteFunction(interfaceItem.TranslatedName,
|
||||||
'Load%0:s(const AFileName: String)',
|
'Load%Name:s(const AFileName: String)',
|
||||||
' Result := LoadXMLDocument(AFileName).' + docBinding);
|
' Result := LoadXMLDocument(AFileName).' + docBinding);
|
||||||
|
|
||||||
WriteFunction(interfaceItem.TranslatedName,
|
WriteFunction(interfaceItem.TranslatedName,
|
||||||
'Load%0:sFromStream(AStream: TStream)',
|
'Load%Name:sFromStream(AStream: TStream)',
|
||||||
' doc := NewXMLDocument;'#13#10 +
|
' doc := NewXMLDocument;'#13#10 +
|
||||||
' doc.LoadFromStream(AStream);'#13#10 +
|
' doc.LoadFromStream(AStream);'#13#10 +
|
||||||
' Result := Get%0:s(doc);',
|
' Result := Get%Name:s(doc);',
|
||||||
' doc: IXMLDocument;');
|
' doc: IXMLDocument;');
|
||||||
|
|
||||||
WriteFunction(interfaceItem.TranslatedName,
|
WriteFunction(interfaceItem.TranslatedName,
|
||||||
'New%0:s',
|
'New%Name:s',
|
||||||
' Result := NewXMLDocument.' + docBinding);
|
' Result := NewXMLDocument.' + docBinding);
|
||||||
|
|
||||||
AStream.WriteLn();
|
AStream.WriteLn();
|
||||||
@ -551,18 +512,20 @@ begin
|
|||||||
|
|
||||||
case ASection of
|
case ASection of
|
||||||
dxsForward:
|
dxsForward:
|
||||||
AStream.WriteLnFmt(InterfaceItemForward, [AItem.TranslatedName]);
|
AStream.WriteLnNamedFmt(InterfaceItemForward,
|
||||||
|
['Name', AItem.TranslatedName]);
|
||||||
dxsInterface:
|
dxsInterface:
|
||||||
begin
|
begin
|
||||||
if Assigned(AItem.BaseItem) then
|
if Assigned(AItem.BaseItem) then
|
||||||
parent := PrefixInterface + AItem.BaseItem.TranslatedName
|
parent := PrefixInterface2 + AItem.BaseItem.TranslatedName
|
||||||
else
|
else
|
||||||
parent := ItemInterface;
|
parent := ItemInterface;
|
||||||
|
|
||||||
WriteDocumentation(AStream, AItem);
|
WriteDocumentation(AStream, AItem);
|
||||||
AStream.WriteLnFmt(InterfaceItemInterface, [AItem.TranslatedName,
|
AStream.WriteLnNamedFmt(InterfaceItemInterface,
|
||||||
parent]);
|
['Name', AItem.TranslatedName,
|
||||||
AStream.WriteLnFmt(' %s', [CreateNewGUID()]);
|
'ParentName', parent]);
|
||||||
|
AStream.WriteLn(' ' + CreateNewGUID());
|
||||||
|
|
||||||
WriteSchemaInterfaceProperties(AStream, AItem, ASection);
|
WriteSchemaInterfaceProperties(AStream, AItem, ASection);
|
||||||
|
|
||||||
@ -572,12 +535,13 @@ begin
|
|||||||
dxsClass:
|
dxsClass:
|
||||||
begin
|
begin
|
||||||
if Assigned(AItem.BaseItem) then
|
if Assigned(AItem.BaseItem) then
|
||||||
parent := PrefixClass + AItem.BaseItem.TranslatedName
|
parent := PrefixClass2 + AItem.BaseItem.TranslatedName
|
||||||
else
|
else
|
||||||
parent := ItemClass;
|
parent := ItemClass;
|
||||||
|
|
||||||
AStream.WriteLnFmt(InterfaceItemClass, [AItem.TranslatedName,
|
AStream.WriteLnNamedFmt(InterfaceItemClass,
|
||||||
parent]);
|
['Name', AItem.TranslatedName,
|
||||||
|
'ParentName', parent]);
|
||||||
|
|
||||||
WriteSchemaInterfaceProperties(AStream, AItem, ASection);
|
WriteSchemaInterfaceProperties(AStream, AItem, ASection);
|
||||||
|
|
||||||
@ -626,17 +590,14 @@ procedure TDelphiXMLDataBindingGenerator.WriteSchemaInterfaceProperties(AStream:
|
|||||||
begin
|
begin
|
||||||
if not hasInterface then
|
if not hasInterface then
|
||||||
begin
|
begin
|
||||||
AStream.WriteLnFmt('procedure %1:s%0:s.AfterConstruction;',
|
AStream.WriteLnFmt('procedure TXML%s.AfterConstruction;', [AItem.TranslatedName]);
|
||||||
[AItem.TranslatedName,
|
|
||||||
PrefixClass]);
|
|
||||||
AStream.WriteLn('begin');
|
AStream.WriteLn('begin');
|
||||||
hasInterface := True;
|
hasInterface := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
AStream.WriteLnFmt(' RegisterChildNode(''%0:s'', %2:s%1:s);',
|
AStream.WriteLnNamedFmt(' RegisterChildNode(''%SourceName:s'', TXML%Name:s);',
|
||||||
[itemProperty.Item.Name,
|
['SourceName', itemProperty.Item.Name,
|
||||||
itemProperty.Item.TranslatedName,
|
'Name', itemProperty.Item.TranslatedName]);
|
||||||
PrefixClass]);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -697,10 +658,10 @@ begin
|
|||||||
begin
|
begin
|
||||||
if propertyItem.ItemType = itEnumeration then
|
if propertyItem.ItemType = itEnumeration then
|
||||||
begin
|
begin
|
||||||
dataTypeName := PrefixClass;
|
dataTypeName := PrefixClass2;
|
||||||
writeTextProp := True;
|
writeTextProp := True;
|
||||||
end else
|
end else
|
||||||
dataTypeName := PrefixInterface;
|
dataTypeName := PrefixInterface2;
|
||||||
|
|
||||||
{ Collections have a Count property, no need to write a
|
{ Collections have a Count property, no need to write a
|
||||||
HasX property as well. }
|
HasX property as well. }
|
||||||
@ -762,15 +723,18 @@ begin
|
|||||||
AStream.WriteLn();
|
AStream.WriteLn();
|
||||||
|
|
||||||
if writeOptional then
|
if writeOptional then
|
||||||
AStream.WriteLnFmt(optionalFormat, [PrefixOptional + itemProperty.TranslatedName,
|
AStream.WriteLnNamedFmt(optionalFormat,
|
||||||
'Boolean']);
|
['Name', PrefixOptional2 + itemProperty.TranslatedName,
|
||||||
|
'DataType', 'Boolean']);
|
||||||
|
|
||||||
if writeTextProp then
|
if writeTextProp then
|
||||||
AStream.WriteLnFmt(propertyFormat, [itemProperty.TranslatedName + PostfixText,
|
AStream.WriteLnNamedFmt(propertyFormat,
|
||||||
'WideString']);
|
['Name', itemProperty.TranslatedName + PostfixText2,
|
||||||
|
'DataType', 'WideString']);
|
||||||
|
|
||||||
AStream.WriteLnFmt(propertyFormat, [itemProperty.TranslatedName,
|
AStream.WriteLnNamedFmt(propertyFormat,
|
||||||
dataTypeName]);
|
['Name', itemProperty.TranslatedName,
|
||||||
|
'DataType', dataTypeName]);
|
||||||
hasMembers := True;
|
hasMembers := True;
|
||||||
localHasMembers := True;
|
localHasMembers := True;
|
||||||
end;
|
end;
|
||||||
@ -784,13 +748,11 @@ begin
|
|||||||
// #ToDo3 (MvR) 7-3-2008: extract strings
|
// #ToDo3 (MvR) 7-3-2008: extract strings
|
||||||
if writeOptional then
|
if writeOptional then
|
||||||
begin
|
begin
|
||||||
AStream.WriteLnFmt('function %0:s%1s.Get%2:s%3:s: Boolean;',
|
AStream.WriteLnNamedFmt('function TXML%Name:s.GetHas%PropertyName:s: Boolean;',
|
||||||
[PrefixClass,
|
['Name', AItem.TranslatedName,
|
||||||
AItem.TranslatedName,
|
'PropertyName', itemProperty.TranslatedName]);
|
||||||
PrefixOptional,
|
|
||||||
itemProperty.TranslatedName]);
|
|
||||||
AStream.WriteLn('begin');
|
AStream.WriteLn('begin');
|
||||||
AStream.WriteLnFmt(' Result := Assigned(ChildNodes.FindNode(''%0:s''));', [itemProperty.Name]);
|
AStream.WriteLnFmt(' Result := Assigned(ChildNodes.FindNode(''%s''));', [itemProperty.Name]);
|
||||||
AStream.WriteLn('end;');
|
AStream.WriteLn('end;');
|
||||||
AStream.WriteLn();
|
AStream.WriteLn();
|
||||||
end;
|
end;
|
||||||
@ -798,30 +760,26 @@ begin
|
|||||||
|
|
||||||
if writeTextProp then
|
if writeTextProp then
|
||||||
begin
|
begin
|
||||||
AStream.WriteLnFmt('function %0:s%1s.Get%3:s%2:s: WideString;',
|
AStream.WriteLnNamedFmt('function TXML%Name:s.Get%PropertyName:sText: WideString;',
|
||||||
[PrefixClass,
|
['Name', AItem.TranslatedName,
|
||||||
AItem.TranslatedName,
|
'PropertyName', itemProperty.TranslatedName]);
|
||||||
PostfixText,
|
|
||||||
itemProperty.TranslatedName]);
|
|
||||||
AStream.WriteLn('begin');
|
AStream.WriteLn('begin');
|
||||||
AStream.WriteLnFmt(' Result := ChildNodes[''%0:s''].NodeValue;', [itemProperty.Name]);
|
AStream.WriteLnFmt(' Result := ChildNodes[''%s''].NodeValue;', [itemProperty.Name]);
|
||||||
AStream.WriteLn('end;');
|
AStream.WriteLn('end;');
|
||||||
AStream.WriteLn();
|
AStream.WriteLn();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
AStream.WriteLnFmt('function %0:s%1:s.Get%2:s: %3:s;',
|
AStream.WriteLnNamedFmt('function TXML%Name:s.Get%PropertyName:s: %DataType:s;',
|
||||||
[PrefixClass,
|
['Name', AItem.TranslatedName,
|
||||||
AItem.TranslatedName,
|
'PropertyName', itemProperty.TranslatedName,
|
||||||
itemProperty.TranslatedName,
|
'DataType', dataTypeName]);
|
||||||
dataTypeName]);
|
|
||||||
|
|
||||||
case itemProperty.PropertyType of
|
case itemProperty.PropertyType of
|
||||||
ptSimple:
|
ptSimple:
|
||||||
begin
|
begin
|
||||||
AStream.WriteLn('begin');
|
AStream.WriteLn('begin');
|
||||||
AStream.WriteLnFmt(' Result := ChildNodes[''%0:s''].NodeValue;',
|
AStream.WriteLnFmt(' Result := ChildNodes[''%s''].NodeValue;', [itemProperty.Name]);
|
||||||
[itemProperty.Name]);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ptItem:
|
ptItem:
|
||||||
@ -833,23 +791,22 @@ begin
|
|||||||
itCollection:
|
itCollection:
|
||||||
begin
|
begin
|
||||||
AStream.WriteLn('begin');
|
AStream.WriteLn('begin');
|
||||||
AStream.WriteLnFmt(' Result := (ChildNodes[''%0:s''] as %1:s%2:s);',
|
AStream.WriteLnNamedFmt(' Result := (ChildNodes[''%Name:s''] as IXML%DataType:s);',
|
||||||
[itemProperty.Name,
|
['Name', itemProperty.Name,
|
||||||
PrefixInterface,
|
'DataType', propertyItem.TranslatedName]);
|
||||||
propertyItem.TranslatedName]);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
itEnumeration:
|
itEnumeration:
|
||||||
begin
|
begin
|
||||||
AStream.WriteLn( 'var');
|
AStream.WriteLn( 'var');
|
||||||
AStream.WriteLn( ' nodeValue: WideString;');
|
AStream.WriteLn( ' nodeValue: WideString;');
|
||||||
AStream.WriteLnFmt(' enumValue: %0:s;', [dataTypeName]);
|
AStream.WriteLnFmt(' enumValue: %s;', [dataTypeName]);
|
||||||
AStream.WriteLn();
|
AStream.WriteLn();
|
||||||
AStream.WriteLn( 'begin');
|
AStream.WriteLn( 'begin');
|
||||||
AStream.WriteLnFmt(' Result := %0:s(-1);', [dataTypeName]);
|
AStream.WriteLnFmt(' Result := %s(-1);', [dataTypeName]);
|
||||||
AStream.WriteLnFmt(' nodeValue := Get%0:sText;', [itemProperty.TranslatedName]);
|
AStream.WriteLnFmt(' nodeValue := Get%sText;', [itemProperty.TranslatedName]);
|
||||||
AStream.WriteLnFmt(' for enumValue := Low(%0:s) to High(%0:s) do', [dataTypeName]);
|
AStream.WriteLnFmt(' for enumValue := Low(%0:s) to High(%0:s) do', [dataTypeName]);
|
||||||
AStream.WriteLnFmt(' if %0:sValues[enumValue] = nodeValue then', [propertyItem.TranslatedName]);
|
AStream.WriteLnFmt(' if %sValues[enumValue] = nodeValue then', [propertyItem.TranslatedName]);
|
||||||
AStream.WriteLn( ' begin');
|
AStream.WriteLn( ' begin');
|
||||||
AStream.WriteLn( ' Result := enumValue;');
|
AStream.WriteLn( ' Result := enumValue;');
|
||||||
AStream.WriteLn( ' break;');
|
AStream.WriteLn( ' break;');
|
||||||
@ -867,6 +824,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
if writeTextProp then
|
if writeTextProp then
|
||||||
begin
|
begin
|
||||||
|
// #ToDo1 (MvR) 15-3-2008: hier was ik
|
||||||
AStream.WriteLnFmt('procedure %0:s%1:s.Set%2:s%3:s(const Value: WideString);',
|
AStream.WriteLnFmt('procedure %0:s%1:s.Set%2:s%3:s(const Value: WideString);',
|
||||||
[PrefixClass,
|
[PrefixClass,
|
||||||
AItem.TranslatedName,
|
AItem.TranslatedName,
|
||||||
@ -880,8 +838,8 @@ begin
|
|||||||
|
|
||||||
if (itemProperty.PropertyType = ptItem) and
|
if (itemProperty.PropertyType = ptItem) and
|
||||||
(TXMLDataBindingItemProperty(itemProperty).Item.ItemType = itEnumeration) then
|
(TXMLDataBindingItemProperty(itemProperty).Item.ItemType = itEnumeration) then
|
||||||
value := Format('%0:sValues[Value]',
|
value := NamedFormat('%Name:sValues[Value]',
|
||||||
[TXMLDataBindingItemProperty(itemProperty).Item.TranslatedName])
|
['Name', TXMLDataBindingItemProperty(itemProperty).Item.TranslatedName])
|
||||||
else
|
else
|
||||||
value := 'Value';
|
value := 'Value';
|
||||||
|
|
||||||
@ -915,7 +873,7 @@ begin
|
|||||||
dxsInterface:
|
dxsInterface:
|
||||||
begin
|
begin
|
||||||
AStream.WriteLnFmt(InterfaceItemInterface, [AItem.TranslatedName,
|
AStream.WriteLnFmt(InterfaceItemInterface, [AItem.TranslatedName,
|
||||||
CollectionInterface]);
|
CollectionInterface]);
|
||||||
AStream.WriteLnFmt(' %s', [CreateNewGUID()]);
|
AStream.WriteLnFmt(' %s', [CreateNewGUID()]);
|
||||||
|
|
||||||
WriteSchemaCollectionProperties(AStream, AItem, ASection);
|
WriteSchemaCollectionProperties(AStream, AItem, ASection);
|
||||||
@ -926,7 +884,7 @@ begin
|
|||||||
dxsClass:
|
dxsClass:
|
||||||
begin
|
begin
|
||||||
AStream.WriteLnFmt(InterfaceItemClass, [AItem.TranslatedName,
|
AStream.WriteLnFmt(InterfaceItemClass, [AItem.TranslatedName,
|
||||||
CollectionClass]);
|
CollectionClass]);
|
||||||
|
|
||||||
WriteSchemaCollectionProperties(AStream, AItem, ASection);
|
WriteSchemaCollectionProperties(AStream, AItem, ASection);
|
||||||
|
|
||||||
@ -1049,7 +1007,8 @@ begin
|
|||||||
if (ASection <> dxsForward) or (AItem.MemberCount = 0) then
|
if (ASection <> dxsForward) or (AItem.MemberCount = 0) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
enumStart := Format(' %0:s%1:s = (', [PrefixClass, AItem.TranslatedName]);
|
enumStart := NamedFormat(' TXML%Name:s = (',
|
||||||
|
['Name', AItem.TranslatedName]);
|
||||||
AStream.Write(enumStart);
|
AStream.Write(enumStart);
|
||||||
lineIndent := StringOfChar(' ', Length(enumStart));
|
lineIndent := StringOfChar(' ', Length(enumStart));
|
||||||
|
|
||||||
@ -1078,16 +1037,19 @@ begin
|
|||||||
if (AItem.MemberCount = 0) then
|
if (AItem.MemberCount = 0) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
enumStart := Format(' %0:sValues: ', [AItem.TranslatedName]);
|
enumStart := NamedFormat(' %Name:sValues: ', ['Name', AItem.TranslatedName]);
|
||||||
AStream.WriteLn(enumStart + Format('array[%0:s%1:s] of WideString =',
|
AStream.WriteLn(enumStart + NamedFormat('array[TXML%Name:s] of WideString =',
|
||||||
[PrefixClass, AItem.TranslatedName]));
|
['Name', AItem.TranslatedName]));
|
||||||
|
|
||||||
lineIndent := StringOfChar(' ', Length(enumStart));
|
lineIndent := StringOfChar(' ', Length(enumStart));
|
||||||
|
|
||||||
AStream.WriteLn(lineIndent + '(');
|
AStream.WriteLn(lineIndent + '(');
|
||||||
|
|
||||||
for memberIndex := 0 to Pred(AItem.MemberCount) do
|
for memberIndex := 0 to Pred(AItem.MemberCount) do
|
||||||
begin
|
begin
|
||||||
AStream.Write(Format('%s ''%s''', [lineIndent, AItem.Members[memberIndex].Name]));
|
AStream.Write(NamedFormat('%Indent:s ''%Name:s''',
|
||||||
|
['Indent', lineIndent,
|
||||||
|
'Name', AItem.Members[memberIndex].Name]));
|
||||||
|
|
||||||
if memberIndex < Pred(AItem.MemberCount) then
|
if memberIndex < Pred(AItem.MemberCount) then
|
||||||
AStream.WriteLn(',')
|
AStream.WriteLn(',')
|
||||||
|
@ -24,6 +24,9 @@ type
|
|||||||
procedure WriteFmt(const ASource: String; const AParams: array of const);
|
procedure WriteFmt(const ASource: String; const AParams: array of const);
|
||||||
procedure WriteLnFmt(const ASource: String; const AParams: array of const);
|
procedure WriteLnFmt(const ASource: String; const AParams: array of const);
|
||||||
|
|
||||||
|
procedure WriteNamedFmt(const ASource: String; const AParams: array of const);
|
||||||
|
procedure WriteLnNamedFmt(const ASource: String; const AParams: array of const);
|
||||||
|
|
||||||
procedure WriteString(const ASource: String);
|
procedure WriteString(const ASource: String);
|
||||||
procedure WriteInteger(const ASource: Integer);
|
procedure WriteInteger(const ASource: Integer);
|
||||||
procedure WriteDateTime(const ASource: TDateTime);
|
procedure WriteDateTime(const ASource: TDateTime);
|
||||||
@ -33,7 +36,9 @@ type
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
uses
|
uses
|
||||||
SysUtils;
|
SysUtils,
|
||||||
|
|
||||||
|
X2UtNamedFormat;
|
||||||
|
|
||||||
|
|
||||||
{ TStreamHelper }
|
{ TStreamHelper }
|
||||||
@ -112,6 +117,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TStreamHelper.WriteNamedFmt(const ASource: String; const AParams: array of const);
|
||||||
|
begin
|
||||||
|
Write(NamedFormat(ASource, AParams));
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TStreamHelper.WriteLnNamedFmt(const ASource: String; const AParams: array of const);
|
||||||
|
begin
|
||||||
|
WriteLn(NamedFormat(ASource, AParams));
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TStreamHelper.WriteString(const ASource: String);
|
procedure TStreamHelper.WriteString(const ASource: String);
|
||||||
var
|
var
|
||||||
iSize: Integer;
|
iSize: Integer;
|
||||||
|
@ -125,7 +125,7 @@
|
|||||||
<Directories Name="PackageDCPOutputDir"></Directories>
|
<Directories Name="PackageDCPOutputDir"></Directories>
|
||||||
<Directories Name="SearchPath"></Directories>
|
<Directories Name="SearchPath"></Directories>
|
||||||
<Directories Name="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</Directories>
|
<Directories Name="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</Directories>
|
||||||
<Directories Name="Conditionals">madExcept</Directories>
|
<Directories Name="Conditionals"></Directories>
|
||||||
<Directories Name="DebugSourceDirs"></Directories>
|
<Directories Name="DebugSourceDirs"></Directories>
|
||||||
<Directories Name="UsePackages">False</Directories>
|
<Directories Name="UsePackages">False</Directories>
|
||||||
</Directories>
|
</Directories>
|
||||||
|
@ -32,9 +32,9 @@
|
|||||||
-M
|
-M
|
||||||
-$M16384,1048576
|
-$M16384,1048576
|
||||||
-K$00400000
|
-K$00400000
|
||||||
-N"Lib"
|
-N0"Lib"
|
||||||
-LE"c:\program files\borland\delphi7\Projects\Bpl"
|
-LE"C:\Documents and Settings\PsychoMark\My Documents\Borland Studio Projects\Bpl"
|
||||||
-LN"c:\program files\borland\delphi7\Projects\Bpl"
|
-LN"C:\Documents and Settings\PsychoMark\My Documents\Borland Studio Projects\Bpl"
|
||||||
-w-UNSAFE_TYPE
|
-w-UNSAFE_TYPE
|
||||||
-w-UNSAFE_CODE
|
-w-UNSAFE_CODE
|
||||||
-w-UNSAFE_CAST
|
-w-UNSAFE_CAST
|
||||||
|
Loading…
Reference in New Issue
Block a user