@@ -116,6 +116,7 @@ enum class Kind
116116 heading,
117117 link,
118118 list_item,
119+ unordered_list,
119120 paragraph,
120121 param,
121122 returns,
@@ -178,6 +179,12 @@ enum class Parts
178179// --------------------------------------------
179180
180181/* * This is a variant-like list element.
182+
183+ There are two types of nodes: text and block.
184+
185+ - The javadoc is a list of blocks.
186+ - A block contains a list of text elements.
187+ - A text element contains a string.
181188*/
182189struct MRDOCS_DECL
183190 Node
@@ -367,6 +374,8 @@ struct Copied : Reference
367374/* * A piece of block content
368375
369376 The top level is a list of blocks.
377+
378+ There are two types of blocks: headings and paragraphs
370379*/
371380struct MRDOCS_DECL
372381 Block : Node
@@ -447,7 +456,7 @@ struct Heading : Block
447456 bool equals (const Node& other) const noexcept override
448457 {
449458 return kind == other.kind &&
450- *this == static_cast <const Heading&>(other);
459+ *this == dynamic_cast <const Heading&>(other);
451460 }
452461};
453462
@@ -494,7 +503,7 @@ struct Brief : Paragraph
494503 bool equals (const Node& other) const noexcept override
495504 {
496505 return kind == other.kind &&
497- *this == static_cast <const Brief&>(other);
506+ *this == dynamic_cast <const Brief&>(other);
498507 }
499508};
500509
@@ -520,7 +529,7 @@ struct Admonition : Paragraph
520529 bool equals (const Node& other) const noexcept override
521530 {
522531 return kind == other.kind &&
523- *this == static_cast <const Admonition&>(other);
532+ *this == dynamic_cast <const Admonition&>(other);
524533 }
525534};
526535
@@ -542,7 +551,7 @@ struct Code : Paragraph
542551 bool equals (const Node& other) const noexcept override
543552 {
544553 return kind == other.kind &&
545- *this == static_cast <const Code&>(other);
554+ *this == dynamic_cast <const Code&>(other);
546555 }
547556};
548557
@@ -563,7 +572,31 @@ struct ListItem : Paragraph
563572 bool equals (const Node& other) const noexcept override
564573 {
565574 return kind == other.kind &&
566- *this == static_cast <const ListItem&>(other);
575+ *this == dynamic_cast <const ListItem&>(other);
576+ }
577+ };
578+
579+ /* * A list of list items
580+ */
581+ struct UnorderedList : Paragraph
582+ {
583+ static constexpr Kind static_kind = Kind::unordered_list;
584+
585+ // Vector of list items
586+ List<ListItem> items;
587+
588+ UnorderedList ()
589+ : Paragraph(Kind::unordered_list)
590+ {
591+ }
592+
593+ bool operator ==(const UnorderedList&)
594+ const noexcept = default ;
595+
596+ bool equals (const Node& other) const noexcept override
597+ {
598+ return kind == other.kind &&
599+ *this == dynamic_cast <const UnorderedList&>(other);
567600 }
568601};
569602
@@ -784,6 +817,8 @@ visit(
784817 return f.template operator ()<Copied>(std::forward<Args>(args)...);
785818 case Kind::list_item:
786819 return f.template operator ()<ListItem>(std::forward<Args>(args)...);
820+ case Kind::unordered_list:
821+ return f.template operator ()<UnorderedList>(std::forward<Args>(args)...);
787822 case Kind::paragraph:
788823 return f.template operator ()<Paragraph>(std::forward<Args>(args)...);
789824 case Kind::param:
@@ -851,6 +886,8 @@ visit(
851886 return visitor.template visit <Copied>();
852887 case Kind::list_item:
853888 return visitor.template visit <ListItem>();
889+ case Kind::unordered_list:
890+ return visitor.template visit <UnorderedList>();
854891 case Kind::param:
855892 return visitor.template visit <Param>();
856893 case Kind::returns:
@@ -917,12 +954,11 @@ class Corpus;
917954
918955/* * A processed Doxygen-style comment attached to a declaration.
919956*/
920- class MRDOCS_DECL
957+ struct MRDOCS_DECL
921958 Javadoc
922959{
923960 doc::List<doc::Block> blocks_;
924961
925- public:
926962 /* * Constructor.
927963 */
928964 MRDOCS_DECL
0 commit comments