1
0
mirror of synced 2024-11-23 14:13:49 +00:00

TEncoding parameter for Load...FromString helper function

This commit is contained in:
Mark van Renswoude 2014-12-09 14:26:11 +00:00
parent bebb08153e
commit 8feb95edb4
3 changed files with 4 additions and 5 deletions

View File

@ -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;

View File

@ -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 +

View File

@ -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;