Changeset 189 for branches/generator/Packages/Common/URegistry.pas
- Timestamp:
- May 16, 2019, 11:35:07 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/generator/Packages/Common/URegistry.pas
r167 r189 29 29 procedure SetCurrentContext(AValue: TRegistryContext); 30 30 public 31 function ReadChar(const Name: string): Char; 32 procedure WriteChar(const Name: string; Value: Char); 31 33 function ReadBoolWithDefault(const Name: string; 32 34 DefaultValue: Boolean): Boolean; 33 35 function ReadIntegerWithDefault(const Name: string; DefaultValue: Integer): Integer; 34 36 function ReadStringWithDefault(const Name: string; DefaultValue: string): string; 37 function ReadCharWithDefault(const Name: string; DefaultValue: Char): Char; 35 38 function ReadFloatWithDefault(const Name: string; 36 39 DefaultValue: Double): Double; … … 89 92 end; 90 93 94 function TRegistryEx.ReadCharWithDefault(const Name: string; DefaultValue: Char 95 ): Char; 96 begin 97 if ValueExists(Name) then Result := ReadChar(Name) 98 else begin 99 WriteChar(Name, DefaultValue); 100 Result := DefaultValue; 101 end; 102 end; 103 91 104 function TRegistryEx.ReadFloatWithDefault(const Name: string; 92 105 DefaultValue: Double): Double; … … 137 150 end; 138 151 152 function TRegistryEx.ReadChar(const Name: string): Char; 153 var 154 S: string; 155 begin 156 S := ReadString(Name); 157 if Length(S) > 0 then Result := S[1] 158 else Result := #0; 159 end; 160 161 procedure TRegistryEx.WriteChar(const Name: string; Value: Char); 162 begin 163 WriteString(Name, Value); 164 end; 165 139 166 function TRegistryEx.ReadBoolWithDefault(const Name: string; 140 167 DefaultValue: Boolean): Boolean;
Note:
See TracChangeset
for help on using the changeset viewer.