本文整理汇总了C++中AttributedString::appendFragment方法的典型用法代码示例。如果您正苦于以下问题:C++ AttributedString::appendFragment方法的具体用法?C++ AttributedString::appendFragment怎么用?C++ AttributedString::appendFragment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributedString
的用法示例。
在下文中一共展示了AttributedString::appendFragment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getAttributedString
AttributedString BaseTextShadowNode::getAttributedString(
const TextAttributes &textAttributes,
const SharedShadowNodeSharedList &childNodes
) const {
// TODO: Implement caching.
AttributedString attributedString;
for (auto &&childNode : *childNodes) {
// RawShadowNode
SharedRawTextShadowNode rawTextShadowNode = std::dynamic_pointer_cast<const RawTextShadowNode>(childNode);
if (rawTextShadowNode) {
AttributedString::Fragment fragment;
fragment.string = rawTextShadowNode->getProps()->text;
fragment.textAttributes = textAttributes;
attributedString.appendFragment(fragment);
continue;
}
// TextShadowNode
SharedTextShadowNode textShadowNode = std::dynamic_pointer_cast<const TextShadowNode>(childNode);
if (textShadowNode) {
TextAttributes localTextAttributes = textAttributes;
localTextAttributes.apply(textShadowNode->getProps()->textAttributes);
attributedString.appendAttributedString(textShadowNode->getAttributedString(localTextAttributes, textShadowNode->getChildren()));
continue;
}
// Any other kind of ShadowNode
AttributedString::Fragment fragment;
fragment.shadowNode = childNode;
fragment.textAttributes = textAttributes;
attributedString.appendFragment(fragment);
}
return attributedString;
}