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

#include <qhp.h>

Inheritance diagram for Qhp:
IndexIntf

Public Member Functions

 Qhp ()
 
 ~Qhp ()
 
void initialize ()
 
void finalize ()
 
void incContentsDepth ()
 
void decContentsDepth ()
 
void addContentsItem (bool isDir, const char *name, const char *ref, const char *file, const char *anchor, bool separateIndex, bool addToNavIndex, Definition *def)
 
void addIndexItem (Definition *context, MemberDef *md, const char *sectionAnchor, const char *title)
 
void addIndexFile (const char *name)
 
void addImageFile (const char *name)
 
void addStyleSheetFile (const char *name)
 
- Public Member Functions inherited from IndexIntf
virtual ~IndexIntf ()
 

Static Public Member Functions

static QCString getQhpFileName ()
 

Private Member Functions

void handlePrevSection ()
 
void clearPrevSection ()
 
void setPrevSection (const char *title, const char *basename, const char *anchor, int level)
 
void addFile (const char *fileName)
 

Static Private Member Functions

static QCString getFullProjectName ()
 

Private Attributes

QhpXmlWriter m_doc
 
QhpXmlWriter m_toc
 
QhpXmlWriter m_index
 
QhpXmlWriter m_files
 
QCString m_prevSectionTitle
 
QCString m_prevSectionBaseName
 
QCString m_prevSectionAnchor
 
int m_prevSectionLevel
 
int m_sectionLevel
 
bool m_skipMainPageSection
 

Detailed Description

Definition at line 23 of file qhp.h.

Constructor & Destructor Documentation

Qhp::Qhp ( )
Qhp::~Qhp ( )

Definition at line 64 of file qhp.cpp.

References clearPrevSection().

Member Function Documentation

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

Implements IndexIntf.

Definition at line 192 of file qhp.cpp.

References QhpXmlWriter::close(), handlePrevSection(), m_prevSectionLevel, m_sectionLevel, m_toc, and setPrevSection().

{
//printf("Qhp::addContentsItem(%s) %d\n",name,m_sectionLevel);
// Backup difference before modification
QCString f = file;
if (!f.isEmpty() && f.at(0)=='^') return; // absolute URL not supported
setPrevSection(name, f, anchor, m_sectionLevel);
// Close sections as needed
//printf("Qhp::addContentsItem() closing %d sections\n",diff);
for (; diff > 0; diff--)
{
m_toc.close("section");
}
}
void Qhp::addFile ( const char *  fileName)
private

Definition at line 357 of file qhp.cpp.

References m_files, and QhpXmlWriter::openCloseContent().

Referenced by addImageFile(), addIndexFile(), and addStyleSheetFile().

{
m_files.openCloseContent("file", fileName);
}
void Qhp::addImageFile ( const char *  name)
virtual

Implements IndexIntf.

Definition at line 362 of file qhp.cpp.

References addFile().

{
addFile(fileName);
}
void Qhp::addIndexFile ( const char *  name)
virtual

Implements IndexIntf.

Definition at line 275 of file qhp.cpp.

References addFile().

{
addFile(name);
}
void Qhp::addIndexItem ( Definition context,
MemberDef md,
const char *  sectionAnchor,
const char *  title 
)
virtual

Implements IndexIntf.

Definition at line 217 of file qhp.cpp.

References MemberDef::anchor(), Config_getBool, MemberDef::getFileDef(), MemberDef::getGroupDef(), MemberDef::getOutputFileBase(), Definition::getOutputFileBase(), m_index, makeRef(), Definition::name(), and QhpXmlWriter::openClose().

{
(void)word;
//printf("addIndexItem(%s %s %s\n",
// context?context->name().data():"<none>",
// md?md->name().data():"<none>",
// word);
if (md) // member
{
static bool separateMemberPages = Config_getBool(SEPARATE_MEMBER_PAGES);
if (context==0) // global member
{
if (md->getGroupDef())
context = md->getGroupDef();
else if (md->getFileDef())
context = md->getFileDef();
}
if (context==0) return; // should not happen
QCString cfname = md->getOutputFileBase();
QCString cfiname = context->getOutputFileBase();
QCString level1 = context->name();
QCString level2 = word ? QCString(word) : md->name();
QCString contRef = separateMemberPages ? cfname : cfiname;
QCString anchor = sectionAnchor ? QCString(sectionAnchor) : md->anchor();
QCString ref;
// <keyword name="foo" id="MyApplication::foo" ref="doc.html#foo"/>
ref = makeRef(contRef, anchor);
QCString id = level1+"::"+level2;
const char * attributes[] =
{
"name", level2,
"id", id,
"ref", ref,
0
};
m_index.openClose("keyword", attributes);
}
else if (context) // container
{
// <keyword name="Foo" id="Foo" ref="doc.html#Foo"/>
QCString contRef = context->getOutputFileBase();
QCString level1 = word ? QCString(word) : context->name();
QCString ref = makeRef(contRef,sectionAnchor);
const char * attributes[] =
{
"name", level1,
"id", level1,
"ref", ref,
0
};
m_index.openClose("keyword", attributes);
}
}
void Qhp::addStyleSheetFile ( const char *  name)
virtual

