|
1 | 1 | :doctitle: --implicit-visibility command-line option |
2 | 2 |
|
3 | | -When you declare a class, ObjectPascal rules say that default ("implicit") visibility of members is __public__, unless the class is declared within {$M+} state or the class inherits from another class |
4 | | -declared in {$M+} state (like TPersistent) -- then it's __published__. |
| 3 | +When you declare a class, ObjectPascal rules say that the default ("implicit") visibility of members is __public__, unless the class is declared within `{$M+}` state or the class inherits from another class |
| 4 | +declared in `{$M+}` state (like `TPersistent`) -- then it's __published__. For example: |
5 | 5 |
|
6 | | -However, pasdoc cannot always absolutely correctly implement this behavior |
7 | | -(only the compiler really knows whether class inherits from another class declared in {$M+} state). |
| 6 | +```pascal |
| 7 | +type |
| 8 | + TMyClass = class(TObject) |
| 9 | + // this field is public |
| 10 | + MyField: Integer; |
| 11 | + end; |
8 | 12 |
|
9 | | -You can control using the command-line option `--implicit-visibility` how |
10 | | -exactly pasdoc handles members with "implicit visibility": |
| 13 | + {$M+} |
| 14 | + TMyClass2 = class(TObject) |
| 15 | + // this field is published |
| 16 | + MyField: Integer; |
| 17 | + end; |
| 18 | +``` |
| 19 | + |
| 20 | +However, PasDoc cannot always correctly implement this behavior, because we don't know all your ancestor classes (unlike the compiler). For example: |
| 21 | + |
| 22 | +```pascal |
| 23 | +uses Classes; |
| 24 | +type |
| 25 | + TMyClass = class(TComponent) |
| 26 | + // this is published, but PasDoc doesn't know that |
| 27 | + MyField: Integer; |
| 28 | + end; |
| 29 | +``` |
| 30 | + |
| 31 | +Therefore you can customize how we treat members with "implicit visibility" (i.e. members without an explicit visibility section) using the command-line option `--implicit-visibility`. It has the following possible values: |
11 | 32 |
|
12 | 33 | --implicit-visibility=public:: |
13 | | -Visibility of implicit members is __public__, unless the class is |
14 | | -declared within {$M+} state, then visibility is __published__. This is |
15 | | -the default setting. |
| 34 | +Visibility of implicit members is __public__, unless the class is declared within `{$M+}` state, then visibility is __published__. This is the default setting. |
16 | 35 |
|
17 | 36 | --implicit-visibility=published:: |
18 | | -Visibility of implicit members is always __published__. |
| 37 | +Visibility of implicit members is always __published__. Use this if you always descend from classes declared in `{$M+}` state (like `TPersistent`, `TComponent`, `TForm`). |
19 | 38 |
|
20 | 39 | --implicit-visibility=implicit:: |
21 | | -Visibility of implicit members is always __implicit__. _Implicit_ is a new |
22 | | -visibility kind, invented only for the sake of pasdoc. It's another |
23 | | -possible kind for `--visible-members` option. By default, |
24 | | ---visible-members do not include _implicit_ members. |
25 | | - |
26 | | -If you don't use `--implicit-visibility=implicit` command-line option then |
27 | | -_no_ members will be ever considered as having an _implicit_ visibility |
28 | | -by pasdoc. |
| 40 | +Assign to the implicit members a special invented visibility level, which we call __implicit__. The link:VisibleMembers[--visible-members] option allows to control whether they are displayed. |
| 41 | ++ |
| 42 | +If you don't use `--implicit-visibility=implicit` command-line option then _no_ members will be ever considered as having an _implicit_ visibility. |
0 commit comments