Changeset 484


Ignore:
Timestamp:
Jul 26, 2016, 8:59:43 AM (8 years ago)
Author:
chronos
Message:
  • Added: XML supporting functions also with Int64 type.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Common/UXMLUtils.pas

    r483 r484  
    1212function DateTimeToXMLTime(Value: TDateTime; ApplyLocalBias: Boolean = True): WideString;
    1313procedure WriteInteger(Node: TDOMNode; Name: string; Value: Integer);
     14procedure WriteInt64(Node: TDOMNode; Name: string; Value: Int64);
    1415procedure WriteBoolean(Node: TDOMNode; Name: string; Value: Boolean);
    1516procedure WriteString(Node: TDOMNode; Name: string; Value: string);
    1617procedure WriteDateTime(Node: TDOMNode; Name: string; Value: TDateTime);
    1718function ReadInteger(Node: TDOMNode; Name: string; DefaultValue: Integer): Integer;
     19function ReadInt64(Node: TDOMNode; Name: string; DefaultValue: Int64): Int64;
    1820function ReadBoolean(Node: TDOMNode; Name: string; DefaultValue: Boolean): Boolean;
    1921function ReadString(Node: TDOMNode; Name: string; DefaultValue: string): string;
     
    142144end;
    143145
     146procedure WriteInt64(Node: TDOMNode; Name: string; Value: Int64);
     147var
     148  NewNode: TDOMNode;
     149begin
     150  NewNode := Node.OwnerDocument.CreateElement(Name);
     151  NewNode.TextContent := IntToStr(Value);
     152  Node.AppendChild(NewNode);
     153end;
     154
    144155procedure WriteBoolean(Node: TDOMNode; Name: string; Value: Boolean);
    145156var
     
    177188  if Assigned(NewNode) then
    178189    Result := StrToInt(NewNode.TextContent);
     190end;
     191
     192function ReadInt64(Node: TDOMNode; Name: string; DefaultValue: Int64): Int64;
     193var
     194  NewNode: TDOMNode;
     195begin
     196  Result := DefaultValue;
     197  NewNode := Node.FindNode(Name);
     198  if Assigned(NewNode) then
     199    Result := StrToInt64(NewNode.TextContent);
    179200end;
    180201
Note: See TracChangeset for help on using the changeset viewer.