Skip to content

Commit fcadb69

Browse files
committed
Replaced DocNode::kind() by dynamic_cast checks
1 parent 3d7c85d commit fcadb69

10 files changed

+439
-587
lines changed

src/docbookvisitor.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,12 +1501,7 @@ DB_VIS_C
15011501
if (m_hide) return;
15021502
m_t << " <row>\n";
15031503

1504-
DocParamSect *sect = 0;
1505-
if (pl->parent() && pl->parent()->kind()==DocNode::Kind_ParamSect)
1506-
{
1507-
sect=dynamic_cast<DocParamSect*>(pl->parent());
1508-
}
1509-
1504+
DocParamSect *sect = pl->parent() ? dynamic_cast<DocParamSect*>(pl->parent()) : 0;
15101505
if (sect && sect->hasInOutSpecifier())
15111506
{
15121507
m_t << "<entry>";
@@ -1533,17 +1528,20 @@ DB_VIS_C
15331528
m_t << "<entry>";
15341529
for (const auto &type : pl->paramTypes())
15351530
{
1536-
if (type->kind()==DocNode::Kind_Word)
1531+
DocWord *word = dynamic_cast<DocWord* >(type.get());
1532+
DocLinkedWord *linkedWord = dynamic_cast<DocLinkedWord*>(type.get());
1533+
DocSeparator *sep = dynamic_cast<DocSeparator* >(type.get());
1534+
if (word)
15371535
{
1538-
visit(dynamic_cast<DocWord*>(type.get()));
1536+
visit(word);
15391537
}
1540-
else if (type->kind()==DocNode::Kind_LinkedWord)
1538+
else if (linkedWord)
15411539
{
1542-
visit(dynamic_cast<DocLinkedWord*>(type.get()));
1540+
visit(linkedWord);
15431541
}
1544-
else if (type->kind()==DocNode::Kind_Sep)
1542+
else if (sep)
15451543
{
1546-
m_t << " " << dynamic_cast<DocSeparator *>(type.get())->chars() << " ";
1544+
m_t << " " << sep->chars() << " ";
15471545
}
15481546

15491547
}
@@ -1564,13 +1562,15 @@ DB_VIS_C
15641562
{
15651563
m_t << ", ";
15661564
}
1567-
if (param->kind()==DocNode::Kind_Word)
1565+
DocWord *word = dynamic_cast<DocWord* >(param.get());
1566+
DocLinkedWord *linkedWord = dynamic_cast<DocLinkedWord*>(param.get());
1567+
if (word)
15681568
{
1569-
visit(dynamic_cast<DocWord*>(param.get()));
1569+
visit(word);
15701570
}
1571-
else if (param->kind()==DocNode::Kind_LinkedWord)
1571+
else if (linkedWord)
15721572
{
1573-
visit(dynamic_cast<DocLinkedWord*>(param.get()));
1573+
visit(linkedWord);
15741574
}
15751575
cnt++;
15761576
}

0 commit comments

Comments
 (0)