Skip to main content

The HtmlHelp Class Reference

A class that generated the HTML Help specific files. More...

Declaration

class HtmlHelp { ... }

Included Headers

#include <src/htmlhelp.h>

Base class

classIndexIntf

Abstract interface for index generators. More...

Enumerations Index

enumImageNumber { ... }

Public Constructors Index

HtmlHelp ()

Public Destructor Index

~HtmlHelp ()

Public Member Functions Index

voidinitialize ()
voidfinalize ()
voidincContentsDepth ()
voiddecContentsDepth ()
voidaddContentsItem (bool isDir, const QCString &name, const QCString &ref, const QCString &file, const QCString &anchor, bool separateIndex, bool addToNavIndex, const Definition *def, const QCString &nameAsHtml)
voidaddIndexItem (const Definition *context, const MemberDef *md, const QCString &sectionAnchor, const QCString &title)
voidaddIndexFile (const QCString &name)
voidaddImageFile (const QCString &)
voidaddStyleSheetFile (const QCString &)

Private Member Functions Index

QCStringrecode (const QCString &s)

Private Member Attributes Index

std::unique_ptr< Private >p

Public Static Attributes Index

static const QCStringhhcFileName = "index.hhc"
static const QCStringhhkFileName = "index.hhk"
static const QCStringhhpFileName = "index.hhp"

Description

A class that generated the HTML Help specific files.

These files can be used with the Microsoft HTML Help workshop to generate compressed HTML files (.chm).

Definition at line 35 of file htmlhelp.h.

Enumerations

ImageNumber

enum HtmlHelp::ImageNumber
Enumeration values
BOOK_CLOSED (=1)
BOOK_OPEN
BOOK_CLOSED_NEW
BOOK_OPEN_NEW
FOLDER_CLOSED
FOLDER_OPEN
FOLDER_CLOSED_NEW
FOLDER_OPEN_NEW
QUERY
QUERY_NEW
TEXT
TEXT_NEW
WEB_DOC
WEB_DOC_NEW
WEB_LINK
WEB_LINK_NEW
INFO
INFO_NEW
LINK
LINK_NEW
BOOKLET
BOOKLET_NEW
EMAIL
EMAIL_NEW
EMAIL2
EMAIL2_NEW
IMAGE
IMAGE_NEW
AUDIO
AUDIO_NEW
MUSIC
MUSIC_NEW
VIDEO
VIDEO_NEW
INDEX
INDEX_NEW
IDEA
IDEA_NEW
NOTE
NOTE_NEW
TOOL
TOOL_NEW

used in imageNumber param of HTMLHelp::addContentsItem() function to specify document icon in tree view. Writes <param name="ImageNumber" value="xx"> in .HHC file.

Definition at line 40 of file htmlhelp.h.

Public Constructors

HtmlHelp()

HtmlHelp::HtmlHelp ()

Constructs an html object. The object has to be initialized before it can be used.

Declaration at line 64 of file htmlhelp.h, definition at line 361 of file htmlhelp.cpp.

361HtmlHelp::HtmlHelp() : p(std::make_unique<Private>()) {}

Reference p.

Referenced by ~HtmlHelp.

Public Destructor

~HtmlHelp()

HtmlHelp::~HtmlHelp ()

Definition at line 65 of file htmlhelp.h.

Reference HtmlHelp.

Public Member Functions

addContentsItem()

void HtmlHelp::addContentsItem (bool isDir, const QCString & name, const QCString & ref, const QCString & file, const QCString & anchor, bool separateIndex, bool addToNavIndex, const Definition * def, const QCString & nameAsHtml)
virtual

Add an list item to the contents file.

Parameters
isDir

boolean indicating if this is a dir or file entry

name

the name of the item.

ref

the URL of to the item.

file

the file in which the item is defined.

anchor

the anchor of the item.

separateIndex

not used.

addToNavIndex

not used.

def

not used.

nameAsHtml

name parameter in HTML format

Declaration at line 72 of file htmlhelp.h, definition at line 548 of file htmlhelp.cpp.

