Doxygen
Loading...
Searching...
No Matches
DocbookCodeGenerator Class Reference

#include <src/docbookgen.h>

+ Inheritance diagram for DocbookCodeGenerator:
+ Collaboration diagram for DocbookCodeGenerator:

Public Member Functions

 DocbookCodeGenerator (TextStream *t)
 
void setTextStream (TextStream *t)
 
OutputType type () const override
 
std::unique_ptr< OutputCodeIntfclone () override
 
void codify (const QCString &text) override
 
void stripCodeComments (bool b) override
 
void startSpecialComment () override
 
void endSpecialComment () override
 
void setStripIndentAmount (size_t amount) override
 
void writeCodeLink (CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip) override
 
void writeTooltip (const QCString &, const DocLinkInfo &, const QCString &, const QCString &, const SourceLinkInfo &, const SourceLinkInfo &) override
 
void startCodeLine (int) override
 
void endCodeLine () override
 
void startFontClass (const QCString &colorClass) override
 
void endFontClass () override
 
void writeCodeAnchor (const QCString &) override
 
void writeLineNumber (const QCString &extRef, const QCString &compId, const QCString &anchorId, int l, bool writeLineAnchor) override
 
void startCodeFragment (const QCString &style) override
 
void endCodeFragment (const QCString &style) override
 
void startFold (int, const QCString &, const QCString &) override
 
void endFold () override
 
void setRelativePath (const QCString &path)
 
void setSourceFileName (const QCString &sourceFileName)
 
QCString sourceFileName ()
 
void finish ()
 
- Public Member Functions inherited from OutputCodeIntf
 OutputCodeIntf ()=default
 

Private Member Functions

void writeCodeLinkLine (CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip, bool)
 

Private Attributes

TextStreamm_t
 
QCString m_refId
 
QCString m_external
 
int m_lineNumber = -1
 
size_t m_col = 0
 
bool m_insideCodeLine = false
 
bool m_insideSpecialHL = false
 
QCString m_relPath
 
QCString m_sourceFileName
 
bool m_stripCodeComments = false
 
bool m_hide = false
 
size_t m_stripIndentAmount = 0
 

Detailed Description

Definition at line 47 of file docbookgen.h.

Constructor & Destructor Documentation

◆ DocbookCodeGenerator()

DocbookCodeGenerator::DocbookCodeGenerator ( TextStream * t)

Definition at line 162 of file docbookgen.cpp.

162 : m_t(t)
163{
164}
TextStream * m_t
Definition docbookgen.h:89

References m_t.

Member Function Documentation

◆ clone()

std::unique_ptr< OutputCodeIntf > DocbookCodeGenerator::clone ( )
inlineoverridevirtual

Implements OutputCodeIntf.

Definition at line 54 of file docbookgen.h.

54{ return std::make_unique<DocbookCodeGenerator>(m_t); }

References m_t.

◆ codify()

void DocbookCodeGenerator::codify ( const QCString & text)
overridevirtual

Implements OutputCodeIntf.

Definition at line 166 of file docbookgen.cpp.

167{
168 Docbook_DB(("(codify \"%s\")\n",text));
169 writeDocbookCodeString(m_hide,*m_t,text,m_col,static_cast<size_t>(m_stripIndentAmount));
170}
void writeDocbookCodeString(bool hide, TextStream &t, const QCString &str, size_t &col, size_t stripIndentAmount)
#define Docbook_DB(x)

References Docbook_DB, m_col, m_hide, m_stripIndentAmount, m_t, and writeDocbookCodeString().

Referenced by writeLineNumber().

◆ endCodeFragment()

void DocbookCodeGenerator::endCodeFragment ( const QCString & style)
overridevirtual

Implements OutputCodeIntf.

Definition at line 308 of file docbookgen.cpp.

309{
311 //endCodeLine checks is there is still an open code line, if so closes it.
312 endCodeLine();
313
314 *m_t << "</programlisting>";
315}
void endCodeLine() override
#define DB_GEN_C1(x)

