Doxygen
HtmlHelp类 参考

A class that generated the HTML Help specific files. 更多...

#include <htmlhelp.h>

+ 类 HtmlHelp 继承关系图:
+ HtmlHelp 的协作图:

class  Private
 

Public 成员函数

 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 成员函数 继承自 IndexIntf
virtual ~IndexIntf ()
 

静态 Public 成员函数

static QCString getLanguageString ()
 

Private 类型

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 成员函数

QCString recode (const QCString &s)
 

Private 属性

std::unique_ptr< Privatep
 

详细描述

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

在文件 htmlhelp.h32 行定义.

成员枚举类型说明

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

枚举值
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 

在文件 htmlhelp.h37 行定义.

构造及析构函数说明

◆ HtmlHelp()

HtmlHelp::HtmlHelp ( )

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

在文件 htmlhelp.cpp332 行定义.

332  : p(std::make_unique<Private>())
333 {
334 }

◆ ~HtmlHelp()

HtmlHelp::~HtmlHelp ( )

在文件 htmlhelp.cpp336 行定义.

337 {
338 }

成员函数说明

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

参数
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.

实现了 IndexIntf.

在文件 htmlhelp.cpp630 行定义.

638 {
639  static bool binaryTOC = Config_getBool(BINARY_TOC);
640  // If we're using a binary toc then folders cannot have links.
641  // Tried this and I didn't see any problems, when not using
642  // the resetting of file and anchor the TOC works better
643  // (prev / next button)
644  //if(Config_getBool(BINARY_TOC) && isDir)
645  //{
646  //file = 0;
647  //anchor = 0;
648  //}
649  p->ctsItemPresent = true;
650  int i; for (i=0;i<p->dc;i++) p->cts << " ";
651  p->cts << "<LI><OBJECT type=\"text/sitemap\">";
652  p->cts << "<param name=\"Name\" value=\"" << convertToHtml(p->recoder.recode(name),TRUE) << "\">";
653  if (!file.isEmpty()) // made file optional param - KPW
654  {
655  if (file[0]=='!' || file[0]=='^') // special markers for user defined URLs
656  {
657  p->cts << "<param name=\"";
658  if (file[0]=='^') p->cts << "URL"; else p->cts << "Local";
659  p->cts << "\" value=\"";
660  p->cts << &file[1];
661  p->cts << "\">";
662  }
663  else
664  {
665  if (!(binaryTOC && isDir))
666  {
667  p->cts << "<param name=\"Local\" value=\"";
668  p->cts << addHtmlExtensionIfMissing(file);
669  if (!anchor.isEmpty()) p->cts << "#" << anchor;
670  p->cts << "\">";
671  }
672  }
673  }
674  p->cts << "<param name=\"ImageNumber\" value=\"";
675  if (isDir) // added - KPW
676  {
677  p->cts << (int)BOOK_CLOSED ;
678  }
679  else
680  {
681  p->cts << (int)TEXT;
682  }
683  p->cts << "\">";
684  p->cts << "</OBJECT>\n";
685 }

引用了 addHtmlExtensionIfMissing(), BOOK_CLOSED, Config_getBool, convertToHtml(), QCString::isEmpty(), p, TEXT , 以及 TRUE.

◆ addImageFile()

void HtmlHelp::addImageFile ( const QCString fileName)
virtual

实现了 IndexIntf.

在文件 htmlhelp.cpp720 行定义.

721 {
722  p->imageFiles.insert(fileName.str());
723 }

引用了 p , 以及 QCString::str().

◆ addIndexFile()

void HtmlHelp::addIndexFile ( const QCString name)
virtual

实现了 IndexIntf.

在文件 htmlhelp.cpp568 行定义.

569 {
570  p->indexFiles.insert(s.str());
571 }

引用了 p , 以及 QCString::str().

◆ addIndexItem()

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

实现了 IndexIntf.

在文件 htmlhelp.cpp688 行定义.

