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)
 
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 &)
 
- Public Member Functions inherited from IndexIntf

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:91

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

Implements IndexIntf.

Definition at line 547 of file htmlhelp.cpp.

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

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

628{
629 p->imageFiles.insert(fileName.str());
630}
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 602 of file htmlhelp.cpp.

604{
605 if (context && md)
606 {
607 QCString cfname = md->getOutputFileBase();
608 QCString argStr = md->argsString();
609 QCString level1 = context->name();
610 QCString level2 = md->name() + argStr;
611 QCString anchor = !sectionAnchor.isEmpty() ? sectionAnchor : md->anchor();
612 p->index.addItem(level1,level2,cfname,anchor,TRUE,FALSE);
613 p->index.addItem(level2,level1,cfname,anchor,TRUE,TRUE);
614 }
615 else if (context)
616 {
617 QCString level1 = !word.isEmpty() ? word : context->name();
618 p->index.addItem(level1,QCString(),context->getOutputFileBase(),sectionAnchor,TRUE,FALSE);
619 }
620}
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
std::string_view word
Definition util.cpp:980

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

◆ addStyleSheetFile()

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

Implements IndexIntf.

Definition at line 622 of file htmlhelp.cpp.

623{
624 p->styleFiles.insert(fileName.str());
625}

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 %s for writing\n",qPrint(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 %s for writing\n",qPrint(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:87
static const QCString hhcFileName
Definition htmlhelp.h:86
#define Config_getString(name)
Definition config.h:32
#define term(fmt,...)
Definition message.h:94
std::ofstream openOutputStream(const QCString &name, bool append=false)
Definition portable.cpp:665
const char * qPrint(const char *s)
Definition qcstring.h:672

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

◆ recode()

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

Member Data Documentation

◆ hhcFileName

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

Definition at line 86 of file htmlhelp.h.

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

◆ hhkFileName

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

Definition at line 87 of file htmlhelp.h.

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

◆ hhpFileName

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

Definition at line 88 of file htmlhelp.h.

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

◆ p


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