References DB_GEN_C1, endCodeLine(), and m_t.

◆ endCodeLine()

void DocbookCodeGenerator::endCodeLine ( )
overridevirtual

Implements OutputCodeIntf.

Definition at line 233 of file docbookgen.cpp.

234{
235 if (m_hide) return;
236 if (m_insideCodeLine) *m_t << "\n";
237 Docbook_DB(("(endCodeLine)\n"));
238 m_lineNumber = -1;
239 m_refId.clear();
240 m_external.clear();
242}
#define FALSE
Definition qcstring.h:34

References Docbook_DB, FALSE, m_external, m_hide, m_insideCodeLine, m_lineNumber, m_refId, and m_t.

Referenced by endCodeFragment(), and finish().

◆ endFold()

void DocbookCodeGenerator::endFold ( )
inlineoverridevirtual

Implements OutputCodeIntf.

Definition at line 77 of file docbookgen.h.

77{}

◆ endFontClass()

void DocbookCodeGenerator::endFontClass ( )
overridevirtual

Implements OutputCodeIntf.

Definition at line 252 of file docbookgen.cpp.

253{
254 if (m_hide) return;
255 Docbook_DB(("(endFontClass)\n"));
256 *m_t << "</emphasis>"; // non DocBook
258}

References Docbook_DB, FALSE, m_hide, m_insideSpecialHL, and m_t.

◆ endSpecialComment()

void DocbookCodeGenerator::endSpecialComment ( )
overridevirtual

Implements OutputCodeIntf.

Definition at line 182 of file docbookgen.cpp.

183{
184 m_hide = false;
185}

References m_hide.

◆ finish()

void DocbookCodeGenerator::finish ( )

Definition at line 297 of file docbookgen.cpp.

298{
299 endCodeLine();
300}

References endCodeLine().

◆ setRelativePath()

void DocbookCodeGenerator::setRelativePath ( const QCString & path)
inline

Definition at line 79 of file docbookgen.h.

79{ m_relPath = path; }

References m_relPath.

◆ setSourceFileName()

void DocbookCodeGenerator::setSourceFileName ( const QCString & sourceFileName)
inline

Definition at line 80 of file docbookgen.h.

References m_sourceFileName, and sourceFileName().

◆ setStripIndentAmount()

void DocbookCodeGenerator::setStripIndentAmount ( size_t amount)
overridevirtual

Implements OutputCodeIntf.

Definition at line 187 of file docbookgen.cpp.

188{
189 m_stripIndentAmount = amount;
190}

References m_stripIndentAmount.

◆ setTextStream()

void DocbookCodeGenerator::setTextStream ( TextStream * t)
inline

Definition at line 51 of file docbookgen.h.

51{ m_t = t; }

References m_t.

◆ sourceFileName()

QCString DocbookCodeGenerator::sourceFileName ( )
inline

Definition at line 81 of file docbookgen.h.

81{ return m_sourceFileName; }

References m_sourceFileName.

Referenced by setSourceFileName().

◆ startCodeFragment()

void DocbookCodeGenerator::startCodeFragment ( const QCString & style)
overridevirtual

Implements OutputCodeIntf.

Definition at line 302 of file docbookgen.cpp.

303{
305 *m_t << "<programlisting linenumbering=\"unnumbered\">";
306}

References DB_GEN_C1, and m_t.

◆ startCodeLine()

void DocbookCodeGenerator::startCodeLine ( int )
overridevirtual

Implements OutputCodeIntf.

Definition at line 225 of file docbookgen.cpp.

226{
227 if (m_hide) return;
228 Docbook_DB(("(startCodeLine)\n"));
230 m_col=0;
231}
#define TRUE
Definition qcstring.h:37

References Docbook_DB, m_col, m_hide, m_insideCodeLine, and TRUE.

◆ startFold()

void DocbookCodeGenerator::startFold ( int ,
const QCString & ,
const QCString &  )
inlineoverridevirtual

Implements OutputCodeIntf.

Definition at line 76 of file docbookgen.h.

76{}

◆ startFontClass()

void DocbookCodeGenerator::startFontClass ( const QCString & colorClass)
overridevirtual

Implements OutputCodeIntf.

Definition at line 244 of file docbookgen.cpp.

245{
246 if (m_hide) return;
247 Docbook_DB(("(startFontClass)\n"));
248 *m_t << "<emphasis role=\"" << colorClass << "\">";
250}

References Docbook_DB, m_hide, m_insideSpecialHL, m_t, and TRUE.

◆ startSpecialComment()

void DocbookCodeGenerator::startSpecialComment ( )
overridevirtual

Implements OutputCodeIntf.

Definition at line 177 of file docbookgen.cpp.

178{
180}

References m_hide, and m_stripCodeComments.

◆ stripCodeComments()

void DocbookCodeGenerator::stripCodeComments ( bool b)
overridevirtual

Implements OutputCodeIntf.

Definition at line 172 of file docbookgen.cpp.

173{
175}

References m_stripCodeComments.

◆ type()

OutputType DocbookCodeGenerator::type ( ) const
inlineoverridevirtual

Implements OutputCodeIntf.

Definition at line 53 of file docbookgen.h.

53{ return OutputType::Docbook; }

References Docbook.

◆ writeCodeAnchor()

void DocbookCodeGenerator::writeCodeAnchor ( const QCString & )
overridevirtual

Implements OutputCodeIntf.

Definition at line 260 of file docbookgen.cpp.

261{
262 Docbook_DB(("(writeCodeAnchor)\n"));
263}

References Docbook_DB.

◆ writeCodeLink()

void DocbookCodeGenerator::writeCodeLink ( CodeSymbolType type,
const QCString & ref,
const QCString & file,
const QCString & anchor,
const QCString & name,
const QCString & tooltip )
overridevirtual

Implements OutputCodeIntf.

Definition at line 192 of file docbookgen.cpp.

196{
197 if (m_hide) return;
198 Docbook_DB(("(writeCodeLink)\n"));
199 writeDocbookLink(*m_t,ref,file,anchor,name,tooltip);
200 m_col+=name.length();
201}
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
void writeDocbookLink(TextStream &t, const QCString &, const QCString &compoundId, const QCString &anchorId, const QCString &text, const QCString &)

References Docbook_DB, QCString::length(), m_col, m_hide, m_t, and writeDocbookLink().

Referenced by writeLineNumber().

◆ writeCodeLinkLine()

void DocbookCodeGenerator::writeCodeLinkLine ( CodeSymbolType type,
const QCString & ref,
const QCString & file,
const QCString & anchor,
const QCString & name,
const QCString & tooltip,
bool writeLineAnchor )
private

Definition at line 203 of file docbookgen.cpp.

207{
208 if (m_hide) return;
209 Docbook_DB(("(writeCodeLinkLine)\n"));
210 if (!writeLineAnchor) return;
211 *m_t << "<anchor xml:id=\"_" << stripExtensionGeneral(stripPath(file),".xml");
212 *m_t << "_1l";
213 writeDocbookString(*m_t,name);
214 *m_t << "\"/>";
215 m_col+=name.length();
216}
void writeDocbookString(TextStream &t, const QCString &s)
QCString stripPath(const QCString &s)
Definition util.cpp:5292
QCString stripExtensionGeneral(const QCString &fName, const QCString &ext)
Definition util.cpp:5255

References Docbook_DB, QCString::length(), m_col, m_hide, m_t, stripExtensionGeneral(), stripPath(), and writeDocbookString().

Referenced by writeLineNumber().

◆ writeLineNumber()

void DocbookCodeGenerator::writeLineNumber ( const QCString & extRef,
const QCString & compId,
const QCString & anchorId,
int l,
bool writeLineAnchor )
overridevirtual

Implements OutputCodeIntf.

Definition at line 265 of file docbookgen.cpp.

