本文整理汇总了C++中CharSet::substring方法的典型用法代码示例。如果您正苦于以下问题:C++ CharSet::substring方法的具体用法?C++ CharSet::substring怎么用?C++ CharSet::substring使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CharSet
的用法示例。
在下文中一共展示了CharSet::substring方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: INTL_adjust_text_descriptor
void INTL_adjust_text_descriptor(thread_db* tdbb, dsc* desc)
{
/**************************************
*
* I N T L _ a d j u s t _ t e x t _ d e s c r i p t o r
*
**************************************
*
* Functional description
* This function receives a text descriptor with
* dsc_length = numberOfCharacters * maxBytesPerChar
* and change dsc_length to number of bytes used by the string.
*
**************************************/
if (desc->dsc_dtype == dtype_text)
{
SET_TDBB(tdbb);
USHORT ttype = INTL_TTYPE(desc);
CharSet* charSet = INTL_charset_lookup(tdbb, ttype);
if (charSet->isMultiByte())
{
Firebird::HalfStaticArray<UCHAR, BUFFER_SMALL> buffer;
if (charSet->getFlags() & CHARSET_LEGACY_SEMANTICS)
{
desc->dsc_length = charSet->substring(TEXT_LEN(desc), desc->dsc_address, TEXT_LEN(desc),
buffer.getBuffer(TEXT_LEN(desc) * charSet->maxBytesPerChar()), 0,
TEXT_LEN(desc));
const ULONG maxLength = TEXT_LEN(desc) / charSet->maxBytesPerChar();
ULONG charLength = charSet->length(desc->dsc_length, desc->dsc_address, true);
while (charLength > maxLength)
{
if (desc->dsc_address[desc->dsc_length - 1] == *charSet->getSpace())
{
--desc->dsc_length;
--charLength;
}
else
break;
}
}
else
{
desc->dsc_length = charSet->substring(TEXT_LEN(desc), desc->dsc_address,
TEXT_LEN(desc), buffer.getBuffer(TEXT_LEN(desc)), 0,
TEXT_LEN(desc) / charSet->maxBytesPerChar());
}
}
}
}