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

56{
57 DString fileName = "index.html";
58 std::shared_ptr<Entry> root = std::make_shared<Entry>();
59
60 // 1. Pass input through commentcnv
61 std::string convBuf;
62 convBuf.reserve(text.size()+1024);
63 convertCppComments(text,convBuf,"input.md");
64
65 // 2. Pass result through commentscan
66 MarkdownOutlineParser markdownParser;
67 CommentScanner scanner;
68 int lineNr=1;
69 scanner.enterFile(fileName,lineNr);
70 int pos=0;
71 bool needsEntry=false;
73 Markdown markdown(fileName,1,0);
74 DString processedDocs = markdown.process(convBuf.data(),lineNr,true);
75 std::shared_ptr<Entry> current = std::make_shared<Entry>();
76 current->lang = SrcLangExt::Markdown;
77 current->fileName = fn;
78 current->docFile = fn;
79 current->docLine = 1;
80 auto prot = Protection::Public;
81 while (scanner.parseCommentBlock(&markdownParser,
82 current.get(),
83 processedDocs,
84 fileName,lineNr,
85 false, // isBrief
86 false, // isAutoBriefOn
87 false, // isInbody
88 prot,
89 pos,
90 needsEntry,
91 true, // markdownSupport
92 &guards))
93 {
94 if (needsEntry)
95 {
96 DString docFile = current->docFile;
97 root->moveToSubEntryAndRefresh(current);
98 current->lang = SrcLangExt::Markdown;
99 current->docFile = docFile;
100 current->docLine = lineNr;
101 }
102 }
103 root->moveToSubEntryAndKeep(current);
104 scanner.leaveFile(fileName,lineNr);
105
106 // 3. Pass result through docparser
107 for (const auto &child : root->children())
108 {
109 if (!child->brief.empty())
110 {
111 generateHtmlOutput(fn,child->brief);
112 }
113 if (!child->doc.empty())
114 {
115 generateHtmlOutput(fn,child->doc);
116 }
117 }
118}
void enterFile(const DString &fileName, int lineNr)
void leaveFile(const DString &fileName, int lineNr)
bool parseCommentBlock(OutlineParserInterface *parser, Entry *curEntry, const DString &comment, const DString &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.
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
Helper class to process markdown formatted text.
Definition markdown.h:33
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 DString &fileName, const DString &doc)

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

Referenced by parseInput().