549 const QCString &name,
550 const QCString &ref,
551 const QCString &file,
552 const QCString &anchor,
553 bool /* separateIndex */,
554 bool /* addToNavIndex */,
555 const Definition * /* def */,
556 const QCString & /* nameAsHtml */)
557{
558 p->ctsItemPresent = true;
559 for (int i=0; i<p->dc; i++) p->cts << " ";
560 p->cts << "<LI><OBJECT type=\"text/sitemap\">";
561 p->cts << "<param name=\"Name\" value=\"" << convertToHtml(p->recoder.recode(name),TRUE) << "\">";
562 if (!file.isEmpty()) // made file optional param - KPW
563 {
564 if (file[0]=='!' || file[0]=='^') // special markers for user defined URLs
565 {
566 p->cts << "<param name=\"";
567 if (file[0]=='^') p->cts << "URL"; else p->cts << "Local";
568 p->cts << "\" value=\"";
569 p->cts << &file[1];
570 p->cts << "\">";
571 }
572 else
573 {
574 QCString currFile = file;
576 QCString currAnc = anchor;
577 p->cts << "<param name=\"Local\" value=\"";
578 if (!ref.isEmpty()) p->cts << externalRef("",ref,true);
579 p->cts << currFile;
580 if (p->prevFile == currFile && p->prevAnc.isEmpty() && currAnc.isEmpty())
581 {
582 currAnc = "top";
583 }
584 if (!currAnc.isEmpty()) p->cts << "#" << currAnc;
585 p->cts << "\">";
586 p->prevFile = currFile;
587 p->prevAnc = currAnc;
588 }
589 }
590 p->cts << "<param name=\"ImageNumber\" value=\"";
591 if (isDir) // added - KPW
592 {
593 p->cts << static_cast<int>(BOOK_CLOSED);
594 }
595 else
596 {
597 p->cts << static_cast<int>(TEXT);
598 }
599 p->cts << "\">";
600 p->cts << "</OBJECT>\n";
601}

References addHtmlExtensionIfMissing, BOOK_CLOSED, convertToHtml, externalRef, QCString::isEmpty, p, TEXT and TRUE.

addImageFile()

void HtmlHelp::addImageFile (const QCString & fileName)
virtual

Declaration at line 84 of file htmlhelp.h, definition at line 629 of file htmlhelp.cpp.

629void HtmlHelp::addImageFile(const QCString &fileName)
630{
631 p->imageFiles.insert(fileName.str());
632}

References p and QCString::str.

addIndexFile()

void HtmlHelp::addIndexFile (const QCString & name)
virtual

Declaration at line 83 of file htmlhelp.h, definition at line 485 of file htmlhelp.cpp.

486{
487 p->indexFiles.insert(s.str());
488}

References p and QCString::str.

addIndexItem()

void HtmlHelp::addIndexItem (const Definition * context, const MemberDef * md, const QCString & sectionAnchor, const QCString & title)
virtual

Declaration at line 81 of file htmlhelp.h, definition at line 604 of file htmlhelp.cpp.

604void HtmlHelp::addIndexItem(const Definition *context,const MemberDef *md,
605 const QCString &sectionAnchor,const QCString &word)
606{
607 if (context && md)
608 {
609 QCString cfname = md->getOutputFileBase();
610 QCString argStr = md->argsString();
611 QCString level1 = context->name();
612 QCString level2 = md->name() + argStr;
613 QCString anchor = !sectionAnchor.isEmpty() ? sectionAnchor : md->anchor();
614 p->index.addItem(level1,level2,cfname,anchor,TRUE,FALSE);
615 p->index.addItem(level2,level1,cfname,anchor,TRUE,TRUE);
616 }
617 else if (context)
618 {
619 QCString level1 = !word.isEmpty() ? word : context->name();
620 p->index.addItem(level1,QCString(),context->getOutputFileBase(),sectionAnchor,TRUE,FALSE);
621 }
622}

References Definition::anchor, MemberDef::argsString, FALSE, Definition::getOutputFileBase, QCString::isEmpty, Definition::name, p and TRUE.

addStyleSheetFile()

void HtmlHelp::addStyleSheetFile (const QCString & fileName)
virtual

Declaration at line 85 of file htmlhelp.h, definition at line 624 of file htmlhelp.cpp.

625{
626 p->styleFiles.insert(fileName.str());
627}

References p and QCString::str.

decContentsDepth()

void HtmlHelp::decContentsDepth ()
virtual

Decrease the level of the contents hierarchy. This will end the unnumber HTML list.

See Also

incContentsDepth()

Declaration at line 71 of file htmlhelp.h, definition at line 530 of file htmlhelp.cpp.

531{
532 for (int i=0; i<p->dc; i++) p->cts << " ";
533 p->cts << "</UL>\n";
534 --p->dc;
535}

Reference p.

finalize()

void HtmlHelp::finalize ()
virtual

Finalizes the HTML help. This will finish and close the htmlhelp contents file and the htmlhelp index file.

See Also

initialize()

Declaration at line 69 of file htmlhelp.h, definition at line 494 of file htmlhelp.cpp.

495{
496 // end the contents file
497 p->cts << "</UL>\n";
498 p->cts << "</BODY>\n";
499 p->cts << "</HTML>\n";
500 p->cts.close();
501
502 p->index.writeFields(p->kts);
503
504 // end the index file
505 p->kts << "</UL>\n";
506 p->kts << "</BODY>\n";
507 p->kts << "</HTML>\n";
508 p->kts.close();
509
510 p->createProjectFile();
511
512 p->recoder.finalize();
513}

Reference p.

incContentsDepth()

void HtmlHelp::incContentsDepth ()
virtual

Increase the level of the contents hierarchy. This will start a new unnumbered HTML list in contents file.

See Also

decContentsDepth()

Declaration at line 70 of file htmlhelp.h, definition at line 519 of file htmlhelp.cpp.

520{
521 for (int i=0; i<p->dc+1; i++) p->cts << " ";
522 p->cts << "<UL>\n";
523 ++p->dc;
524}

Reference p.

initialize()

void HtmlHelp::initialize ()
virtual

This will create a contents file (index.hhc) and a index file (index.hhk) and write the header of those files. It also creates a project file (index.hhp)

See Also

finalize()

Declaration at line 68 of file htmlhelp.h, definition at line 369 of file htmlhelp.cpp.

370{
371 p->recoder.initialize();
372
373 /* open the contents file */
374 QCString fName = Config_getString(HTML_OUTPUT) + "/" + hhcFileName;
375 p->cts = Portable::openOutputStream(fName);
376 if (!p->cts.is_open())
377 {
378 term("Could not open file {} for writing\n",fName);
379 }
380 /* Write the header of the contents file */
381 p->cts << "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n"
382 "<HTML><HEAD></HEAD><BODY>\n"
383 "<OBJECT type=\"text/site properties\">\n"
384 "<param name=\"FrameName\" value=\"right\">\n"
385 "</OBJECT>\n"
386 "<UL>\n";
387
388 /* open the index file */
389 fName = Config_getString(HTML_OUTPUT) + "/" + hhkFileName;
390 p->kts = Portable::openOutputStream(fName);
391 if (!p->kts.is_open())
392 {
393 term("Could not open file {} for writing\n",fName);
394 }
395 /* Write the header of the contents file */
396 p->kts << "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n"
397 "<HTML><HEAD></HEAD><BODY>\n"
398 "<OBJECT type=\"text/site properties\">\n"
399 "<param name=\"FrameName\" value=\"right\">\n"
400 "</OBJECT>\n"
401 "<UL>\n";
402
403}

References Config_getString, hhcFileName, hhkFileName, Portable::openOutputStream, p and term.

Private Member Functions

recode()

QCString HtmlHelp::recode (const QCString & s)

Definition at line 93 of file htmlhelp.h.

Private Member Attributes

p

std::unique_ptr<Private> HtmlHelp::p

Definition at line 92 of file htmlhelp.h.

92 std::unique_ptr<Private> p;

Referenced by addContentsItem, addImageFile, addIndexFile, addIndexItem, addStyleSheetFile, decContentsDepth, finalize, HtmlHelp, incContentsDepth and initialize.

Public Static Attributes

hhcFileName

const QCString HtmlHelp::hhcFileName = "index.hhc"
static

Definition at line 87 of file htmlhelp.h.

87 static inline const QCString hhcFileName = "index.hhc";

Referenced by HtmlHelp::Private::createProjectFile and initialize.

hhkFileName

const QCString HtmlHelp::hhkFileName = "index.hhk"
static

Definition at line 88 of file htmlhelp.h.

88 static inline const QCString hhkFileName = "index.hhk";

Referenced by HtmlHelp::Private::createProjectFile and initialize.

hhpFileName

const QCString HtmlHelp::hhpFileName = "index.hhp"
static

Definition at line 89 of file htmlhelp.h.

89 static inline const QCString hhpFileName = "index.hhp";

Referenced by HtmlHelp::Private::createProjectFile and runHtmlHelpCompiler.


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


Generated via doxygen2docusaurus by Doxygen 1.14.0.