Skip to content

Commit c54297c

Browse files
committed
pull_request doxygen#11336 Minor code changes
1 parent 0a223f1 commit c54297c

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

src/dotclassgraph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ static QCString joinLabels(const StringSet &ss)
243243
}
244244
if (maxLabels!=0 && count==maxLabels)
245245
{
246-
label+="\n...";
246+
label+="\n ...";
247247
}
248248
}
249249
return label;

src/dotnode.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ static void writeBoxMemberList(TextStream &t,
175175
label+="()";
176176
}
177177
}
178-
t << DotNode::convertLabel(label,true);
178+
t << DotNode::convertLabel(label,DotNode::LabelStyle::List);
179179
t << br << tr_end;
180180
lineWritten = true;
181181
count++;
@@ -193,7 +193,7 @@ static void writeBoxMemberList(TextStream &t,
193193
}
194194
}
195195

196-
QCString DotNode::convertLabel(const QCString &l, bool htmlLike, bool tableLike)
196+
QCString DotNode::convertLabel(const QCString &l, LabelStyle style)
197197
{
198198
QCString bBefore("\\_/<({[: =-+@%#~?$"); // break before character set
199199
QCString bAfter(">]),:;|"); // break after character set
@@ -207,20 +207,20 @@ QCString DotNode::convertLabel(const QCString &l, bool htmlLike, bool tableLike)
207207
int foldLen = Config_getInt(DOT_WRAP_THRESHOLD); // ideal text length
208208
QCString br;
209209
QCString br1;
210-
if (tableLike)
210+
if (style==LabelStyle::Table)
211211
{
212212
result += "<<TABLE CELLBORDER=\"0\" BORDER=\"0\"><TR><TD VALIGN=\"top\" ALIGN=\"LEFT\" CELLPADDING=\"1\" CELLSPACING=\"0\">";
213213
}
214-
if (htmlLike)
214+
if (style==LabelStyle::List)
215215
{
216216
br = "<BR ALIGN=\"LEFT\"/>";
217217
}
218-
else if (tableLike)
218+
else if (style==LabelStyle::Table)
219219
{
220220
br1 = "</TD></TR>\n<TR><TD VALIGN=\"top\" ALIGN=\"LEFT\" CELLPADDING=\"1\" CELLSPACING=\"0\">";
221221
br = br1 + "&nbsp;&nbsp;";
222222
}
223-
else
223+
else // style==LabelStyle::Plain
224224
{
225225
br = "\\l";
226226
}
@@ -229,7 +229,7 @@ QCString DotNode::convertLabel(const QCString &l, bool htmlLike, bool tableLike)
229229
char c = p[idx++];
230230
char cs[2] = { c, 0 };
231231
const char *replacement = cs;
232-
if (htmlLike || tableLike)
232+
if (style!=LabelStyle::Plain)
233233
{
234234
switch(c)
235235
{
@@ -242,7 +242,7 @@ QCString DotNode::convertLabel(const QCString &l, bool htmlLike, bool tableLike)
242242
case '&': replacement="&amp;"; break;
243243
}
244244
}
245-
else
245+
else // style==LabelStyle::Plain
246246
{
247247
switch(c)
248248
{
@@ -260,7 +260,7 @@ QCString DotNode::convertLabel(const QCString &l, bool htmlLike, bool tableLike)
260260
// boxes and at the same time prevent ugly breaks
261261
if (c=='\n')
262262
{
263-
if (tableLike)
263+
if (style==LabelStyle::Table)
264264
{
265265
result+=br1;
266266
}
@@ -301,11 +301,11 @@ QCString DotNode::convertLabel(const QCString &l, bool htmlLike, bool tableLike)
301301
charsLeft--;
302302
pc=c;
303303
}
304-
if (htmlLike)
304+
if (style==LabelStyle::List)
305305
{
306306
result = result.stripWhiteSpace();
307307
}
308-
if (tableLike)
308+
if (style==LabelStyle::Table)
309309
{
310310
result += "</TD></TR>\n</TABLE>>";
311311
}
@@ -447,7 +447,7 @@ void DotNode::writeLabel(TextStream &t, GraphType gt) const
447447
constexpr auto empty_line = "<TR><TD COLSPAN=\"2\" CELLPADDING=\"1\" CELLSPACING=\"0\">&nbsp;</TD></TR>\n";
448448
//printf("DotNode::writeBox for %s\n",qPrint(m_classDef->name()));
449449
t << "<<TABLE CELLBORDER=\"0\" BORDER=\"1\">";
450-
t << hr_start << convertLabel(m_label,true) << hr_end;
450+
t << hr_start << convertLabel(m_label,LabelStyle::List) << hr_end;
451451
auto dotUmlDetails = Config_getEnum(DOT_UML_DETAILS);
452452
if (dotUmlDetails!=DOT_UML_DETAILS_t::NONE)
453453
{
@@ -504,11 +504,11 @@ void DotNode::writeLabel(TextStream &t, GraphType gt) const
504504
else if (m_truncated == Truncated)
505505
t << "<<i>" << convertToXML(m_label) << "</i>>";
506506
else
507-
t << '"' << convertLabel(m_label) << '"';
507+
t << '"' << convertLabel(m_label,LabelStyle::Plain) << '"';
508508
}
509509
else // standard look
510510
{
511-
t << "label=" << '"' << convertLabel(m_label) << '"';
511+
t << "label=" << '"' << convertLabel(m_label,LabelStyle::Plain) << '"';
512512
}
513513
}
514514

@@ -634,7 +634,7 @@ void DotNode::writeArrow(TextStream &t,
634634
t << ",tooltip=\" \""; // space in tooltip is required otherwise still something like 'Node0 -> Node1' is used
635635
if (!ei->label().isEmpty())
636636
{
637-
t << ",label=" << convertLabel(ei->label(),false,true) << " ,fontcolor=\"grey\" ";
637+
t << ",label=" << convertLabel(ei->label(),LabelStyle::Table) << " ,fontcolor=\"grey\" ";
638638
}
639639
if (Config_getBool(UML_LOOK) &&
640640
eProps->arrowStyleMap[ei->color()] &&

src/dotnode.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ using EdgeInfoVector = std::vector<EdgeInfo>;
6767
class DotNode
6868
{
6969
public:
70+
enum class LabelStyle { Plain, List, Table };
7071
static constexpr auto placeholderUrl = "-";
7172
static void deleteNodes(DotNode* node);
72-
static QCString convertLabel(const QCString& , bool htmlLike=false, bool tableLike=false);
73+
static QCString convertLabel(const QCString&, LabelStyle=LabelStyle::Plain);
7374
DotNode(DotGraph *graph,const QCString &lab,const QCString &tip,const QCString &url,
7475
bool rootNode=FALSE,const ClassDef *cd=nullptr);
7576

0 commit comments

Comments
 (0)