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 195 of file xmlgen.cpp.

195 : m_t(t)
196{
197}
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 200 of file xmlgen.cpp.

201{
202 XML_DB(("(codify \"%s\")\n",qPrint(text)));
204 {
205 *m_t << "<highlight class=\"normal\">";
207 }
209}
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:661
#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:69

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 361 of file xmlgen.cpp.

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

References m_t, and XML_DB.

◆ endCodeLine()

void XMLCodeGenerator::endCodeLine ( )
overridevirtual

Implements OutputCodeIntf.

Definition at line 286 of file xmlgen.cpp.

287{
288 if (m_hide) return;
289 XML_DB(("(endCodeLine)\n"));
291 {
292 *m_t << "</highlight>";
294 }
296 {
297 *m_t << "</codeline>\n";
298 }
299 m_lineNumber = -1;
300 m_refId.clear();
301 m_external.clear();
303}
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 318 of file xmlgen.cpp.

319{
320 if (m_hide) return;
321 XML_DB(("(endFontClass)\n"));
322 *m_t << "</highlight>"; // non DocBook
324}

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

◆ endSpecialComment()

void XMLCodeGenerator::endSpecialComment ( )
overridevirtual

Implements OutputCodeIntf.

Definition at line 216 of file xmlgen.cpp.

217{
218 m_hide = false;
219}

References m_hide.

◆ finish()

void XMLCodeGenerator::finish ( )

Definition at line 349 of file xmlgen.cpp.

350{
351 XML_DB(("(finish insideCodeLine=%d)\n",m_insideCodeLine));
353}
void endCodeLine() override
Definition xmlgen.cpp:286

References endCodeLine(), m_insideCodeLine, and XML_DB.

◆ setStripIndentAmount()

void XMLCodeGenerator::setStripIndentAmount ( size_t amount)
overridevirtual

Implements OutputCodeIntf.

Definition at line 226 of file xmlgen.cpp.

227{
228 m_stripIndentAmount = amount;
229}

References m_stripIndentAmount.

◆ startCodeFragment()

void XMLCodeGenerator::startCodeFragment ( const QCString & )
overridevirtual

Implements OutputCodeIntf.

Definition at line 355 of file xmlgen.cpp.

356{
357 XML_DB(("(startCodeFragment)\n"));
358 *m_t << " <programlisting>\n";
359}

References m_t, and XML_DB.

◆ startCodeLine()

void XMLCodeGenerator::startCodeLine ( int )
overridevirtual

Implements OutputCodeIntf.

Definition at line 255 of file xmlgen.cpp.

256{
257 m_col=0;
258 if (m_hide) return;
259 XML_DB(("(startCodeLine)\n"));
260 *m_t << "<codeline";
261 if (m_lineNumber!=-1)
262 {
263 *m_t << " lineno=\"" << m_lineNumber << "\"";
264 if (!m_refId.isEmpty())
265 {
266 *m_t << " refid=\"" << m_refId << "\"";
267 if (m_isMemberRef)
268 {
269 *m_t << " refkind=\"member\"";
270 }
271 else
272 {
273 *m_t << " refkind=\"compound\"";
274 }
275 }
276 if (!m_external.isEmpty())
277 {
278 *m_t << " external=\"" << m_external << "\"";
279 }
280 }
281 *m_t << ">";
283 m_col=0;
284}
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 305 of file xmlgen.cpp.

306{
307 if (m_hide) return;
308 XML_DB(("(startFontClass)\n"));
310 {
311 *m_t << "</highlight>";
313 }
314 *m_t << "<highlight class=\"" << colorClass << "\">"; // non DocBook
316}

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 221 of file xmlgen.cpp.

222{
224}
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 211 of file xmlgen.cpp.

212{
214}

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 326 of file xmlgen.cpp.

327{
328 if (m_hide) return;
329 XML_DB(("(writeCodeAnchor)\n"));
330}

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 231 of file xmlgen.cpp.

235{
236 if (m_hide) return;
237 XML_DB(("(writeCodeLink)\n"));
239 {
240 *m_t << "<highlight class=\"normal\">";
242 }
243 writeXMLLink(*m_t,ref,file,anchor,name,tooltip);
244 m_col+=name.length();
245}
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:158

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 332 of file xmlgen.cpp.

334{
335 if (m_hide) return;
336 XML_DB(("(writeLineNumber)\n"));
337 // we remember the information provided here to use it
338 // at the <codeline> start tag.
339 m_lineNumber = l;
340 if (!compId.isEmpty())
341 {
342 m_refId=compId;
343 if (!anchorId.isEmpty()) m_refId+=QCString("_1")+anchorId;
344 m_isMemberRef = anchorId!=nullptr;
345 if (!extRef.isEmpty()) m_external=extRef;
346 }
347}
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 247 of file xmlgen.cpp.

250{
251 if (m_hide) return;
252 XML_DB(("(writeToolTip)\n"));
253}

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: