这篇教程C++ visit函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中visit函数的典型用法代码示例。如果您正苦于以下问题:C++ visit函数的具体用法?C++ visit怎么用?C++ visit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了visit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: visit void visit(ast::TypeCall * node) override { s << "type"; visit(static_cast<ast::SpecialCall*>(node)); }
开发者ID:o-,项目名称:rift,代码行数:4,
示例2: switchvoidVisitor::visit(Type* t) { switch (t->kind) { case typename_type: return visit(as<Typename_type>(t)); case unit_type: return visit(as<Unit_type>(t)); case bool_type: return visit(as<Bool_type>(t)); case nat_type: return visit(as<Nat_type>(t)); case int_type: return visit(as<Int_type>(t)); case char_type: return visit(as<Char_type>(t)); case fn_type: return visit(as<Fn_type>(t)); case range_type: return visit(as<Range_type>(t)); case bitfield_type: return visit(as<Bitfield_type>(t)); case record_type: return visit(as<Record_type>(t)); case variant_type: return visit(as<Variant_type>(t)); case dep_variant_type: return visit(as<Dep_variant_type>(t)); case enum_type: return visit(as<Enum_type>(t)); case array_type: return visit(as<Array_type>(t)); case dep_type: return visit(as<Dep_type>(t)); case module_type: return visit(as<Module>(t)); case net_str_type: return visit(as<Net_str_type>(t)); case net_seq_type: return visit(as<Net_seq_type>(t)); default: return no_such_visitor(t); }}
开发者ID:flowgrammable,项目名称:steve-legacy,代码行数:24,
示例3: visitvoidVisitor::visit(Stmt* s) { if (Decl* d = as<Decl>(s)) return visit(d); return no_such_visitor(s);}
开发者ID:flowgrammable,项目名称:steve-legacy,代码行数:6,
示例4: updateContentvoid Label::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags){ if (! _visible || (_utf8Text.empty() && _children.empty()) ) { return; } if (_systemFontDirty || _contentDirty) { updateContent(); } uint32_t flags = processParentFlags(parentTransform, parentFlags); if (!_utf8Text.empty() && _shadowEnabled && (_shadowDirty || (flags & FLAGS_DIRTY_MASK))) { _position.x += _shadowOffset.width; _position.y += _shadowOffset.height; _transformDirty = _inverseDirty = true; _shadowTransform = transform(parentTransform); _position.x -= _shadowOffset.width; _position.y -= _shadowOffset.height; _transformDirty = _inverseDirty = true; _shadowDirty = false; } bool visibleByCamera = isVisitableByVisitingCamera(); if (_children.empty() && !_textSprite && !visibleByCamera) { return; } // IMPORTANT: // To ease the migration to v3.0, we still support the Mat4 stack, // but it is deprecated and your code should not rely on it _director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); _director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform); if (!_children.empty()) { sortAllChildren(); int i = 0; // draw children zOrder < 0 for (; i < _children.size(); i++) { auto node = _children.at(i); if (node && node->getLocalZOrder() < 0) node->visit(renderer, _modelViewTransform, flags); else break; } this->drawSelf(visibleByCamera, renderer, flags); for (auto it = _children.cbegin() + i; it != _children.cend(); ++it) { (*it)->visit(renderer, _modelViewTransform, flags); } } else { this->drawSelf(visibleByCamera, renderer, flags); } _director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);}
开发者ID:CienProject2016,项目名称:VESS,代码行数:72,
示例5: ifvoid LatexDocVisitor::visitPre(DocParamList *pl){ if (m_hide) return; DocParamSect::Type parentType = DocParamSect::Unknown; DocParamSect *sect = 0; if (pl->parent() && pl->parent()->kind()==DocNode::Kind_ParamSect) { parentType = ((DocParamSect*)pl->parent())->type(); sect=(DocParamSect*)pl->parent(); } bool useTable = parentType==DocParamSect::Param || parentType==DocParamSect::RetVal || parentType==DocParamSect::Exception || parentType==DocParamSect::TemplateParam; if (!useTable) { m_t << "//item["; } if (sect && sect->hasInOutSpecifier()) { if (pl->direction()!=DocParamSect::Unspecified) { m_t << "//mbox{//tt "; if (pl->direction()==DocParamSect::In) { m_t << "in"; } else if (pl->direction()==DocParamSect::Out) { m_t << "out"; } else if (pl->direction()==DocParamSect::InOut) { m_t << "in,out"; } m_t << "} "; } if (useTable) m_t << " & "; } if (sect && sect->hasTypeSpecifier()) { QListIterator<DocNode> li(pl->paramTypes()); DocNode *type; bool first=TRUE; for (li.toFirst();(type=li.current());++li) { if (!first) m_t << " | "; else first=FALSE; if (type->kind()==DocNode::Kind_Word) { visit((DocWord*)type); } else if (type->kind()==DocNode::Kind_LinkedWord) { visit((DocLinkedWord*)type); } } if (useTable) m_t << " & "; } m_t << "{//em "; //QStrListIterator li(pl->parameters()); //const char *s; QListIterator<DocNode> li(pl->parameters()); DocNode *param; bool first=TRUE; for (li.toFirst();(param=li.current());++li) { if (!first) m_t << ","; else first=FALSE; m_insideItem=TRUE; if (param->kind()==DocNode::Kind_Word) { visit((DocWord*)param); } else if (param->kind()==DocNode::Kind_LinkedWord) { visit((DocLinkedWord*)param); } m_insideItem=FALSE; } m_t << "}"; if (useTable) { m_t << " & "; } else { m_t << "]"; }}
开发者ID:augsod,项目名称:doxygen-uno,代码行数:88,
示例6: visit void visit(TypeAArray *t) { t->index->accept(this); visit((TypeNext *)t); }
开发者ID:hariomrana,项目名称:dmd,代码行数:5,
示例7: lean_assertexpr replace_visitor::visit_app(expr const & e) { lean_assert(is_app(e)); return update_app(e, visit(app_fn(e)), visit(app_arg(e)));}
开发者ID:bmalehorn,项目名称:lean,代码行数:4,
示例8: link_traversevoid link_traverse(void (*visit)(link_t)){ link_t p; for(p = head->next; p!= tail; p = p->next) visit(p);}
开发者ID:akaehy,项目名称:Project,代码行数:6,
示例9: visitmethodstatic void visitmethod(const upb_refcounted *r, upb_refcounted_visit *visit, void *closure) { const upb_pbdecodermethod *m = (const upb_pbdecodermethod*)r; visit(r, m->group, closure);}
开发者ID:alring,项目名称:upb,代码行数:5,
示例10: processParentFlagsvoid ClippingNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags){ if (!_visible || !hasContent()) return; uint32_t flags = processParentFlags(parentTransform, parentFlags); // IMPORTANT: // To ease the migration to v3.0, we still support the Mat4 stack, // but it is deprecated and your code should not rely on it Director* director = Director::getInstance(); CCASSERT(nullptr != director, "Director is null when seting matrix stack"); director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform); //Add group command _groupCommand.init(_globalZOrder); renderer->addCommand(&_groupCommand); renderer->pushGroup(_groupCommand.getRenderQueueID()); _beforeVisitCmd.init(_globalZOrder); _beforeVisitCmd.func = CC_CALLBACK_0(ClippingNode::onBeforeVisit, this); renderer->addCommand(&_beforeVisitCmd); if (_alphaThreshold < 1) {#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)#else // since glAlphaTest do not exists in OES, use a shader that writes // pixel only if greater than an alpha threshold GLProgram *program = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV); GLint alphaValueLocation = glGetUniformLocation(program->getProgram(), GLProgram::UNIFORM_NAME_ALPHA_TEST_VALUE); // set our alphaThreshold program->use(); program->setUniformLocationWith1f(alphaValueLocation, _alphaThreshold); // we need to recursively apply this shader to all the nodes in the stencil node // FIXME: we should have a way to apply shader to all nodes without having to do this setProgram(_stencil, program); #endif } _stencil->visit(renderer, _modelViewTransform, flags); _afterDrawStencilCmd.init(_globalZOrder); _afterDrawStencilCmd.func = CC_CALLBACK_0(ClippingNode::onAfterDrawStencil, this); renderer->addCommand(&_afterDrawStencilCmd); int i = 0; bool visibleByCamera = isVisitableByVisitingCamera(); if(!_children.empty()) { sortAllChildren(); // draw children zOrder < 0 for(auto size = _children.size(); i < size; i++) { auto node = _children.at(i); if ( node && node->getLocalZOrder() < 0 ) node->visit(renderer, _modelViewTransform, flags); else break; } // self draw if (visibleByCamera) this->draw(renderer, _modelViewTransform, flags); for(auto it=_children.cbegin()+i, itCend = _children.cend(); it != itCend; ++it) (*it)->visit(renderer, _modelViewTransform, flags); } else if (visibleByCamera) { this->draw(renderer, _modelViewTransform, flags); } _afterVisitCmd.init(_globalZOrder); _afterVisitCmd.func = CC_CALLBACK_0(ClippingNode::onAfterVisit, this); renderer->addCommand(&_afterVisitCmd); renderer->popGroup(); director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);}
开发者ID:ShineWu,项目名称:Quick-Cocos2dx-Community,代码行数:85,
示例11: retstd::string Value::getDescription(){ std::string ret("/n"); ret += visit(*this, 0); return ret;}
开发者ID:253627764,项目名称:WagonWar,代码行数:6,
示例12: processParentFlagsvoid Scale9Sprite::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags){ // quick return if not visible. children won't be drawn. if (!_visible) { return; } uint32_t flags = processParentFlags(parentTransform, parentFlags); // IMPORTANT: // To ease the migration to v3.0, we still support the Mat4 stack, // but it is deprecated and your code should not rely on it Director* director = Director::getInstance(); CCASSERT(nullptr != director, "Director is null when seting matrix stack"); director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform); int i = 0; // used by _children int j = 0; // used by _protectedChildren sortAllChildren(); sortAllProtectedChildren(); // // draw children and protectedChildren zOrder < 0 // for( ; i < _children.size(); i++ ) { auto node = _children.at(i); if ( node && node->getLocalZOrder() < 0 ) node->visit(renderer, _modelViewTransform, flags); else break; } // if (_scale9Enabled)// {// for( ; j < _protectedChildren.size(); j++ )// {// auto node = _protectedChildren.at(j);// // if ( node && node->getLocalZOrder() < 0 )// node->visit(renderer, _modelViewTransform, flags);// else// break;// }// }// else// {// if (_scale9Image && _scale9Image->getLocalZOrder() < 0 )// {// _scale9Image->visit(renderer, _modelViewTransform, flags);// }// } // // draw self //// if (isVisitableByVisitingCamera())// this->draw(renderer, _modelViewTransform, flags); // // draw children and protectedChildren zOrder >= 0 //// if (_scale9Enabled)// {// for(auto it=_protectedChildren.cbegin()+j; it != _protectedChildren.cend(); ++it)// (*it)->visit(renderer, _modelViewTransform, flags);// }// else// {// if (_scale9Image && _scale9Image->getLocalZOrder() >= 0 )// {// _scale9Image->visit(renderer, _modelViewTransform, flags);// }// } for(auto it=_children.cbegin()+i; it != _children.cend(); ++it) (*it)->visit(renderer, _modelViewTransform, flags); // FIX ME: Why need to set _orderOfArrival to 0?? // Please refer to https://github.com/cocos2d/cocos2d-x/pull/6920 // setOrderOfArrival(0); director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); }
开发者ID:LeeWei92,项目名称:cocos2dx-3.2-qt,代码行数:91,
示例13: mainint main(int argc, char *argv[]){ element_type test_array[20]; int i; BTREE T = init_tree(); TREE_NODE p; int height; for(i=0; i<20; i++){ test_array[i]= random(200); printf("%d, ", test_array[i]); } printf("/n"); T = creat_tree(test_array, sizeof(test_array)/sizeof(test_array[0]), T); height = height_recursive(T); printf("height is %d/n", height); printf("preorder:/n"); preorder_recursive(T); printf("/n"); printf("inoder:/n"); inorder_recursive(T); printf("/n"); printf("postorder:/n"); postorder_recursive(T); printf("/n"); printf("preorder nonrec:/n"); preorder_norecursive(T); printf("/n"); printf("inorder nonrec:/n"); inorder_norecursive(T); printf("/n"); printf("postorder nonrec:/n"); postorder_norcursive(T); printf("/n"); printf("levelorder:/n"); levelorder(T); printf("/n"); printf("print leaf recursive:/n"); output_leaf_recursive(T); printf("/n"); printf("print leaf norecursive/n"); output_leaf_norecursive(T); printf("/n"); printf("find an element/n"); if(find_tree(177, T) == NULL) printf("no such element/n"); else preorder_recursive(find_tree(177, T)); printf("/n"); printf("min node/n"); visit(find_min(T)->element); printf("/n"); printf("max node/n"); visit(find_max(T)->element); printf("/n"); printf("delet:/n"); tree_delete(115, T); preorder_recursive(T); printf("/n"); printf("exchange tree:/n"); exchange_recursive(T); preorder_recursive(T); printf("/n"); printf("exchange tree norecursive:/n"); exchange_norecursive(T); preorder_recursive(T); printf("/n"); free_tree(T); return 0;}
开发者ID:Trietptm-on-Coding-Algorithms,项目名称:data-structure,代码行数:89,
示例14: DBG_RTFvoid RTFDocVisitor::visitPre(DocParamList *pl){ static int columnPos[4][5] = { { 2, 25, 100, 100, 100 }, // no inout, no type { 3, 14, 35, 100, 100 }, // inout, no type { 3, 25, 50, 100, 100 }, // no inout, type { 4, 14, 35, 55, 100 }, // inout, type }; int config=0; if (m_hide) return; DBG_RTF("{//comment RTFDocVisitor::visitPre(DocParamList)}/n"); DocParamSect::Type parentType = DocParamSect::Unknown; DocParamSect *sect = 0; if (pl->parent() && pl->parent()->kind()==DocNode::Kind_ParamSect) { parentType = ((DocParamSect*)pl->parent())->type(); sect=(DocParamSect*)pl->parent(); } bool useTable = parentType==DocParamSect::Param || parentType==DocParamSect::RetVal || parentType==DocParamSect::Exception || parentType==DocParamSect::TemplateParam; if (sect && sect->hasInOutSpecifier()) config+=1; if (sect && sect->hasTypeSpecifier()) config+=2; if (useTable) { int i; m_t << "//trowd //trgaph108//trleft426//tblind426" "//trbrdrt//brdrs//brdrw10//brdrcf15 " "//trbrdrl//brdrs//brdrw10//brdrcf15 " "//trbrdrb//brdrs//brdrw10//brdrcf15 " "//trbrdrr//brdrs//brdrw10//brdrcf15 " "//trbrdrh//brdrs//brdrw10//brdrcf15 " "//trbrdrv//brdrs//brdrw10//brdrcf15 "<< endl; for (i=0;i<columnPos[config][0];i++) { m_t << "//clvertalt//clbrdrt//brdrs//brdrw10//brdrcf15 " "//clbrdrl//brdrs//brdrw10//brdrcf15 " "//clbrdrb//brdrs//brdrw10//brdrcf15 " "//clbrdrr //brdrs//brdrw10//brdrcf15 " "//cltxlrtb " "//cellx" << (rtf_pageWidth*columnPos[config][i+1]/100) << endl; } m_t << "//pard //widctlpar//intbl//adjustright" << endl; } if (sect && sect->hasInOutSpecifier()) { if (useTable) { m_t << "{"; } // Put in the direction: in/out/in,out if specified. if (pl->direction()!=DocParamSect::Unspecified) { if (pl->direction()==DocParamSect::In) { m_t << "in"; } else if (pl->direction()==DocParamSect::Out) { m_t << "out"; } else if (pl->direction()==DocParamSect::InOut) { m_t << "in,out"; } } if (useTable) { m_t << "//cell }"; } } if (sect && sect->hasTypeSpecifier()) { if (useTable) { m_t << "{"; } QListIterator<DocNode> li(pl->paramTypes()); DocNode *type; bool first=TRUE; for (li.toFirst();(type=li.current());++li) { if (!first) m_t << " | "; else first=FALSE; if (type->kind()==DocNode::Kind_Word) { visit((DocWord*)type); } else if (type->kind()==DocNode::Kind_LinkedWord) { visit((DocLinkedWord*)type); } } if (useTable) {//.........这里部分代码省略.........
开发者ID:AmesianX,项目名称:doxygen,代码行数:101,
示例15: operator expr operator()(expr const & e) { return visit(e); }
开发者ID:cpehle,项目名称:lean,代码行数:1,
示例16: mca_btl_tcp2_proc_insert//.........这里部分代码省略......... (struct sockaddr*) peer_interfaces[j]->ipv6_address, local_interfaces[i]->ipv6_netmask)) { weights[i][j] = CQ_PUBLIC_SAME_NETWORK; } else { weights[i][j] = CQ_PUBLIC_DIFFERENT_NETWORK; } best_addr[i][j] = peer_interfaces[j]->ipv6_endpoint_addr; } } /* for each peer interface */ } /* for each local interface */ /* * determine the size of the set to permute (max number of * interfaces */ best_assignment = (unsigned int *) malloc (perm_size * sizeof(int)); a = (int *) malloc(perm_size * sizeof(int)); if (NULL == a) { return OMPI_ERR_OUT_OF_RESOURCE; } /* Can only find the best set of connections when the number of * interfaces is not too big. When it gets larger, we fall back * to a simpler and faster (and not as optimal) algorithm. * See ticket https://svn.open-mpi.org/trac/ompi/ticket/2031 * for more details about this issue. */ if (perm_size <= MAX_PERMUTATION_INTERFACES) { memset(a, 0, perm_size * sizeof(int)); max_assignment_cardinality = -1; max_assignment_weight = -1; visit(0, -1, perm_size, a); rc = OMPI_ERR_UNREACH; for(i = 0; i < perm_size; ++i) { if(best_assignment[i] > num_peer_interfaces || weights[i][best_assignment[i]] == CQ_NO_CONNECTION || peer_interfaces[best_assignment[i]]->inuse || NULL == peer_interfaces[best_assignment[i]]) { continue; } peer_interfaces[best_assignment[i]]->inuse++; btl_endpoint->endpoint_addr = best_addr[i][best_assignment[i]]; btl_endpoint->endpoint_addr->addr_inuse++; rc = OMPI_SUCCESS; break; } } else { enum mca_btl_tcp2_connection_quality max; int i_max = 0, j_max = 0; /* Find the best connection that is not in use. Save away * the indices of the best location. */ max = CQ_NO_CONNECTION; for(i=0; i<num_local_interfaces; ++i) { for(j=0; j<num_peer_interfaces; ++j) { if (!peer_interfaces[j]->inuse) { if (weights[i][j] > max) { max = weights[i][j]; i_max = i; j_max = j; } } } }
开发者ID:Dissolubilis,项目名称:ompi-svn-mirror,代码行数:67,
示例17: visit_app expr visit_app(expr const & e) { expr new_f = visit(app_fn(e)); expr new_v = visit(app_arg(e)); return update_app(e, new_f, new_v); }
开发者ID:cpehle,项目名称:lean,代码行数:5,
示例18: visitvoid CtrGenerator::visit(const P_ConstraintList& list) { for (vector<P_NumConstraint*>::const_iterator it=list.ctrs.begin(); it!=list.ctrs.end(); it++) { visit(**it); }}
开发者ID:cprudhom,项目名称:ibex-lib,代码行数:5,
示例19: livoid XmlDocVisitor::visitPre(DocParamList *pl){ if (m_hide) return; m_t << "<parameteritem>" << endl; m_t << "<parameternamelist>" << endl; //QStrListIterator li(pl->parameters()); //const char *s; QListIterator<DocNode> li(pl->parameters()); DocNode *param; for (li.toFirst();(param=li.current());++li) { if (pl->paramTypes().count()>0) { QListIterator<DocNode> li(pl->paramTypes()); DocNode *type; for (li.toFirst();(type=li.current());++li) { m_t << "<parametertype>"; if (type->kind()==DocNode::Kind_Word) { visit((DocWord*)type); } else if (type->kind()==DocNode::Kind_LinkedWord) { visit((DocLinkedWord*)type); } m_t << "</parametertype>" << endl; } } m_t << "<parametername"; if (pl->direction()!=DocParamSect::Unspecified) { m_t << " direction=/""; if (pl->direction()==DocParamSect::In) { m_t << "in"; } else if (pl->direction()==DocParamSect::Out) { m_t << "out"; } else if (pl->direction()==DocParamSect::InOut) { m_t << "inout"; } m_t << "/""; } m_t << ">"; if (param->kind()==DocNode::Kind_Word) { visit((DocWord*)param); } else if (param->kind()==DocNode::Kind_LinkedWord) { visit((DocLinkedWord*)param); } m_t << "</parametername>" << endl; } m_t << "</parameternamelist>" << endl; m_t << "<parameterdescription>" << endl;}
开发者ID:bo0ts,项目名称:doxygen-fixes,代码行数:61,
示例20: insertAssertsvoid insertAsserts(IRUnit& unit) { // Note: it doesn't matter what order we visit the blocks for this pass. for (auto& block : poSortCfg(unit)) visit(unit, block);}
开发者ID:shixiao,项目名称:hhvm,代码行数:4,
注:本文中的visit函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ visitChildren函数代码示例 C++ visibility函数代码示例 |