Doxygen
Loading...
Searching...
No Matches
htmlhelp.cpp File Reference
#include "htmlhelp.h"
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include "config.h"
#include "doxygen.h"
#include "filedef.h"
#include "fileinfo.h"
#include "language.h"
#include "linkedmap.h"
#include "memberdef.h"
#include "message.h"
#include "portable.h"
#include "regex.h"
#include "util.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 DString field2URL (const IndexField *f, bool checkReversed)
static DString convertToHtmlAndTruncate (const DString &s)

Function Documentation

◆ convertToHtmlAndTruncate()

DString convertToHtmlAndTruncate ( const DString & s)
static

Definition at line 183 of file htmlhelp.cpp.

184{
185 /* to prevent
186 * Warning: Keyword string:
187 * ...
188 * is too long. The maximum size is 488 characters.
189 */
190 int maxLen = 400;
191 size_t maxExpandedLen = maxLen+50;
192 DString result = convertToHtml(s,true);
193 if (result.length()>maxExpandedLen) // we need to truncate the string
194 {
195 // in the unlikely case that the string after conversion grows from maxLen to maxExpandedLen, we try smaller parts
196 // until we end up below the limit
197 while (maxLen>0 && result.length()>maxExpandedLen)
198 {
199 result = convertToHtml(s.left(maxLen));
200 maxLen-=20;
201 }
202 return result+"...";
203 }
204 else
205 {
206 return result;
207 }
208}
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
DString left(size_t len) const
Definition dstring.h:306
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:151
DString convertToHtml(const DString &s, bool keepEntities)
Definition util.cpp:3291

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

Referenced by HtmlHelpIndex::writeFields().

◆ field2URL()

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

Definition at line 172 of file htmlhelp.cpp.

173{
174 DString result = f->url;
176 if (!f->anchor.empty() && (!checkReversed || f->reversed))
177 {
178 result+="#"+f->anchor;
179 }
180 return result;
181}
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
DString url
Definition htmlhelp.cpp:106
DString anchor
Definition htmlhelp.cpp:107
bool reversed
Definition htmlhelp.cpp:109
void addHtmlExtensionIfMissing(DString &fName)
Definition util.cpp:3931

References addHtmlExtensionIfMissing(), IndexField::anchor, DString::empty(), IndexField::reversed, and IndexField::url.

Referenced by HtmlHelpIndex::writeFields().