52 if (str.
isEmpty()) str =
"CP1250";
56 term(
"unsupported character conversion for CHM_INDEX_ENCODING: '%s'->'UTF-8'\n",
qPrint(str));
71 size_t oSize = iSize*4;
75 const char *iPtr = s.
data();
81 output.
at(oSize)=
'\0';
121 bool hasLink,
bool reversed);
155 static const reg::Ex re(R
"(@\d+)");
162 std::string key_anchor;
165 key_anchor = key+anchor.
str();
171 m_map.add(key_anchor.c_str(),key.c_str(),url,anchor,hasLink,reversed);
193 size_t maxExpandedLen = maxLen+50;
195 if (result.
length()>maxExpandedLen)
199 while (maxLen>0 && result.
length()>maxExpandedLen)
240 std::stable_sort(std::begin(
m_map),
242 [](
const auto &e1,
const auto &e2) {
return qstricmp_sort(e1->name,e2->name)<0; }
245 bool level2Started=
FALSE;
246 for (
auto it = std::begin(
m_map); it!=std::end(
m_map); ++it)
250 int i = f->name.
find(
'?');
253 level1 = f->name.
left(i);
254 level2 = f->name.
right(f->name.length()-i-1);
262 if (level2Started) t <<
" </UL>\n";
273 auto it_next = std::next(it);
274 if (it_next!=std::end(
m_map))
276 auto &fnext = *it_next;
277 int j = fnext->name.find(
'?');
279 nextLevel1 = fnext->name.
left(j);
281 if (!(level1 == prevLevel1 || level1 == nextLevel1))
290 t <<
" <LI><OBJECT type=\"text/sitemap\">";
291 t <<
"<param name=\"Local\" value=\"" <<
field2URL(f.get(),
FALSE);
300 t <<
" <LI><OBJECT type=\"text/sitemap\">";
301 t <<
"<param name=\"Local\" value=\"" <<
field2URL(f.get(),
TRUE);
308 t <<
" <LI><OBJECT type=\"text/sitemap\">";
315 if (!level2Started && !level2.
isEmpty())
320 else if (level2Started && level2.
isEmpty())
327 t <<
" <LI><OBJECT type=\"text/sitemap\">";
328 t <<
"<param name=\"Local\" value=\"" <<
field2URL(f.get(),
FALSE);
334 if (level2Started) t <<
" </UL>\n";
371 p->recoder.initialize();
376 if (!
p->cts.is_open())
378 term(
"Could not open file %s for writing\n",
qPrint(fName));
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"
391 if (!
p->kts.is_open())
393 term(
"Could not open file %s for writing\n",
qPrint(fName));
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"
414 bool hhkPresent =
index.size()>0;
416 if (!hhkPresent) hhkFile =
"";
426 t <<
"Compiled file=index.chm\n";
428 t <<
"Compatibility=1.1\n"
429 "Full-text search=Yes\n";
431 t <<
"Default Window=main\n"
432 "Default topic=" << indexName <<
"\n";
433 if (hhkPresent) t <<
"Index file=" +
hhkFileName +
"\n";
434 t <<
"Language=" <<
theTranslator->getLanguageString() <<
"\n";
454 << hhkFile <<
",\"" << indexName <<
"\",\"" <<
455 indexName <<
"\",,,,,0x23520,,0x70387e,,,,,,,,0\n\n";
460 << hhkFile <<
",\"" << indexName <<
"\",\"" <<
461 indexName <<
"\",,,,,0x23520,,0x10387e,,,,,,,,0\n\n";
467 t << s.c_str() <<
"\n";
471 t << s.c_str() <<
"\n";
475 t << s.c_str() <<
"\n";
481 err(
"Could not open file %s for writing\n",
qPrint(fName));
487 p->indexFiles.insert(s.
str());
498 p->cts <<
"</BODY>\n";
499 p->cts <<
"</HTML>\n";
502 p->index.writeFields(
p->kts);
506 p->kts <<
"</BODY>\n";
507 p->kts <<
"</HTML>\n";
510 p->createProjectFile();
512 p->recoder.finalize();
521 for (
int i=0; i<
p->dc+1; i++)
p->cts <<
" ";
532 for (
int i=0; i<
p->dc; i++)
p->cts <<
" ";
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) <<
"\">";
562 if (file[0]==
'!' || file[0]==
'^')
564 p->cts <<
"<param name=\"";
565 if (file[0]==
'^')
p->cts <<
"URL";
else p->cts <<
"Local";
566 p->cts <<
"\" value=\"";
575 p->cts <<
"<param name=\"Local\" value=\"";
578 if (
p->prevFile == currFile &&
p->prevAnc.isEmpty() && currAnc.
isEmpty())
582 if (!currAnc.
isEmpty())
p->cts <<
"#" << currAnc;
584 p->prevFile = currFile;
585 p->prevAnc = currAnc;
588 p->cts <<
"<param name=\"ImageNumber\" value=\"";
595 p->cts <<
static_cast<int>(
TEXT);
598 p->cts <<
"</OBJECT>\n";
612 p->index.addItem(level1,level2,cfname,anchor,
TRUE,
FALSE);
613 p->index.addItem(level2,level1,cfname,anchor,
TRUE,
TRUE);
624 p->styleFiles.insert(fileName.
str());
629 p->imageFiles.insert(fileName.
str());
The common base class of all entity definitions found in the sources.
virtual QCString anchor() const =0
virtual QCString getOutputFileBase() const =0
virtual const QCString & name() const =0
static QCString htmlFileExtension
void addImageFile(const QCString &)
void addIndexFile(const QCString &name)
static const QCString hhkFileName
void addIndexItem(const Definition *context, const MemberDef *md, const QCString §ionAnchor, const QCString &title)
static const QCString hhpFileName
std::unique_ptr< Private > p
void addContentsItem(bool isDir, const QCString &name, const QCString &ref, const QCString &file, const QCString &anchor, bool separateIndex, bool addToNavIndex, const Definition *def)
void addStyleSheetFile(const QCString &)
static const QCString hhcFileName
A helper class for HtmlHelp that manages a two level index in alphabetical order.
HtmlHelpRecoder & m_recoder
void addItem(const QCString &first, const QCString &second, const QCString &url, const QCString &anchor, bool hasLink, bool reversed)
void writeFields(std::ostream &t)
HtmlHelpIndex(HtmlHelpRecoder &recoder)
LinkedMap< IndexField > m_map
Helper class to deal with recoding the UTF8 encoded text back to the native encoding specified by CHM...
QCString recode(const QCString &s)
Container class representing a vector of objects with keys.
A model of a class/file/namespace member symbol.
virtual QCString argsString() const =0
This is an alternative implementation of QCString.
int find(char c, int index=0, bool cs=TRUE) const
size_t length() const
Returns the length of the string, not counting the 0-terminator.
char & at(size_t i)
Returns a reference to the character at index i.
char * rawData()
Returns a writable pointer to the data.
bool isEmpty() const
Returns TRUE iff the string is empty.
void resize(size_t newlen)
const std::string & str() const
QCString right(size_t len) const
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
QCString left(size_t len) const
Class representing a regular expression.
#define Config_getBool(name)
#define Config_getString(name)
#define NON_COPYABLE(cls)
Macro to help implementing the rule of 5 for a non-copyable & movable class.
std::set< std::string > StringSet
static QCString convertToHtmlAndTruncate(const QCString &s)
static QCString field2URL(const IndexField *f, bool checkReversed)
Translator * theTranslator
std::ofstream openOutputStream(const QCString &name, bool append=false)
bool search(std::string_view 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.
Portable versions of functions that are platform dependent.
int portable_iconv_close(void *cd)
size_t portable_iconv(void *cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
void * portable_iconv_open(const char *tocode, const char *fromcode)
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
int qstricmp_sort(const char *str1, const char *str2)
const char * qPrint(const char *s)
Class representing a field in the HTML help index.
IndexField(const QCString &k, const QCString &n, const QCString &u, const QCString &a, bool l, bool r)
QCString externalRef(const QCString &relPath, const QCString &ref, bool href)
QCString convertToHtml(const QCString &s, bool keepEntities)
void addHtmlExtensionIfMissing(QCString &fName)
A bunch of utility functions.