unit Unit10;
interface
uses
System.Classes,System.SysUtils;
Type
TVersion =
record
private
fmajor,fminor,frelease,fbuild : Integer;
public
property Major:integer
read fmajor
write fmajor;
property Minor:integer
read fminor
write fminor;
property Release:integer
read frelease
write frelease;
Property Build:integer
read fbuild
write fbuild;
Procedure SetVersion(major,minor,release,build:integer);
Procedure FromString(VersionStr:
string);
function isEqualTo(Versionstr:
string):boolean;
end;
implementation
procedure TVersion.FromString(VersionStr:
string);
var
str : TStrings;
begin
str := TStringlist.Create;
str.Delimiter := '
.';
str.DelimitedText := VersionStr;
fmajor := StrToInt(str.Strings[0]);
fminor := StrToInt(str.Strings[1]);
frelease := StrToInt(str.strings[2]);
fbuild := StrToInt(str.Strings[3]);
str.Free;
end;
function TVersion.isEqualTo(Versionstr:
string):boolean;
var
str : TStrings;
hlp : integer;
begin
str := Tstringlist.Create;
str.Delimiter := '
.';
str.DelimitedText := VersionStr;
result := false;
hlp := StrToInt(str.Strings[0]);
if (hlp = fmajor)
then
begin
hlp := StrToInt(str.Strings[1]);
if (hlp = fminor)
then
begin
hlp := StrToInt(str.Strings[2]);
if (hlp = frelease)
then
begin
hlp := StrToInt(str.Strings[3]);
if (hlp = fbuild)
then
result := true;
end;
end;
end;
str.Free;
end;
procedure TVersion.SetVersion(major: Integer; minor: Integer; release: Integer; build: Integer);
begin
fmajor := major;
fminor := minor;
frelease : release;
fbuild := build;
end;
end.