本文整理汇总了C++中KidsPointer::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ KidsPointer::isNull方法的具体用法?C++ KidsPointer::isNull怎么用?C++ KidsPointer::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KidsPointer
的用法示例。
在下文中一共展示了KidsPointer::isNull方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
JS_ALWAYS_INLINE void
js::PropertyTree::orphanChildren(Shape *shape)
{
KidsPointer *kidp = &shape->kids;
JS_ASSERT(!kidp->isNull());
if (kidp->isShape()) {
Shape *kid = kidp->toShape();
if (!JSID_IS_VOID(kid->id)) {
JS_ASSERT(kid->parent == shape);
kid->parent = NULL;
}
} else {
KidsHash *hash = kidp->toHash();
for (KidsHash::Range range = hash->all(); !range.empty(); range.popFront()) {
Shape *kid = range.front();
if (!JSID_IS_VOID(kid->id)) {
JS_ASSERT(kid->parent == shape);
kid->parent = NULL;
}
}
hash->~KidsHash();
js_free(hash);
}
kidp->setNull();
}
示例2: HashChildren
bool
PropertyTree::insertChild(JSContext *cx, Shape *parent, Shape *child)
{
JS_ASSERT(!parent->inDictionary());
JS_ASSERT(!child->parent);
JS_ASSERT(!child->inDictionary());
JS_ASSERT(!JSID_IS_VOID(parent->id));
JS_ASSERT(!JSID_IS_VOID(child->id));
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()) {
Shape *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;
}
KidsHash *hash = kidp->toHash();
KidsHash::AddPtr addPtr = hash->lookupForAdd(child);
JS_ASSERT(!addPtr.found());
if (!hash->add(addPtr, child)) {
JS_ReportOutOfMemory(cx);
return false;
}
child->setParent(parent);
return true;
}
示例3: HashChildren
bool
PropertyTree::insertChild(ExclusiveContext *cx, Shape *parent, Shape *child)
{
JS_ASSERT(!parent->inDictionary());
JS_ASSERT(!child->parent);
JS_ASSERT(!child->inDictionary());
JS_ASSERT(child->compartment() == parent->compartment());
JS_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();
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(StackShape(child), child)) {
js_ReportOutOfMemory(cx);
return false;
}
child->setParent(parent);
return true;
}
示例4: 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;
}