本文整理汇总了C++中KidsPointer::setHash方法的典型用法代码示例。如果您正苦于以下问题:C++ KidsPointer::setHash方法的具体用法?C++ KidsPointer::setHash怎么用?C++ KidsPointer::setHash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KidsPointer
的用法示例。
在下文中一共展示了KidsPointer::setHash方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HashChildren
bool
PropertyTree::insertChild(ExclusiveContext *cx, Shape *parent, Shape *child)
{
MOZ_ASSERT(!parent->inDictionary());
MOZ_ASSERT(!child->parent);
MOZ_ASSERT(!child->inDictionary());
MOZ_ASSERT(child->compartment() == parent->compartment());
MOZ_ASSERT(cx->isInsideCurrentCompartment(this));
KidsPointer *kidp = &parent->kids;
if (kidp->isNull()) {
child->setParent(parent);
kidp->setShape(child);
return true;
}
if (kidp->isShape()) {
Shape *shape = kidp->toShape();
MOZ_ASSERT(shape != child);
MOZ_ASSERT(!shape->matches(child));
KidsHash *hash = HashChildren(shape, child);
if (!hash) {
js_ReportOutOfMemory(cx);
return false;
}
kidp->setHash(hash);
child->setParent(parent);
return true;
}
if (!kidp->toHash()->putNew(StackShape(child), child)) {
js_ReportOutOfMemory(cx);
return false;
}
child->setParent(parent);
return true;
}
示例2: HashChildren
bool
PropertyTree::insertChild(JSContext *cx, UnrootedShape parent, UnrootedShape child)
{
JS_ASSERT(!parent->inDictionary());
JS_ASSERT(!child->parent);
JS_ASSERT(!child->inDictionary());
JS_ASSERT(cx->compartment == compartment);
JS_ASSERT(child->compartment() == parent->compartment());
KidsPointer *kidp = &parent->kids;
if (kidp->isNull()) {
child->setParent(parent);
kidp->setShape(child);
return true;
}
if (kidp->isShape()) {
UnrootedShape shape = kidp->toShape();
JS_ASSERT(shape != child);
JS_ASSERT(!shape->matches(child));
KidsHash *hash = HashChildren(shape, child);
if (!hash) {
JS_ReportOutOfMemory(cx);
return false;
}
kidp->setHash(hash);
child->setParent(parent);
return true;
}
if (!kidp->toHash()->putNew(child, child)) {
JS_ReportOutOfMemory(cx);
return false;
}
child->setParent(parent);
return true;
}