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. More...
 
virtual void finalize ()
 Finish generation of the Eclipse specific help files. More...
 
virtual void incContentsDepth ()
 Increase the level of content hierarchy. More...
 
virtual void decContentsDepth ()
 Decrease the level of content hierarchy. More...
 
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. More...
 
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
 
QFilem_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.

22  : m_depth(0), m_endtag(FALSE), m_openTags(0), m_tocfile(0)
23 {
24 }
const bool FALSE
Definition: qglobal.h:370
QFile * m_tocfile
Definition: eclipsehelp.h:65
int m_openTags
Definition: eclipsehelp.h:63
bool m_endtag
Definition: eclipsehelp.h:62
EclipseHelp::~EclipseHelp ( )
virtual

Definition at line 26 of file eclipsehelp.cpp.

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

178 {
179  // -- write the topic tag
180  closedTag();
181  if (file)
182  {
183  switch (file[0]) // check for special markers (user defined URLs)
184  {
185  case '^':
186  // URL not supported by eclipse toc.xml
187  break;
188 
189  case '!':
190  indent();
191  m_tocstream << "<topic label=\"" << convertToXML(name) << "\"";
192  m_tocstream << " href=\"" << convertToXML(m_pathprefix) << &file[1] << "\"";
193  m_endtag = TRUE;
194  break;
195 
196  default:
197  indent();
198  m_tocstream << "<topic label=\"" << convertToXML(name) << "\"";
199  m_tocstream << " href=\"" << convertToXML(m_pathprefix)
200  << file << Doxygen::htmlFileExtension;
201  if (anchor)
202  {
203  m_tocstream << "#" << anchor;
204  }
205  m_tocstream << "\"";
206  m_endtag = TRUE;
207  break;
208  }
209  }
210  else
211  {
212  indent();
213  m_tocstream << "<topic label=\"" << convertToXML(name) << "\"";
214  m_endtag = TRUE;
215  }
216 }
static QCString name
Definition: declinfo.cpp:673
QCString convertToXML(const char *s)
Definition: util.cpp:5717
static QCString htmlFileExtension
Definition: doxygen.h:130
QCString m_pathprefix
Definition: eclipsehelp.h:67
void indent()
Definition: eclipsehelp.cpp:30
FTextStream m_tocstream
Definition: eclipsehelp.h:66
bool m_endtag
Definition: eclipsehelp.h:62
void closedTag()
Definition: eclipsehelp.cpp:39
const bool TRUE
Definition: qglobal.h:371
void EclipseHelp::addImageFile ( const char *  name)
virtual

Implements IndexIntf.

Definition at line 230 of file eclipsehelp.cpp.

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

Implements IndexIntf.

Definition at line 226 of file eclipsehelp.cpp.

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

Implements IndexIntf.

Definition at line 218 of file eclipsehelp.cpp.

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

Implements IndexIntf.

Definition at line 234 of file eclipsehelp.cpp.

235 {
236 }
void EclipseHelp::closedTag ( )
private

Definition at line 39 of file eclipsehelp.cpp.

40 {
41  if (m_endtag)
42  {
43  m_tocstream << "/>" << endl;
44  m_endtag = FALSE;
45  }
46 }
const bool FALSE
Definition: qglobal.h:370
FTextStream m_tocstream
Definition: eclipsehelp.h:66
bool m_endtag
Definition: eclipsehelp.h:62
QTextStream & endl(QTextStream &s)
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.

144 {
145  // -- end of the opened topic
146  closedTag();
147  --m_depth;
148 
149  if (m_openTags==m_depth)
150  {
151  --m_openTags;
152  indent();
153  m_tocstream << "</topic>" << endl;
154  }
155 }
void indent()
Definition: eclipsehelp.cpp:30
FTextStream m_tocstream
Definition: eclipsehelp.h:66
int m_openTags
Definition: eclipsehelp.h:63
void closedTag()
Definition: eclipsehelp.cpp:39
QTextStream & endl(QTextStream &s)
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.

