TEncoding parameter for Load...FromString helper function
This commit is contained in:
parent
bebb08153e
commit
8feb95edb4
@ -609,7 +609,6 @@ begin
|
|||||||
{ In ye olde days this is where we checked if XMLDataBindingUtils was required. With the
|
{ In ye olde days this is where we checked if XMLDataBindingUtils was required. With the
|
||||||
introduction of the IXSDValidate, this is practically always the case. }
|
introduction of the IXSDValidate, this is practically always the case. }
|
||||||
AWriter.WriteLine('uses');
|
AWriter.WriteLine('uses');
|
||||||
AWriter.WriteLine(' SysUtils,');
|
|
||||||
AWriter.WriteLine(' Variants;');
|
AWriter.WriteLine(' Variants;');
|
||||||
AWriter.WriteLine;
|
AWriter.WriteLine;
|
||||||
end;
|
end;
|
||||||
|
@ -27,6 +27,7 @@ const
|
|||||||
'uses' + CrLf +
|
'uses' + CrLf +
|
||||||
'%<UsesClause>:s' +
|
'%<UsesClause>:s' +
|
||||||
' Classes,' + CrLf +
|
' Classes,' + CrLf +
|
||||||
|
' SysUtils,' + CrLf +
|
||||||
' XMLDoc,' + CrLf +
|
' XMLDoc,' + CrLf +
|
||||||
' XMLIntf,' + CrLf +
|
' XMLIntf,' + CrLf +
|
||||||
' XMLDataBindingUtils;' + CrLf +
|
' XMLDataBindingUtils;' + CrLf +
|
||||||
@ -45,7 +46,7 @@ const
|
|||||||
DocumentFunctionsInterface = ' function Get%<Name>:s(ADocument: XMLIntf.IXMLDocument): IXML%<Name>:s;' + CrLf +
|
DocumentFunctionsInterface = ' function Get%<Name>:s(ADocument: XMLIntf.IXMLDocument): IXML%<Name>:s;' + CrLf +
|
||||||
' function Load%<Name>:s(const AFileName: String): IXML%<Name>:s;' + CrLf +
|
' function Load%<Name>:s(const AFileName: String): IXML%<Name>:s;' + CrLf +
|
||||||
' function Load%<Name>:sFromStream(AStream: TStream): IXML%<Name>:s;' + CrLf +
|
' function Load%<Name>:sFromStream(AStream: TStream): IXML%<Name>:s;' + CrLf +
|
||||||
' function Load%<Name>:sFromString(const AString: String): IXML%<Name>:s;' + CrLf +
|
' function Load%<Name>:sFromString(const AString: String{$IF CompilerVersion >= 20}; AEncoding: TEncoding = nil; AOwnsEncoding: Boolean = True{$IFEND}): IXML%<Name>:s;' + CrLf +
|
||||||
' function New%<Name>:s: IXML%<Name>:s;' + CrLf;
|
' function New%<Name>:s: IXML%<Name>:s;' + CrLf;
|
||||||
|
|
||||||
DocumentFunctionsImplementation = 'function Get%<Name>:s(ADocument: XMLIntf.IXMLDocument): IXML%<Name>:s;' + CrLf +
|
DocumentFunctionsImplementation = 'function Get%<Name>:s(ADocument: XMLIntf.IXMLDocument): IXML%<Name>:s;' + CrLf +
|
||||||
@ -68,12 +69,12 @@ const
|
|||||||
' Result := Get%<Name>:s(doc);' + CrLf +
|
' Result := Get%<Name>:s(doc);' + CrLf +
|
||||||
'end;' + CrLf +
|
'end;' + CrLf +
|
||||||
'' + CrLf +
|
'' + CrLf +
|
||||||
'function Load%<Name>:sFromString(const AString: String): IXML%<Name>:s;' + CrLf +
|
'function Load%<Name>:sFromString(const AString: String{$IF CompilerVersion >= 20}; AEncoding: TEncoding; AOwnsEncoding: Boolean{$IFEND}): IXML%<Name>:s;' + CrLf +
|
||||||
'var' + CrLf +
|
'var' + CrLf +
|
||||||
' stream: TStringStream;' + CrLf +
|
' stream: TStringStream;' + CrLf +
|
||||||
'' + CrLf +
|
'' + CrLf +
|
||||||
'begin' + CrLf +
|
'begin' + CrLf +
|
||||||
' stream := TStringStream.Create(AString);' + CrLf +
|
' stream := TStringStream.Create(AString{$IF CompilerVersion >= 20}, AEncoding, AOwnsEncoding{$IFEND});' + CrLf +
|
||||||
' try' + CrLf +
|
' try' + CrLf +
|
||||||
' Result := Load%<Name>:sFromStream(stream);' + CrLf +
|
' Result := Load%<Name>:sFromStream(stream);' + CrLf +
|
||||||
' finally' + CrLf +
|
' finally' + CrLf +
|
||||||
|
@ -704,7 +704,6 @@ var
|
|||||||
schemaDef: IXMLSchemaDef;
|
schemaDef: IXMLSchemaDef;
|
||||||
attributeIndex: Integer;
|
attributeIndex: Integer;
|
||||||
attribute: IXMLAttributeDef;
|
attribute: IXMLAttributeDef;
|
||||||
item: TXMLDataBindingItem;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
schemaDef := ASchema.SchemaDef;
|
schemaDef := ASchema.SchemaDef;
|
||||||
|
Loading…
Reference in New Issue
Block a user