690 {
691  if (md)
692  {
693  static bool separateMemberPages = Config_getBool(SEPARATE_MEMBER_PAGES);
694  if (context==0) // global member
695  {
696  if (md->getGroupDef())
697  context = md->getGroupDef();
698  else if (md->getFileDef())
699  context = md->getFileDef();
700  }
701  if (context==0) return; // should not happen
702 
703  QCString cfname = md->getOutputFileBase();
704  QCString cfiname = context->getOutputFileBase();
705  QCString level1 = context->name();
706  QCString level2 = md->name();
707  QCString contRef = separateMemberPages ? cfname : cfiname;
708  QCString memRef = cfname;
709  QCString anchor = !sectionAnchor.isEmpty() ? sectionAnchor : md->anchor();
710  p->index.addItem(level1,level2,contRef,anchor,TRUE,FALSE);
711  p->index.addItem(level2,level1,memRef,anchor,TRUE,TRUE);
712  }
713  else if (context)
714  {
715  QCString level1 = !word.isEmpty() ? word : context->name();
716  p->index.addItem(level1,QCString(),context->getOutputFileBase(),sectionAnchor,TRUE,FALSE);
717  }
718 }

引用了 MemberDef::anchor(), Config_getBool, FALSE, MemberDef::getFileDef(), MemberDef::getGroupDef(), MemberDef::getOutputFileBase(), Definition::getOutputFileBase(), QCString::isEmpty(), Definition::name(), p , 以及 TRUE.

◆ addStyleSheetFile()

void HtmlHelp::addStyleSheetFile ( const QCString )
inlinevirtual

实现了 IndexIntf.

在文件 htmlhelp.h80 行定义.

80 {}

◆ decContentsDepth()

void HtmlHelp::decContentsDepth ( )
virtual

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

参见
incContentsDepth()

实现了 IndexIntf.

在文件 htmlhelp.cpp613 行定义.

614 {
615  int i; for (i=0;i<p->dc;i++) p->cts << " ";
616  p->cts << "</UL>\n";
617  --p->dc;
618 }

引用了 p.

◆ finalize()

void HtmlHelp::finalize ( )
virtual

Finalizes the HTML help. This will finish and close the contents file (index.hhc) and the index file (index.hhk).

参见
initialize()

实现了 IndexIntf.

在文件 htmlhelp.cpp577 行定义.

578 {
579  // end the contents file
580  p->cts << "</UL>\n";
581  p->cts << "</BODY>\n";
582  p->cts << "</HTML>\n";
583  p->cts.close();
584 
585  p->index.writeFields(p->kts);
586 
587  // end the index file
588  p->kts << "</UL>\n";
589  p->kts << "</BODY>\n";
590  p->kts << "</HTML>\n";
591  p->kts.close();
592 
593  p->createProjectFile();
594 
595  p->recoder.finalize();
596 }

引用了 p.

◆ getLanguageString()

QCString HtmlHelp::getLanguageString ( )
static

在文件 htmlhelp.cpp480 行定义.

481 {
482  if (!theTranslator->idLanguage().isEmpty())
483  {
484  auto it = s_languageDict.find(theTranslator->idLanguage().str());
485  if (it!=s_languageDict.end())
486  {
487  return QCString(it->second);
488  }
489  }
490  // default language
491  return "0x409 English (United States)";
492 }

引用了 Translator::idLanguage(), QCString::isEmpty(), s_languageDict, QCString::str() , 以及 theTranslator.

被这些函数引用 HtmlHelp::Private::createProjectFile() , 以及 TranslateContext::Private::langString().

◆ incContentsDepth()

void HtmlHelp::incContentsDepth ( )
virtual

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

参见
decContentsDepth()

实现了 IndexIntf.

在文件 htmlhelp.cpp602 行定义.

603 {
604  int i; for (i=0;i<p->dc+1;i++) p->cts << " ";
605  p->cts << "<UL>\n";
606  ++p->dc;
607 }

引用了 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)