Implements IndexIntf.

Definition at line 367 of file qhp.cpp.

References addFile().

{
addFile(fileName);
}
void Qhp::clearPrevSection ( )
private

Definition at line 350 of file qhp.cpp.

References m_prevSectionAnchor, m_prevSectionBaseName, and m_prevSectionTitle.

Referenced by handlePrevSection(), and ~Qhp().

{
m_prevSectionTitle.resize(0);
}
void Qhp::decContentsDepth ( )
virtual

Implements IndexIntf.

Definition at line 182 of file qhp.cpp.

References m_sectionLevel, and m_skipMainPageSection.

void Qhp::finalize ( )
virtual

Implements IndexIntf.

Definition at line 145 of file qhp.cpp.

References QhpXmlWriter::close(), Config_getString, QhpXmlWriter::dumpTo(), err(), getQhpFileName(), handlePrevSection(), QhpXmlWriter::insert(), m_doc, m_files, m_index, m_prevSectionLevel, and m_toc.

{
// Finish TOC
for (int i = m_prevSectionLevel; i > 0; i--)
{
m_toc.close("section");
}
m_toc.close("toc");
// Finish index
m_index.close("keywords");
// Finish files
m_files.close("files");
m_doc.close("filterSection");
m_doc.close("QtHelpProject");
QCString fileName = Config_getString(HTML_OUTPUT) + "/" + getQhpFileName();
QFile file(fileName);
if (!file.open(IO_WriteOnly))
{
err("Could not open file %s for writing\n", fileName.data());
exit(1);
}
m_doc.dumpTo(file);
}
QCString Qhp::getFullProjectName ( )
staticprivate

Definition at line 285 of file qhp.cpp.

References Config_getString.

Referenced by handlePrevSection(), and initialize().

{
QCString projectName = Config_getString(PROJECT_NAME);
QCString versionText = Config_getString(PROJECT_NUMBER);
if (projectName.isEmpty()) projectName="Root";
return projectName + (versionText.isEmpty()
? QCString("")
: QCString(" ") + versionText);
}
QCString Qhp::getQhpFileName ( )
static

Definition at line 280 of file qhp.cpp.

Referenced by finalize(), and generateOutput().

{
return "index.qhp";
}
void Qhp::handlePrevSection ( )
private

Definition at line 295 of file qhp.cpp.

References clearPrevSection(), getFullProjectName(), m_prevSectionAnchor, m_prevSectionBaseName, m_prevSectionLevel, m_prevSectionTitle, m_sectionLevel, m_skipMainPageSection, m_toc, makeRef(), QhpXmlWriter::open(), and QhpXmlWriter::openClose().

Referenced by addContentsItem(), and finalize().

{
/*
<toc>
<section title="My Application Manual" ref="index.html">
<section title="Chapter 1" ref="doc.html#chapter1"/>
<section title="Chapter 2" ref="doc.html#chapter2"/>
<section title="Chapter 3" ref="doc.html#chapter3"/>
</section>
</toc>
*/
if (m_prevSectionTitle.isNull())
{
m_prevSectionTitle=" "; // should not happen...
}
// We skip "Main Page" as our extra root is pointing to that
{
const char * const attributes[] =
{ "title", m_prevSectionTitle,
"ref", finalRef,
NULL
};
{
// Section with children
m_toc.open("section", attributes);
}
else
{
// Section without children
m_toc.openClose("section", attributes);
}
}
else
{
}
}
void Qhp::incContentsDepth ( )
virtual

Implements IndexIntf.

Definition at line 177 of file qhp.cpp.

References m_sectionLevel.

void Qhp::initialize ( )
virtual

Implements IndexIntf.

Definition at line 69 of file qhp.cpp.