102 {
103  closedTag(); // -- close previous tag
104 
105  // -- write ending tag
106  --m_depth;
107  m_tocstream << "</toc>" << endl;
108 
109  // -- close the content file
111  m_tocfile->close();
112  delete m_tocfile; m_tocfile = 0;
113 
114  QCString name = Config_getString("HTML_OUTPUT") + "/plugin.xml";
115  QFile pluginFile(name);
116  if (pluginFile.open(IO_WriteOnly))
117  {
118  QString docId = Config_getString("ECLIPSE_DOC_ID");
119  FTextStream t(&pluginFile);
120  t << "<plugin name=\"" << docId << "\" id=\"" << docId << "\"" << endl;
121  t << " version=\"1.0.0\" provider-name=\"Doxygen\">" << endl;
122  t << " <extension point=\"org.eclipse.help.toc\">" << endl;
123  t << " <toc file=\"toc.xml\" primary=\"true\" />" << endl;
124  t << " </extension>" << endl;
125  t << "</plugin>" << endl;
126  }
127 }
static QCString name
Definition: declinfo.cpp:673
#define IO_WriteOnly
Definition: qiodevice.h:62
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
void unsetDevice()
FTextStream m_tocstream
Definition: eclipsehelp.h:66
QFile * m_tocfile
Definition: eclipsehelp.h:65
#define Config_getString(val)
Definition: config.cpp:660
The QFile class is an I/O device that operates on files.
Definition: qfile.h:50
void closedTag()
Definition: eclipsehelp.cpp:39
void close()
Definition: qfile_unix.cpp:614
QTextStream & endl(QTextStream &s)
void EclipseHelp::incContentsDepth ( )
virtual

Increase the level of content hierarchy.

Implements IndexIntf.

Definition at line 132 of file eclipsehelp.cpp.

133 {
134  openedTag();
135  ++m_depth;
136 }
void openedTag()
Definition: eclipsehelp.cpp:48
void EclipseHelp::indent ( )
private

Definition at line 30 of file eclipsehelp.cpp.

31 {
32  int i;
33  for (i=0; i<m_depth; i++)
34  {
35  m_tocstream << " ";
36  }
37 }
FTextStream m_tocstream
Definition: eclipsehelp.h:66
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.

65 {
66  // -- read path prefix from the configuration
67  //m_pathprefix = Config_getString("ECLIPSE_PATHPREFIX");
68  //if (m_pathprefix.isEmpty()) m_pathprefix = "html/";
69 
70  // -- open the contents file
71  QCString name = Config_getString("HTML_OUTPUT") + "/toc.xml";
72  m_tocfile = new QFile(name);
73  if (!m_tocfile->open(IO_WriteOnly))
74  {
75  err("Could not open file %s for writing\n", name.data());
76  exit(1);
77  }
78 
79  // -- initialize its text stream
81  //m_tocstream.setEncoding(FTextStream::UnicodeUTF8);
82 
83  // -- write the opening tag
84  QCString title = Config_getString("PROJECT_NAME");
85  if (title.isEmpty())
86  {
87  title = "Doxygen generated documentation";
88  }
89  m_tocstream << "<toc label=\"" << convertToXML(title)
90  << "\" topic=\"" << convertToXML(m_pathprefix)
91  << "index" << Doxygen::htmlFileExtension << "\">" << endl;
92  ++ m_depth;
93 }
static QCString name
Definition: declinfo.cpp:673
QCString convertToXML(const char *s)
Definition: util.cpp:5717
bool isEmpty() const
Definition: qcstring.h:189
#define IO_WriteOnly
Definition: qiodevice.h:62
static QCString htmlFileExtension
Definition: doxygen.h:130
void setDevice(QIODevice *)
QCString m_pathprefix
Definition: eclipsehelp.h:67
FTextStream m_tocstream
Definition: eclipsehelp.h:66
bool open(int)
Definition: qfile_unix.cpp:134
QFile * m_tocfile
Definition: eclipsehelp.h:65
const char * data() const
Definition: qcstring.h:207
#define Config_getString(val)
Definition: config.cpp:660
void err(const char *fmt,...)
Definition: message.cpp:226
The QFile class is an I/O device that operates on files.
Definition: qfile.h:50
QTextStream & endl(QTextStream &s)
void EclipseHelp::openedTag ( )
private

Definition at line 48 of file eclipsehelp.cpp.

49 {
50  if (m_endtag)
51  {
52  m_tocstream << ">" << endl;
53  m_endtag = FALSE;
54  ++m_openTags;
55  }
56 }
const bool FALSE
Definition: qglobal.h:370
FTextStream m_tocstream
Definition: eclipsehelp.h:66
int m_openTags
Definition: eclipsehelp.h:63
bool m_endtag
Definition: eclipsehelp.h:62
QTextStream & endl(QTextStream &s)
EclipseHelp& EclipseHelp::operator= ( const EclipseHelp )
private

Member Data Documentation

int EclipseHelp::m_depth
private

Definition at line 61 of file eclipsehelp.h.

bool EclipseHelp::m_endtag
private

Definition at line 62 of file eclipsehelp.h.

int EclipseHelp::m_openTags
private

Definition at line 63 of file eclipsehelp.h.

QCString EclipseHelp::m_pathprefix
private

Definition at line 67 of file eclipsehelp.h.

QFile* EclipseHelp::m_tocfile
private

Definition at line 65 of file eclipsehelp.h.

FTextStream EclipseHelp::m_tocstream
private

Definition at line 66 of file eclipsehelp.h.


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