参见
finalize()

实现了 IndexIntf.

在文件 htmlhelp.cpp443 行定义.

444 {
445  p->recoder.initialize();
446 
447  /* open the contents file */
448  QCString fName = Config_getString(HTML_OUTPUT) + "/index.hhc";
449  p->cts.open(fName.str(),std::ofstream::out | std::ofstream::binary);
450  if (!p->cts.is_open())
451  {
452  term("Could not open file %s for writing\n",qPrint(fName));
453  }
454  /* Write the header of the contents file */
455  p->cts << "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n"
456  "<HTML><HEAD></HEAD><BODY>\n"
457  "<OBJECT type=\"text/site properties\">\n"
458  "<param name=\"FrameName\" value=\"right\">\n"
459  "</OBJECT>\n"
460  "<UL>\n";
461 
462  /* open the contents file */
463  fName = Config_getString(HTML_OUTPUT) + "/index.hhk";
464  p->kts.open(fName.str(),std::ofstream::out | std::ofstream::binary);
465  if (!p->kts.is_open())
466  {
467  term("Could not open file %s for writing\n",qPrint(fName));
468  }
469  /* Write the header of the contents file */
470  p->kts << "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n"
471  "<HTML><HEAD></HEAD><BODY>\n"
472  "<OBJECT type=\"text/site properties\">\n"
473  "<param name=\"FrameName\" value=\"right\">\n"
474  "</OBJECT>\n"
475  "<UL>\n";
476 
477 }

引用了 Config_getString, p, qPrint(), QCString::str() , 以及 term().

◆ recode()

QCString HtmlHelp::recode ( const QCString s)
private

类成员变量说明

◆ p

std::unique_ptr<Private> HtmlHelp::p
private

