本文整理汇总了C++中SkDisplayable::setChildHasID方法的典型用法代码示例。如果您正苦于以下问题:C++ SkDisplayable::setChildHasID方法的具体用法?C++ SkDisplayable::setChildHasID怎么用?C++ SkDisplayable::setChildHasID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkDisplayable
的用法示例。
在下文中一共展示了SkDisplayable::setChildHasID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onAddAttributeLen
bool SkDisplayXMLParser::onAddAttributeLen(const char attrName[], const char attrValue[],
size_t attrValueLen)
{
if (fCurrDisplayable == NULL) // this signals we should ignore attributes for this element
return strncmp(attrName, "xmlns", sizeof("xmlns") - 1) != 0;
SkDisplayable* displayable = fCurrDisplayable;
SkDisplayTypes type = fCurrType;
if (strcmp(attrName, "id") == 0) {
if (fMaker.find(attrValue, attrValueLen, NULL)) {
fError->setNoun(attrValue, attrValueLen);
fError->setCode(SkXMLParserError::kDuplicateIDs);
return true;
}
#ifdef SK_DEBUG
displayable->_id.set(attrValue, attrValueLen);
displayable->id = displayable->_id.c_str();
#endif
fMaker.idsSet(attrValue, attrValueLen, displayable);
int parentIndex = fParents.count() - 1;
if (parentIndex > 0) {
SkDisplayable* parent = fParents[parentIndex - 1].fDisplayable;
parent->setChildHasID();
}
return false;
}
const char* name = attrName;
const SkMemberInfo* info = SkDisplayType::GetMember(&fMaker, type, &name);
if (info == NULL) {
fError->setNoun(name);
fError->setCode(SkXMLParserError::kUnknownAttributeName);
return true;
}
if (info->setValue(fMaker, NULL, 0, info->getCount(), displayable, info->getType(), attrValue,
attrValueLen))
return false;
if (fMaker.fError.hasError()) {
fError->setNoun(attrValue, attrValueLen);
return true;
}
SkDisplayable* ref = NULL;
if (fMaker.find(attrValue, attrValueLen, &ref) == false) {
ref = fMaker.createInstance(attrValue, attrValueLen);
if (ref == NULL) {
fError->setNoun(attrValue, attrValueLen);
fError->setCode(SkXMLParserError::kErrorInAttributeValue);
return true;
} else
fMaker.helperAdd(ref);
}
if (info->fType != SkType_MemberProperty) {
fError->setNoun(name);
fError->setCode(SkXMLParserError::kUnknownAttributeName);
return true;
}
SkScriptValue scriptValue;
scriptValue.fOperand.fDisplayable = ref;
scriptValue.fType = ref->getType();
displayable->setProperty(info->propertyIndex(), scriptValue);
return false;
}