From 84330e6954ec4d9bd6f36e22e4079f438fbe0140 Mon Sep 17 00:00:00 2001 From: miks1965 Date: Mon, 6 Aug 2018 20:00:24 +0300 Subject: [PATCH] Countries.pas --- bin/Lib/Countries.pas | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 bin/Lib/Countries.pas diff --git a/bin/Lib/Countries.pas b/bin/Lib/Countries.pas new file mode 100644 index 000000000..ba4edc02c --- /dev/null +++ b/bin/Lib/Countries.pas @@ -0,0 +1,36 @@ +unit Countries; + +type + Att = class(System.Attribute) + Num: integer; + constructor (n: integer) := Num := n; + end; + + Country = auto class + nm,cap: string; + inh: integer; + cont: string; + public + [Att(1)] + property Название: string read nm; + [Att(2)] + property Столица: string read cap; + [Att(4)] + property Население: integer read inh; + [Att(3)] + property Континент: string read cont; + end; + +function ЗаполнитьМассивСтран: array of Country; +begin + var fname := __FindFile('Databases\Страны.csv'); + if fname = '' then + raise new System.ApplicationException('Не найден массив стран Databases\Страны.csv'); + Result := ReadLines(fname) + .Select(s->s.ToWords(';')) + .Select(w->new Country(w[0],w[1],w[2].ToInteger,w[3])).ToArray; +end; + +begin + +end. \ No newline at end of file