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

#include <src/xmlgen.h>

+ Inheritance diagram for XMLCodeGenerator:
+ Collaboration diagram for XMLCodeGenerator:

Public Member Functions

 XMLCodeGenerator (TextStream *t)
 
OutputType type () const override
 
void codify (const QCString &text) override
 Generator for producing XML formatted source code.
 
void stripCodeComments (bool b) override
 
void startSpecialComment () override
 
void endSpecialComment () override
 
void setStripIndentAmount (size_t amount) override
 
std::unique_ptr< OutputCodeIntfclone () 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 &) override
 
void endCodeFragment (const QCString &) override
 
void startFold (int, const QCString &, const QCString &) override
 
void endFold () override
 
void finish ()
 
- Public Member Functions inherited from OutputCodeIntf
 OutputCodeIntf ()=default
 

Private Attributes

TextStreamm_t
 
QCString m_refId
 
QCString m_external
 
int m_lineNumber = -1
 
bool m_isMemberRef = false
 
size_t m_col = 0
 
bool m_insideCodeLine = false
 
bool m_normalHLNeedStartTag = true
 
bool m_insideSpecialHL = false
 
bool m_stripCodeComments = false
 
bool m_hide = false
 
size_t m_stripIndentAmount = 0
 

Detailed Description

Definition at line 20 of file xmlgen.h.

Constructor & Destructor Documentation

◆ XMLCodeGenerator()

XMLCodeGenerator::XMLCodeGenerator ( TextStream * t)

Definition at line 201 of file xmlgen.cpp.

201 : m_t(t)
202{
203}
TextStream * m_t
Definition xmlgen.h:55

References m_t.

Member Function Documentation

◆ clone()

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

Implements OutputCodeIntf.

Definition at line 32 of file xmlgen.h.

32{ return std::make_unique<XMLCodeGenerator>(*this); }

◆ codify()

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

Generator for producing XML formatted source code.

Implements OutputCodeIntf.

Definition at line 206 of file xmlgen.cpp.

207{
208 XML_DB(("(codify \"%s\")\n",qPrint(text)));
210 {
211 *m_t << "<highlight class=\"normal\">";
213 }
215}
bool m_insideSpecialHL
Definition xmlgen.h:64
size_t m_stripIndentAmount
Definition xmlgen.h:67
bool m_normalHLNeedStartTag
Definition xmlgen.h:63
bool m_insideCodeLine
Definition xmlgen.h:62
size_t m_col
Definition xmlgen.h:60
const char * qPrint(const char *s)
Definition qcstring.h:672
#define FALSE
Definition qcstring.h:34
#define XML_DB(x)
Definition xmlgen.cpp:56
void writeXMLCodeString(bool hide, TextStream &t, const QCString &str, size_t &col, size_t stripIndentAmount)
Definition xmlgen.cpp:75

References FALSE, m_col, m_hide, m_insideCodeLine, m_insideSpecialHL, m_normalHLNeedStartTag, m_stripIndentAmount, m_t, qPrint(), writeXMLCodeString(), and XML_DB.

◆ endCodeFragment()

void XMLCodeGenerator::endCodeFragment ( const QCString & )
overridevirtual

Implements OutputCodeIntf.

Definition at line 367 of file xmlgen.cpp.

368{
369 XML_DB(("(endCodeFragment)\n"));
370 *m_t << " </programlisting>\n";
371}

References m_t, and XML_DB.

◆ endCodeLine()

void XMLCodeGenerator::endCodeLine ( )
overridevirtual

Implements OutputCodeIntf.

Definition at line 292 of file xmlgen.cpp.

293{
294 if (m_hide) return;
295 XML_DB(("(endCodeLine)\n"));
297 {
298 *m_t << "</highlight>";
300 }
302 {
303 *m_t << "</codeline>\n";
304 }
305 m_lineNumber = -1;
306 m_refId.clear();
307 m_external.clear();
309}
QCString m_refId
Definition xmlgen.h:56
QCString m_external
Definition xmlgen.h:57
#define TRUE
Definition qcstring.h:37

References FALSE, m_external, m_hide, m_insideCodeLine, m_insideSpecialHL, m_lineNumber, m_normalHLNeedStartTag, m_refId, m_t, TRUE, and XML_DB.

Referenced by finish().

