Sign in Join
Wiki copytemporary

Set/fr: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11## Introduction
22
3-Un ensemble (set) code plusieurs valeurs d'une énumération vers un type Ordinal.
4-
5-Par exemple, prenons l'énumération:
3+Un ensemble (set) code plusieurs valeurs d'une énumération vers un type Ordinal.
64
7-``` pascal
8- TSpeed = (spVerySlow,spSlow,spAVerage,spFast,spVeryFast);
5+Par exemple, prenons l'énumération:
96```
10-
11-Et cet ensemble:
12-
13-``` pascal
14- TPossibleSpeeds = set of TSpeed
7+TSpeed = (spVerySlow,spSlow,spAVerage,spFast,spVeryFast);
158```
169
17-TPossibleSpeeds peut être défini comme une constante entre crochets:
10+Et cet ensemble:
11+```
12+TPossibleSpeeds = set of TSpeed
13+```
1814
19-``` pascal
20- const
21- RatherSlow = [spVerySlow,spSlow];
22- RatherFast = [spFast,spVeryFast];
15+TPossibleSpeeds peut être défini comme une constante entre crochets:
2316```
17+const
18+ RatherSlow = [spVerySlow,spSlow];
19+ RatherFast = [spFast,spVeryFast];
20+```
2421
25-RatherSlow et RatherFast sont quelques ensembles de TSpeed.
22+RatherSlow et RatherFast sont quelques ensembles de TSpeed.
2623
2724## Manipulation des sets
2825
29-Habituellement, deux fonctions natives du compilateur sont employées pour manipuler un ensemble : **Include(UnEnsemble,UneValeur)** et **Exclude(UnEnsemble,UneValeur)**.
30-
31-``` pascal
32- var
33- SomeSpeeds = TPossibleSpeeds;
34- begin
35- SomeSpeeds := [];
36- Include(SomeSpeeds,spVerySlow);
37- Include(SomeSpeeds,spVeryFast);
38- end;
26+Habituellement, deux fonctions natives du compilateur sont employées pour manipuler un ensemble : **Include(UnEnsemble,UneValeur)** et **Exclude(UnEnsemble,UneValeur)**.
3927```
40-
41-Les ensembles ne peuvent être directement manipulés s'ils sont des propriétés publiées d'une classe. Vous devez normalement alors faire une copie locale, la modifier et passer cette valeur au setter.
42-
43-``` pascal
44- procedure TSomething.DoSomething(Sender: TFarObject);
45- var
46- LocalCopy = TPossibleSpeeds;
47- begin
48- LocalCopy := Sender.PossibleSpeeds; // getter to local
49- Include(LocalCopy,spVerySlow);
50- Sender.PossibleSpeeds := LocalCopy; // local to setter.
51- end;
28+var
29+ SomeSpeeds = TPossibleSpeeds;
30+ begin
31+ SomeSpeeds := [];
32+ Include(SomeSpeeds,spVerySlow);
33+ Include(SomeSpeeds,spVeryFast);
34+ end;
5235```
5336
54-Le mot-clé **in** est aussi utilisé pour vérifier si une valeur est dans un ensemble. Généralement, c'est de la forme:
37+Les ensembles ne peuvent être directement manipulés s'ils sont des propriétés publiées d'une classe. Vous devez normalement alors faire une copie locale, la modifier et passer cette valeur au setter.
38+```
39+procedure TSomething.DoSomething(Sender: TFarObject);
40+ var
41+ LocalCopy = TPossibleSpeeds;
42+ begin
43+ LocalCopy := Sender.PossibleSpeeds; // getter to local
44+ Include(LocalCopy,spVerySlow);
45+ Sender.PossibleSpeeds := LocalCopy; // local to setter.
46+ end;
47+```
5548
56-``` pascal
57- var
58- CanBeSlow: Boolean;
59- const
60- SomeSpeeds = [Low(TSpeed)..High(TSpeed)];
61- begin
62- CanBeSlow := (spVerySlow in SomeSpeeds) or (spSlow in SomeSpeeds);
63- end;
49+Le mot-clé **in** est aussi utilisé pour vérifier si une valeur est dans un ensemble. Généralement, c'est de la forme:
6450```
51+var
52+ CanBeSlow: Boolean;
53+ const
54+ SomeSpeeds = [Low(TSpeed)..High(TSpeed)];
55+ begin
56+ CanBeSlow := (spVerySlow in SomeSpeeds) or (spSlow in SomeSpeeds);
57+ end;
58+```
6559
66-Les ensembles supportent aussi des opération ensemblistes sous la forme d'opérateurs décrits dans \[<http://www.freepascal.org/docs-html/ref/refsu45.html#x139-14900012.8.5>\| Set operators\]
60+Les ensembles supportent aussi des opération ensemblistes sous la forme d'opérateurs décrits dans [Set operators](<http://www.freepascal.org/docs-html/ref/refsu45.html#x139-14900012.8.5%7C>)
6761
62+Types de données
63+---
64+Types de données simples | [[Boolean/fr|Boolean]] | [[Byte/fr|Byte]] |[[Cardinal/fr|Cardinal]] | [[Char/fr|Char]] | [[Currency/fr|Currency]] | [[Extended/fr|Extended]] | [[Int64/fr|Int64]] | [[Integer/fr|Integer]] | [[Longint/fr|Longint]] | [[Pointer/fr|Pointer]] | [[Real/fr|Real]] | [[Shortint/fr|Shortint]] | [[Smallint/fr|Smallint]] | [[Word/fr|Word]]
65+Types de données complexes | [[Array/fr|Array]] | [[Class/fr|Class]] | [[Record/fr|Record]] | Set | [[String/fr|String]] | [[Shortstring/fr|ShortString]]
66+
6867---
69-*From the Free Pascal wiki, page "Set/fr", as it stood on 2020-02-26 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
68+*From the Free Pascal wiki, page "Set/fr", as the Internet Archive kept it on 2025-03-23, last changed on 2020-02-27. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history