diff options
author | Leandro Melo <leandro.melo@nokia.com> | 2011-12-07 15:05:02 +0100 |
---|---|---|
committer | Leandro Melo <leandro.melo@nokia.com> | 2011-12-09 10:25:59 +0100 |
commit | beede7d7cff3e740ec0b0053ae9e382693e7f42c (patch) | |
tree | 74c0ffc3cad7569aa2f7946a2884dfd6d89c7361 /src/plugins/cpptools/doxygengenerator.h | |
parent | 24b4c127372c6a9c496c8d0bd812696f6ad0f4d4 (diff) | |
download | qt-creator-beede7d7cff3e740ec0b0053ae9e382693e7f42c.tar.gz |
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>
Diffstat (limited to 'src/plugins/cpptools/doxygengenerator.h')
-rw-r--r-- | src/plugins/cpptools/doxygengenerator.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/plugins/cpptools/doxygengenerator.h b/src/plugins/cpptools/doxygengenerator.h new file mode 100644 index 0000000000..78b6b6b914 --- /dev/null +++ b/src/plugins/cpptools/doxygengenerator.h @@ -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 |