◆ endFold()

void XMLCodeGenerator::endFold ( )
inlineoverridevirtual

Implements OutputCodeIntf.

Definition at line 50 of file xmlgen.h.

50{}

◆ endFontClass()

void XMLCodeGenerator::endFontClass ( )
overridevirtual

Implements OutputCodeIntf.

Definition at line 324 of file xmlgen.cpp.

325{
326 if (m_hide) return;
327 XML_DB(("(endFontClass)\n"));
328 *m_t << "</highlight>"; // non DocBook
330}

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

◆ endSpecialComment()

void XMLCodeGenerator::endSpecialComment ( )
overridevirtual

Implements OutputCodeIntf.

Definition at line 222 of file xmlgen.cpp.

223{
224 m_hide = false;
225}

References m_hide.

◆ finish()

void XMLCodeGenerator::finish ( )

Definition at line 355 of file xmlgen.cpp.

356{
357 XML_DB(("(finish insideCodeLine=%d)\n",m_insideCodeLine));
359}
void endCodeLine() override
Definition xmlgen.cpp:292

References endCodeLine(), m_insideCodeLine, and XML_DB.

◆ setStripIndentAmount()

void XMLCodeGenerator::setStripIndentAmount ( size_t amount)
overridevirtual

Implements OutputCodeIntf.

Definition at line 232 of file xmlgen.cpp.

233{
234 m_stripIndentAmount = amount;
235}

References m_stripIndentAmount.

◆ startCodeFragment()

void XMLCodeGenerator::startCodeFragment ( const QCString & )
overridevirtual

Implements OutputCodeIntf.

Definition at line 361 of file xmlgen.cpp.

362{
363 XML_DB(("(startCodeFragment)\n"));
364 *m_t << " <programlisting>\n";
365}

References m_t, and XML_DB.

◆ startCodeLine()

void XMLCodeGenerator::startCodeLine ( int )
overridevirtual

Implements OutputCodeIntf.

Definition at line 261 of file xmlgen.cpp.

262{
263 m_col=0;
264 if (m_hide) return;
265 XML_DB(("(startCodeLine)\n"));
266 *m_t << "<codeline";
267 if (m_lineNumber!=-1)
268 {
269 *m_t << " lineno=\"" << m_lineNumber << "\"";
270 if (!m_refId.isEmpty())
271 {
272 *m_t << " refid=\"" << m_refId << "\"";
273 if (m_isMemberRef)
274 {
275 *m_t << " refkind=\"member\"";
276 }
277 else
278 {
279 *m_t << " refkind=\"compound\"";
280 }
281 }
282 if (!m_external.isEmpty())
283 {
284 *m_t << " external=\"" << m_external << "\"";
285 }
286 }
287 *m_t << ">";
289 m_col=0;
290}
bool m_isMemberRef
Definition xmlgen.h:59

References m_col, m_external, m_hide, m_insideCodeLine, m_isMemberRef, m_lineNumber, m_refId, m_t, TRUE, and XML_DB.

◆ startFold()

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

Implements OutputCodeIntf.

Definition at line 49 of file xmlgen.h.

49{}

◆ startFontClass()

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

Implements OutputCodeIntf.

Definition at line 311 of file xmlgen.cpp.

312{
313 if (m_hide) return;
314 XML_DB(("(startFontClass)\n"));
316 {
317 *m_t << "</highlight>";
319 }
320 *m_t << "<highlight class=\"" << colorClass << "\">"; // non DocBook
322}

References m_hide, m_insideCodeLine, m_insideSpecialHL, m_normalHLNeedStartTag, m_t, TRUE, and XML_DB.

◆ startSpecialComment()

void XMLCodeGenerator::startSpecialComment ( )
overridevirtual

Implements OutputCodeIntf.

Definition at line 227 of file xmlgen.cpp.

228{
230}
bool m_stripCodeComments
Definition xmlgen.h:65

References m_hide, and m_stripCodeComments.

◆ stripCodeComments()

void XMLCodeGenerator::stripCodeComments ( bool b)
overridevirtual

Implements OutputCodeIntf.

Definition at line 217 of file xmlgen.cpp.

218{
220}

References m_stripCodeComments.

◆ type()

OutputType XMLCodeGenerator::type ( ) const
inlineoverridevirtual

Implements OutputCodeIntf.

