@@ -120,6 +120,7 @@ enum class NodeKind
120120 throws,
121121 details,
122122 see,
123+ related,
123124 precondition,
124125 postcondition
125126};
@@ -374,6 +375,26 @@ struct Copied final : Reference
374375 }
375376};
376377
378+ /* * A reference to a related symbol.
379+ */
380+ struct Related final : Reference
381+ {
382+ static constexpr auto static_kind = NodeKind::related;
383+
384+ Related (std::string string_ = std::string()) noexcept
385+ : Reference(std::move(string_), NodeKind::related)
386+ {
387+ }
388+
389+ auto operator <=>(Related const &) const = default ;
390+ bool operator ==(Related const &) const noexcept = default ;
391+ bool equals (Node const & other) const noexcept override
392+ {
393+ return Kind == other.Kind &&
394+ *this == dynamic_cast <Related const &>(other);
395+ }
396+ };
397+
377398// ------------------------------------------------
378399//
379400// Block nodes
@@ -877,62 +898,6 @@ struct Postcondition : Paragraph
877898
878899// ------------------------------------------------
879900
880- /* * A visitor for node types.
881- */
882- template <class F , class ... Args>
883- constexpr
884- auto
885- visit (
886- NodeKind kind,
887- F&& f, Args&&... args)
888- {
889- switch (kind)
890- {
891- case NodeKind::admonition:
892- return f.template operator ()<Admonition>(std::forward<Args>(args)...);
893- case NodeKind::brief:
894- return f.template operator ()<Brief>(std::forward<Args>(args)...);
895- case NodeKind::code:
896- return f.template operator ()<Code>(std::forward<Args>(args)...);
897- case NodeKind::heading:
898- return f.template operator ()<Heading>(std::forward<Args>(args)...);
899- case NodeKind::link:
900- return f.template operator ()<Link>(std::forward<Args>(args)...);
901- case NodeKind::reference:
902- return f.template operator ()<Reference>(std::forward<Args>(args)...);
903- case NodeKind::copied:
904- return f.template operator ()<Copied>(std::forward<Args>(args)...);
905- case NodeKind::list_item:
906- return f.template operator ()<ListItem>(std::forward<Args>(args)...);
907- case NodeKind::unordered_list:
908- return f.template operator ()<UnorderedList>(std::forward<Args>(args)...);
909- case NodeKind::paragraph:
910- return f.template operator ()<Paragraph>(std::forward<Args>(args)...);
911- case NodeKind::param:
912- return f.template operator ()<Param>(std::forward<Args>(args)...);
913- case NodeKind::returns:
914- return f.template operator ()<Returns>(std::forward<Args>(args)...);
915- case NodeKind::styled:
916- return f.template operator ()<Styled>(std::forward<Args>(args)...);
917- case NodeKind::text:
918- return f.template operator ()<Text>(std::forward<Args>(args)...);
919- case NodeKind::tparam:
920- return f.template operator ()<TParam>(std::forward<Args>(args)...);
921- case NodeKind::throws:
922- return f.template operator ()<Throws>(std::forward<Args>(args)...);
923- case NodeKind::details:
924- return f.template operator ()<Details>(std::forward<Args>(args)...);
925- case NodeKind::see:
926- return f.template operator ()<See>(std::forward<Args>(args)...);
927- case NodeKind::precondition:
928- return f.template operator ()<Precondition>(std::forward<Args>(args)...);
929- case NodeKind::postcondition:
930- return f.template operator ()<Postcondition>(std::forward<Args>(args)...);
931- default :
932- return f.template operator ()<void >(std::forward<Args>(args)...);
933- }
934- }
935-
936901/* * Visit a node.
937902
938903 @param node The node to visit.
@@ -995,6 +960,8 @@ visit(
995960 return visitor.template visit <Precondition>();
996961 case NodeKind::postcondition:
997962 return visitor.template visit <Postcondition>();
963+ case NodeKind::related:
964+ return visitor.template visit <Related>();
998965 default :
999966 MRDOCS_UNREACHABLE ();
1000967 }
@@ -1063,6 +1030,9 @@ struct MRDOCS_DECL
10631030 // / The list of "see also" references.
10641031 std::vector<doc::See> sees;
10651032
1033+ // / The list of "related" references.
1034+ std::vector<SymbolID> related;
1035+
10661036 // / The list of preconditions.
10671037 std::vector<doc::Precondition> preconditions;
10681038
@@ -1093,6 +1063,7 @@ struct MRDOCS_DECL
10931063 tparams.empty () &&
10941064 exceptions.empty () &&
10951065 sees.empty () &&
1066+ related.empty () &&
10961067 preconditions.empty () &&
10971068 postconditions.empty ();
10981069 }
0 commit comments