Skip to content

Commit 6a98051

Browse files
committed
[commons] new simple function helpers
1 parent c1c5176 commit 6a98051

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

Quick.Commons.pas

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ ***************************************************************************
1+
{ ***************************************************************************
22
33
Copyright (c) 2016-2021 Kike P�rez
44
@@ -256,6 +256,16 @@ TDateTimeHelper = record helper for TDateTime
256256
function IsAM : Boolean;
257257
function IsPM : Boolean;
258258
end;
259+
260+
TDateHelper = record helper for TDate
261+
public
262+
function ToString : string;
263+
end;
264+
265+
TTimeHelper = record helper for TTime
266+
public
267+
function ToString : string;
268+
end;
259269
{$ENDIF}
260270

261271
EEnvironmentPath = class(Exception);
@@ -2314,6 +2324,18 @@ function TDateTimeHelper.IsPM : Boolean;
23142324
begin
23152325
Result := System.DateUtils.IsPM(Self);
23162326
end;
2327+
2328+
{ TDateHelper }
2329+
function TDateHelper.ToString : string;
2330+
begin
2331+
Result := DateToStr(Self);
2332+
end;
2333+
2334+
{ TTimeHelper }
2335+
function TTimeHelper.ToString : string;
2336+
begin
2337+
Result := TimeToStr(Self);
2338+
end;
23172339
{$ENDIF}
23182340

23192341
{$IFNDEF NEXTGEN}

Quick.Crypto.pas

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@
3030

3131
interface
3232

33-
uses
34-
35-
function AES128_Encrypt(Value, Password: string): string;
36-
function AES128_Decrypt(Value, Password: string): string;
33+
function AES128_Encrypt(const Value, Password: string): string;
34+
function AES128_Decrypt(const Value, Password: string): string;
3735

3836
implementation
3937

@@ -130,7 +128,7 @@ function __AES128_DeriveKeyFromPassword(m_hProv: HCRYPTPROV; Password: string):
130128
end;
131129
end;
132130

133-
function AES128_Encrypt(Value, Password: string): string;
131+
function AES128_Encrypt(const Value, Password: string): string;
134132
var
135133
hCProv: HCRYPTPROV;
136134
hKey: HCRYPTKEY;
@@ -164,7 +162,7 @@ function AES128_Encrypt(Value, Password: string): string;
164162
end;
165163
end;
166164

167-
function AES128_Decrypt(Value, Password: string): string;
165+
function AES128_Decrypt(const Value, Password: string): string;
168166
var
169167
hCProv: HCRYPTPROV;
170168
hKey: HCRYPTKEY;

0 commit comments

Comments
 (0)