Doxygen
Loading...
Searching...
No Matches
HtmlHelp Class Reference

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

#include <src/htmlhelp.h>

Inheritance diagram for HtmlHelp:
Collaboration diagram for HtmlHelp:

Classes

class  Private

Public Member Functions

 HtmlHelp ()
 ~HtmlHelp ()
void initialize ()
void finalize ()
void incContentsDepth ()
void decContentsDepth ()
void 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)
void addIndexItem (const Definition *context, const MemberDef *md, const QCString &sectionAnchor, const QCString &title)
void addIndexFile (const QCString &name)
void addImageFile (const QCString &)
void addStyleSheetFile (const QCString &)

Static Public Attributes

static const QCString hhcFileName = "index.hhc"
static const QCString hhkFileName = "index.hhk"
static const QCString hhpFileName = "index.hhp"

Private Types

enum  ImageNumber {
  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
}

Private Member Functions

QCString recode (const QCString &s)

Private Attributes

std::unique_ptr< Privatep

Detailed 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.

Member Enumeration Documentation

◆ ImageNumber

enum HtmlHelp::ImageNumber
private

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

Enumerator
BOOK_CLOSED 
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 

Definition at line 40 of file htmlhelp.h.

40 {
62 };
@ WEB_DOC_NEW
Definition htmlhelp.h:47
@ FOLDER_CLOSED
Definition htmlhelp.h:43
@ EMAIL_NEW
Definition htmlhelp.h:52
@ TOOL_NEW
Definition htmlhelp.h:61
@ MUSIC_NEW
Definition htmlhelp.h:56
@ NOTE_NEW
Definition htmlhelp.h:60
@ FOLDER_OPEN
Definition htmlhelp.h:43
@ IMAGE_NEW
Definition htmlhelp.h:54
@ AUDIO_NEW
Definition htmlhelp.h:55
@ WEB_LINK
Definition htmlhelp.h:48
@ QUERY_NEW
Definition htmlhelp.h:45
@ LINK_NEW
Definition htmlhelp.h:50
@ INDEX_NEW
Definition htmlhelp.h:58
@ TEXT_NEW
Definition htmlhelp.h:46
@ FOLDER_OPEN_NEW
Definition htmlhelp.h:44
@ FOLDER_CLOSED_NEW
Definition htmlhelp.h:44
@ VIDEO_NEW
Definition htmlhelp.h:57
@ BOOK_OPEN
Definition htmlhelp.h:41
@ EMAIL2_NEW
Definition htmlhelp.h:53
@ BOOKLET_NEW
Definition htmlhelp.h:51
@ BOOKLET
Definition htmlhelp.h:51
@ BOOK_OPEN_NEW
Definition htmlhelp.h:42
@ WEB_LINK_NEW
Definition htmlhelp.h:48
@ BOOK_CLOSED_NEW
Definition htmlhelp.h:42
@ IDEA_NEW
Definition htmlhelp.h:59
@ BOOK_CLOSED
Definition htmlhelp.h:41
@ WEB_DOC
Definition htmlhelp.h:47
@ INFO_NEW
Definition htmlhelp.h:49

Constructor & Destructor Documentation

◆ HtmlHelp()

HtmlHelp::HtmlHelp ( )

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

Definition at line 357 of file htmlhelp.cpp.

357: p(std::make_unique<Private>()) {}
std::unique_ptr< Private > p
Definition htmlhelp.h:92

References p.

Referenced by ~HtmlHelp().

◆ ~HtmlHelp()

HtmlHelp::~HtmlHelp ( )
default

References HtmlHelp().

Member Function Documentation

◆ 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
isDirboolean indicating if this is a dir or file entry
namethe name of the item.
refthe URL of to the item.
filethe file in which the item is defined.
anchorthe anchor of the item.
separateIndexnot used.
addToNavIndexnot used.
defnot used.
nameAsHtmlname parameter in HTML format

Implements IndexIntf.

Definition at line 544 of file htmlhelp.cpp.

553{
554 p->ctsItemPresent = true;
555 for (int i=0; i<p->dc; i++) p->cts << " ";
556 p->cts << "<LI><OBJECT type=\"text/sitemap\">";
557 p->cts << "<param name=\"Name\" value=\"" << convertToHtml(p->recoder.recode(name),TRUE) << "\">";
558 if (!file.isEmpty()) // made file optional param - KPW
559 {
560 if (file[0]=='!' || file[0]=='^') // special markers for user defined URLs
561 {
562 p->cts << "<param name=\"";
563 if (file[0]=='^') p->cts << "URL"; else p->cts << "Local";
564 p->cts << "\" value=\"";
565 p->cts << &file[1];
566 p->cts << "\">";
567 }
568 else
569 {
570 QCString currFile = file;
572 QCString currAnc = anchor;
573 p->cts << "<param name=\"Local\" value=\"";
574 if (!ref.isEmpty()) p->cts << externalRef("",ref,true);
575 p->cts << currFile;
576 if (p->prevFile == currFile && p->prevAnc.isEmpty() && currAnc.isEmpty())
577 {
578 currAnc = "top";
579 }
580 if (!currAnc.isEmpty()) p->cts << "#" << currAnc;
581 p->cts << "\">";
582 p->prevFile = currFile;
583 p->prevAnc = currAnc;
584 }
585 }
586 p->cts << "<param name=\"ImageNumber\" value=\"";
587 if (isDir) // added - KPW
588 {
589 p->cts << static_cast<int>(BOOK_CLOSED);
590 }
591 else
592 {
593 p->cts << static_cast<int>(TEXT);
594 }
595 p->cts << "\">";
596 p->cts << "</OBJECT>\n";
597}
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:163
#define TRUE
Definition qcstring.h:37
QCString externalRef(const QCString &relPath, const QCString &ref, bool href)
Definition util.cpp:6272
QCString convertToHtml(const QCString &s, bool keepEntities)
Definition util.cpp:4479
void addHtmlExtensionIfMissing(QCString &fName)
Definition util.cpp:5418

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

◆ addImageFile()

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

Implements IndexIntf.

Definition at line 625 of file htmlhelp.cpp.

626{
627 p->imageFiles.insert(fileName.str());
628}
const std::string & str() const
Definition qcstring.h:552

References p, and QCString::str().

◆ addIndexFile()

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

Implements IndexIntf.

Definition at line 481 of file htmlhelp.cpp.

482{
483 p->indexFiles.insert(s.str());
484}

References p, and QCString::str().

◆ addIndexItem()

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

Implements IndexIntf.

Definition at line 600 of file htmlhelp.cpp.

602{
603 if (context && md)
604 {
605 QCString cfname = md->getOutputFileBase();
606 QCString argStr = md->argsString();
607 QCString level1 = context->name();
608 QCString level2 = md->name() + argStr;
609 QCString anchor = !sectionAnchor.isEmpty() ? sectionAnchor : md->anchor();
610 p->index.addItem(level1,level2,cfname,anchor,TRUE,FALSE);
611 p->index.addItem(level2,level1,cfname,anchor,TRUE,TRUE);
612 }
613 else if (context)
614 {
615 QCString level1 = !word.isEmpty() ? word : context->name();
616 p->index.addItem(level1,QCString(),context->getOutputFileBase(),sectionAnchor,TRUE,FALSE);
617 }
618}
virtual QCString anchor() const =0
virtual QCString getOutputFileBase() const =0
virtual const QCString & name() const =0
virtual QCString argsString() const =0
#define FALSE
Definition qcstring.h:34

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

◆ addStyleSheetFile()

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

Implements IndexIntf.

Definition at line 620 of file htmlhelp.cpp.

621{
622 p->styleFiles.insert(fileName.str());
623}

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()

Implements IndexIntf.

Definition at line 526 of file htmlhelp.cpp.

527{
528 for (int i=0; i<p->dc; i++) p->cts << " ";
529 p->cts << "</UL>\n";
530 --p->dc;
531}

References 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()

Implements IndexIntf.

Definition at line 490 of file htmlhelp.cpp.

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

References 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()

Implements IndexIntf.

Definition at line 515 of file htmlhelp.cpp.

516{
517 for (int i=0; i<p->dc+1; i++) p->cts << " ";
518 p->cts << "<UL>\n";
519 ++p->dc;
520}

References 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()

Implements IndexIntf.

Definition at line 365 of file htmlhelp.cpp.

366{
367 p->recoder.initialize();
368
369 /* open the contents file */
370 QCString fName = Config_getString(HTML_OUTPUT) + "/" + hhcFileName;
371 p->cts = Portable::openOutputStream(fName);
372 if (!p->cts.is_open())
373 {
374 term("Could not open file {} for writing\n",fName);
375 }
376 /* Write the header of the contents file */
377 p->cts << "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n"
378 "<HTML><HEAD></HEAD><BODY>\n"
379 "<OBJECT type=\"text/site properties\">\n"
380 "<param name=\"FrameName\" value=\"right\">\n"
381 "</OBJECT>\n"
382 "<UL>\n";
383
384 /* open the index file */
385 fName = Config_getString(HTML_OUTPUT) + "/" + hhkFileName;
386 p->kts = Portable::openOutputStream(fName);
387 if (!p->kts.is_open())
388 {
389 term("Could not open file {} for writing\n",fName);
390 }
391 /* Write the header of the contents file */
392 p->kts << "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n"
393 "<HTML><HEAD></HEAD><BODY>\n"
394 "<OBJECT type=\"text/site properties\">\n"
395 "<param name=\"FrameName\" value=\"right\">\n"
396 "</OBJECT>\n"
397 "<UL>\n";
398
399}
static const QCString hhkFileName
Definition htmlhelp.h:88
static const QCString hhcFileName
Definition htmlhelp.h:87
#define Config_getString(name)
Definition config.h:32
#define term(fmt,...)
Definition message.h:137
std::ofstream openOutputStream(const QCString &name, bool append=false)
Definition portable.cpp:649

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

◆ recode()

QCString HtmlHelp::recode ( const QCString & s)
private

Member Data Documentation

◆ hhcFileName

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

Definition at line 87 of file htmlhelp.h.

Referenced by HtmlHelp::Private::createProjectFile(), and initialize().

◆ hhkFileName

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

Definition at line 88 of file htmlhelp.h.

Referenced by HtmlHelp::Private::createProjectFile(), and initialize().

◆ hhpFileName

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

Definition at line 89 of file htmlhelp.h.

Referenced by HtmlHelp::Private::createProjectFile(), and runHtmlHelpCompiler().

◆ p


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