Doxygen
Loading...
Searching...
No Matches
singlecomment.h File Reference
#include <string>
Include dependency graph for singlecomment.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void generateHtmlForComment (const std::string &fileName, const std::string &text)
 Helper for implemented the -c option of doxygen, which produces HTML output for a given doxygen formatted string.

Function Documentation

◆ generateHtmlForComment()

void generateHtmlForComment ( const std::string & fileName,
const std::string & text )

Helper for implemented the -c option of doxygen, which produces HTML output for a given doxygen formatted string.

Definition at line 54 of file singlecomment.cpp.

55{
56 QCString fileName = "index.html";
57 std::shared_ptr<Entry> root = std::make_shared<Entry>();
58
59 // 1. Pass input through commentcnv
60 std::string convBuf;
61 convBuf.reserve(text.size()+1024);
62 convertCppComments(text,convBuf,"input.md");
63
64 // 2. Pass result through commentscan
65 MarkdownOutlineParser markdownParser;
66 CommentScanner scanner;
67 int lineNr=1;
68 scanner.enterFile(fileName,lineNr);
69 int pos=0;
70 bool needsEntry=false;
72 Markdown markdown(fileName,1,0);
73 QCString processedDocs = markdown.process(convBuf.data(),lineNr,true);
74 std::shared_ptr<Entry> current = std::make_shared<Entry>();
75 current->lang = SrcLangExt::Markdown;
76 current->fileName = fn;
77 current->docFile = fn;
78 current->docLine = 1;
79 auto prot = Protection::Public;
80 while (scanner.parseCommentBlock(&markdownParser,
81 current.get(),
82 processedDocs,
83 fileName,lineNr,
84 false, // isBrief
85 false, // isAutoBriefOn
86 false, // isInbody
87 prot,
88 pos,
89 needsEntry,
90 true, // markdownSupport
91 &guards))
92 {
93 if (needsEntry)
94 {
95 QCString docFile = current->docFile;
96 root->moveToSubEntryAndRefresh(current);
97 current->lang = SrcLangExt::Markdown;
98 current->docFile = docFile;
99 current->docLine = lineNr;
100 }
101 }
102 root->moveToSubEntryAndKeep(current);
103 scanner.leaveFile(fileName,lineNr);
104
105 // 3. Pass result through docparser
106 for (const auto &child : root->children())
107 {
108 if (!child->brief.isEmpty())
109 {
110 generateHtmlOutput(fn,child->brief);
111 }
112 if (!child->doc.isEmpty())
113 {
114 generateHtmlOutput(fn,child->doc);
115 }
116 }
117}
bool parseCommentBlock(OutlineParserInterface *parser, Entry *curEntry, const QCString &comment, const QCString &fileName, int &lineNr, bool isBrief, bool isJavadocStyle, bool isInbody, Protection &prot, int &position, bool &newEntryNeeded, bool markdownEnabled, GuardedSectionStack *guards)
Invokes the comment block parser with the request to parse a single comment block.
void enterFile(const QCString &fileName, int lineNr)
void leaveFile(const QCString &fileName, int lineNr)
Helper class to process markdown formatted text.
Definition markdown.h:32
This is an alternative implementation of QCString.
Definition qcstring.h:101
void convertCppComments(const std::string &inBuf, std::string &outBuf, const std::string &fn)
Converts the comments in a file.
std::stack< GuardedSection > GuardedSectionStack
Definition commentscan.h:48
static void generateHtmlOutput(const QCString &fileName, const QCString &doc)

References convertCppComments(), CommentScanner::enterFile(), generateHtmlOutput(), CommentScanner::leaveFile(), CommentScanner::parseCommentBlock(), and Markdown::process().

Referenced by parseInput().