Definition at line 25 of file xmlgen.h.

25{ return OutputType::XML; }

References XML.

◆ writeCodeAnchor()

void XMLCodeGenerator::writeCodeAnchor ( const QCString & )
overridevirtual

Implements OutputCodeIntf.

Definition at line 332 of file xmlgen.cpp.

333{
334 if (m_hide) return;
335 XML_DB(("(writeCodeAnchor)\n"));
336}

References m_hide, and XML_DB.

◆ writeCodeLink()

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

Implements OutputCodeIntf.

Definition at line 237 of file xmlgen.cpp.

241{
242 if (m_hide) return;
243 XML_DB(("(writeCodeLink)\n"));
245 {
246 *m_t << "<highlight class=\"normal\">";
248 }
249 writeXMLLink(*m_t,ref,file,anchor,name,tooltip);
250 m_col+=name.length();
251}
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
void writeXMLLink(TextStream &t, const QCString &extRef, const QCString &compoundId, const QCString &anchorId, const QCString &text, const QCString &tooltip)
Definition xmlgen.cpp:164

References FALSE, QCString::length(), m_col, m_hide, m_insideCodeLine, m_insideSpecialHL, m_normalHLNeedStartTag, m_t, writeXMLLink(), and XML_DB.

◆ writeLineNumber()

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

Implements OutputCodeIntf.

Definition at line 338 of file xmlgen.cpp.

340{
341 if (m_hide) return;
342 XML_DB(("(writeLineNumber)\n"));
343 // we remember the information provided here to use it
344 // at the <codeline> start tag.
345 m_lineNumber = l;
346 if (!compId.isEmpty())
347 {
348 m_refId=compId;
349 if (!anchorId.isEmpty()) m_refId+=QCString("_1")+anchorId;
350 m_isMemberRef = anchorId!=nullptr;
351 if (!extRef.isEmpty()) m_external=extRef;
352 }
353}
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150

References QCString::isEmpty(), m_external, m_hide, m_isMemberRef, m_lineNumber, m_refId, and XML_DB.

◆ writeTooltip()

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

Implements OutputCodeIntf.

Definition at line 253 of file xmlgen.cpp.

256{
257 if (m_hide) return;
258 XML_DB(("(writeToolTip)\n"));
259}

References m_hide, and XML_DB.

Member Data Documentation

◆ m_col

size_t XMLCodeGenerator::m_col = 0
private

Definition at line 60 of file xmlgen.h.

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

◆ m_external

QCString XMLCodeGenerator::m_external
private

Definition at line 57 of file xmlgen.h.

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

◆ m_hide

◆ m_insideCodeLine

bool XMLCodeGenerator::m_insideCodeLine = false
private

Definition at line 62 of file xmlgen.h.

Referenced by codify(), endCodeLine(), finish(), startCodeLine(), startFontClass(), and writeCodeLink().

◆ m_insideSpecialHL

bool XMLCodeGenerator::m_insideSpecialHL = false
private

Definition at line 64 of file xmlgen.h.

Referenced by codify(), endCodeLine(), endFontClass(), startFontClass(), and writeCodeLink().

◆ m_isMemberRef

bool XMLCodeGenerator::m_isMemberRef = false
private

Definition at line 59 of file xmlgen.h.

Referenced by startCodeLine(), and writeLineNumber().

◆ m_lineNumber

int XMLCodeGenerator::m_lineNumber = -1
private

Definition at line 58 of file xmlgen.h.

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

◆ m_normalHLNeedStartTag

bool XMLCodeGenerator::m_normalHLNeedStartTag = true
private

Definition at line 63 of file xmlgen.h.

Referenced by codify(), endCodeLine(), startFontClass(), and writeCodeLink().

◆ m_refId

QCString XMLCodeGenerator::m_refId
private

Definition at line 56 of file xmlgen.h.

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

◆ m_stripCodeComments

bool XMLCodeGenerator::m_stripCodeComments = false
private

Definition at line 65 of file xmlgen.h.

Referenced by startSpecialComment(), and stripCodeComments().

◆ m_stripIndentAmount

size_t XMLCodeGenerator::m_stripIndentAmount = 0
private

Definition at line 67 of file xmlgen.h.

Referenced by codify(), and setStripIndentAmount().

◆ m_t


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