My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
EclipseHelp Class Reference

#include <eclipsehelp.h>

Inheritance diagram for EclipseHelp:
IndexIntf

Public Member Functions

 EclipseHelp ()
 
virtual ~EclipseHelp ()
 
virtual void initialize ()
 Initialize the Eclipse generator.
 
virtual void finalize ()
 Finish generation of the Eclipse specific help files.
 
virtual void incContentsDepth ()
 Increase the level of content hierarchy.
 
virtual void decContentsDepth ()
 Decrease the level of content hierarchy.
 
virtual void addContentsItem (bool isDir, const char *name, const char *ref, const char *file, const char *anchor, bool separateIndex, bool addToNavIndex, Definition *def)
 Add an item to the content.
 
virtual void addIndexItem (Definition *context, MemberDef *md, const char *sectionAnchor, const char *title)
 
virtual void addIndexFile (const char *name)
 
virtual void addImageFile (const char *name)
 
virtual void addStyleSheetFile (const char *name)
 
- Public Member Functions inherited from IndexIntf
virtual ~IndexIntf ()
 

Private Member Functions

 EclipseHelp (const EclipseHelp &)
 
EclipseHelpoperator= (const EclipseHelp &)
 
void indent ()
 
void closedTag ()
 
void openedTag ()
 

Private Attributes

int m_depth
 
bool m_endtag
 
int m_openTags
 
QFile * m_tocfile
 
FTextStream m_tocstream
 
QCString m_pathprefix
 

Detailed Description

Generator for Eclipse help files.

This class generates the Eclipse specific help files. These files can be used to generate a help plugin readable by the Eclipse IDE.

Definition at line 40 of file eclipsehelp.h.

Constructor & Destructor Documentation

EclipseHelp::EclipseHelp ( )

Definition at line 22 of file eclipsehelp.cpp.

: m_depth(0), m_endtag(FALSE), m_openTags(0), m_tocfile(0)
{
}
EclipseHelp::~EclipseHelp ( )
virtual

Definition at line 26 of file eclipsehelp.cpp.

{
}
EclipseHelp::EclipseHelp ( const EclipseHelp )
private

Member Function Documentation

void EclipseHelp::addContentsItem ( bool  isDir,
const char *  name,
const char *  ref,
const char *  file,
const char *  anchor,
bool  separateIndex,
bool  addToNavIndex,
Definition def 
)
virtual

Add an item to the content.

Parameters
isDirFlag whether the argument file is a directory or a file entry
nameName of the item
refURL of the item
fileName of a file which the item is defined in (without extension)
anchorName of an anchor of the item.
separateIndexnot used.
addToNavIndexnot used.
defnot used.

Implements IndexIntf.

Definition at line 169 of file eclipsehelp.cpp.

References closedTag(), convertToXML(), Doxygen::htmlFileExtension, indent(), m_endtag, m_pathprefix, and m_tocstream.

{
// -- write the topic tag
if (file)
{
switch (file[0]) // check for special markers (user defined URLs)
{
case '^':
// URL not supported by eclipse toc.xml
break;
case '!':
indent();
m_tocstream << "<topic label=\"" << convertToXML(name) << "\"";
m_tocstream << " href=\"" << convertToXML(m_pathprefix) << &file[1] << "\"";
m_endtag = TRUE;
break;
default:
indent();
m_tocstream << "<topic label=\"" << convertToXML(name) << "\"";
if (anchor)
{
m_tocstream << "#" << anchor;
}
m_tocstream << "\"";
m_endtag = TRUE;
break;
}
}
else
{
indent();
m_tocstream << "<topic label=\"" << convertToXML(name) << "\"";
m_endtag = TRUE;
}
}
void EclipseHelp::addImageFile ( const char *  name)
virtual

Implements IndexIntf.

Definition at line 230 of file eclipsehelp.cpp.

{
}
void EclipseHelp::addIndexFile ( const char *  name)
virtual

Implements IndexIntf.

Definition at line 226 of file eclipsehelp.cpp.

{
}
void EclipseHelp::addIndexItem ( Definition context,
MemberDef md,
const char *  sectionAnchor,
const char *  title 
)
virtual

Implements IndexIntf.

Definition at line 218 of file eclipsehelp.cpp.

{
}
void EclipseHelp::addStyleSheetFile ( const char *  name)
virtual

Implements IndexIntf.

Definition at line 234 of file eclipsehelp.cpp.

{
}
void EclipseHelp::closedTag ( )
private

Definition at line 39 of file eclipsehelp.cpp.

References endl(), m_endtag, and m_tocstream.

Referenced by addContentsItem(), decContentsDepth(), and finalize().

{
if (m_endtag)
{
m_tocstream << "/>" << endl;
m_endtag = FALSE;
}
}
void EclipseHelp::decContentsDepth ( )
virtual

