Doxygen
htmlhelp.cpp
浏览该文件的文档.
1 /******************************************************************************
2  *
3  * Copyright (C) 1997-2020 by Dimitri van Heesch.
4  *
5  * Permission to use, copy, modify, and distribute this software and its
6  * documentation under the terms of the GNU General Public License is hereby
7  * granted. No representations are made about the suitability of this software
8  * for any purpose. It is provided "as is" without express or implied warranty.
9  * See the GNU General Public License for more details.
10  *
11  * Documents produced by Doxygen are derivative works derived from the
12  * input used in their production; they are not affected by this license.
13  *
14  * The original version of this file is largely based on a contribution from
15  * Harm van der Heijden.
16  */
17 
18 #include <algorithm>
19 
20 #include <stdio.h>
21 #include <stdlib.h>
22 
23 #include "htmlhelp.h"
24 #include "config.h"
25 #include "message.h"
26 #include "doxygen.h"
27 #include "language.h"
28 #include "portable.h"
29 #include "groupdef.h"
30 #include "memberdef.h"
31 #include "filedef.h"
32 #include "util.h"
33 #include "linkedmap.h"
34 #include "regex.h"
35 #include "fileinfo.h"
36 
37 //----------------------------------------------------------------------------
38 
39 /** Helper class to deal with recoding the UTF8 encoded text back to the native encoding
40  * specified by CHM_INDEX_ENCODING.
41  */
43 {
44  public:
45  HtmlHelpRecoder() {}
46  ~HtmlHelpRecoder() { finalize(); }
47  HtmlHelpRecoder(const HtmlHelpRecoder &) = delete;
48  HtmlHelpRecoder &operator=(const HtmlHelpRecoder &) = delete;
49 
50  void initialize()
51  {
52  QCString str = Config_getString(CHM_INDEX_ENCODING);
53  if (str.isEmpty()) str = "CP1250"; // use safe and likely default
54  m_fromUtf8 = portable_iconv_open(str.data(),"UTF-8");
56  {
57  term("unsupported character conversion for CHM_INDEX_ENCODING: '%s'->'UTF-8'\n", qPrint(str));
58  }
59  }
60  void finalize()
61  {
63  {
66  }
67  }
68 
69  QCString recode(const QCString &s)
70  {
71  int iSize = s.length();
72  int oSize = iSize*4+1;
73  QCString output(oSize);
74  size_t iLeft = iSize;
75  size_t oLeft = oSize;
76  const char *iPtr = s.data();
77  char *oPtr = output.rawData();
78  if (!portable_iconv(m_fromUtf8,&iPtr,&iLeft,&oPtr,&oLeft))
79  {
80  oSize -= (int)oLeft;
81  output.resize(oSize+1);
82  output.at(oSize)='\0';
83  return output;
84  }
85  else
86  {
87  return s;
88  }
89  }
90  private:
91  void *m_iconv_null = (void*)(-1);
92  void *m_fromUtf8 = m_iconv_null;
93 
94 };
95 
96 //----------------------------------------------------------------------------
97 
98 /** Class representing a field in the HTML help index. */
99 struct IndexField
100 {
101  IndexField(const QCString &k,const QCString &n,const QCString &u,const QCString &a,bool l,bool r) :
102  key(k), name(n), url(u), anchor(a), link(l), reversed(r) {}
107  bool link;
108  bool reversed;
109 };
110 
111 /** A helper class for HtmlHelp that manages a two level index in
112  * alphabetical order.
113  */
115 {
116  public:
117  HtmlHelpIndex(HtmlHelpRecoder &recoder);
118  ~HtmlHelpIndex();
119  void addItem(const QCString &first,const QCString &second,
120  const QCString &url, const QCString &anchor,
121  bool hasLink,bool reversed);
122  void writeFields(std::ostream &t);
123  size_t size() const { return m_map.size(); }
124  private:
127 };
128 
129 /*! Constructs a new HtmlHelp index */
130 HtmlHelpIndex::HtmlHelpIndex(HtmlHelpRecoder &recoder) : m_recoder(recoder)
131 {
132 }
133 
134 /*! Destroys the HtmlHelp index */
136 {
137 }
138 
139 /*! Stores an item in the index if it is not already present.
140  * Items are stored in alphabetical order, by sorting on the
141  * concatenation of \a level1 and \a level2 (if present).
142  *
143  * \param level1 the string at level 1 in the index.
144  * \param level2 the string at level 2 in the index (or 0 if not applicable).
145  * \param url the url of the documentation (without .html extension).
146  * \param anchor the anchor of the documentation within the page.
147  * \param hasLink if true, the url (without anchor) can be used in the
148  * level1 item, when writing the header of a list of level2 items.
149  * \param reversed TRUE if level1 is the member name and level2 the compound
150  * name.
151  */
152 void HtmlHelpIndex::addItem(const QCString &level1,const QCString &level2,
153  const QCString &url,const QCString &anchor,bool hasLink,
154  bool reversed)
155 {
156  static const reg::Ex re(R"(@\d+)");
157  std::string key = level1.str();
158  if (!level2.isEmpty()) key+= std::string("?") + level2.str();
159  if (reg::search(key,re)) // skip anonymous stuff
160  {
161  return;
162  }
163  std::string key_anchor;
164  if (!anchor.isEmpty())
165  {
166  key_anchor = key+anchor.str();
167  }
168  else
169  {
170  key_anchor = key;
171  }
172  m_map.add(key_anchor.c_str(),key.c_str(),url,anchor,hasLink,reversed);
173 }
174 
175 static QCString field2URL(const IndexField *f,bool checkReversed)
176 {
178  if (!f->anchor.isEmpty() && (!checkReversed || f->reversed))
179  {
180  // HTML Help needs colons in link anchors to be escaped in the .hhk file.
181  result+="#"+substitute(f->anchor,":","%3A");
182  }
183  return result;
184 }
185 
186 /*! Writes the sorted list of index items into a html like list.
187  *
188  * An list of calls with <code>name = level1,level2</code> as follows:
189  * <pre>
190  * a1,b1
191  * a1,b2
192  * a2,b1
193  * a2,b2
194  * a3
195  * a4,b1
196  * </pre>
197  *
198  * Will result in the following list:
199  *
200  * <pre>
201  * a1 -> link to url if hasLink==TRUE
202  * b1 -> link to url#anchor
203  * b2 -> link to url#anchor
204  * a2 -> link to url if hasLink==TRUE
205  * b1 -> link to url#anchor
206  * b2 -> link to url#anchor
207  * a3 -> link to url if hasLink==TRUE
208  * a4 -> link to url if hasLink==TRUE
209  * b1 -> link to url#anchor
210  * </pre>
211  */
212 void HtmlHelpIndex::writeFields(std::ostream &t)
213 {
214  std::sort(std::begin(m_map),
215  std::end(m_map),
216  [](const auto &e1,const auto &e2) { return e1->name < e2->name; }
217  );
218  QCString prevLevel1;
219  bool level2Started=FALSE;
220  for (auto it = std::begin(m_map); it!=std::end(m_map); ++it)
221  {
222  auto &f = *it;
223  QCString level1,level2;
224  int i;
225  if ((i=f->name.find('?'))!=-1)
226  {
227  level1 = f->name.left(i);
228  level2 = f->name.right(f->name.length()-i-1);
229  }
230  else
231  {
232  level1 = f->name;
233  }
234 
235  { // finish old list at level 2
236  if (level2Started) t << " </UL>\n";
237  level2Started=FALSE;
238 
239  // <Antony>
240  // Added this code so that an item with only one subitem is written
241  // without any subitem.
242  // For example:
243  // a1, b1 -> will create only a1, not separate subitem for b1
244  // a2, b2
245  // a2, b3
246  QCString nextLevel1;
247  auto it_next = std::next(it);
248  if (it_next!=std::end(m_map))
249  {
250  auto &fnext = *it_next;
251  int j = fnext->name.find('?');
252  if (j<0) j=0;
253  nextLevel1 = fnext->name.left(j);
254  }
255  if (!(level1 == prevLevel1 || level1 == nextLevel1))
256  {
257  level2 = "";
258  }
259  prevLevel1 = level1;
260  // </Antony>
261 
262  if (level2.isEmpty())
263  {
264  t << " <LI><OBJECT type=\"text/sitemap\">";
265  t << "<param name=\"Local\" value=\"" << field2URL(f.get(),FALSE);
266  t << "\">";
267  t << "<param name=\"Name\" value=\"" << convertToHtml(m_recoder.recode(level1),TRUE) << "\">"
268  "</OBJECT>\n";
269  }
270  else
271  {
272  if (f->link)
273  {
274  t << " <LI><OBJECT type=\"text/sitemap\">";
275  t << "<param name=\"Local\" value=\"" << field2URL(f.get(),TRUE);
276  t << "\">";
277  t << "<param name=\"Name\" value=\"" << convertToHtml(m_recoder.recode(level1),TRUE) << "\">"
278  "</OBJECT>\n";
279  }
280  else
281  {
282  t << " <LI><OBJECT type=\"text/sitemap\">";
283  t << "<param name=\"See Also\" value=\"" << convertToHtml(m_recoder.recode(level1),TRUE) << "\">";
284  t << "<param name=\"Name\" value=\"" << convertToHtml(m_recoder.recode(level1),TRUE) << "\">"
285  "</OBJECT>\n";
286  }
287  }
288  }
289  if (!level2Started && !level2.isEmpty())
290  { // start new list at level 2
291  t << " <UL>\n";
292  level2Started=TRUE;
293  }
294  else if (level2Started && level2.isEmpty())
295  { // end list at level 2
296  t << " </UL>\n";
297  level2Started=FALSE;
298  }
299  if (level2Started)
300  {
301  t << " <LI><OBJECT type=\"text/sitemap\">";
302  t << "<param name=\"Local\" value=\"" << field2URL(f.get(),FALSE);
303  t << "\">";
304  t << "<param name=\"Name\" value=\"" << convertToHtml(m_recoder.recode(level2),TRUE) << "\">"
305  "</OBJECT>\n";
306  }
307  }
308  if (level2Started) t << " </UL>\n";
309 }
310 
311 //----------------------------------------------------------------------------
312 //
314 {
315  public:
317  void createProjectFile();
318  std::ofstream cts,kts;
319  bool ctsItemPresent = false;
320  int dc = 0;
325 };
326 
327 
328 /*! Constructs an html object.
329  * The object has to be \link initialize() initialized\endlink before it can
330  * be used.
331  */
332 HtmlHelp::HtmlHelp() : p(std::make_unique<Private>())
333 {
334 }
335 
337 {
338 }
339 
340 /* language codes for Html help
341  0x405 Czech
342  0x406 Danish
343  0x413 Dutch
344  0xC09 English (Australia)
345  0x809 English (Britain)
346  0x1009 English (Canada)
347  0x1809 English (Ireland)
348  0x1409 English (New Zealand)
349  0x1C09 English (South Africa)
350  0x409 English (United States)
351  0x40B Finnish
352  0x40C French
353  0x407 German
354  0x408 Greece
355  0x40E Hungarian
356  0x410 Italian
357  0x814 Norwegian
358  0x415 Polish
359  0x816 Portuguese(Portugal)
360  0x416 Portuguese(Brazil)
361  0x419 Russian
362  0x80A Spanish(Mexico)
363  0xC0A Spanish(Modern Sort)
364  0x40A Spanish(Traditional Sort)
365  0x41D Swedish
366  0x41F Turkey
367  0x411 Japanese
368  0x412 Korean
369  0x804 Chinese (PRC)
370  0x404 Chinese (Taiwan)
371 
372  New LCIDs:
373  0x421 Indonesian
374  0x41A Croatian
375  0x418 Romanian
376  0x424 Slovenian
377  0x41B Slovak
378  0x422 Ukrainian
379  0x81A Serbian (Serbia, Latin)
380  0x403 Catalan
381  0x426 Latvian
382  0x427 Lithuanian
383  0x436 Afrikaans
384  0x42A Vietnamese
385  0x429 Persian (Iran)
386  0xC01 Arabic (Egypt) - I don't know which version of arabic is used inside translator_ar.h ,
387  so I have chosen Egypt at random
388 
389 */
391 {
392  { "czech", "0x405 Czech" },
393  { "danish", "0x406 Danish" },
394  { "dutch", "0x413 Dutch" },
395  { "finnish", "0x40B Finnish" },
396  { "french", "0x40C French" },
397  { "german", "0x407 German" },
398  { "greek", "0x408 Greece" },
399  { "hungarian", "0x40E Hungarian" },
400  { "italian", "0x410 Italian" },
401  { "norwegian", "0x814 Norwegian" },
402  { "polish", "0x415 Polish" },
403  { "portuguese", "0x816 Portuguese(Portugal)" },
404  { "brazilian", "0x416 Portuguese(Brazil)" },
405  { "russian", "0x419 Russian" },
406  { "spanish", "0x40A Spanish(Traditional Sort)" },
407  { "swedish", "0x41D Swedish" },
408  { "turkish", "0x41F Turkey" },
409  { "japanese", "0x411 Japanese" },
410  { "japanese-en", "0x411 Japanese" },
411  { "korean", "0x412 Korean" },
412  { "korean-en", "0x412 Korean" },
413  { "chinese", "0x804 Chinese (PRC)" },
414  { "chinese-traditional", "0x404 Chinese (Taiwan)" },
415  { "indonesian", "0x421 Indonesian" },
416  { "croatian", "0x41A Croatian" },
417  { "romanian", "0x418 Romanian" },
418  { "slovene", "0x424 Slovenian" },
419  { "slovak", "0x41B Slovak" },
420  { "ukrainian", "0x422 Ukrainian" },
421  { "serbian", "0x81A Serbian (Serbia, Latin)" },
422  { "catalan", "0x403 Catalan" },
423  { "lithuanian", "0x427 Lithuanian" },
424  { "afrikaans", "0x436 Afrikaans" },
425  { "vietnamese", "0x42A Vietnamese" },
426  { "persian", "0x429 Persian (Iran)" },
427  { "arabic", "0xC01 Arabic (Egypt)" },
428  { "latvian", "0x426 Latvian" },
429  { "macedonian", "0x042f Macedonian (Former Yugoslav Republic of Macedonia)" },
430  { "armenian", "0x42b Armenian" },
431  //Code for Esperanto should be as shown below but the htmlhelp compiler 1.3 does not support this
432  // (and no newer version is available).
433  //So do a fallback to the default language (see getLanguageString())
434  //{ "esperanto", "0x48f Esperanto" },
435  { "serbian-cyrillic", "0xC1A Serbian (Serbia, Cyrillic)" }
436 };
437 
438 /*! This will create a contents file (index.hhc) and a index file (index.hhk)
439  * and write the header of those files.
440  * It also creates a project file (index.hhp)
441  * \sa finalize()
442  */
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 }
478 
479 
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 }
493 
494 
495 
497 {
498  /* Write the project file */
499  QCString fName = Config_getString(HTML_OUTPUT) + "/index.hhp";
500  std::ofstream t(fName.str(),std::ofstream::out | std::ofstream::binary);
501  if (t.is_open())
502  {
503  const char *hhcFile = "\"index.hhc\"";
504  const char *hhkFile = "\"index.hhk\"";
505  bool hhkPresent = index.size()>0;
506  if (!ctsItemPresent) hhcFile = "";
507  if (!hhkPresent) hhkFile = "";
508 
509  QCString indexName="index"+Doxygen::htmlFileExtension;
510  t << "[OPTIONS]\n";
511  if (!Config_getString(CHM_FILE).isEmpty())
512  {
513  t << "Compiled file=" << Config_getString(CHM_FILE) << "\n";
514  }
515  t << "Compatibility=1.1\n"
516  "Full-text search=Yes\n";
517  if (ctsItemPresent) t << "Contents file=index.hhc\n";
518  t << "Default Window=main\n"
519  "Default topic=" << indexName << "\n";
520  if (hhkPresent) t << "Index file=index.hhk\n";
521  t << "Language=" << getLanguageString() << "\n";
522  if (Config_getBool(BINARY_TOC)) t << "Binary TOC=YES\n";
523  if (Config_getBool(GENERATE_CHI)) t << "Create CHI file=YES\n";
524  t << "Title=" << recoder.recode(Config_getString(PROJECT_NAME)) << "\n\n";
525 
526  t << "[WINDOWS]\n";
527 
528  // NOTE: the 0x10387e number is a set of bits specifying the buttons
529  // which should appear in the CHM viewer; that specific value
530  // means "show all buttons including the font-size one";
531  // the font-size one is not normally settable by the HTML Help Workshop
532  // utility but the way to set it is described here:
533  // http://support.microsoft.com/?scid=kb%3Ben-us%3B240062&x=17&y=18
534  // NOTE: the 0x70387e number in addition to the above the Next and Prev button
535  // are shown. They can only be shown in case of a binary toc.
536  // dee http://www.mif2go.com/xhtml/htmlhelp_0016_943addingtabsandtoolbarbuttonstohtmlhelp.htm#Rz108x95873
537  // Value has been taken from htmlhelp.h file of the HTML Help Workshop
538  if (Config_getBool(BINARY_TOC))
539  {
540  t << "main=\"" << recoder.recode(Config_getString(PROJECT_NAME)) << "\"," << hhcFile << ","
541  << hhkFile << ",\"" << indexName << "\",\"" <<
542  indexName << "\",,,,,0x23520,,0x70387e,,,,,,,,0\n\n";
543  }
544  else
545  {
546  t << "main=\"" << recoder.recode(Config_getString(PROJECT_NAME)) << "\"," << hhcFile << ","
547  << hhkFile << ",\"" << indexName << "\",\"" <<
548  indexName << "\",,,,,0x23520,,0x10387e,,,,,,,,0\n\n";
549  }
550 
551  t << "[FILES]\n";
552  for (auto &s : indexFiles)
553  {
554  t << s.c_str() << "\n";
555  }
556  for (auto &s : imageFiles)
557  {
558  t << s.c_str() << "\n";
559  }
560  t.close();
561  }
562  else
563  {
564  err("Could not open file %s for writing\n",qPrint(fName));
565  }
566 }
567 
569 {
570  p->indexFiles.insert(s.str());
571 }
572 
573 /*! Finalizes the HTML help. This will finish and close the
574  * contents file (index.hhc) and the index file (index.hhk).
575  * \sa initialize()
576  */
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 }
597 
598 /*! Increase the level of the contents hierarchy.
599  * This will start a new unnumbered HTML list in contents file.
600  * \sa decContentsDepth()
601  */
603 {
604  int i; for (i=0;i<p->dc+1;i++) p->cts << " ";
605  p->cts << "<UL>\n";
606  ++p->dc;
607 }
608 
609 /*! Decrease the level of the contents hierarchy.
610  * This will end the unnumber HTML list.
611  * \sa incContentsDepth()
612  */
614 {
615  int i; for (i=0;i<p->dc;i++) p->cts << " ";
616  p->cts << "</UL>\n";
617  --p->dc;
618 }
619 
620 /*! Add an list item to the contents file.
621  * \param isDir boolean indicating if this is a dir or file entry
622  * \param name the name of the item.
623  * \param ref the URL of to the item.
624  * \param file the file in which the item is defined.
625  * \param anchor the anchor of the item.
626  * \param separateIndex not used.
627  * \param addToNavIndex not used.
628  * \param def not used.
629  */
631  const QCString &name,
632  const QCString & /*ref*/,
633  const QCString &file,
634  const QCString &anchor,
635  bool /* separateIndex */,
636  bool /* addToNavIndex */,
637  const Definition * /* def */)
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 }
686 
687 
688 void HtmlHelp::addIndexItem(const Definition *context,const MemberDef *md,
689  const QCString &sectionAnchor,const QCString &word)
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 }
719 
720 void HtmlHelp::addImageFile(const QCString &fileName)
721 {
722  p->imageFiles.insert(fileName.str());
723 }
724 
HtmlHelp::Private::indexFiles
StringSet indexFiles
Definition: htmlhelp.cpp:321
HtmlHelpRecoder::recode
QCString recode(const QCString &s)
Definition: htmlhelp.cpp:84
HtmlHelpIndex::HtmlHelpIndex
HtmlHelpIndex(HtmlHelpRecoder &recoder)
Definition: htmlhelp.cpp:130
portable_iconv
size_t portable_iconv(void *cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
fileinfo.h
HtmlHelp::Private::ctsItemPresent
bool ctsItemPresent
Definition: htmlhelp.cpp:319
HtmlHelp::BOOK_CLOSED
@ BOOK_CLOSED
Definition: htmlhelp.h:38
htmlhelp.h
QCString::rawData
char * rawData()
Returns a writable pointer to the data.
Definition: qcstring.h:157
HtmlHelpRecoder::operator=
HtmlHelpRecoder & operator=(const HtmlHelpRecoder &)=delete
HtmlHelp::Private::kts
std::ofstream kts
Definition: htmlhelp.cpp:318
Definition
The common base class of all entity definitions found in the sources.
Definition: definition.h:76
HtmlHelp::initialize
void initialize()
Definition: htmlhelp.cpp:443
QCString::length
uint length() const
Returns the length of the string, not counting the 0-terminator.
Definition: qcstring.h:147
memberdef.h
QCString::isEmpty
bool isEmpty() const
Returns TRUE iff the string is empty
Definition: qcstring.h:144
HtmlHelp::p
std::unique_ptr< Private > p
Definition: htmlhelp.h:84
HtmlHelpIndex::writeFields
void writeFields(std::ostream &t)
Definition: htmlhelp.cpp:212
IndexField::link
bool link
Definition: htmlhelp.cpp:107
LinkedMap::add
T * add(const char *k, Args &&... args)
Adds a new object to the ordered vector if it was not added already.
Definition: linkedmap.h:103
StringUnorderedMap
std::unordered_map< std::string, std::string > StringUnorderedMap
Definition: containers.h:27
StringSet
std::set< std::string > StringSet
Definition: containers.h:30
QCString::str
std::string str() const
Definition: qcstring.h:442
field2URL
static QCString field2URL(const IndexField *f, bool checkReversed)
Definition: htmlhelp.cpp:175
IndexField::key
QCString key
Definition: htmlhelp.cpp:103
HtmlHelp::Private::index
HtmlHelpIndex index
Definition: htmlhelp.cpp:324
err
void err(const char *fmt,...)
Definition: message.cpp:203
HtmlHelpRecoder::initialize
void initialize()
Definition: htmlhelp.cpp:65
QCString::at
char & at(size_t i)
Returns a reference to the character at index i.
Definition: qcstring.h:477
portable_iconv_open
void * portable_iconv_open(const char *tocode, const char *fromcode)
linkedmap.h
begin
DirIterator begin(DirIterator it) noexcept
Definition: dir.cpp:123
HtmlHelp::incContentsDepth
void incContentsDepth()
Definition: htmlhelp.cpp:602
HtmlHelp::addIndexItem
void addIndexItem(const Definition *context, const MemberDef *md, const QCString &sectionAnchor, const QCString &title)
Definition: htmlhelp.cpp:688
end
DirIterator end(const DirIterator &) noexcept
Definition: dir.cpp:128
HtmlHelp::TEXT
@ TEXT
Definition: htmlhelp.h:43
HtmlHelp::decContentsDepth
void decContentsDepth()
Definition: htmlhelp.cpp:613
IndexField::name
QCString name
Definition: htmlhelp.cpp:104
HtmlHelp::Private::dc
int dc
Definition: htmlhelp.cpp:320
MemberDef::anchor
virtual QCString anchor() const =0
HtmlHelpRecoder::HtmlHelpRecoder
HtmlHelpRecoder()
Definition: htmlhelp.cpp:60
HtmlHelp::Private::cts
std::ofstream cts
Definition: htmlhelp.cpp:318
addHtmlExtensionIfMissing
QCString addHtmlExtensionIfMissing(const QCString &fName)
Definition: util.cpp:5275
MemberDef
A model of a class/file/namespace member symbol.
Definition: memberdef.h:45
IndexField
Class representing a field in the HTML help index.
Definition: htmlhelp.cpp:99
HtmlHelp::addIndexFile
void addIndexFile(const QCString &name)
Definition: htmlhelp.cpp:568
QCString::left
QCString left(size_t len) const
Definition: qcstring.h:212
message.h
HtmlHelp::HtmlHelp
HtmlHelp()
Definition: htmlhelp.cpp:332
theTranslator
Translator * theTranslator
Definition: language.cpp:156
HtmlHelpRecoder::~HtmlHelpRecoder
~HtmlHelpRecoder()
Definition: htmlhelp.cpp:61
Definition::name
virtual QCString name() const =0
doxygen.h
HtmlHelpRecoder
Helper class to deal with recoding the UTF8 encoded text back to the native encoding specified by CHM...
Definition: htmlhelp.cpp:42
IndexField::url
QCString url
Definition: htmlhelp.cpp:105
language.h
HtmlHelp::Private::recoder
HtmlHelpRecoder recoder
Definition: htmlhelp.cpp:323
Translator::idLanguage
virtual QCString idLanguage()=0
TRUE
#define TRUE
Definition: qcstring.h:36
Definition::getOutputFileBase
virtual QCString getOutputFileBase() const =0
regex.h
HtmlHelpIndex::m_map
LinkedMap< IndexField > m_map
Definition: htmlhelp.cpp:125
filedef.h
HtmlHelpIndex::~HtmlHelpIndex
~HtmlHelpIndex()
Definition: htmlhelp.cpp:135
HtmlHelp::Private::Private
Private()
Definition: htmlhelp.cpp:316
HtmlHelp::finalize
void finalize()
Definition: htmlhelp.cpp:577
HtmlHelp::getLanguageString
static QCString getLanguageString()
Definition: htmlhelp.cpp:480
IndexField::anchor
QCString anchor
Definition: htmlhelp.cpp:106
substitute
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition: qcstring.cpp:465
HtmlHelp::Private
Definition: htmlhelp.cpp:313
MemberDef::getOutputFileBase
virtual QCString getOutputFileBase() const =0
Config_getBool
#define Config_getBool(name)
Definition: config.h:33
HtmlHelpIndex::addItem
void addItem(const QCString &first, const QCString &second, const QCString &url, const QCString &anchor, bool hasLink, bool reversed)
Definition: htmlhelp.cpp:152
Doxygen::htmlFileExtension
static QCString htmlFileExtension
Definition: doxygen.h:103
s_languageDict
static StringUnorderedMap s_languageDict
Definition: htmlhelp.cpp:390
reg::Ex
Class representing a regular expression.
Definition: regex.h:48
term
void term(const char *fmt,...)
Definition: message.cpp:220
IndexField::IndexField
IndexField(const QCString &k, const QCString &n, const QCString &u, const QCString &a, bool l, bool r)
Definition: htmlhelp.cpp:101
HtmlHelpIndex::m_recoder
HtmlHelpRecoder & m_recoder
Definition: htmlhelp.cpp:126
IndexField::reversed
bool reversed
Definition: htmlhelp.cpp:108
HtmlHelpRecoder::finalize
void finalize()
Definition: htmlhelp.cpp:75
qPrint
const char * qPrint(const char *s)
Definition: qcstring.h:589
HtmlHelp::Private::createProjectFile
void createProjectFile()
Definition: htmlhelp.cpp:496
HtmlHelpRecoder::m_fromUtf8
void * m_fromUtf8
Definition: htmlhelp.cpp:107
MemberDef::getFileDef
virtual const FileDef * getFileDef() const =0
Config_getString
#define Config_getString(name)
Definition: config.h:32
config.h
groupdef.h
QCString::data
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string
Definition: qcstring.h:153
LinkedMap< IndexField >
HtmlHelp::~HtmlHelp
~HtmlHelp()
Definition: htmlhelp.cpp:336
HtmlHelpIndex::size
size_t size() const
Definition: htmlhelp.cpp:123
HtmlHelpRecoder::m_iconv_null
void * m_iconv_null
Definition: htmlhelp.cpp:106
portable.h
Portable versions of functions that are platform dependent.
reg::search
bool search(const std::string &str, Match &match, const Ex &re, size_t pos)
Search in a given string str starting at position pos for a match against regular expression re.
Definition: regex.cpp:718
portable_iconv_close
int portable_iconv_close(void *cd)
HtmlHelp::addContentsItem
void addContentsItem(bool isDir, const QCString &name, const QCString &ref, const QCString &file, const QCString &anchor, bool separateIndex, bool addToNavIndex, const Definition *def)
Definition: htmlhelp.cpp:630
HtmlHelpIndex
A helper class for HtmlHelp that manages a two level index in alphabetical order.
Definition: htmlhelp.cpp:114
util.h
A bunch of utility functions.
HtmlHelp::Private::imageFiles
StringSet imageFiles
Definition: htmlhelp.cpp:322
QCString::right
QCString right(size_t len) const
Definition: qcstring.h:217
QCString::resize
bool resize(size_t newlen)
Resizes the string to hold newlen characters (this value should also count the 0-terminator).
Definition: qcstring.h:164
convertToHtml
QCString convertToHtml(const QCString &s, bool keepEntities)
Definition: util.cpp:4063
MemberDef::getGroupDef
virtual const GroupDef * getGroupDef() const =0
FALSE
#define FALSE
Definition: qcstring.h:33
HtmlHelp::addImageFile
void addImageFile(const QCString &)
Definition: htmlhelp.cpp:720
LinkedMap::size
size_t size() const
Definition: linkedmap.h:223
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108