本文整理汇总了C++中DOMStringImpl::length方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMStringImpl::length方法的具体用法?C++ DOMStringImpl::length怎么用?C++ DOMStringImpl::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMStringImpl
的用法示例。
在下文中一共展示了DOMStringImpl::length方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setText
void RenderText::setText(DOMStringImpl *text, bool force)
{
if( !force && str == text ) return;
DOMStringImpl *oldstr = str;
if(text && style())
str = text->collapseWhiteSpace(style()->preserveLF(), style()->preserveWS());
else
str = text;
if(str) str->ref();
if(oldstr) oldstr->deref();
if ( str && style() ) {
oldstr = str;
switch(style()->textTransform()) {
case CAPITALIZE:
{
RenderObject *o;
bool runOnString = false;
// find previous non-empty text renderer if one exists
for (o = previousRenderer(); o; o = o->previousRenderer()) {
if (!o->isInlineFlow()) {
if (!o->isText())
break;
DOMStringImpl *prevStr = static_cast<RenderText*>(o)->string();
// !prevStr can happen with css like "content:open-quote;"
if (!prevStr)
break;
if (prevStr->length() == 0)
continue;
QChar c = (*prevStr)[prevStr->length() - 1];
if (!c.isSpace())
runOnString = true;
break;
}
}
str = str->capitalize(runOnString);
}
break;
case UPPERCASE: str = str->upper(); break;
case LOWERCASE: str = str->lower(); break;
case NONE:
default:;
}
str->ref();
oldstr->deref();
}
// ### what should happen if we change the text of a
// RenderBR object ?
KHTMLAssert(!isBR() || (str->l == 1 && (*str->s) == '\n'));
KHTMLAssert(!str->l || str->s);
setNeedsLayoutAndMinMaxRecalc();
#ifdef BIDI_DEBUG
QConstString cstr(str->s, str->l);
kdDebug( 6040 ) << "RenderText::setText( " << cstr.string().length() << " ) '" << cstr.string() << "'" << endl;
#endif
}