Decrease the level of content hierarchy.

It closes currently opened topic tag.

Implements IndexIntf.

Definition at line 143 of file eclipsehelp.cpp.

References closedTag(), endl(), indent(), m_depth, m_openTags, and m_tocstream.

{
// -- end of the opened topic
{
indent();
m_tocstream << "</topic>" << endl;
}
}
void EclipseHelp::finalize ( )
virtual

Finish generation of the Eclipse specific help files.

This method writes footers of the files and closes them.

See Also
initialize()

Implements IndexIntf.

Definition at line 101 of file eclipsehelp.cpp.

References closedTag(), Config_getString, endl(), m_depth, m_tocfile, m_tocstream, and FTextStream::unsetDevice().

{
closedTag(); // -- close previous tag
// -- write ending tag
m_tocstream << "</toc>" << endl;
// -- close the content file
m_tocfile->close();
delete m_tocfile; m_tocfile = 0;
QCString name = Config_getString(HTML_OUTPUT) + "/plugin.xml";
QFile pluginFile(name);
if (pluginFile.open(IO_WriteOnly))
{
QString docId = Config_getString(ECLIPSE_DOC_ID);
FTextStream t(&pluginFile);
t << "<plugin name=\"" << docId << "\" id=\"" << docId << "\"" << endl;
t << " version=\"1.0.0\" provider-name=\"Doxygen\">" << endl;
t << " <extension point=\"org.eclipse.help.toc\">" << endl;
t << " <toc file=\"toc.xml\" primary=\"true\" />" << endl;
t << " </extension>" << endl;
t << "</plugin>" << endl;
}
}
void EclipseHelp::incContentsDepth ( )
virtual

Increase the level of content hierarchy.

Implements IndexIntf.

Definition at line 132 of file eclipsehelp.cpp.

References m_depth, and openedTag().

{
}
void EclipseHelp::indent ( )
private

Definition at line 30 of file eclipsehelp.cpp.

References m_depth, and m_tocstream.

Referenced by addContentsItem(), and decContentsDepth().

{
int i;
for (i=0; i<m_depth; i++)
{
m_tocstream << " ";
}
}
void EclipseHelp::initialize ( )
virtual

Initialize the Eclipse generator.

This method opens the XML TOC file and writes headers of the files.

See Also
finalize()

Implements IndexIntf.

Definition at line 64 of file eclipsehelp.cpp.

References Config_getString, convertToXML(), endl(), err(), Doxygen::htmlFileExtension, m_depth, m_pathprefix, m_tocfile, m_tocstream, and FTextStream::setDevice().

{
// -- read path prefix from the configuration
//m_pathprefix = Config_getString(ECLIPSE_PATHPREFIX);
//if (m_pathprefix.isEmpty()) m_pathprefix = "html/";
// -- open the contents file
QCString name = Config_getString(HTML_OUTPUT) + "/toc.xml";
m_tocfile = new QFile(name);
if (!m_tocfile->open(IO_WriteOnly))
{
err("Could not open file %s for writing\n", name.data());
exit(1);
}
// -- initialize its text stream
//m_tocstream.setEncoding(FTextStream::UnicodeUTF8);
// -- write the opening tag
QCString title = Config_getString(PROJECT_NAME);
if (title.isEmpty())
{
title = "Doxygen generated documentation";
}
m_tocstream << "<toc label=\"" << convertToXML(title)
<< "\" topic=\"" << convertToXML(m_pathprefix)
<< "index" << Doxygen::htmlFileExtension << "\">" << endl;
++ m_depth;
}
void EclipseHelp::openedTag ( )
private

Definition at line 48 of file eclipsehelp.cpp.

References endl(), m_endtag, m_openTags, and m_tocstream.

Referenced by incContentsDepth().

{
if (m_endtag)
{
m_tocstream << ">" << endl;
m_endtag = FALSE;
}
}
EclipseHelp& EclipseHelp::operator= ( const EclipseHelp )
private

Member Data Documentation

int EclipseHelp::m_depth
private

Definition at line 61 of file eclipsehelp.h.

Referenced by decContentsDepth(), finalize(), incContentsDepth(), indent(), and initialize().

bool EclipseHelp::m_endtag
private

Definition at line 62 of file eclipsehelp.h.

Referenced by addContentsItem(), closedTag(), and openedTag().

int EclipseHelp::m_openTags
private

Definition at line 63 of file eclipsehelp.h.

Referenced by decContentsDepth(), and openedTag().

QCString EclipseHelp::m_pathprefix
private

Definition at line 67 of file eclipsehelp.h.

Referenced by addContentsItem(), and initialize().

QFile* EclipseHelp::m_tocfile
private

Definition at line 65 of file eclipsehelp.h.

Referenced by finalize(), and initialize().

FTextStream EclipseHelp::m_tocstream
private

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