mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 16:09:23 +02:00
* Some improvements/fix based on remarks of Alexey Torgashin
This commit is contained in:
parent
446cc62b60
commit
8e3158d965
@ -137,6 +137,7 @@ begin
|
|||||||
P.Sources.AddSrcFiles('src/win/fclel.*', P.Directory);
|
P.Sources.AddSrcFiles('src/win/fclel.*', P.Directory);
|
||||||
// Install windows resources
|
// Install windows resources
|
||||||
P.InstallFiles.Add('src/win/fclel.res',AllWindowsOSes,'$(unitinstalldir)');
|
P.InstallFiles.Add('src/win/fclel.res',AllWindowsOSes,'$(unitinstalldir)');
|
||||||
|
T:=P.Targets.AddUnit('basenenc.pp');
|
||||||
|
|
||||||
// Examples
|
// Examples
|
||||||
P.ExamplePath.Add('examples');
|
P.ExamplePath.Add('examples');
|
||||||
|
@ -37,7 +37,7 @@ Type
|
|||||||
'0123456789ABCDEF',
|
'0123456789ABCDEF',
|
||||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567',
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567',
|
||||||
'0123456789ABCDEFGHIJKLMNOPQRSTUV',
|
'0123456789ABCDEFGHIJKLMNOPQRSTUV',
|
||||||
'0123456789ABCDEFGHJKMNPQRSTVWZYZ',
|
'0123456789ABCDEFGHJKMNPQRSTVWXYZ',
|
||||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
|
||||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_');
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_');
|
||||||
Private
|
Private
|
||||||
@ -49,7 +49,7 @@ Type
|
|||||||
class function GetStdEncoder(AIndex: Integer): TAlphabetEncoder; static;
|
class function GetStdEncoder(AIndex: Integer): TAlphabetEncoder; static;
|
||||||
public
|
public
|
||||||
// Construct an encoder with alphabet, bits per letter, padding size in bits
|
// Construct an encoder with alphabet, bits per letter, padding size in bits
|
||||||
Constructor Create(aAlphabet : AnsiString; aBits : Byte; aPadding : Integer); virtual;
|
Constructor Create(Const aAlphabet : AnsiString; aBits : Byte; aPadding : Integer); virtual;
|
||||||
// Destroy all standard encoders
|
// Destroy all standard encoders
|
||||||
Class Destructor Done;
|
Class Destructor Done;
|
||||||
// Create a standard encoder. You must free the result
|
// Create a standard encoder. You must free the result
|
||||||
@ -59,7 +59,7 @@ Type
|
|||||||
// Encode data in buffer aBuffer. If doPad is true, add padding if needed.
|
// Encode data in buffer aBuffer. If doPad is true, add padding if needed.
|
||||||
Function Encode(aBuffer : TBytes; doPad : Boolean = True) : AnsiString; overload;
|
Function Encode(aBuffer : TBytes; doPad : Boolean = True) : AnsiString; overload;
|
||||||
// Encode data in string aBuffer. If doPad is true, add padding if needed.
|
// Encode data in string aBuffer. If doPad is true, add padding if needed.
|
||||||
Function Encode(aBuffer : AnsiString; doPad : Boolean = True) : AnsiString; overload;
|
Function Encode(const aBuffer : AnsiString; doPad : Boolean = True) : AnsiString; overload;
|
||||||
// Decode aSrcBuffer with length aLen.
|
// Decode aSrcBuffer with length aLen.
|
||||||
// Buffer must have enough room. Calculate maximum needed room with GetDecodeLen
|
// Buffer must have enough room. Calculate maximum needed room with GetDecodeLen
|
||||||
Function Decode(const aSrcBuffer : PByte; aLen : Integer; ABuffer : PByte) : Integer; virtual; overload;
|
Function Decode(const aSrcBuffer : PByte; aLen : Integer; ABuffer : PByte) : Integer; virtual; overload;
|
||||||
@ -107,14 +107,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TAlphabetEncoder.Encode(aBuffer: AnsiString; doPad : Boolean = True): AnsiString;
|
function TAlphabetEncoder.Encode(Const aBuffer: AnsiString; doPad : Boolean = True): AnsiString;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=Encode(TEncoding.UTF8.GetAnsiBytes(aBuffer),DoPad);
|
Result:=Encode(TEncoding.UTF8.GetAnsiBytes(aBuffer),DoPad);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Constructor TAlphabetEncoder.Create(aAlphabet: AnsiString; aBits: Byte; aPadding: Integer);
|
Constructor TAlphabetEncoder.Create(const aAlphabet: AnsiString; aBits: Byte; aPadding: Integer);
|
||||||
|
|
||||||
Var
|
Var
|
||||||
I : Integer;
|
I : Integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user