本文整理汇总了C++中ContentData::text方法的典型用法代码示例。如果您正苦于以下问题:C++ ContentData::text方法的具体用法?C++ ContentData::text怎么用?C++ ContentData::text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentData
的用法示例。
在下文中一共展示了ContentData::text方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prepareToSetContent
ContentData* RenderStyle::prepareToSetContent(StringImpl* string, bool add)
{
OwnPtr<ContentData>& content = rareNonInheritedData.access()->m_content;
ContentData* lastContent = content.get();
while (lastContent && lastContent->next())
lastContent = lastContent->next();
if (string && add && lastContent && lastContent->isText()) {
// Augment the existing string and share the existing ContentData node.
String newText = lastContent->text();
newText.append(string);
lastContent->setText(newText.impl());
return 0;
}
bool reuseContent = !add;
OwnPtr<ContentData> newContentData;
if (reuseContent && content) {
content->clear();
newContentData = content.release();
} else
newContentData = adoptPtr(new ContentData);
ContentData* result = newContentData.get();
if (lastContent && !reuseContent)
lastContent->setNext(newContentData.release());
else
content = newContentData.release();
return result;
}
示例2: setContent
void RenderStyle::setContent(PassRefPtr<StringImpl> s, bool add)
{
if (!s)
return; // The string is null. Nothing to do. Just bail.
OwnPtr<ContentData>& content = rareNonInheritedData.access()->m_content;
ContentData* lastContent = content.get();
while (lastContent && lastContent->next())
lastContent = lastContent->next();
bool reuseContent = !add;
if (add && lastContent) {
if (lastContent->isText()) {
// We can augment the existing string and share this ContentData node.
String newStr = lastContent->text();
newStr.append(s.get());
lastContent->setText(newStr.impl());
return;
}
}
ContentData* newContentData = 0;
if (reuseContent && content) {
content->clear();
newContentData = content.release();
} else
newContentData = new ContentData;
if (lastContent && !reuseContent)
lastContent->setNext(newContentData);
else
content.set(newContentData);
newContentData->setText(s);
}
示例3: dataEquivalent
bool ContentData::dataEquivalent(const ContentData& other) const
{
if (type() != other.type())
return false;
switch (type()) {
case CONTENT_NONE:
return true;
break;
case CONTENT_TEXT:
return equal(text(), other.text());
break;
case CONTENT_OBJECT:
return StyleImage::imagesEquivalent(image(), other.image());
break;
case CONTENT_COUNTER:
return *counter() == *other.counter();
break;
}
ASSERT_NOT_REACHED();
return false;
}