Skip to content

Commit ec3b3fe

Browse files
committed
Better docs for implicit levels, also clarify strictprivate is also hidden by default (makes sense, as we hide provate too)
1 parent 9bfe5a1 commit ec3b3fe

2 files changed

Lines changed: 37 additions & 21 deletions

File tree

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,42 @@
11
:doctitle: --implicit-visibility command-line option
22

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:
55

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;
812

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:
1132

1233
--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.
1635

1736
--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`).
1938

2039
--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.

src/VisibleMembers.asciidoc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
== What members to include in the documentation
77

88
The link:CommandLine[CommandLine] option `--visible-members` (short
9-
form is `-M`) controls what class members are visible in final
9+
form is `-M`) controls what class members are visible in the generated
1010
documentation. The following visibility types are known:
1111

1212
* `private`
@@ -16,15 +16,17 @@ documentation. The following visibility types are known:
1616
* `public`
1717
* `published`
1818
* `automated`
19-
* `implicit` (which can mean either `public` or `published`; see link:ImplicitVisibilityOption[--implicit-visibility option])
19+
* `implicit`
20+
+
21+
This is a special visibility level, used only if you requested it by `--implicit-visibility=implicit`.See link:ImplicitVisibilityOption[--implicit-visibility option] for more details.
2022

2123
Example:
2224

2325
----
2426
pasdoc --visible-members protected,public,published,automated
2527
----
2628

27-
By default `private` and `implicit` members are hidden, the rest is shown.
29+
By default `private`, `strictprivate` and `implicit` members are hidden. The rest is shown.
2830

2931
== Make some members "included but hidden by default"
3032

0 commit comments

Comments
 (0)