Ignore:
Timestamp:
Jun 28, 2024, 11:08:43 PM (5 months ago)
Author:
chronos
Message:
  • Modified: Updated Common package.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/RegistryEx.pas

    r29 r30  
    1 unit URegistry;
     1unit RegistryEx;
    22
    33interface
     
    3838    function DeleteKeyRecursive(const Key: string): Boolean;
    3939    function OpenKey(const Key: string; CanCreate: Boolean): Boolean;
    40     function GetValue(const Name: string; const DefaultValue: Integer): Integer; overload;
    41     function GetValue(const Name: string; const DefaultValue: string): string; overload;
    42     function GetValue(const Name: string; const DefaultValue: Boolean): Boolean; overload;
    43     function GetValue(const Name: string; const DefaultValue: Double): Double; overload;
    44     function GetValue(const Name: string; const DefaultValue: Char): Char; overload;
    45     procedure SetValue(const Name: string; const Value: Integer); overload;
    46     procedure SetValue(const Name: string; const Value: string); overload;
    47     procedure SetValue(const Name: string; const Value: Boolean); overload;
    48     procedure SetValue(const Name: string; const Value: Double); overload;
    49     procedure SetValue(const Name: string; const Value: Char); overload;
    5040    property CurrentContext: TRegistryContext read GetCurrentContext write SetCurrentContext;
    5141  end;
     
    120110end;
    121111
    122 function TRegistryEx.GetValue(const Name: string; const DefaultValue: Integer
    123   ): Integer;
    124 begin
    125   Result := ReadIntegerWithDefault(Name, DefaultValue);
    126 end;
    127 
    128 function TRegistryEx.GetValue(const Name: string; const DefaultValue: string
    129   ): string;
    130 begin
    131   Result := ReadStringWithDefault(Name, DefaultValue);
    132 end;
    133 
    134 function TRegistryEx.GetValue(const Name: string; const DefaultValue: Boolean
    135   ): Boolean;
    136 begin
    137   Result := ReadBoolWithDefault(Name, DefaultValue);
    138 end;
    139 
    140 function TRegistryEx.GetValue(const Name: string; const DefaultValue: Double
    141   ): Double;
    142 begin
    143   Result := ReadFloatWithDefault(Name, DefaultValue);
    144 end;
    145 
    146 function TRegistryEx.GetValue(const Name: string; const DefaultValue: Char
    147   ): Char;
    148 begin
    149   Result := ReadCharWithDefault(Name, DefaultValue);
    150 end;
    151 
    152 procedure TRegistryEx.SetValue(const Name: string; const Value: Integer);
    153 begin
    154   WriteInteger(Name, Value);
    155 end;
    156 
    157 procedure TRegistryEx.SetValue(const Name: string; const Value: string);
    158 begin
    159   WriteString(Name, Value);
    160 end;
    161 
    162 procedure TRegistryEx.SetValue(const Name: string; const Value: Boolean);
    163 begin
    164   WriteBool(Name, Value);
    165 end;
    166 
    167 procedure TRegistryEx.SetValue(const Name: string; const Value: Double);
    168 begin
    169   WriteFloat(Name, Value);
    170 end;
    171 
    172 procedure TRegistryEx.SetValue(const Name: string; const Value: Char);
    173 begin
    174   WriteChar(Name, Value);
    175 end;
    176 
    177112function TRegistryEx.DeleteKeyRecursive(const Key: string): Boolean;
    178113var
     
    198133  //CloseKey;
    199134  {$ENDIF}
    200   Result := inherited OpenKey(Key, CanCreate);
     135  Result := inherited;
    201136end;
    202137
Note: See TracChangeset for help on using the changeset viewer.