int traverseChildren(ClassRegister * cReg, const char *parent, const char *chldn) { char *child; int rc = CMPI_RC_ERR_FAILED; UtilList *ul = getChildren(cReg, parent); cReg->ft->rLock(cReg); if (ul) for (child = (char *) ul->ft->getFirst(ul); child; child = (char *) ul->ft->getNext(ul)) { if (strcasecmp(child, chldn) == 0) { rc = CMPI_RC_OK; break; } else { rc = traverseChildren(cReg, child, chldn); if (rc == CMPI_RC_OK) break; } } cReg->ft->rUnLock(cReg); return rc; }
//----------------------------------------------------------------------- void SWTraversal::onTree(PagingLandScapeOctree & n, VisibleObjectsBoundsInfo * const visibleBounds) { if(occlusion.mCurrentCam->isVisible(n.getCullBoundingBox ())) { #ifdef _VISIBILITYDEBUG occlusion.traversed_nodes_cnt++; n.getNodeData (occlusion.mCurrentCam)->viewFrustumVisible = true; #endif //_VISIBILITYDEBUG const bool isitVisible = isVisible(n); if (isitVisible) { traverseChildren (n, visibleBounds); } #ifdef _VISIBILITYDEBUG n.getNodeData (occlusion.mCurrentCam)->queryVisible = isitVisible; #endif //_VISIBILITYDEBUG } #ifdef _VISIBILITYDEBUG else { occlusion.traversed_nodes_cnt++; n.getNodeData (occlusion.mCurrentCam)->viewFrustumVisible = false; occlusion.frustum_culled_nodes_cnt++; } #endif //_VISIBILITYDEBUG }
void Traverser::onApplicable(Node *node, Applicable *applicable) { // Apply, do children, then remove applicable->apply(); traverseChildren(node); applicable->remove(); }
void ColumnBalancer::traverseSubtree(const LayoutBox& box) { if (box.childrenInline() && box.isLayoutBlockFlow()) { // Look for breaks between lines. traverseLines(toLayoutBlockFlow(box)); } // Look for breaks between and inside block-level children. Even if this is a // block flow with inline children, there may be interesting floats to examine // here. traverseChildren(box); }
void Traverser::onDrawable(Node *node, Drawable *drawable) { // Check if excluded if (drawable->isExcluded()) { return; } // Do children then draw it traverseChildren(node); if (drawable->isVisible()) drawable->draw(); }
void Node::traverse(NodeVisitor& visitor) { // First, visit the node itself INodePtr self = getSelf(); if (visitor.pre(self)) { // The walker requested to descend the children of this node as well traverseChildren(visitor); } visitor.post(self); }
/** Recursively traverses a node. * * Automatically takes care of performing different actions depending on what * type of interfaces the node supports. * * @param node Pointer to the Node to traverse. */ void Traverser::traverseNode(Node *node) { Applicable *applicable; Drawable *drawable; // Determine if node is applicable or drawable if ((applicable = dynamic_cast<Applicable*>(node))) { onApplicable(node, applicable); } else if ((drawable = dynamic_cast<Drawable*>(node))) { onDrawable(node, drawable); } else { traverseChildren(node); } }
void Node::evaluateChildBounds() const { if (_childBoundsChanged) { ASSERT_MESSAGE(!_childBoundsMutex, "re-entering bounds evaluation"); _childBoundsMutex = true; _childBounds = AABB(); // Instantiate an AABB accumulator AABBAccumulateWalker accumulator(_childBounds); // greebo: traverse the children of this node traverseChildren(accumulator); _childBoundsMutex = false; _childBoundsChanged = false; } }
//----------------------------------------------------------------------- void TreeOverlayDebug::onTree(PagingLandScapeOctree& n, VisibleObjectsBoundsInfo * const visibleBounds) const { SimpleRenderable * const s = n.getRectangle2d(mScnMrg); if (n.getNodeData (occlusion.mCurrentCam)->viewFrustumVisible) { if (n.getNodeData (occlusion.mCurrentCam)->queryVisible) { s->setMaterial ("BaseWhiteNoLightNoDepthCheck"); occlusion.mCurrentRenderQueue->addRenderable (s, s->getRenderQueueGroup ()); traverseChildren (n, visibleBounds); } else { s->setMaterial ("BaseRedNoLightNoDepthCheck"); occlusion.mCurrentRenderQueue->addRenderable (s, s->getRenderQueueGroup ()); } } else { s->setMaterial ("BaseGreenNoLightNoDepthCheck"); occlusion.mCurrentRenderQueue->addRenderable (s, s->getRenderQueueGroup ()); } }
static CMPIStatus ClassProviderInvokeMethod(CMPIMethodMI * mi, const CMPIContext *ctx, const CMPIResult *rslt, const CMPIObjectPath * ref, const char *methodName, const CMPIArgs * in, CMPIArgs * out) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIArray *ar; int rc; ClassRegister *cReg; _SFCB_ENTER(TRACE_PROVIDERS, "ClassProviderInvokeMethod"); cReg = getNsReg(ref, &rc); if (cReg == NULL) { CMPIStatus st = { CMPI_RC_ERR_INVALID_NAMESPACE, NULL }; _SFCB_RETURN(st); } if (strcasecmp(methodName, "getchildren") == 0) { CMPIData cn = CMGetArg(in, "class", NULL); _SFCB_TRACE(1, ("--- getchildren %s", (char *) cn.value.string->hdl)); cReg->ft->wLock(cReg); if (cn.type == CMPI_string && cn.value.string && cn.value.string->hdl) { char *child; int l = 0, i = 0; UtilList *ul = getChildren(cReg, (char *) cn.value.string->hdl); if (ul) l = ul->ft->size(ul); ar = CMNewArray(_broker, l, CMPI_string, NULL); if (ul) for (child = (char *) ul->ft->getFirst(ul); child; child = (char *) ul->ft->getNext(ul)) { CMSetArrayElementAt(ar, i++, child, CMPI_chars); } st = CMAddArg(out, "children", &ar, CMPI_stringA); } else { } cReg->ft->wUnLock(cReg); } else if (strcasecmp(methodName, "getallchildren") == 0) { int ignprov = 0; CMPIStatus st; CMPIData cn = CMGetArg(in, "class", &st); cReg->ft->wLock(cReg); if (st.rc != CMPI_RC_OK) { cn = CMGetArg(in, "classignoreprov", NULL); ignprov = 1; } _SFCB_TRACE(1, ("--- getallchildren %s", (char *) cn.value.string->hdl)); if (cn.type == CMPI_string && cn.value.string && cn.value.string->hdl) { int n = 0, i = 0; loopOnChildCount(cReg, (char *) cn.value.string->hdl, &n, ignprov); _SFCB_TRACE(1, ("--- count %d", n)); ar = CMNewArray(_broker, n, CMPI_string, NULL); if (n) { _SFCB_TRACE(1, ("--- loop %s", (char *) cn.value.string->hdl)); loopOnChildChars(cReg, (char *) cn.value.string->hdl, ar, &i, ignprov); } st = CMAddArg(out, "children", &ar, CMPI_stringA); } else { } cReg->ft->wUnLock(cReg); } else if (strcasecmp(methodName, "getassocs") == 0) { ar = CMNewArray(_broker, cReg->topAssocs, CMPI_string, NULL); ClassBase *cb = (ClassBase *) (cReg + 1); UtilHashTable *ct = cb->ht; HashTableIterator *i; char *cn; ClassRecord *crec; int n; cReg->ft->wLock(cReg); for (n = 0, i = ct->ft->getFirst(ct, (void **) &cn, (void **) &crec); i; i = ct->ft->getNext(ct, i, (void **) &cn, (void **) &crec)) { if (crec->flags & CREC_isAssociation && crec->parent == NULL) { /* * add top-level association class */ CMSetArrayElementAt(ar, n++, cn, CMPI_chars); } } CMAddArg(out, "assocs", &ar, CMPI_stringA); cReg->ft->wUnLock(cReg); } else if (strcasecmp(methodName, "ischild") == 0) { char *parent = (char *) CMGetClassName(ref, NULL)->hdl; char *chldn = (char *) CMGetArg(in, "child", NULL).value.string->hdl; st.rc = traverseChildren(cReg, parent, chldn); } else if (strcasecmp(methodName, "_startup") == 0) { /* let providerMgr know that we're odne init'ing */ semRelease(sfcbSem,INIT_CLASS_PROV_ID); st.rc = CMPI_RC_OK; } else { mlogf(M_ERROR, M_SHOW, "--- ClassProvider: Invalid invokeMethod request %s\n", methodName); st.rc = CMPI_RC_ERR_METHOD_NOT_FOUND; } _SFCB_RETURN(st); }
void AcceleratorManagerPrivate::manageWidget(QWidget *w, Item *item) { // first treat the special cases QTabBar *tabBar = qobject_cast<QTabBar*>(w); if (tabBar) { manageTabBar(tabBar, item); return; } QStackedWidget *wds = qobject_cast<QStackedWidget*>( w ); if ( wds ) { QWidgetStackAccelManager::manage( wds ); // return; } QDockWidget *dock = qobject_cast<QDockWidget*>( w ); if ( dock ) { //QWidgetStackAccelManager::manage( wds ); manageDockWidget(dock, item); } QMenu *popupMenu = qobject_cast<QMenu*>(w); if (popupMenu) { // create a popup accel manager that can deal with dynamic menus PopupAccelManager::manage(popupMenu); return; } QStackedWidget *wdst = qobject_cast<QStackedWidget*>( w ); if ( wdst ) { QWidgetStackAccelManager::manage( wdst ); // return; } QMenuBar *menuBar = qobject_cast<QMenuBar*>(w); if (menuBar) { manageMenuBar(menuBar, item); return; } if (qobject_cast<QComboBox*>(w) || qobject_cast<QLineEdit*>(w) || w->inherits("Q3TextEdit") || qobject_cast<QTextEdit*>(w) || qobject_cast<QAbstractSpinBox*>(w) || w->inherits( "KMultiTabBar" ) ) return; if ( w->inherits("KUrlRequester") ) { traverseChildren(w, item); return; } if ( qobject_cast<PathRequester*>(w) ) { traverseChildren(w, item); return; } // now treat 'ordinary' widgets QLabel *label = qobject_cast<QLabel*>(w); if ( label ) { if ( !label->buddy() ) return; else { if ( label->textFormat() == Qt::RichText || ( label->textFormat() == Qt::AutoText && Qt::mightBeRichText( label->text() ) ) ) return; } } if (w->focusPolicy() != Qt::NoFocus || label || qobject_cast<QGroupBox*>(w) || qobject_cast<QRadioButton*>( w )) { QString content; QVariant variant; int tprop = w->metaObject()->indexOfProperty("text"); if (tprop != -1) { QMetaProperty p = w->metaObject()->property( tprop ); if ( p.isValid() && p.isWritable() ) variant = p.read (w); else tprop = -1; } if (tprop == -1) { tprop = w->metaObject()->indexOfProperty("title"); if (tprop != -1) { QMetaProperty p = w->metaObject()->property( tprop ); if ( p.isValid() && p.isWritable() ) variant = p.read (w); } } if (variant.isValid()) content = variant.toString(); if (!content.isEmpty()) { Item *i = new Item; i->m_widget = w; // put some more weight on the usual action elements int weight = AccelManagerAlgorithm::DEFAULT_WEIGHT; if (qobject_cast<QPushButton*>(w) || qobject_cast<QCheckBox*>(w) || qobject_cast<QRadioButton*>(w) || qobject_cast<QLabel*>(w)) weight = AccelManagerAlgorithm::ACTION_ELEMENT_WEIGHT; // don't put weight on non-checkable group boxes, // as usually the contents are more important QGroupBox *groupBox = qobject_cast<QGroupBox*>(w); if (groupBox) { if (groupBox->isCheckable()) weight = AccelManagerAlgorithm::CHECKABLE_GROUP_BOX_WEIGHT; else weight = AccelManagerAlgorithm::GROUP_BOX_WEIGHT; } i->m_content = AccelString(content, weight); item->addChild(i); } } traverseChildren(w, item); }
void ColumnBalancer::traverseChildren(const LayoutObject& object) { // The break-after value from the previous in-flow block-level object to be // joined with the break-before value of the next in-flow block-level sibling. EBreak previousBreakAfterValue = BreakAuto; for (const LayoutObject* child = object.slowFirstChild(); child; child = child->nextSibling()) { if (!child->isBox()) { // Keep traversing inside inlines. There may be floats there. if (child->isLayoutInline()) traverseChildren(*child); continue; } const LayoutBox& childBox = toLayoutBox(*child); LayoutUnit borderEdgeOffset; LayoutUnit logicalTop = childBox.logicalTop(); LayoutUnit logicalHeight = childBox.logicalHeightWithVisibleOverflow(); // Floats' margins don't collapse with column boundaries, and we don't want // to break inside them, or separate them from the float's border box. Set // the offset to the margin-before edge (rather than border-before edge), // and include the block direction margins in the child height. if (childBox.isFloating()) { LayoutUnit marginBefore = childBox.marginBefore(object.style()); LayoutUnit marginAfter = childBox.marginAfter(object.style()); logicalHeight = std::max(logicalHeight, childBox.logicalHeight() + marginAfter); logicalTop -= marginBefore; logicalHeight += marginBefore; // As soon as we want to process content inside this child, though, we // need to get to its border-before edge. borderEdgeOffset = marginBefore; } if (m_flowThreadOffset + logicalTop + logicalHeight <= logicalTopInFlowThread()) { // This child is fully above the flow thread portion we're examining. continue; } if (m_flowThreadOffset + logicalTop >= logicalBottomInFlowThread()) { // This child is fully below the flow thread portion we're examining. We // cannot just stop here, though, thanks to negative margins. // So keep looking. continue; } if (childBox.isOutOfFlowPositioned() || childBox.isColumnSpanAll()) continue; // Tables are wicked. Both table rows and table cells are relative to their // table section. LayoutUnit offsetForThisChild = childBox.isTableRow() ? LayoutUnit() : logicalTop; m_flowThreadOffset += offsetForThisChild; examineBoxAfterEntering(childBox, logicalHeight, previousBreakAfterValue); // Unless the child is unsplittable, or if the child establishes an inner // multicol container, we descend into its subtree for further examination. if (childBox.getPaginationBreakability() != LayoutBox::ForbidBreaks && (!childBox.isLayoutBlockFlow() || !toLayoutBlockFlow(childBox).multiColumnFlowThread())) { // We need to get to the border edge before processing content inside // this child. If the child is floated, we're currently at the margin // edge. m_flowThreadOffset += borderEdgeOffset; traverseSubtree(childBox); m_flowThreadOffset -= borderEdgeOffset; } previousBreakAfterValue = childBox.breakAfter(); examineBoxBeforeLeaving(childBox, logicalHeight); m_flowThreadOffset -= offsetForThisChild; } }
static CMPIStatus ClassProviderInvokeMethod(CMPIMethodMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * ref, const char *methodName, const CMPIArgs * in, CMPIArgs * out) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIArray *ar; int rc; ClassRegister *cReg; _SFCB_ENTER(TRACE_PROVIDERS, "ClassProviderInvokeMethod"); cReg=getNsReg(ref, &rc); if (cReg==NULL) { CMPIStatus st = { CMPI_RC_ERR_INVALID_NAMESPACE, NULL }; _SFCB_RETURN(st); } if (strcasecmp(methodName, "getchildren") == 0) { CMPIData cn = CMGetArg(in, "class", NULL); _SFCB_TRACE(1,("--- getchildren %s",(char*)cn.value.string->hdl)); cReg->ft->wLock(cReg); if (cn.type == CMPI_string && cn.value.string && cn.value.string->hdl) { char *child; int l=0, i=0; UtilList *ul = getChildren(cReg, (char *) cn.value.string->hdl); if (ul) l = ul->ft->size(ul); ar = CMNewArray(_broker, l, CMPI_string, NULL); if (ul) for (child = (char *) ul->ft->getFirst(ul); child; child = (char *) ul->ft->getNext(ul)) { CMSetArrayElementAt(ar, i++, child, CMPI_chars); } st = CMAddArg(out, "children", &ar, CMPI_stringA); } else { } cReg->ft->wUnLock(cReg); } else if (strcasecmp(methodName, "getallchildren") == 0) { int ignprov=0; CMPIStatus st; CMPIData cn = CMGetArg(in, "class", &st); cReg->ft->wLock(cReg); if (st.rc!=CMPI_RC_OK) { cn = CMGetArg(in, "classignoreprov", NULL); ignprov=1; } _SFCB_TRACE(1,("--- getallchildren %s",(char*)cn.value.string->hdl)); if (cn.type == CMPI_string && cn.value.string && cn.value.string->hdl) { int n=0,i=0; loopOnChildCount(cReg,(char *)cn.value.string->hdl,&n,ignprov); _SFCB_TRACE(1,("--- count %d",n)); ar = CMNewArray(_broker, n, CMPI_string, NULL); if (n) { _SFCB_TRACE(1,("--- loop %s",(char*)cn.value.string->hdl)); loopOnChildChars(cReg, (char *)cn.value.string->hdl,ar,&i,ignprov); } st = CMAddArg(out, "children", &ar, CMPI_stringA); } else { } cReg->ft->wUnLock(cReg); } else if (strcasecmp(methodName, "getassocs") == 0) { ar = CMNewArray(_broker, cReg->topAssocs, CMPI_string, NULL); ClassBase *cb = (ClassBase *) (cReg + 1); UtilHashTable *ct = cb->ht; HashTableIterator *i; char *cn; ClassRecord *crec; int n; cReg->ft->wLock(cReg); for (n = 0, i = ct->ft->getFirst(ct, (void **) &cn, (void **) &crec); i; i = ct->ft->getNext(ct, i, (void **) &cn, (void **) &crec)) { if(crec->flags & CREC_isAssociation && crec->parent == NULL) { /* add top-level association class */ CMSetArrayElementAt(ar, n++, cn, CMPI_chars); } } CMAddArg(out, "assocs", &ar, CMPI_stringA); cReg->ft->wUnLock(cReg); } else if (strcasecmp(methodName, "ischild") == 0) { char *parent=(char*)CMGetClassName(ref,NULL)->hdl; char *chldn=(char*)CMGetArg(in, "child", NULL).value.string->hdl; st.rc = traverseChildren(cReg, parent, chldn); } else if (strcasecmp(methodName, "_startup") == 0) { /* check to see if cacheLimit was specified in providerRegister */ CMPIStatus parm_st = { CMPI_RC_OK, NULL }; CMPIData parmdata = CMGetContextEntry(ctx, "sfcbProviderParameters", &parm_st); if (parm_st.rc == CMPI_RC_OK ) { const char* parms = CMGetCharPtr(parmdata.value.string); /* cacheLimit is currently the only param, so just take whatever is after the '=' */ const char* val = strchr(parms,'='); /* conversion to uint may cause wrapping; won't catch negatives */ cacheLimit = ((val != NULL) && (cacheLimit = atoi(val+sizeof(char)))>0) ? cacheLimit : 10; } st.rc=CMPI_RC_OK; } else { mlogf(M_ERROR,M_SHOW,"--- ClassProvider: Invalid invokeMethod request %s\n", methodName); st.rc = CMPI_RC_ERR_METHOD_NOT_FOUND; } _SFCB_RETURN(st); }