该类的文档由以下文件生成:
HtmlHelp::EMAIL
@ EMAIL
Definition: htmlhelp.h:49
HtmlHelp::WEB_LINK_NEW
@ WEB_LINK_NEW
Definition: htmlhelp.h:45
HtmlHelp::BOOK_CLOSED
@ BOOK_CLOSED
Definition: htmlhelp.h:38
HtmlHelp::BOOKLET
@ BOOKLET
Definition: htmlhelp.h:48
HtmlHelp::FOLDER_OPEN_NEW
@ FOLDER_OPEN_NEW
Definition: htmlhelp.h:41
HtmlHelp::QUERY_NEW
@ QUERY_NEW
Definition: htmlhelp.h:42
QCString::isEmpty
bool isEmpty() const
Returns TRUE iff the string is empty
Definition: qcstring.h:144
HtmlHelp::INFO_NEW
@ INFO_NEW
Definition: htmlhelp.h:46
HtmlHelp::IDEA
@ IDEA
Definition: htmlhelp.h:56
HtmlHelp::p
std::unique_ptr< Private > p
Definition: htmlhelp.h:84
HtmlHelp::BOOK_CLOSED_NEW
@ BOOK_CLOSED_NEW
Definition: htmlhelp.h:39
HtmlHelp::INDEX
@ INDEX
Definition: htmlhelp.h:55
HtmlHelp::INDEX_NEW
@ INDEX_NEW
Definition: htmlhelp.h:55
QCString::str
std::string str() const
Definition: qcstring.h:442
HtmlHelp::WEB_DOC_NEW
@ WEB_DOC_NEW
Definition: htmlhelp.h:44
HtmlHelp::EMAIL2
@ EMAIL2
Definition: htmlhelp.h:50
HtmlHelp::EMAIL2_NEW
@ EMAIL2_NEW
Definition: htmlhelp.h:50
HtmlHelp::AUDIO
@ AUDIO
Definition: htmlhelp.h:52
HtmlHelp::FOLDER_OPEN
@ FOLDER_OPEN
Definition: htmlhelp.h:40
HtmlHelp::TEXT
@ TEXT
Definition: htmlhelp.h:43
HtmlHelp::LINK
@ LINK
Definition: htmlhelp.h:47
MemberDef::anchor
virtual QCString anchor() const =0
HtmlHelp::VIDEO_NEW
@ VIDEO_NEW
Definition: htmlhelp.h:54
addHtmlExtensionIfMissing
QCString addHtmlExtensionIfMissing(const QCString &fName)
Definition: util.cpp:5275
HtmlHelp::QUERY
@ QUERY
Definition: htmlhelp.h:42
HtmlHelp::BOOK_OPEN
@ BOOK_OPEN
Definition: htmlhelp.h:38
HtmlHelp::MUSIC_NEW
@ MUSIC_NEW
Definition: htmlhelp.h:53
HtmlHelp::VIDEO
@ VIDEO
Definition: htmlhelp.h:54
HtmlHelp::WEB_DOC
@ WEB_DOC
Definition: htmlhelp.h:44
HtmlHelp::IDEA_NEW
@ IDEA_NEW
Definition: htmlhelp.h:56
theTranslator
Translator * theTranslator
Definition: language.cpp:156
HtmlHelp::NOTE_NEW
@ NOTE_NEW
Definition: htmlhelp.h:57
Definition::name
virtual QCString name() const =0
Translator::idLanguage
virtual QCString idLanguage()=0
HtmlHelp::NOTE
@ NOTE
Definition: htmlhelp.h:57
TRUE
#define TRUE
Definition: qcstring.h:36
Definition::getOutputFileBase
virtual QCString getOutputFileBase() const =0
HtmlHelp::EMAIL_NEW
@ EMAIL_NEW
Definition: htmlhelp.h:49
HtmlHelp::AUDIO_NEW
@ AUDIO_NEW
Definition: htmlhelp.h:52
HtmlHelp::LINK_NEW
@ LINK_NEW
Definition: htmlhelp.h:47
HtmlHelp::TOOL
@ TOOL
Definition: htmlhelp.h:58
MemberDef::getOutputFileBase
virtual QCString getOutputFileBase() const =0
Config_getBool
#define Config_getBool(name)
Definition: config.h:33
s_languageDict
static StringUnorderedMap s_languageDict
Definition: htmlhelp.cpp:390
HtmlHelp::TOOL_NEW
@ TOOL_NEW
Definition: htmlhelp.h:58
term
void term(const char *fmt,...)
Definition: message.cpp:220
HtmlHelp::BOOK_OPEN_NEW
@ BOOK_OPEN_NEW
Definition: htmlhelp.h:39
qPrint
const char * qPrint(const char *s)
Definition: qcstring.h:589
HtmlHelp::TEXT_NEW
@ TEXT_NEW
Definition: htmlhelp.h:43
MemberDef::getFileDef
virtual const FileDef * getFileDef() const =0
Config_getString
#define Config_getString(name)
Definition: config.h:32
HtmlHelp::INFO
@ INFO
Definition: htmlhelp.h:46
HtmlHelp::MUSIC
@ MUSIC
Definition: htmlhelp.h:53
HtmlHelp::WEB_LINK
@ WEB_LINK
Definition: htmlhelp.h:45
HtmlHelp::IMAGE_NEW
@ IMAGE_NEW
Definition: htmlhelp.h:51
HtmlHelp::IMAGE
@ IMAGE
Definition: htmlhelp.h:51
HtmlHelp::FOLDER_CLOSED
@ FOLDER_CLOSED
Definition: htmlhelp.h:40
HtmlHelp::FOLDER_CLOSED_NEW
@ FOLDER_CLOSED_NEW
Definition: htmlhelp.h:41
convertToHtml
QCString convertToHtml(const QCString &s, bool keepEntities)
Definition: util.cpp:4063
HtmlHelp::BOOKLET_NEW
@ BOOKLET_NEW
Definition: htmlhelp.h:48
MemberDef::getGroupDef
virtual const GroupDef * getGroupDef() const =0
FALSE
#define FALSE
Definition: qcstring.h:33
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108