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

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 DString &name, const DString &ref, const DString &file, const DString &anchor, bool separateIndex, bool addToNavIndex, const Definition *def, const DString &nameAsHtml)
void addIndexItem (const Definition *context, const MemberDef *md, const DString &sectionAnchor, const DString &title)
void addIndexFile (const DString &name)
void addImageFile (const DString &)
void addStyleSheetFile (const DString &)

Static Public Attributes

static const DString hhcFileName = "index.hhc"
static const DString hhkFileName = "index.hhk"
static const DString 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

DString recode (const DString &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 356 of file htmlhelp.cpp.

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

References p.

Referenced by ~HtmlHelp().

◆ ~HtmlHelp()

Member Function Documentation

◆ addContentsItem()

void HtmlHelp::addContentsItem ( bool isDir,
const DString & name,
const DString & ref,
const DString & file,
const DString & anchor,
bool separateIndex,
bool addToNavIndex,
const Definition * def,
const DString & 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 543 of file htmlhelp.cpp.

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

References addHtmlExtensionIfMissing(), BOOK_CLOSED, convertToHtml(), DString::empty(), externalRef(), p, and TEXT.

Referenced by ~HtmlHelp().

◆ addImageFile()

void HtmlHelp::addImageFile ( const DString & 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 dstring.h:634

References p, and DString::str().

Referenced by ~HtmlHelp().

◆ addIndexFile()

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

Implements IndexIntf.

Definition at line 480 of file htmlhelp.cpp.

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

References p, and DString::str().

Referenced by ~HtmlHelp().

◆ addIndexItem()

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

Implements IndexIntf.

Definition at line 599 of file htmlhelp.cpp.

601{
602 if (context && md)
603 {
604 if (sectionAnchor.empty() && !md->hasDocumentation()) return;
605 DString cfname = md->getOutputFileBase();
606 DString argStr = md->argsString();
607 DString level1 = context->name();
608 DString level2 = md->name() + argStr;
609 DString anchor = !sectionAnchor.empty() ? 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 DString level1 = !word.empty() ? word : context->name();
616 p->index.addItem(level1,DString(),context->getOutputFileBase(),sectionAnchor,true,false);
617 }
618}
DString()=default
virtual const DString & name() const =0
virtual bool hasDocumentation() const =0
virtual DString anchor() const =0
virtual DString getOutputFileBase() const =0
virtual DString argsString() const =0

References Definition::anchor(), MemberDef::argsString(), DString::DString(), DString::empty(), Definition::getOutputFileBase(), Definition::hasDocumentation(), Definition::name(), and p.

Referenced by ~HtmlHelp().

◆ addStyleSheetFile()

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

Implements IndexIntf.

Definition at line 620 of file htmlhelp.cpp.

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

References p, and DString::str().

Referenced by ~HtmlHelp().

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

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

References p.

Referenced by ~HtmlHelp().

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

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

References p.

Referenced by ~HtmlHelp().

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

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

References p.

Referenced by ~HtmlHelp().

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

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

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

Referenced by ~HtmlHelp().

◆ recode()

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

Member Data Documentation

◆ hhcFileName

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

Definition at line 87 of file htmlhelp.h.

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

◆ hhkFileName

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

Definition at line 88 of file htmlhelp.h.

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

◆ hhpFileName

const DString 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: