forked from qt-creator/qt-creator
CppEditor: De-obfuscate DoxygenGenerator
- m_startComment was always false. - One of the two public generate() functions is an internal helper. Change-Id: I03a860bf7f44aab8f98c5656bc2b36f9fe5e1ef2 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -342,7 +342,6 @@ static bool trySplitComment(TextEditor::TextEditorWidget *editorWidget,
|
|||||||
doxygen.setStyle(style);
|
doxygen.setStyle(style);
|
||||||
doxygen.setAddLeadingAsterisks(settings.leadingAsterisks);
|
doxygen.setAddLeadingAsterisks(settings.leadingAsterisks);
|
||||||
doxygen.setGenerateBrief(settings.generateBrief);
|
doxygen.setGenerateBrief(settings.generateBrief);
|
||||||
doxygen.setStartComment(false);
|
|
||||||
|
|
||||||
// Move until we reach any possibly meaningful content.
|
// Move until we reach any possibly meaningful content.
|
||||||
while (textDocument->characterAt(cursor.position()).isSpace()
|
while (textDocument->characterAt(cursor.position()).isSpace()
|
||||||
|
|||||||
@@ -29,11 +29,6 @@ void DoxygenGenerator::setStyle(DocumentationStyle style)
|
|||||||
m_style = style;
|
m_style = style;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoxygenGenerator::setStartComment(bool start)
|
|
||||||
{
|
|
||||||
m_startComment = start;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DoxygenGenerator::setGenerateBrief(bool get)
|
void DoxygenGenerator::setGenerateBrief(bool get)
|
||||||
{
|
{
|
||||||
m_generateBrief = get;
|
m_generateBrief = get;
|
||||||
@@ -136,8 +131,6 @@ QString DoxygenGenerator::generate(QTextCursor cursor, DeclarationAST *decl)
|
|||||||
assignCommentOffset(cursor);
|
assignCommentOffset(cursor);
|
||||||
|
|
||||||
QString comment;
|
QString comment;
|
||||||
if (m_startComment)
|
|
||||||
writeStart(&comment);
|
|
||||||
writeNewLine(&comment);
|
writeNewLine(&comment);
|
||||||
writeContinuation(&comment);
|
writeContinuation(&comment);
|
||||||
|
|
||||||
@@ -221,13 +214,6 @@ QString DoxygenGenerator::generate(QTextCursor cursor, DeclarationAST *decl)
|
|||||||
return comment;
|
return comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
QChar DoxygenGenerator::startMark() const
|
|
||||||
{
|
|
||||||
if (m_style == QtStyle)
|
|
||||||
return QLatin1Char('!');
|
|
||||||
return QLatin1Char('*');
|
|
||||||
}
|
|
||||||
|
|
||||||
QChar DoxygenGenerator::styleMark() const
|
QChar DoxygenGenerator::styleMark() const
|
||||||
{
|
{
|
||||||
if (m_style == QtStyle || m_style == CppStyleA || m_style == CppStyleB)
|
if (m_style == QtStyle || m_style == CppStyleA || m_style == CppStyleB)
|
||||||
@@ -246,16 +232,6 @@ QString DoxygenGenerator::commandSpelling(Command command)
|
|||||||
return QLatin1String("brief ");
|
return QLatin1String("brief ");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoxygenGenerator::writeStart(QString *comment) const
|
|
||||||
{
|
|
||||||
if (m_style == CppStyleA)
|
|
||||||
comment->append(QLatin1String("///"));
|
|
||||||
if (m_style == CppStyleB)
|
|
||||||
comment->append(QLatin1String("//!"));
|
|
||||||
else
|
|
||||||
comment->append(offsetString() + "/*" + startMark());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DoxygenGenerator::writeEnd(QString *comment) const
|
void DoxygenGenerator::writeEnd(QString *comment) const
|
||||||
{
|
{
|
||||||
if (m_style == CppStyleA)
|
if (m_style == CppStyleA)
|
||||||
|
|||||||
@@ -26,17 +26,15 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void setStyle(DocumentationStyle style);
|
void setStyle(DocumentationStyle style);
|
||||||
void setStartComment(bool start);
|
|
||||||
void setGenerateBrief(bool gen);
|
void setGenerateBrief(bool gen);
|
||||||
void setAddLeadingAsterisks(bool add);
|
void setAddLeadingAsterisks(bool add);
|
||||||
|
|
||||||
QString generate(QTextCursor cursor,
|
QString generate(QTextCursor cursor,
|
||||||
const CPlusPlus::Snapshot &snapshot,
|
const CPlusPlus::Snapshot &snapshot,
|
||||||
const Utils::FilePath &documentFilePath);
|
const Utils::FilePath &documentFilePath);
|
||||||
QString generate(QTextCursor cursor, CPlusPlus::DeclarationAST *decl);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QChar startMark() const;
|
QString generate(QTextCursor cursor, CPlusPlus::DeclarationAST *decl);
|
||||||
QChar styleMark() const;
|
QChar styleMark() const;
|
||||||
|
|
||||||
enum Command {
|
enum Command {
|
||||||
@@ -46,7 +44,6 @@ private:
|
|||||||
};
|
};
|
||||||
static QString commandSpelling(Command command);
|
static QString commandSpelling(Command command);
|
||||||
|
|
||||||
void writeStart(QString *comment) const;
|
|
||||||
void writeEnd(QString *comment) const;
|
void writeEnd(QString *comment) const;
|
||||||
void writeContinuation(QString *comment) const;
|
void writeContinuation(QString *comment) const;
|
||||||
void writeNewLine(QString *comment) const;
|
void writeNewLine(QString *comment) const;
|
||||||
@@ -63,7 +60,6 @@ private:
|
|||||||
|
|
||||||
bool m_addLeadingAsterisks = true;
|
bool m_addLeadingAsterisks = true;
|
||||||
bool m_generateBrief = true;
|
bool m_generateBrief = true;
|
||||||
bool m_startComment = true;
|
|
||||||
DocumentationStyle m_style = QtStyle;
|
DocumentationStyle m_style = QtStyle;
|
||||||
CPlusPlus::Overview m_printer;
|
CPlusPlus::Overview m_printer;
|
||||||
QString m_commentOffset;
|
QString m_commentOffset;
|
||||||
|
|||||||
Reference in New Issue
Block a user