Doxygen
Loading...
Searching...
No Matches
commentscan.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2015 by Dimitri van Heesch.
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation under the terms of the GNU General Public License is hereby
7 * granted. No representations are made about the suitability of this software
8 * for any purpose. It is provided "as is" without express or implied warranty.
9 * See the GNU General Public License for more details.
10 *
11 * Documents produced by Doxygen are derivative works derived from the
12 * input used in their production; they are not affected by this license.
13 *
14 */
15
16#ifndef COMMENTSCAN_H
17#define COMMENTSCAN_H
18
19#include <memory>
20#include <stack>
21
22#include "types.h"
23#include "construct.h"
24
25class Entry;
27
29{
30 public:
33 void setEnabled(bool enabled) { m_enabled = enabled; }
34 bool isEnabled() const { return m_enabled; }
36 bool isEnabledFound() const { return m_enabledFound; }
37 bool parentVisible() const { return m_parentVisible; }
38 void setElse() { m_hasElse = true; }
39 bool hasElse() const { return m_hasElse; }
40
41 private:
43 bool m_enabledFound = false;
44 bool m_enabled = false;
45 bool m_hasElse = false;
46};
47
48using GuardedSectionStack = std::stack<GuardedSection>;
49
50/** @file
51 * @brief Interface for the comment block scanner */
52
54{
55 public:
59
60 /** Invokes the comment block parser with the request to parse a
61 * single comment block.
62 * @param[in] parser The language parse that invoked this function.
63 * The comment block parse may invoke
64 * ParserInterface::parsePrototype() in order to parse
65 * the argument of a @@fn command.
66 * @param[in] curEntry The Entry to which the comment block belongs.
67 * Any information (like documentation) that is found in
68 * the comment block will be stored in this entry.
69 * @param[in] comment A string representing the actual comment block.
70 * Note that leading *'s are already stripped from the comment block.
71 * @param[in] fileName The name of the file in which the comment is found.
72 * Mainly used for producing warnings.
73 * @param[in,out] lineNr The line number at which the comment block was found.
74 * When the function returns it will be set to the last line parsed.
75 * @param[in] isBrief TRUE iff this comment block represents a brief description.
76 * @param[in] isJavadocStyle TRUE iff this comment block is in "Javadoc" style.
77 * This means that it starts as a brief description until the end of
78 * the sentences is found and then proceeds as a detailed description.
79 * @param[in] isInbody TRUE iff this comment block is located in the body of
80 * a function.
81 * @param[in,out] prot The protection level in which this comment block was
82 * found. Commands in the comment block may override this.
83 * @param[in,out] position The character position within \a comment where the
84 * comment block starts. Typically used in case the comment block
85 * contains multiple structural commands.
86 * @param[out] newEntryNeeded Boolean that is TRUE if the comment block parser
87 * finds that a the comment block finishes the entry and a new one
88 * needs to be started.
89 * @param[in] markdownEnabled Indicates if markdown specific processing should be done.
90 * @param[inout] guards Tracks nested conditional sections (if,ifnot,..)
91 * @returns TRUE if the comment requires further processing. The
92 * parameter \a newEntryNeeded will typically be true in this case and
93 * \a position will indicate the offset inside the \a comment string
94 * where to proceed parsing. FALSE indicates no further processing is
95 * needed.
96 */
97 bool parseCommentBlock(OutlineParserInterface *parser,
98 Entry *curEntry,
99 const QCString &comment,
100 const QCString &fileName,
101 int &lineNr,
102 bool isBrief,
103 bool isJavadocStyle,
104 bool isInbody,
105 Protection &prot,
106 int &position,
107 bool &newEntryNeeded,
108 bool markdownEnabled,
109 GuardedSectionStack *guards
110 );
111 void initGroupInfo(Entry *entry);
112 void enterFile(const QCString &fileName,int lineNr);
113 void leaveFile(const QCString &fileName,int lineNr);
114 void enterCompound(const QCString &fileName,int line,const QCString &name);
115 void leaveCompound(const QCString &fileName,int line,const QCString &name);
116 void open(Entry *e,const QCString &fileName,int line,bool implicit=false);
117 void close(Entry *e,const QCString &fileName,int line,bool foundInline,bool implicit=false);
118 private:
119 struct Private;
120 std::unique_ptr<Private> p;
121};
122
123#endif
void close(Entry *e, const QCString &fileName, int line, bool foundInline, bool implicit=false)
void leaveCompound(const QCString &fileName, int line, const QCString &name)
void open(Entry *e, const QCString &fileName, int line, bool implicit=false)
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 initGroupInfo(Entry *entry)
std::unique_ptr< Private > p
void enterCompound(const QCString &fileName, int line, const QCString &name)
void enterFile(const QCString &fileName, int lineNr)
void leaveFile(const QCString &fileName, int lineNr)
Represents an unstructured piece of information, about an entity found in the sources.
Definition entry.h:116
bool isEnabledFound() const
Definition commentscan.h:36
bool hasElse() const
Definition commentscan.h:39
bool isEnabled() const
Definition commentscan.h:34
void setEnabled(bool enabled)
Definition commentscan.h:33
bool parentVisible() const
Definition commentscan.h:37
GuardedSection(bool parentVisible)
Definition commentscan.h:31
void setEnabledFound()
Definition commentscan.h:35
Abstract interface for outline parsers.
Definition parserintf.h:42
std::stack< GuardedSection > GuardedSectionStack
Definition commentscan.h:48
#define NON_COPYABLE(cls)
Macro to help implementing the rule of 5 for a non-copyable & movable class.
Definition construct.h:37
This file contains a number of basic enums and types.
Protection
Protection level of members.
Definition types.h:26
const char * comment