本文整理汇总了C++中UT_UTF8String::byteLength方法的典型用法代码示例。如果您正苦于以下问题:C++ UT_UTF8String::byteLength方法的具体用法?C++ UT_UTF8String::byteLength怎么用?C++ UT_UTF8String::byteLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UT_UTF8String
的用法示例。
在下文中一共展示了UT_UTF8String::byteLength方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveDefaults
void AP_Dialog_EpubExportOptions::saveDefaults()
{
UT_ASSERT(m_app);
if (m_app == NULL) return;
XAP_Prefs * pPrefs = m_app->getPrefs();
if (pPrefs == NULL) return;
XAP_PrefsScheme * pPScheme = pPrefs->getCurrentScheme();
if (pPScheme == NULL) return;
UT_UTF8String pref;
if (m_exp_opt->bEpub2) {
if (pref.byteLength()) pref += ",";
pref += "EPUB2";
}
if (m_exp_opt->bSplitDocument) {
if (pref.byteLength()) pref += ",";
pref += "split-document";
}
if (m_exp_opt->bRenderMathMLToPNG) {
if (pref.byteLength()) pref += ",";
pref += "mathml-to-png";
}
const gchar * szValue = (const gchar *) pref.utf8_str();
pPScheme->setValue(EPUB_EXPORT_SCHEME_NAME, szValue);
}
示例2: notify
virtual bool notify(AV_View * pAView, const AV_ChangeMask mask, void * pPrivateData)
{
if(mask != AV_CHG_BLOCKCHECK)
{
return true;
}
// printf("I've been notified!! View = %x hint mask %d \n",pAView,mask);
m_pView = static_cast<FV_View *>(pAView);
m_pBlock = reinterpret_cast<fl_BlockLayout *>(pPrivateData);
m_pDoc = m_pView->getDocument();
UT_UTF8String sText;
m_pBlock->appendUTF8String(sText);
if (sText.byteLength() == 0) {
return true;
}
m_GrammarCheck.CheckBlock(m_pBlock);
return true;
}
示例3: _outputData
void s_XSL_FO_Listener::_outputData(const UT_UCSChar * data, UT_uint32 length)
{
UT_UTF8String sBuf;
const UT_UCSChar * pData;
UT_ASSERT(sizeof(UT_Byte) == sizeof(char));
sBuf.reserve(length);
for (pData=data; (pData<data+length); /**/)
{
switch (*pData)
{
case '<':
{
sBuf += "<";
pData++;
break;
}
case '>':
{
sBuf += ">";
pData++;
break;
}
case '&':
{
sBuf += "&";
pData++;
break;
}
case UCS_LF: // LF -- representing a Forced-Line-Break
{
UT_ASSERT(UT_TODO);
pData++;
break;
}
case UCS_VTAB: // VTAB -- representing a Forced-Column-Break
{
UT_ASSERT(UT_TODO);
pData++;
break;
}
case UCS_FF: // FF -- representing a Forced-Page-Break
{
UT_ASSERT(UT_TODO);
pData++;
break;
}
default:
{
if(*pData < 0x20) //invalid xml chars
{
pData++;
}
else
{
sBuf.appendUCS4(pData, 1);
pData++;
}
break;
}
}
}
m_pie->write(sBuf.utf8_str(), sBuf.byteLength());
}
示例4:
/* replaces <str1> with <str2> in the current string
*/
void UT_UTF8Stringbuf::escape (const UT_UTF8String & utf8_str1,
const UT_UTF8String & utf8_str2)
{
size_t diff = 0;
size_t len1 = utf8_str1.byteLength ();
size_t len2 = utf8_str2.byteLength ();
const char * str1 = utf8_str1.utf8_str ();
const char * str2 = utf8_str2.utf8_str ();
if (len2 > len1)
{
diff = len2 - len1;
size_t incr = 0;
char * ptr = m_psz;
while (ptr + len1 <= m_pEnd)
{
if (memcmp (ptr, str1, len1) == 0)
{
incr += diff;
ptr += len1;
}
else
{
++ptr;
}
}
if (!grow (incr)) return;
}
else
{
diff = len1 - len2;
}
char * ptr = m_psz;
while (ptr + len1 <= m_pEnd)
{
if (memcmp (ptr, str1, len1) == 0)
{
if (diff)
{
if (len2 > len1)
{
memmove (ptr + diff, ptr, m_pEnd - ptr + 1);
m_pEnd += diff;
}
else
{
memmove (ptr, ptr + diff, m_pEnd - (ptr + diff) + 1);
m_pEnd -= diff;
}
}
memcpy (ptr, str2, len2);
ptr += len2;
m_strlen += utf8_str2.length () - utf8_str1.length ();
}
else
{
++ptr;
}
}
}