浏览该文件的文档.
53 if (str.
isEmpty()) str =
"CP1250";
57 term(
"unsupported character conversion for CHM_INDEX_ENCODING: '%s'->'UTF-8'\n",
qPrint(str));
72 int oSize = iSize*4+1;
76 const char *iPtr = s.
data();
82 output.
at(oSize)=
'\0';
121 bool hasLink,
bool reversed);
156 static const reg::Ex re(R
"(@\d+)");
157 std::string key = level1.str();
158 if (!level2.
isEmpty()) key+= std::string(
"?") + level2.
str();
163 std::string key_anchor;
166 key_anchor = key+anchor.
str();
172 m_map.
add(key_anchor.c_str(),key.c_str(),url,anchor,hasLink,reversed);
216 [](
const auto &e1,
const auto &e2) {
return e1->name < e2->name; }
219 bool level2Started=
FALSE;
225 if ((i=f->name.find(
'?'))!=-1)
227 level1 = f->name.
left(i);
228 level2 = f->name.
right(f->name.length()-i-1);
236 if (level2Started) t <<
" </UL>\n";
247 auto it_next = std::next(it);
250 auto &fnext = *it_next;
251 int j = fnext->name.find(
'?');
253 nextLevel1 = fnext->name.
left(j);
255 if (!(level1 == prevLevel1 || level1 == nextLevel1))
264 t <<
" <LI><OBJECT type=\"text/sitemap\">";
265 t <<
"<param name=\"Local\" value=\"" <<
field2URL(f.get(),
FALSE);
274 t <<
" <LI><OBJECT type=\"text/sitemap\">";
275 t <<
"<param name=\"Local\" value=\"" <<
field2URL(f.get(),
TRUE);
282 t <<
" <LI><OBJECT type=\"text/sitemap\">";
289 if (!level2Started && !level2.
isEmpty())
294 else if (level2Started && level2.
isEmpty())
301 t <<
" <LI><OBJECT type=\"text/sitemap\">";
302 t <<
"<param name=\"Local\" value=\"" <<
field2URL(f.get(),
FALSE);
308 if (level2Started) t <<
" </UL>\n";
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" },
435 {
"serbian-cyrillic",
"0xC1A Serbian (Serbia, Cyrillic)" }
445 p->recoder.initialize();
449 p->cts.open(fName.
str(),std::ofstream::out | std::ofstream::binary);
450 if (!
p->cts.is_open())
452 term(
"Could not open file %s for writing\n",
qPrint(fName));
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"
464 p->kts.open(fName.
str(),std::ofstream::out | std::ofstream::binary);
465 if (!
p->kts.is_open())
467 term(
"Could not open file %s for writing\n",
qPrint(fName));
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"
491 return "0x409 English (United States)";
500 std::ofstream t(fName.
str(),std::ofstream::out | std::ofstream::binary);
503 const char *hhcFile =
"\"index.hhc\"";
504 const char *hhkFile =
"\"index.hhk\"";
507 if (!hhkPresent) hhkFile =
"";
515 t <<
"Compatibility=1.1\n"
516 "Full-text search=Yes\n";
518 t <<
"Default Window=main\n"
519 "Default topic=" << indexName <<
"\n";
520 if (hhkPresent) t <<
"Index file=index.hhk\n";
541 << hhkFile <<
",\"" << indexName <<
"\",\"" <<
542 indexName <<
"\",,,,,0x23520,,0x70387e,,,,,,,,0\n\n";
547 << hhkFile <<
",\"" << indexName <<
"\",\"" <<
548 indexName <<
"\",,,,,0x23520,,0x10387e,,,,,,,,0\n\n";
554 t << s.c_str() <<
"\n";
558 t << s.c_str() <<
"\n";
564 err(
"Could not open file %s for writing\n",
qPrint(fName));
570 p->indexFiles.insert(s.
str());
581 p->cts <<
"</BODY>\n";
582 p->cts <<
"</HTML>\n";
585 p->index.writeFields(
p->kts);
589 p->kts <<
"</BODY>\n";
590 p->kts <<
"</HTML>\n";
593 p->createProjectFile();
595 p->recoder.finalize();
604 int i;
for (i=0;i<
p->dc+1;i++)
p->cts <<
" ";
615 int i;
for (i=0;i<
p->dc;i++)
p->cts <<
" ";
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) <<
"\">";
655 if (file[0]==
'!' || file[0]==
'^')
657 p->cts <<
"<param name=\"";
658 if (file[0]==
'^')
p->cts <<
"URL";
else p->cts <<
"Local";
659 p->cts <<
"\" value=\"";
665 if (!(binaryTOC && isDir))
667 p->cts <<
"<param name=\"Local\" value=\"";
669 if (!anchor.
isEmpty())
p->cts <<
"#" << anchor;
674 p->cts <<
"<param name=\"ImageNumber\" value=\"";
684 p->cts <<
"</OBJECT>\n";
693 static bool separateMemberPages =
Config_getBool(SEPARATE_MEMBER_PAGES);
701 if (context==0)
return;
707 QCString contRef = separateMemberPages ? cfname : cfiname;
710 p->index.addItem(level1,level2,contRef,anchor,
TRUE,
FALSE);
711 p->index.addItem(level2,level1,memRef,anchor,
TRUE,
TRUE);
722 p->imageFiles.insert(fileName.
str());
QCString recode(const QCString &s)
HtmlHelpIndex(HtmlHelpRecoder &recoder)
size_t portable_iconv(void *cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
char * rawData()
Returns a writable pointer to the data.
HtmlHelpRecoder & operator=(const HtmlHelpRecoder &)=delete
The common base class of all entity definitions found in the sources.
uint length() const
Returns the length of the string, not counting the 0-terminator.
bool isEmpty() const
Returns TRUE iff the string is empty
std::unique_ptr< Private > p
void writeFields(std::ostream &t)
T * add(const char *k, Args &&... args)
Adds a new object to the ordered vector if it was not added already.
std::unordered_map< std::string, std::string > StringUnorderedMap
std::set< std::string > StringSet
static QCString field2URL(const IndexField *f, bool checkReversed)
void err(const char *fmt,...)
char & at(size_t i)
Returns a reference to the character at index i.
void * portable_iconv_open(const char *tocode, const char *fromcode)
DirIterator begin(DirIterator it) noexcept
void addIndexItem(const Definition *context, const MemberDef *md, const QCString §ionAnchor, const QCString &title)
DirIterator end(const DirIterator &) noexcept
virtual QCString anchor() const =0
QCString addHtmlExtensionIfMissing(const QCString &fName)
A model of a class/file/namespace member symbol.
Class representing a field in the HTML help index.
void addIndexFile(const QCString &name)
QCString left(size_t len) const
Translator * theTranslator
virtual QCString name() const =0
Helper class to deal with recoding the UTF8 encoded text back to the native encoding specified by CHM...
virtual QCString idLanguage()=0
virtual QCString getOutputFileBase() const =0
LinkedMap< IndexField > m_map
static QCString getLanguageString()
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
virtual QCString getOutputFileBase() const =0
#define Config_getBool(name)
void addItem(const QCString &first, const QCString &second, const QCString &url, const QCString &anchor, bool hasLink, bool reversed)
static QCString htmlFileExtension
static StringUnorderedMap s_languageDict
Class representing a regular expression.
void term(const char *fmt,...)
IndexField(const QCString &k, const QCString &n, const QCString &u, const QCString &a, bool l, bool r)
HtmlHelpRecoder & m_recoder
const char * qPrint(const char *s)
virtual const FileDef * getFileDef() const =0
#define Config_getString(name)
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string
Portable versions of functions that are platform dependent.
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.
int portable_iconv_close(void *cd)
void addContentsItem(bool isDir, const QCString &name, const QCString &ref, const QCString &file, const QCString &anchor, bool separateIndex, bool addToNavIndex, const Definition *def)
A helper class for HtmlHelp that manages a two level index in alphabetical order.
A bunch of utility functions.
QCString right(size_t len) const
bool resize(size_t newlen)
Resizes the string to hold newlen characters (this value should also count the 0-terminator).
QCString convertToHtml(const QCString &s, bool keepEntities)
virtual const GroupDef * getGroupDef() const =0
void addImageFile(const QCString &)
This is an alternative implementation of QCString.