My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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.

virtual XMLCodeGenerator::~XMLCodeGenerator ( )
inlinevirtual

Definition at line 229 of file xmlgen.cpp.

{ }

Member Function Documentation

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

Implements CodeOutputInterface.

Definition at line 341 of file xmlgen.cpp.

{
}
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.

References m_col, m_insideCodeLine, m_insideSpecialHL, m_normalHLNeedStartTag, m_t, writeXMLCodeString(), and XML_DB.

{
XML_DB(("(codify \"%s\")\n",text));
{
m_t << "<highlight class=\"normal\">";
}
}
void XMLCodeGenerator::endCodeLine ( )
inlinevirtual

Ends a line of code started with startCodeLine()

Implements CodeOutputInterface.

Definition at line 288 of file xmlgen.cpp.

References endl(), m_external, m_insideCodeLine, m_insideSpecialHL, m_lineNumber, m_normalHLNeedStartTag, m_refId, m_t, and XML_DB.

Referenced by finish().

{
XML_DB(("(endCodeLine)\n"));
{
m_t << "</highlight>";
}
m_t << "</codeline>" << endl; // non DocBook
m_refId.resize(0);
m_external.resize(0);
}
void XMLCodeGenerator::endFontClass ( )
inlinevirtual

Ends a block started with startFontClass()

Implements CodeOutputInterface.

Definition at line 313 of file xmlgen.cpp.

References m_insideSpecialHL, m_t, and XML_DB.

{
XML_DB(("(endFontClass)\n"));
m_t << "</highlight>"; // non DocBook
}
void XMLCodeGenerator::finish ( )
inline

Definition at line 345 of file xmlgen.cpp.

References endCodeLine(), and m_insideCodeLine.

Referenced by writeXMLCodeBlock().

void XMLCodeGenerator::setCurrentDoc ( Definition ,
const char *  ,
bool   
)
inlinevirtual

Implements CodeOutputInterface.

Definition at line 338 of file xmlgen.cpp.

{
}
void XMLCodeGenerator::startCodeLine ( bool  )
inlinevirtual

Implements CodeOutputInterface.

Definition at line 260 of file xmlgen.cpp.

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

{
XML_DB(("(startCodeLine)\n"));
m_t << "<codeline";
if (m_lineNumber!=-1)
{
m_t << " lineno=\"" << m_lineNumber << "\"";
if (!m_refId.isEmpty())
{
m_t << " refid=\"" << m_refId << "\"";
{
m_t << " refkind=\"member\"";
}
else
{
m_t << " refkind=\"compound\"";
}
}
if (!m_external.isEmpty())
{
m_t << " external=\"" << m_external << "\"";
}
}
m_t << ">";
m_col=0;
}
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.

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

{
XML_DB(("(startFontClass)\n"));
{
m_t << "</highlight>";
}
m_t << "<highlight class=\"" << colorClass << "\">"; // non DocBook
}
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.

References XML_DB.

{
XML_DB(("(writeCodeAnchor)\n"));
}
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.

References m_col, m_insideCodeLine, m_insideSpecialHL, m_normalHLNeedStartTag, m_t, writeXMLLink(), and XML_DB.

{
XML_DB(("(writeCodeLink)\n"));
{
m_t << "<highlight class=\"normal\">";
}
writeXMLLink(m_t,ref,file,anchor,name,tooltip);
m_col+=qstrlen(name);
}
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.

References m_external, m_isMemberRef, m_lineNumber, m_refId, and XML_DB.

{
XML_DB(("(writeLineNumber)\n"));
// we remember the information provided here to use it
// at the <codeline> start tag.
if (compId)
{
m_refId=compId;
if (anchorId) m_refId+=(QCString)"_1"+anchorId;
m_isMemberRef = anchorId!=0;
if (extRef) m_external=extRef;
}
}
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.

References XML_DB.

{
XML_DB(("(writeToolTip)\n"));
}

Member Data Documentation

int XMLCodeGenerator::m_col
private

Definition at line 356 of file xmlgen.cpp.

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

QCString XMLCodeGenerator::m_external
private

Definition at line 353 of file xmlgen.cpp.

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

bool XMLCodeGenerator::m_insideCodeLine
private

Definition at line 358 of file xmlgen.cpp.

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

bool XMLCodeGenerator::m_insideSpecialHL
private

Definition at line 360 of file xmlgen.cpp.

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

bool XMLCodeGenerator::m_isMemberRef
private

Definition at line 355 of file xmlgen.cpp.

Referenced by startCodeLine(), and writeLineNumber().

int XMLCodeGenerator::m_lineNumber
private

Definition at line 354 of file xmlgen.cpp.

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

bool XMLCodeGenerator::m_normalHLNeedStartTag
private

Definition at line 359 of file xmlgen.cpp.

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

QCString XMLCodeGenerator::m_refId
private

Definition at line 352 of file xmlgen.cpp.

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

FTextStream& XMLCodeGenerator::m_t
private

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