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 361 of file htmlhelp.cpp.

361: 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 548 of file htmlhelp.cpp.

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}
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
#define TRUE
Definition qcstring.h:37
QCString externalRef(const QCString &relPath, const QCString &ref, bool href)
Definition util.cpp:6266
QCString convertToHtml(const QCString &s, bool keepEntities)
Definition util.cpp:4476
void addHtmlExtensionIfMissing(QCString &fName)
Definition util.cpp:5412

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 629 of file htmlhelp.cpp.

630{
631 p->imageFiles.insert(fileName.str());
632}
const std::string & str() const
Definition qcstring.h:537

References p, and QCString::str().

◆ addIndexFile()

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

Implements IndexIntf.

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

Implements IndexIntf.

Definition at line 604 of file htmlhelp.cpp.

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

Implements IndexIntf.

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}

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 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}

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 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}

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 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}
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:665

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: