Changeset 562 for Common/UXMLUtils.pas
- Timestamp:
- May 27, 2023, 11:00:20 AM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/UXMLUtils.pas
r558 r562 14 14 procedure WriteString(Node: TDOMNode; Name: string; Value: string); 15 15 procedure WriteDateTime(Node: TDOMNode; Name: string; Value: TDateTime); 16 procedure WriteDouble(Node: TDOMNode; Name: string; Value: Double); 16 17 function ReadInteger(Node: TDOMNode; Name: string; DefaultValue: Integer): Integer; 17 18 function ReadInt64(Node: TDOMNode; Name: string; DefaultValue: Int64): Int64; … … 19 20 function ReadString(Node: TDOMNode; Name: string; DefaultValue: string): string; 20 21 function ReadDateTime(Node: TDOMNode; Name: string; DefaultValue: TDateTime): TDateTime; 22 function ReadDouble(Node: TDOMNode; Name: string; DefaultValue: Double): Double; 21 23 procedure ReadXMLFileParser(out Doc: TXMLDocument; FileName: string); 22 24 23 25 24 26 implementation 27 28 function ReadDouble(Node: TDOMNode; Name: string; DefaultValue: Double): Double; 29 var 30 NewNode: TDOMNode; 31 begin 32 Result := DefaultValue; 33 NewNode := Node.FindNode(DOMString(Name)); 34 if Assigned(NewNode) then 35 Result := StrToFloat(string(NewNode.TextContent)); 36 end; 25 37 26 38 procedure ReadXMLFileParser(out Doc: TXMLDocument; FileName: string); … … 200 212 end; 201 213 214 procedure WriteDouble(Node: TDOMNode; Name: string; Value: Double); 215 var 216 NewNode: TDOMNode; 217 begin 218 NewNode := Node.OwnerDocument.CreateElement(DOMString(Name)); 219 NewNode.TextContent := DOMString(FloatToStr(Value)); 220 Node.AppendChild(NewNode); 221 end; 222 202 223 function ReadInteger(Node: TDOMNode; Name: string; DefaultValue: Integer): Integer; 203 224 var … … 252 273 253 274 end. 254
Note:
See TracChangeset
for help on using the changeset viewer.