Skip to main content

The HtmlHelpRecoder Class Reference

Helper class to deal with recoding the UTF8 encoded text back to the native encoding specified by CHM_INDEX_ENCODING. More...

Declaration

class HtmlHelpRecoder { ... }

Public Constructors Index

HtmlHelpRecoder ()

Public Destructor Index

~HtmlHelpRecoder ()

Public Member Functions Index

voidinitialize ()
voidfinalize ()
QCStringrecode (const QCString &s)

Private Member Attributes Index

void *m_iconv_null = reinterpret_cast<void*>(-1)
void *m_fromUtf8 = m_iconv_null

Description

Helper class to deal with recoding the UTF8 encoded text back to the native encoding specified by CHM_INDEX_ENCODING.

Definition at line 42 of file htmlhelp.cpp.

Public Constructors

HtmlHelpRecoder()

HtmlHelpRecoder::HtmlHelpRecoder ()
inline

Definition at line 45 of file htmlhelp.cpp.

Public Destructor

~HtmlHelpRecoder()

HtmlHelpRecoder::~HtmlHelpRecoder ()
inline

Definition at line 46 of file htmlhelp.cpp.

Reference finalize.

Public Member Functions

finalize()

void HtmlHelpRecoder::finalize ()
inline

Definition at line 59 of file htmlhelp.cpp.

59 void finalize()
60 {
62 {
65 }
66 }

References m_fromUtf8, m_iconv_null and portable_iconv_close.

Referenced by ~HtmlHelpRecoder.

initialize()

void HtmlHelpRecoder::initialize ()
inline

Definition at line 49 of file htmlhelp.cpp.

49 void initialize()
50 {
51 QCString str = Config_getString(CHM_INDEX_ENCODING);
52 if (str.isEmpty()) str = "CP1250"; // use safe and likely default
53 m_fromUtf8 = portable_iconv_open(str.data(),"UTF-8");
55 {
56 term("unsupported character conversion for CHM_INDEX_ENCODING: '{}'->'UTF-8'\n", str);
57 }
58 }

References Config_getString, QCString::data, initialize, QCString::isEmpty, m_fromUtf8, m_iconv_null, portable_iconv_open and term.

Referenced by initialize.

recode()

QCString HtmlHelpRecoder::recode (const QCString & s)
inline

Definition at line 68 of file htmlhelp.cpp.

69 {
70 size_t iSize = s.length();
71 size_t oSize = iSize*4;
72 QCString output(oSize, QCString::ExplicitSize);
73 size_t iLeft = iSize;
74 size_t oLeft = oSize;
75 const char *iPtr = s.data();
76 char *oPtr = output.rawData();
77 if (!portable_iconv(m_fromUtf8,&iPtr,&iLeft,&oPtr,&oLeft))
78 {
79 oSize -= oLeft;
80 output.resize(oSize);
81 output.at(oSize)='\0';
82 return output;
83 }
84 else
85 {
86 return s;
87 }
88 }

References QCString::at, QCString::data, QCString::ExplicitSize, QCString::length, m_fromUtf8, portable_iconv, QCString::rawData and QCString::resize.

Private Member Attributes

m_fromUtf8

void* HtmlHelpRecoder::m_fromUtf8 = m_iconv_null

Definition at line 91 of file htmlhelp.cpp.

Referenced by finalize, initialize and recode.

m_iconv_null

void* HtmlHelpRecoder::m_iconv_null = reinterpret_cast<void*>(-1)

Definition at line 90 of file htmlhelp.cpp.

90 void *m_iconv_null = reinterpret_cast<void*>(-1);

Referenced by finalize and initialize.


The documentation for this class was generated from the following file:


Generated via doxygen2docusaurus by Doxygen 1.14.0.