Skip to content

overloads javadoc #859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Feb 13, 2025
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions docs/modules/ROOT/pages/config-file.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ For exclusion rules, the symbol must strictly match the pattern to be excluded.

The following options can be defined both in the configuration file and on the command line, where the command line options always take precedence.

Whenever applicable, the command line options attempt to mirror (i) non-abbreviated (ii) kebab-case variants of the equivalent commands in Doxygen. For instance, the Doxygen `EXTRACT_ANON_NSPACES` option is mirrored by the `extract-anonymous-namespaces` command line option.

[config-options-reference,level=3]
====
include::partial$ConfigOptions.json[]
Expand Down
12 changes: 11 additions & 1 deletion docs/mrdocs.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
},
"overloads": {
"default": true,
"description": "When set to `true`, MrDocs detects function overloads and groups them as a single symbol type.",
"description": "When set to `true`, MrDocs detects function overloads and groups them as a single symbol type. The documentation for this new symbol comes from the union of non-ambiguous metadata from the functions.",
"enum": [
true,
false
Expand Down Expand Up @@ -540,6 +540,16 @@
"title": "Warn if parameters are not documented",
"type": "boolean"
},
"warn-unnamed-param": {
"default": false,
"description": "When set to `true`, MrDocs outputs a warning message if a documented function has a parameter that is not named.",
"enum": [
true,
false
],
"title": "Warn if documented functions have unnamed parameters",
"type": "boolean"
},
"warnings": {
"default": true,
"description": "When set to `true`, MrDocs outputs warning messages during the generation of the documentation. It is usually recommended to enable warnings while writing the documentation.",
Expand Down
4 changes: 2 additions & 2 deletions include/mrdocs/Corpus.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ class MRDOCS_VISIBLE
/** Return the Info for the matching string in a given context.
*/
virtual
Expected<Info const*>
Expected<std::reference_wrapper<Info const>>
lookup(SymbolID const& context, std::string_view name) const = 0;

/** Return the Info for the matching string in the global context.
*/
Expected<Info const*>
Expected<std::reference_wrapper<Info const>>
lookup(std::string_view name) const
{
return lookup(SymbolID::global, name);
Expand Down
1 change: 1 addition & 0 deletions include/mrdocs/Metadata/Info/Function.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ struct FunctionInfo final
std::vector<std::string> Attributes;

// CXXMethodDecl
bool IsRecordMethod = false;
bool IsVirtual = false;
bool IsVirtualAsWritten = false;
bool IsPure = false;
Expand Down
14 changes: 12 additions & 2 deletions include/mrdocs/Metadata/Javadoc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,16 @@ struct Text : Node
}
};

MRDOCS_DECL
std::strong_ordering
operator<=>(Polymorphic<Text> const& lhs, Polymorphic<Text> const& rhs);

inline
bool
operator==(Polymorphic<Text> const& lhs, Polymorphic<Text> const& rhs) {
return std::is_eq(lhs <=> rhs);
}

/** A piece of styled text.
*/
struct Styled final : Text
Expand Down Expand Up @@ -489,7 +499,7 @@ struct Paragraph : Block
}

auto operator<=>(Paragraph const&) const = default;
bool operator==(Paragraph const&) const noexcept = default;

bool equals(Node const& other) const noexcept override
{
return Kind == other.Kind &&
Expand Down Expand Up @@ -518,7 +528,7 @@ struct Brief final : Paragraph
}

auto operator<=>(Brief const&) const = default;
bool operator==(Brief const&) const noexcept = default;

