Doxygen
Loading...
Searching...
No Matches
htmlhelp.cpp File Reference
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include "htmlhelp.h"
#include "config.h"
#include "message.h"
#include "doxygen.h"
#include "language.h"
#include "portable.h"
#include "groupdef.h"
#include "memberdef.h"
#include "filedef.h"
#include "util.h"
#include "linkedmap.h"
#include "regex.h"
#include "fileinfo.h"
+ Include dependency graph for htmlhelp.cpp:

Go to the source code of this file.

Classes

class  HtmlHelpRecoder
 Helper class to deal with recoding the UTF8 encoded text back to the native encoding specified by CHM_INDEX_ENCODING. More...
 
struct  IndexField
 Class representing a field in the HTML help index. More...
 
class  HtmlHelpIndex
 A helper class for HtmlHelp that manages a two level index in alphabetical order. More...
 
class  HtmlHelp::Private
 

Functions

static QCString field2URL (const IndexField *f, bool checkReversed)
 
static QCString convertToHtmlAndTruncate (const QCString &s)
 

Function Documentation

◆ convertToHtmlAndTruncate()

static QCString convertToHtmlAndTruncate ( const QCString & s)
static

Definition at line 185 of file htmlhelp.cpp.

186{
187 /* to prevent
188 * Warning: Keyword string:
189 * ...
190 * is too long. The maximum size is 488 characters.
191 */
192 int maxLen = 400;
193 size_t maxExpandedLen = maxLen+50;
194 QCString result = convertToHtml(s,true);
195 if (result.length()>maxExpandedLen) // we need to truncate the string
196 {
197 // in the unlikely case that the string after conversion grows from maxLen to maxExpandedLen, we try smaller parts
198 // until we end up below the limit
199 while (maxLen>0 && result.length()>maxExpandedLen)
200 {
201 result = convertToHtml(s.left(maxLen));
202 maxLen-=20;
203 }
204 return result+"...";
205 }
206 else
207 {
208 return result;
209 }
210}
This is an alternative implementation of QCString.
Definition qcstring.h:101
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
QCString left(size_t len) const
Definition qcstring.h:214
QCString convertToHtml(const QCString &s, bool keepEntities)
Definition util.cpp:4317

References convertToHtml(), QCString::left(), and QCString::length().

Referenced by HtmlHelpIndex::writeFields().

◆ field2URL()

static QCString field2URL ( const IndexField * f,
bool checkReversed )
static

Definition at line 174 of file htmlhelp.cpp.

175{
176 QCString result = f->url;
178 if (!f->anchor.isEmpty() && (!checkReversed || f->reversed))
179 {
180 result+="#"+f->anchor;
181 }
182 return result;
183}
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
bool reversed
Definition htmlhelp.cpp:107
QCString anchor
Definition htmlhelp.cpp:105
QCString url
Definition htmlhelp.cpp:104
void addHtmlExtensionIfMissing(QCString &fName)
Definition util.cpp:5243

References addHtmlExtensionIfMissing(), IndexField::anchor, QCString::isEmpty(), IndexField::reversed, and IndexField::url.

Referenced by HtmlHelpIndex::writeFields().