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 47 of file singlecomment.cpp.

48{
49 QCString fileName = "index.html";
50 std::shared_ptr<Entry> root = std::make_shared<Entry>();
51
52 // 1. Pass input through commentcnv
53 std::string convBuf;
54 convBuf.reserve(text.size()+1024);
55 convertCppComments(text,convBuf,"input.md");
56
57 // 2. Pass result through commentscan
58 MarkdownOutlineParser markdownParser;
59 CommentScanner scanner;
60 int lineNr=1;
61 scanner.enterFile(fileName,lineNr);
62 int pos=0;
63 bool needsEntry=false;
65 Markdown markdown(fileName,1,0);
66 QCString processedDocs = markdown.process(convBuf.data(),lineNr,true);
67 std::shared_ptr<Entry> current = std::make_shared<Entry>();
68 current->lang = SrcLangExt::Markdown;
69 current->fileName = fn;
70 current->docFile = fn;
71 current->docLine = 1;
72 auto prot = Protection::Public;
73 while (scanner.parseCommentBlock(&markdownParser,
74 current.get(),
75 processedDocs,
76 fileName,lineNr,
77 false, // isBrief
78 false, // isAutoBriefOn
79 false, // isInbody
80 prot,
81 pos,
82 needsEntry,
83 true, // markdownSupport
84 &guards))
85 {
86 if (needsEntry)
87 {
88 QCString docFile = current->docFile;
89 root->moveToSubEntryAndRefresh(current);
90 current->lang = SrcLangExt::Markdown;
91 current->docFile = docFile;
92 current->docLine = lineNr;
93 }
94 }
95 root->moveToSubEntryAndKeep(current);
96 scanner.leaveFile(fileName,lineNr);
97
98 // 3. Pass result through docparser
99 for (const auto &child : root->children())
100 {
101 if (!child->brief.isEmpty())
102 {
103 generateHtmlOutput(QCString(fn),child->brief);
104 }
105 if (!child->doc.isEmpty())
106 {
107 generateHtmlOutput(QCString(fn),child->doc);
108 }
109 }
110}
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)
@ Public
Definition types.h:26
@ Markdown
Definition types.h:57

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

Referenced by parseInput().