bool equals(Node const& other) const noexcept override
{
return Kind == other.Kind &&
Expand Down
3 changes: 2 additions & 1 deletion include/mrdocs/Metadata/Source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ struct MRDOCS_DECL

//--------------------------------------------

constexpr
Location(
std::string_view const full_path = {},
std::string_view const short_path = {},
Expand Down Expand Up @@ -131,7 +132,7 @@ struct MRDOCS_DECL
auto operator<=>(SourceInfo const&) const = default;

protected:
SourceInfo() = default;
constexpr SourceInfo() = default;
};

MRDOCS_DECL
Expand Down
59 changes: 1 addition & 58 deletions share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{{/if}}
{{! Synopsis }}
{{#unless (eq symbol.kind "namespace")}}
{{#> markup/dynamic-level-h }}Synopsis{{/markup/dynamic-level-h}}
{{#> markup/dynamic-level-h }}{{#if (ne symbol.kind "overloads")}}Synopsis{{else}}Synopses{{/if}}{{/markup/dynamic-level-h}}

{{>location/source dcl=(primary_location symbol)}}

Expand Down Expand Up @@ -89,7 +89,6 @@

{{/if}}
{{! Exceptions }}
{{#if (ne symbol.kind "overloads")}}
{{#if symbol.doc.exceptions}}
{{#> markup/dynamic-level-h }}Exceptions{{/markup/dynamic-level-h}}

Expand All @@ -103,24 +102,6 @@
{{/each}}
|===

{{/if}}
{{else}}
{{#with (flattenUnique symbol.members "doc.exceptions" "exception") as |allExceptions|}}
{{#if (ne (len allExceptions) 0)}}
{{#> markup/dynamic-level-h }}Exceptions{{/markup/dynamic-level-h}}

|===
| Name | Thrown on

{{#each allExceptions as |exception|}}
| `{{exception.exception}}`
| {{{exception.description}}}

{{/each}}
|===

{{/if}}
{{/with}}
{{/if}}
{{! Return value }}
{{#if symbol.doc.returns}}
Expand All @@ -136,7 +117,6 @@

{{/if}}
{{! Template Parameters }}
{{#if (ne symbol.kind "overloads")}}
{{#if symbol.doc.tparams}}
{{#> markup/dynamic-level-h }}Template Parameters{{/markup/dynamic-level-h}}

Expand All @@ -150,27 +130,8 @@
{{/each}}
|===

{{/if}}
{{else}}
{{#with (flattenUnique symbol.members "doc.tparams" "name") as |allTParams|}}
{{#if (ne (len allTParams) 0)}}
{{#> markup/dynamic-level-h }}Template Parameters{{/markup/dynamic-level-h}}

|===
| Name | Description

{{#each allTParams as |param|}}
| *{{param.name}}*
| {{{param.description}}}

{{/each}}
|===

{{/if}}
{{/with}}
{{/if}}
{{! Parameters }}
{{#if (ne symbol.kind "overloads")}}
{{#if symbol.doc.params}}
{{#> markup/dynamic-level-h }}Parameters{{/markup/dynamic-level-h}}

Expand All @@ -184,24 +145,6 @@
{{/each}}
|===

{{/if}}
{{else}}
{{#with (flattenUnique symbol.members "doc.params" "name") as |allParams|}}
{{#if (ne (len allParams) 0)}}
{{#> markup/dynamic-level-h }}Parameters{{/markup/dynamic-level-h}}

|===
| Name | Description

{{#each allParams as |param|}}
| *{{param.name}}*
| {{{param.description}}}

{{/each}}
|===

{{/if}}
{{/with}}
{{/if}}
{{! Preconditions }}
{{#if symbol.doc.preconditions}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@
{{#>markup/a href=url}}{{#>markup/code}}{{>symbol/name . nolink=true}}{{/markup/code}}{{/markup/a}} {{>symbol/special-function-suffix .}}
{{~/markup/td}}
{{#if (eq includeBrief true)}}
{{#>markup/td}}
{{#if (ne kind "overloads")~}}
{{#>markup/td~}}
{{{~doc.brief}}}
{{else~}}
{{#each (unique (pluck (pluck members "doc") "brief"))~}}
{{{.}}}

{{/each~}}
{{/if~}}
{{~/markup/td~}}
{{/markup/td~}}
{{/if}}
{{~/markup/tr}}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

{{else}}
{{#each members as | member |}}
{{#if member.doc.brief}}{{#> markup/p }}{{{member.doc.brief}}}{{/markup/p}}{{/if}}

{{#> markup/code-block }}
{{> symbol/signature member link=member}}
{{/markup/code-block}}
Expand Down
80 changes: 1 addition & 79 deletions share/mrdocs/addons/generator/html/partials/symbol.html.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
{{! Synopsis }}
{{#unless (eq symbol.kind "namespace")}}
<div>
{{#> markup/dynamic-level-h level=2 }}Synopsis{{/markup/dynamic-level-h}}
{{#> markup/dynamic-level-h level=2 }}{{#if (ne symbol.kind "overloads")}}Synopsis{{else}}Synopses{{/if}}{{/markup/dynamic-level-h}}
<div>
{{>location/source dcl=(primary_location symbol)}}
</div>
Expand Down Expand Up @@ -116,7 +116,6 @@

{{/if}}
{{! Exceptions }}
{{#if (ne symbol.kind "overloads")}}
{{#if symbol.doc.exceptions}}
<div>
{{#> markup/dynamic-level-h level=2 }}Exceptions{{/markup/dynamic-level-h}}
Expand All @@ -138,31 +137,6 @@
</table>
</div>
{{/if}}
{{else}}
{{#with (flattenUnique symbol.members "doc.exceptions" "exception") as |allExceptions|}}
{{#if (ne (len allExceptions) 0)}}
<div>
{{#> markup/dynamic-level-h level=2 }}Exceptions{{/markup/dynamic-level-h}}
<table>
<thead>
<tr>
<th>Name</th>
<th>Thrown on</th>
</tr>
</thead>
<tbody>
{{#each allExceptions as |exception|}}
<tr>
<td><code>{{exception}}</code></td>
<td>{{{description}}}</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
{{/if}}
{{/with}}
{{/if}}
{{! Return value }}
{{#if symbol.doc.returns}}
<div>
Expand All @@ -179,7 +153,6 @@
</div>
{{/if}}
{{! Template Parameters }}
{{#if (ne symbol.kind "overloads")}}
{{#if symbol.doc.tparams}}
<div>
{{#> markup/dynamic-level-h level=2 }}Template Parameters{{/markup/dynamic-level-h}}
Expand All @@ -201,33 +174,7 @@
</table>
</div>
{{/if}}
{{else}}
{{#with (flattenUnique symbol.members "doc.tparams" "name") as |allTParams|}}
{{#if (ne (len allTParams) 0)}}
<div>
{{#> markup/dynamic-level-h level=2 }}Template Parameters{{/markup/dynamic-level-h}}
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
{{#each allTParams as |param|}}
<tr>
<td><strong>{{param.name}}</strong></td>
<td>{{{param.description}}}</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
{{/if}}
{{/with}}
{{/if}}
{{! Parameters }}
{{#if (ne symbol.kind "overloads")}}
{{#if symbol.doc.params}}
<div>
{{#> markup/dynamic-level-h level=2 }}Parameters{{/markup/dynamic-level-h}}
Expand All @@ -249,31 +196,6 @@
</table>
</div>
{{/if}}
{{else}}
{{#with (flattenUnique symbol.members "doc.params" "name") as |allParams|}}
{{#if (ne (len allParams) 0)}}
<div>
{{#> markup/dynamic-level-h level=2 }}Parameters{{/markup/dynamic-level-h}}
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
{{#each allParams as |param|}}
<tr>
<td><strong>{{param.name}}</strong></td>
<td>{{{param.description}}}</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
{{/if}}
{{/with}}
{{/if}}
{{! Preconditions }}
{{#if symbol.doc.preconditions}}
<div>
Expand Down
Loading