forked from qt-creator/qt-creator
C++: Automatic Doxygen comment blocks generation
This improves our completion support for documentation comments. It's now possible to have a Doxygen block generated when hitting enter after a /** or /*! comment start. A couple other related options are also available. Task-number: QTCREATORBUG-2752 Task-number: QTCREATORBUG-3165 Change-Id: I1c81c0b4b370eb1d409ef72a9c7f22c357f202f4 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@nokia.com> Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
This commit is contained in:
71
src/plugins/cpptools/doxygengenerator.h
Normal file
71
src/plugins/cpptools/doxygengenerator.h
Normal file
@@ -0,0 +1,71 @@
|
||||
#ifndef DOXYGEGENERATOR_H
|
||||
#define DOXYGEGENERATOR_H
|
||||
|
||||
#include "cpptools_global.h"
|
||||
|
||||
#include <cplusplus/Overview.h>
|
||||
|
||||
#include <QtCore/QLatin1String>
|
||||
#include <QtGui/QTextCursor>
|
||||
|
||||
namespace CPlusPlus {
|
||||
class DeclarationAST;
|
||||
}
|
||||
|
||||
namespace CppTools {
|
||||
|
||||
class CPPTOOLS_EXPORT DoxygenGenerator
|
||||
{
|
||||
public:
|
||||
DoxygenGenerator();
|
||||
|
||||
enum DocumentationStyle {
|
||||
JavaStyle,
|
||||
QtStyle
|
||||
};
|
||||
|
||||
void setStyle(DocumentationStyle style);
|
||||
void setStartComment(bool start);
|
||||
void setGenerateBrief(bool gen);
|
||||
void setAddLeadingAsterisks(bool add);
|
||||
|
||||
QString generate(QTextCursor cursor);
|
||||
QString generate(QTextCursor cursor, CPlusPlus::DeclarationAST *decl);
|
||||
|
||||
private:
|
||||
QChar startMark() const;
|
||||
QChar styleMark() const;
|
||||
|
||||
enum Command {
|
||||
BriefCommand,
|
||||
ParamCommand,
|
||||
ReturnCommand
|
||||
};
|
||||
static QString commandSpelling(Command command);
|
||||
|
||||
void writeStart(QString *comment) const;
|
||||
void writeEnd(QString *comment) const;
|
||||
void writeContinuation(QString *comment) const;
|
||||
void writeNewLine(QString *comment) const;
|
||||
void writeCommand(QString *comment,
|
||||
Command command,
|
||||
const QString &commandContent = QString()) const;
|
||||
void writeBrief(QString *comment,
|
||||
const QString &brief,
|
||||
const QString &prefix = QString(),
|
||||
const QString &suffix = QString());
|
||||
|
||||
void assignCommentOffset(QTextCursor cursor);
|
||||
QString offsetString() const;
|
||||
|
||||
bool m_addLeadingAsterisks;
|
||||
bool m_generateBrief;
|
||||
bool m_startComment;
|
||||
DocumentationStyle m_style;
|
||||
CPlusPlus::Overview m_printer;
|
||||
int m_commentOffset;
|
||||
};
|
||||
|
||||
} // CppTools
|
||||
|
||||
#endif // DOXYGEGENERATOR_H
|
||||
Reference in New Issue
Block a user