unit U_Tools;
interface
uses
SysUtils, Classes, Links;
// Parameters
type
TAlbumType = (atAlbum, atDoubleAlbum, atCompilation, atSingle, atEP, atBoxSet,
atDisneyST, atMovieST, atMusicalST, atTVSeriesST, atVideoGameST);
// Forward declarations
TAlbum =
class;
TSong =
class;
// Classes
TArtist =
class
Links: TLinks;
Name:
String;
Albums:
Array of TAlbum;
Songs:
Array of TSong;
function GetAC: Integer;
function GetSC: Integer;
procedure AddAlbum(Album: TAlbum);
procedure AddSong(Song: TSong);
property AlbumCount: Integer
read GetAC;
property SongCount: Integer
read GetSC;
end;
TAlbum =
class
Links: TLinks;
Title:
String;
Year:
String;
Artist: TArtist;
Songs:
Array of TSong;
AlbumType: TAlbumType;
Length: Integer;
Genre:
String;
function GetSC: Integer;
procedure AddSong(Song: TSong);
property SongCount: Integer
read GetSC;
end;
TSong =
class
Links: TLinks;
Title:
String;
Artist: TArtist;
Albums:
Array of TAlbum;
function GetAC: Integer;
procedure AddAlbum(Album: TAlbum);
property AlbumCount: Integer
read GetAC;
end;
function FLetterUC(Title:
String):
String;
implementation
function FLetterUC(Title:
String):
String;
var a: Integer; NextLetterUC: Boolean;
begin
result:='
'; NextLetterUC:=True;
for a:=1
to Length(Title)
do
begin
if NextLetterUC
then
result:=result+AnsiUpperCase(Title[a])
else
result:=result+Title[a];
NextLetterUC:=((Title[a]='
')
or (Title[a]='
('));
end;
end;
// ARTIST //
function TArtist.GetAC: Integer;
begin
result:=Length(Albums);
end;
function TArtist.GetSC: Integer;
begin
result:=Length(Songs);
end;
procedure TArtist.AddAlbum(Album: TAlbum);
begin
SetLength(Albums,AlbumCount+1);
Albums[AlbumCount-1]:=Album;
end;
procedure TArtist.AddSong(Song: TSong);
begin
SetLength(Songs,SongCount+1);
Songs[SongCount-1]:=Song;
end;
// ALBUM //
function TAlbum.GetSC: Integer;
begin
result:=Length(Songs);
end;
procedure TAlbum.AddSong(Song: TSong);
begin
SetLength(Songs,SongCount+1);
Songs[SongCount-1]:=Song;
end;
// SONG //
function TSong.GetAC: Integer;
begin
result:=Length(Albums);
end;
procedure TSong.AddAlbum(Album: TAlbum);
begin
SetLength(Albums,AlbumCount+1);
Albums[AlbumCount-1]:=Album;
end;
end.