52 if (str.
isEmpty()) str =
"CP1250";
56 term(
"unsupported character conversion for CHM_INDEX_ENCODING: '{}'->'UTF-8'\n", 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+)");
165 key_anchor += anchor;
167 m_map.add(key_anchor,key,url,anchor,hasLink,reversed);
189 size_t maxExpandedLen = maxLen+50;
191 if (result.
length()>maxExpandedLen)
195 while (maxLen>0 && result.
length()>maxExpandedLen)
236 std::stable_sort(std::begin(
m_map),
238 [](
const auto &e1,
const auto &e2) {
return qstricmp_sort(e1->name,e2->name)<0; }
241 bool level2Started=
FALSE;
242 for (
auto it = std::begin(
m_map); it!=std::end(
m_map); ++it)
246 int i = f->name.
find(
'?');
249 level1 = f->name.
left(i);
250 level2 = f->name.
right(f->name.length()-i-1);
258 if (level2Started) t <<
" </UL>\n";
269 auto it_next = std::next(it);
270 if (it_next!=std::end(
m_map))
272 auto &fnext = *it_next;
273 int j = fnext->name.find(
'?');
275 nextLevel1 = fnext->name.
left(j);
277 if (!(level1 == prevLevel1 || level1 == nextLevel1))
286 t <<
" <LI><OBJECT type=\"text/sitemap\">";
287 t <<
"<param name=\"Local\" value=\"" <<
field2URL(f.get(),
FALSE);
296 t <<
" <LI><OBJECT type=\"text/sitemap\">";
297 t <<
"<param name=\"Local\" value=\"" <<
field2URL(f.get(),
TRUE);
304 t <<
" <LI><OBJECT type=\"text/sitemap\">";
311 if (!level2Started && !level2.
isEmpty())
316 else if (level2Started && level2.
isEmpty())
323 t <<
" <LI><OBJECT type=\"text/sitemap\">";
324 t <<
"<param name=\"Local\" value=\"" <<
field2URL(f.get(),
FALSE);
330 if (level2Started) t <<
" </UL>\n";
367 p->recoder.initialize();
372 if (!
p->cts.is_open())
374 term(
"Could not open file {} for writing\n",fName);
377 p->cts <<
"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n"
378 "<HTML><HEAD></HEAD><BODY>\n"
379 "<OBJECT type=\"text/site properties\">\n"
380 "<param name=\"FrameName\" value=\"right\">\n"
387 if (!
p->kts.is_open())
389 term(
"Could not open file {} for writing\n",fName);
392 p->kts <<
"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n"
393 "<HTML><HEAD></HEAD><BODY>\n"
394 "<OBJECT type=\"text/site properties\">\n"
395 "<param name=\"FrameName\" value=\"right\">\n"
410 bool hhkPresent =
index.size()>0;
412 if (!hhkPresent) hhkFile =
"";
422 t <<
"Compiled file=index.chm\n";
424 t <<
"Compatibility=1.1\n"
425 "Full-text search=Yes\n";
427 t <<
"Default Window=main\n"
428 "Default topic=" << indexName <<
"\n";
429 if (hhkPresent) t <<
"Index file=" +
hhkFileName +
"\n";
430 t <<
"Language=" <<
theTranslator->getLanguageString() <<
"\n";
450 << hhkFile <<
",\"" << indexName <<
"\",\"" <<
451 indexName <<
"\",,,,,0x23520,,0x70387e,,,,,,,,0\n\n";
456 << hhkFile <<
",\"" << indexName <<
"\",\"" <<
457 indexName <<
"\",,,,,0x23520,,0x10387e,,,,,,,,0\n\n";
477 err(
"Could not open file {} for writing\n",fName);
483 p->indexFiles.insert(s.
str());
494 p->cts <<
"</BODY>\n";
495 p->cts <<
"</HTML>\n";
498 p->index.writeFields(
p->kts);
502 p->kts <<
"</BODY>\n";
503 p->kts <<
"</HTML>\n";
506 p->createProjectFile();
508 p->recoder.finalize();
517 for (
int i=0; i<
p->dc+1; i++)
p->cts <<
" ";
528 for (
int i=0; i<
p->dc; i++)
p->cts <<
" ";
554 p->ctsItemPresent =
true;
555 for (
int i=0; i<
p->dc; i++)
p->cts <<
" ";
556 p->cts <<
"<LI><OBJECT type=\"text/sitemap\">";
557 p->cts <<
"<param name=\"Name\" value=\"" <<
convertToHtml(
p->recoder.recode(name),
TRUE) <<
"\">";
560 if (file[0]==
'!' || file[0]==
'^')
562 p->cts <<
"<param name=\"";
563 if (file[0]==
'^')
p->cts <<
"URL";
else p->cts <<
"Local";
564 p->cts <<
"\" value=\"";
573 p->cts <<
"<param name=\"Local\" value=\"";
576 if (
p->prevFile == currFile &&
p->prevAnc.isEmpty() && currAnc.
isEmpty())
580 if (!currAnc.
isEmpty())
p->cts <<
"#" << currAnc;
582 p->prevFile = currFile;
583 p->prevAnc = currAnc;
586 p->cts <<
"<param name=\"ImageNumber\" value=\"";
593 p->cts <<
static_cast<int>(
TEXT);
596 p->cts <<
"</OBJECT>\n";
610 p->index.addItem(level1,level2,cfname,anchor,
TRUE,
FALSE);
611 p->index.addItem(level2,level1,cfname,anchor,
TRUE,
TRUE);
622 p->styleFiles.insert(fileName.
str());
627 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 addContentsItem(bool isDir, const QCString &name, const QCString &ref, const QCString &file, const QCString &anchor, bool separateIndex, bool addToNavIndex, const Definition *def, const QCString &nameAsHtml)
void addIndexItem(const Definition *context, const MemberDef *md, const QCString §ionAnchor, const QCString &title)
static const QCString hhpFileName
std::unique_ptr< Private > p
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)
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.