References QhpXmlWriter::close(), Config_getString, QhpXmlWriter::declaration(), getFullProjectName(), Doxygen::htmlFileExtension, m_doc, m_files, m_index, m_prevSectionLevel, m_prevSectionTitle, m_sectionLevel, m_toc, QhpXmlWriter::open(), QhpXmlWriter::openCloseContent(), and split().

{
/*
<QtHelpProject version="1.0">
<namespace>mycompany.com.myapplication.1_0</namespace>
<virtualFolder>doc</virtualFolder>
<customFilter name="My Application 1.0">
<filterAttribute>myapp</filterAttribute>
<filterAttribute>1.0</filterAttribute>
</customFilter>
<filterSection>
<filterAttribute>myapp</filterAttribute>
<filterAttribute>1.0</filterAttribute>
..
*/
QCString nameSpace = Config_getString(QHP_NAMESPACE);
QCString virtualFolder = Config_getString(QHP_VIRTUAL_FOLDER);
m_doc.declaration("1.0", "UTF-8");
const char * rootAttributes[] =
{ "version", "1.0", 0 };
m_doc.open("QtHelpProject", rootAttributes);
m_doc.openCloseContent("namespace", nameSpace);
m_doc.openCloseContent("virtualFolder", virtualFolder);
// Add custom filter
QCString filterName = Config_getString(QHP_CUST_FILTER_NAME);
if (!filterName.isEmpty())
{
const char * tagAttributes[] =
{ "name", filterName, 0 };
m_doc.open("customFilter", tagAttributes);
QStringList customFilterAttributes = QStringList::split(QChar(' '), Config_getString(QHP_CUST_FILTER_ATTRS));
for (int i = 0; i < (int)customFilterAttributes.count(); i++)
{
m_doc.openCloseContent("filterAttribute", customFilterAttributes[i].utf8());
}
m_doc.close("customFilter");
}
m_doc.open("filterSection");
// Add section attributes
QStringList sectionFilterAttributes = QStringList::split(QChar(' '),
Config_getString(QHP_SECT_FILTER_ATTRS));
if (!sectionFilterAttributes.contains(QString("doxygen")))
{
sectionFilterAttributes << "doxygen";
}
for (int i = 0; i < (int)sectionFilterAttributes.count(); i++)
{
m_doc.openCloseContent("filterAttribute", sectionFilterAttributes[i].utf8());
}
m_toc.open("toc");
// Add extra root node
QCString fullProjectname = getFullProjectName();
QCString indexFile = "index"+Doxygen::htmlFileExtension;
const char * const attributes[] =
{ "title", fullProjectname,
"ref", indexFile,
NULL
};
m_toc.open("section", attributes);
m_index.open("keywords");
m_files.open("files");
}
void Qhp::setPrevSection ( const char *  title,
const char *  basename,
const char *  anchor,
int  level 
)
private

Member Data Documentation

QhpXmlWriter Qhp::m_doc
private

Definition at line 55 of file qhp.h.

Referenced by finalize(), initialize(), and Qhp().

QhpXmlWriter Qhp::m_files
private

Definition at line 58 of file qhp.h.

Referenced by addFile(), finalize(), initialize(), and Qhp().

QhpXmlWriter Qhp::m_index
private

Definition at line 57 of file qhp.h.

Referenced by addIndexItem(), finalize(), initialize(), and Qhp().

QCString Qhp::m_prevSectionAnchor
private

Definition at line 62 of file qhp.h.

Referenced by clearPrevSection(), handlePrevSection(), and setPrevSection().

QCString Qhp::m_prevSectionBaseName
private

Definition at line 61 of file qhp.h.

Referenced by clearPrevSection(), handlePrevSection(), and setPrevSection().

int Qhp::m_prevSectionLevel
private

Definition at line 64 of file qhp.h.

Referenced by addContentsItem(), finalize(), handlePrevSection(), initialize(), and setPrevSection().

QCString Qhp::m_prevSectionTitle
private

Definition at line 60 of file qhp.h.

Referenced by clearPrevSection(), handlePrevSection(), initialize(), and setPrevSection().

int Qhp::m_sectionLevel
private
bool Qhp::m_skipMainPageSection
private

Definition at line 67 of file qhp.h.

Referenced by decContentsDepth(), and handlePrevSection().

QhpXmlWriter Qhp::m_toc
private

Definition at line 56 of file qhp.h.

Referenced by addContentsItem(), finalize(), handlePrevSection(), initialize(), and Qhp().


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