267{
268 if (m_hide) return;
269 Docbook_DB(("(writeLineNumber)\n"));
271 if (Config_getBool(SOURCE_BROWSER))
272 {
273 QCString lineNumber;
274 lineNumber.sprintf("%05d",l);
275
276 if (!m_sourceFileName.isEmpty())
277 {
278 writeCodeLinkLine(CodeSymbolType::Default,ref,m_sourceFileName,anchor,lineNumber,QCString(),writeLineAnchor);
279 }
280 if (!fileName.isEmpty())
281 {
282 writeCodeLink(CodeSymbolType::Default,ref,fileName,anchor,lineNumber,QCString());
283 }
284 else
285 {
286 codify(lineNumber);
287 }
288 *m_t << " ";
289 }
290 else
291 {
292 *m_t << l << " ";
293 }
294 m_col=0;
295}
void writeCodeLink(CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip) override
void codify(const QCString &text) override
void writeCodeLinkLine(CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip, bool)
QCString & sprintf(const char *format,...)
Definition qcstring.cpp:29
#define Config_getBool(name)
Definition config.h:33

References codify(), Config_getBool, Default, Docbook_DB, QCString::isEmpty(), m_col, m_hide, m_insideCodeLine, m_sourceFileName, m_t, QCString::sprintf(), TRUE, writeCodeLink(), and writeCodeLinkLine().

◆ writeTooltip()

void DocbookCodeGenerator::writeTooltip ( const QCString & ,
const DocLinkInfo & ,
const QCString & ,
const QCString & ,
const SourceLinkInfo & ,
const SourceLinkInfo &  )
overridevirtual

Implements OutputCodeIntf.

Definition at line 218 of file docbookgen.cpp.

221{
222 Docbook_DB(("(writeToolTip)\n"));
223}

References Docbook_DB.

Member Data Documentation

◆ m_col

size_t DocbookCodeGenerator::m_col = 0
private

Definition at line 93 of file docbookgen.h.

Referenced by codify(), startCodeLine(), writeCodeLink(), writeCodeLinkLine(), and writeLineNumber().

◆ m_external

QCString DocbookCodeGenerator::m_external
private

Definition at line 91 of file docbookgen.h.

Referenced by endCodeLine().

◆ m_hide

bool DocbookCodeGenerator::m_hide = false
private

◆ m_insideCodeLine

bool DocbookCodeGenerator::m_insideCodeLine = false
private

Definition at line 94 of file docbookgen.h.

Referenced by endCodeLine(), startCodeLine(), and writeLineNumber().

◆ m_insideSpecialHL

bool DocbookCodeGenerator::m_insideSpecialHL = false
private

Definition at line 95 of file docbookgen.h.

Referenced by endFontClass(), and startFontClass().

◆ m_lineNumber

int DocbookCodeGenerator::m_lineNumber = -1
private

Definition at line 92 of file docbookgen.h.

Referenced by endCodeLine().

◆ m_refId

QCString DocbookCodeGenerator::m_refId
private

Definition at line 90 of file docbookgen.h.

Referenced by endCodeLine().

◆ m_relPath

QCString DocbookCodeGenerator::m_relPath
private

Definition at line 96 of file docbookgen.h.

Referenced by setRelativePath().

◆ m_sourceFileName

QCString DocbookCodeGenerator::m_sourceFileName
private

Definition at line 97 of file docbookgen.h.

Referenced by setSourceFileName(), sourceFileName(), and writeLineNumber().

◆ m_stripCodeComments

bool DocbookCodeGenerator::m_stripCodeComments = false
private

Definition at line 98 of file docbookgen.h.

Referenced by startSpecialComment(), and stripCodeComments().

◆ m_stripIndentAmount

size_t DocbookCodeGenerator::m_stripIndentAmount = 0
private

Definition at line 100 of file docbookgen.h.

Referenced by codify(), and setStripIndentAmount().

◆ m_t


The documentation for this class was generated from the following files: