Public Member Functions | Private Attributes | List of all members
XMLCodeGenerator Class Reference
Inheritance diagram for XMLCodeGenerator:
CodeOutputInterface

Public Member Functions

 XMLCodeGenerator (FTextStream &t)
 
virtual ~XMLCodeGenerator ()
 
void codify (const char *text)
 
void writeCodeLink (const char *ref, const char *file, const char *anchor, const char *name, const char *tooltip)
 
void writeTooltip (const char *, const DocLinkInfo &, const char *, const char *, const SourceLinkInfo &, const SourceLinkInfo &)
 
void startCodeLine (bool)
 
void endCodeLine ()
 
void startFontClass (const char *colorClass)
 
void endFontClass ()
 
void writeCodeAnchor (const char *)
 
void writeLineNumber (const char *extRef, const char *compId, const char *anchorId, int l)
 
void setCurrentDoc (Definition *, const char *, bool)
 
void addWord (const char *, bool)
 
void finish ()
 
- Public Member Functions inherited from CodeOutputInterface
virtual ~CodeOutputInterface ()
 

Private Attributes

FTextStreamm_t
 
QCString m_refId
 
QCString m_external
 
int m_lineNumber
 
bool m_isMemberRef
 
int m_col
 
bool m_insideCodeLine
 
bool m_normalHLNeedStartTag
 
bool m_insideSpecialHL
 

Detailed Description

Generator for producing XML formatted source code.

Definition at line 223 of file xmlgen.cpp.

Constructor & Destructor Documentation

XMLCodeGenerator::XMLCodeGenerator ( FTextStream t)
inline

Definition at line 227 of file xmlgen.cpp.

227  : m_t(t), m_lineNumber(-1), m_isMemberRef(FALSE), m_col(0),
const bool FALSE
Definition: qglobal.h:370
FTextStream & m_t
Definition: xmlgen.cpp:351
bool m_isMemberRef
Definition: xmlgen.cpp:355
bool m_normalHLNeedStartTag
Definition: xmlgen.cpp:359
bool m_insideCodeLine
Definition: xmlgen.cpp:358
bool m_insideSpecialHL
Definition: xmlgen.cpp:360
const bool TRUE
Definition: qglobal.h:371
virtual XMLCodeGenerator::~XMLCodeGenerator ( )
inlinevirtual

Definition at line 229 of file xmlgen.cpp.

229 { }

Member Function Documentation

void XMLCodeGenerator::addWord ( const char *  ,
bool   
)
inlinevirtual

Implements CodeOutputInterface.

Definition at line 341 of file xmlgen.cpp.

342  {
343  }
void XMLCodeGenerator::codify ( const char *  s)
inlinevirtual

Writes an code fragment to the output. This function should keep spaces visible, should break lines at a newline and should convert tabs to the right number of spaces.

Implements CodeOutputInterface.

Definition at line 231 of file xmlgen.cpp.

232  {
233  XML_DB(("(codify \"%s\")\n",text));
235  {
236  m_t << "<highlight class=\"normal\">";
238  }
240  }
void writeXMLCodeString(FTextStream &t, const char *s, int &col)
Definition: xmlgen.cpp:114
const bool FALSE
Definition: qglobal.h:370
FTextStream & m_t
Definition: xmlgen.cpp:351
#define XML_DB(x)
Definition: xmlgen.cpp:52
bool m_normalHLNeedStartTag
Definition: xmlgen.cpp:359
bool m_insideCodeLine
Definition: xmlgen.cpp:358
bool m_insideSpecialHL
Definition: xmlgen.cpp:360
void XMLCodeGenerator::endCodeLine ( )
inlinevirtual

Ends a line of code started with startCodeLine()

Implements CodeOutputInterface.

Definition at line 288 of file xmlgen.cpp.

289  {
290  XML_DB(("(endCodeLine)\n"));
292  {
293  m_t << "</highlight>";
295  }
296  m_t << "</codeline>" << endl; // non DocBook
297  m_lineNumber = -1;
298  m_refId.resize(0);
299  m_external.resize(0);
301  }
bool resize(uint newlen)
Definition: qcstring.h:225
QCString m_external
Definition: xmlgen.cpp:353
QCString m_refId
Definition: xmlgen.cpp:352
const bool FALSE
Definition: qglobal.h:370
FTextStream & m_t
Definition: xmlgen.cpp:351
#define XML_DB(x)
Definition: xmlgen.cpp:52
bool m_normalHLNeedStartTag
Definition: xmlgen.cpp:359
bool m_insideCodeLine
Definition: xmlgen.cpp:358
bool m_insideSpecialHL
Definition: xmlgen.cpp:360
const bool TRUE
Definition: qglobal.h:371
QTextStream & endl(QTextStream &s)
void XMLCodeGenerator::endFontClass ( )
inlinevirtual

Ends a block started with startFontClass()

Implements CodeOutputInterface.

Definition at line 313 of file xmlgen.cpp.

314  {
315  XML_DB(("(endFontClass)\n"));
316  m_t << "</highlight>"; // non DocBook
318  }
const bool FALSE
Definition: qglobal.h:370
FTextStream & m_t
Definition: xmlgen.cpp:351
#define XML_DB(x)
Definition: xmlgen.cpp:52
bool m_insideSpecialHL
Definition: xmlgen.cpp:360
void XMLCodeGenerator::finish ( )
inline

Definition at line 345 of file xmlgen.cpp.

346  {
348  }
bool m_insideCodeLine
Definition: xmlgen.cpp:358
void endCodeLine()
Definition: xmlgen.cpp:288
void XMLCodeGenerator::setCurrentDoc ( Definition ,
const char *  ,
bool   
)
inlinevirtual

Implements CodeOutputInterface.

Definition at line 338 of file xmlgen.cpp.

339  {
340  }
void XMLCodeGenerator::startCodeLine ( bool  )
inlinevirtual

Implements CodeOutputInterface.

Definition at line 260 of file xmlgen.cpp.

261  {
262  XML_DB(("(startCodeLine)\n"));
263  m_t << "<codeline";
264  if (m_lineNumber!=-1)
265  {
266  m_t << " lineno=\"" << m_lineNumber << "\"";
267  if (!m_refId.isEmpty())
268  {
269  m_t << " refid=\"" << m_refId << "\"";
270  if (m_isMemberRef)
271  {
272  m_t << " refkind=\"member\"";
273  }
274  else
275  {
276  m_t << " refkind=\"compound\"";
277  }
278  }
279  if (!m_external.isEmpty())
280  {
281  m_t << " external=\"" << m_external << "\"";
282  }
283  }
284  m_t << ">";
286  m_col=0;
287  }
QCString m_external
Definition: xmlgen.cpp:353
QCString m_refId
Definition: xmlgen.cpp:352
bool isEmpty() const
Definition: qcstring.h:189
FTextStream & m_t
Definition: xmlgen.cpp:351
#define XML_DB(x)
Definition: xmlgen.cpp:52
bool m_isMemberRef
Definition: xmlgen.cpp:355
bool m_insideCodeLine
Definition: xmlgen.cpp:358
const bool TRUE
Definition: qglobal.h:371
void XMLCodeGenerator::startFontClass ( const char *  clsName)
inlinevirtual

Starts a block with a certain meaning. Used for syntax highlighting, which elements of the same type are rendered using the same 'font class'.

Parameters
clsNameThe category name.

Implements CodeOutputInterface.

Definition at line 302 of file xmlgen.cpp.

303  {
304  XML_DB(("(startFontClass)\n"));
306  {
307  m_t << "</highlight>";
309  }
310  m_t << "<highlight class=\"" << colorClass << "\">"; // non DocBook
312  }
FTextStream & m_t
Definition: xmlgen.cpp:351
#define XML_DB(x)
Definition: xmlgen.cpp:52
bool m_normalHLNeedStartTag
Definition: xmlgen.cpp:359
bool m_insideCodeLine
Definition: xmlgen.cpp:358
bool m_insideSpecialHL
Definition: xmlgen.cpp:360
const bool TRUE
Definition: qglobal.h:371
void XMLCodeGenerator::writeCodeAnchor ( const char *  name)
inlinevirtual

Write an anchor to a source listing.

Parameters
nameThe name of the anchor.

Implements CodeOutputInterface.

Definition at line 319 of file xmlgen.cpp.

320  {
321  XML_DB(("(writeCodeAnchor)\n"));
322  }
#define XML_DB(x)
Definition: xmlgen.cpp:52
void XMLCodeGenerator::writeCodeLink ( const char *  ref,
const char *  file,
const char *  anchor,
const char *  name,
const char *  tooltip 
)
inlinevirtual

Writes a link to an object in a code fragment.

Parameters
refIf this is non-zero, the object is to be found in an external documentation file.
fileThe file in which the object is located.
anchorThe anchor uniquely identifying the object within the file.
nameThe text to display as a placeholder for the link.
tooltipThe tooltip to display when the mouse is on the link.

Implements CodeOutputInterface.

Definition at line 241 of file xmlgen.cpp.

244  {
245  XML_DB(("(writeCodeLink)\n"));
247  {
248  m_t << "<highlight class=\"normal\">";
250  }
251  writeXMLLink(m_t,ref,file,anchor,name,tooltip);
252  m_col+=qstrlen(name);
253  }
static QCString name
Definition: declinfo.cpp:673
const bool FALSE
Definition: qglobal.h:370
FTextStream & m_t
Definition: xmlgen.cpp:351
#define XML_DB(x)
Definition: xmlgen.cpp:52
Q_EXPORT uint qstrlen(const char *str)
Definition: qcstring.h:81
bool m_normalHLNeedStartTag
Definition: xmlgen.cpp:359
bool m_insideCodeLine
Definition: xmlgen.cpp:358
void writeXMLLink(FTextStream &t, const char *extRef, const char *compoundId, const char *anchorId, const char *text, const char *tooltip)
Definition: xmlgen.cpp:186
bool m_insideSpecialHL
Definition: xmlgen.cpp:360
void XMLCodeGenerator::writeLineNumber ( const char *  ref,
const char *  file,
const char *  anchor,
int  lineNumber 
)
inlinevirtual

Writes the line number of a source listing

Parameters
refExternal reference (when imported from a tag file)
fileThe file part of the URL pointing to the docs.
anchorThe anchor part of the URL pointing to the docs.
lineNumberThe line number to write

Implements CodeOutputInterface.

Definition at line 323 of file xmlgen.cpp.

325  {
326  XML_DB(("(writeLineNumber)\n"));
327  // we remember the information provided here to use it
328  // at the <codeline> start tag.
329  m_lineNumber = l;
330  if (compId)
331  {
332  m_refId=compId;
333  if (anchorId) m_refId+=(QCString)"_1"+anchorId;
334  m_isMemberRef = anchorId!=0;
335  if (extRef) m_external=extRef;
336  }
337  }
QCString m_external
Definition: xmlgen.cpp:353
QCString m_refId
Definition: xmlgen.cpp:352
static QStrList * l
Definition: config.cpp:1044
#define XML_DB(x)
Definition: xmlgen.cpp:52
bool m_isMemberRef
Definition: xmlgen.cpp:355
void XMLCodeGenerator::writeTooltip ( const char *  id,
const DocLinkInfo docInfo,
const char *  decl,
const char *  desc,
const SourceLinkInfo defInfo,
const SourceLinkInfo declInfo 
)
inlinevirtual

Writes a tool tip definition

Parameters
idunique identifier for the tooltip
docInfoInfo about the symbol's documentation.
declfull declaration of the symbol (for functions)
descbrief description for the symbol
defInfoInfo about the symbol's definition in the source code
declInfoInfo about the symbol's declaration in the source code

Implements CodeOutputInterface.

Definition at line 254 of file xmlgen.cpp.

257  {
258  XML_DB(("(writeToolTip)\n"));
259  }
#define XML_DB(x)
Definition: xmlgen.cpp:52

Member Data Documentation

int XMLCodeGenerator::m_col
private

Definition at line 356 of file xmlgen.cpp.

QCString XMLCodeGenerator::m_external
private

Definition at line 353 of file xmlgen.cpp.

bool XMLCodeGenerator::m_insideCodeLine
private

Definition at line 358 of file xmlgen.cpp.

bool XMLCodeGenerator::m_insideSpecialHL
private

Definition at line 360 of file xmlgen.cpp.

bool XMLCodeGenerator::m_isMemberRef
private

Definition at line 355 of file xmlgen.cpp.

int XMLCodeGenerator::m_lineNumber
private

Definition at line 354 of file xmlgen.cpp.

bool XMLCodeGenerator::m_normalHLNeedStartTag
private

Definition at line 359 of file xmlgen.cpp.

QCString XMLCodeGenerator::m_refId
private

Definition at line 352 of file xmlgen.cpp.

FTextStream& XMLCodeGenerator::m_t
private

Definition at line 351 of file xmlgen.cpp.


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