这篇教程C++ substitute函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中substitute函数的典型用法代码示例。如果您正苦于以下问题:C++ substitute函数的具体用法?C++ substitute怎么用?C++ substitute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了substitute函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: perl_substitute__/*----------------------------------------------------------------------------perl_substitute__()The pattern substitution function which includes loading perl interpreter and doing the pattern substitution, then returning the replaced string.arguments: input: char* string, input text char* pattern, match pattern output:char* string, output text----------------------------------------------------------------------------*/int perl_substitute__( void ){ SV *text; /* Perl representation for the string to be modified by substitution */ char *subst_cmd = ptoc_string(2); int i; /* first load the perl interpreter, if unloaded */ if (perlObjectStatus == UNLOADED) load_perl__(); text = newSV(0); sv_setpv(text, ptoc_string(1)); /* put the string to the SV */ if( !substitute(&text, subst_cmd) ) return(FAILURE); global_pattern_mode = is_global_pattern(subst_cmd); if (substituteString != NULL ) free(substituteString); substituteString = malloc(strlen(SvPV(text,PL_na))+1); strcpy(substituteString,SvPV(text,PL_na)); SvREFCNT_dec(text); /*release space*/ ctop_string(3, string_find(substituteString,1)); /*return changed text*/ return SUCCESS;}
开发者ID:eden,项目名称:navajoverb,代码行数:37,
示例2: normalize_no_unfoldterm* normalize_no_unfold(typing_context* Delta, term* t) { if (t == NULL) return NULL; switch (t->tag) { case VAR: { return term_dup(t); } case APP: { term* l = normalize_no_unfold(Delta, t->left); term* r = normalize_no_unfold(Delta, t->right); if (l->tag == LAM) { term* subs = substitute(l->var, r, l->right); free_term(l); free_term(r); return normalize_no_unfold_and_free(Delta, subs); } return make_app(l, r); } case IMPLICIT: case HOLE: case TYPE: case LAM: case PI: return term_dup(t); default: sentinel("unexpected tag %d"); } error: return NULL;}
开发者ID:uwplse,项目名称:arvo,代码行数:32,
示例3: findint find(struct session *ses, char *str, char *exp, int sub){ char expbuf[BUFFER_SIZE], strbuf[BUFFER_SIZE]; if (ses) { substitute(ses, str, strbuf, SUB_VAR|SUB_FUN); substitute(ses, exp, expbuf, SUB_VAR|SUB_FUN); return tintin_regexp(ses, NULL, strbuf, expbuf, 0, sub); } else { return tintin_regexp(ses, NULL, str, exp, 0, sub); }}
开发者ID:skout23,项目名称:snowy,代码行数:16,
示例4: check_one_regexpint check_one_regexp(struct session *ses, struct listnode *node, char *line, char *original, int option){ char *exp, *str; if (node->regex == NULL) { char result[BUFFER_SIZE]; substitute(ses, node->left, result, SUB_VAR|SUB_FUN); exp = result; } else { exp = node->left; } if (HAS_BIT(node->flags, NODE_FLAG_META)) { exp++; str = original; } else { str = line; } return tintin_regexp(ses, node->regex, str, exp, option, SUB_ARG);}
开发者ID:skout23,项目名称:snowy,代码行数:29,
示例5: visit void visit(TypeReference *t) { if (substitute(t)) return; buf.writeByte('R'); t->next->accept(this); store(t); }
开发者ID:yeswalrus,项目名称:dmd,代码行数:7,
示例6: rulesunsigned intExpressionBuilder::EBTerm::substitute(const EBSubstitutionRule & rule){ EBSubstitutionRuleList rules(1); rules[0] = &rule; return substitute(rules);}
开发者ID:FHilty,项目名称:moose,代码行数:7,
示例7: substitutevoid ConstraintMap::substAlpha() { ConstraintMap alphaDefs; std::map<Exp*, Exp*, lessExpStar>::iterator cc; for (cc = cmap.begin(); cc != cmap.end(); cc++) { // Looking for entries with two TypeVals, where exactly one is an alpha if (!cc->first->isTypeVal() || !cc->second->isTypeVal()) continue; Type *t1, *t2; t1 = ((TypeVal*)cc->first )->getType(); t2 = ((TypeVal*)cc->second)->getType(); int numAlpha = 0; if (t1->isPointerToAlpha()) numAlpha++; if (t2->isPointerToAlpha()) numAlpha++; if (numAlpha != 1) continue; // This is such an equality. Copy it to alphaDefs if (t1->isPointerToAlpha()) alphaDefs.cmap[cc->first] = cc->second; else alphaDefs.cmap[cc->second] = cc->first; } // Remove these from the solution for (cc = alphaDefs.begin(); cc != alphaDefs.end(); cc++) cmap.erase(cc->first); // Now substitute into the remainder substitute(alphaDefs);}
开发者ID:arnew,项目名称:boomerang,代码行数:29,
示例8: prefix_name void prefix_name(Dsymbol *s) { if (!substitute(s)) { store(s); Dsymbol *p = s->toParent(); if (p && p->isTemplateInstance()) { s = p; if (exist(p->isTemplateInstance()->tempdecl)) { p = NULL; } else { p = p->toParent(); } } if (p && !p->isModule()) { prefix_name(p); } source_name(s); } }
开发者ID:yeswalrus,项目名称:dmd,代码行数:26,
示例9: ASSERTvoidbridge_document_rep::notify_remove (path p, int nr) { // cout << "Remove " << p << ", " << nr << " in " << st << "/n"; ASSERT (!is_nil (p), "nil path"); if (is_atom (p)) { int i, n= N(brs), pos= p->item; array<bridge> brs2 (n-nr); for (i=0; i<pos ; i++) brs2[i]= brs[i]; for (; i<n-nr; i++) { brs2[i]= brs[i+nr]; brs2[i]->ip->item -= nr; } bool change_flag= false; for (i=pos; i<pos+nr; i++) change_flag |= !brs[i]->changes->empty(); brs= brs2; n -= nr; st = st (0, pos) * st (pos+nr, N(st)); if (pos>0) brs[pos-1]->notify_change (); // touch in case of surroundings if (pos<n) brs[pos ]->notify_change (); // touch in case of surroundings if (change_flag) // touch brs[pos..n] for correct ``changes handling'' for (i=pos; i<n; i++) brs[i]->notify_change (); if (!is_nil (acc)) acc->notify_remove (p, nr); // initialize_acc (); } else { brs[p->item]->notify_remove (p->next, nr); st= substitute (st, p->item, brs[p->item]->st); if (!is_nil (acc)) acc->notify_assign (p->item, st[p->item]); } status= CORRUPTED;}
开发者ID:Easycker,项目名称:itexmacs,代码行数:33,
示例10: visit void visit(TypeFunction *t) { /* * <function-type> ::= F [Y] <bare-function-type> E * <bare-function-type> ::= <signature type>+ * # types are possible return type, then parameter types */ /* ABI says: "The type of a non-static member function is considered to be different, for the purposes of substitution, from the type of a namespace-scope or static member function whose type appears similar. The types of two non-static member functions are considered to be different, for the purposes of substitution, if the functions are members of different classes. In other words, for the purposes of substitution, the class of which the function is a member is considered part of the type of function." BUG: Right now, types of functions are never merged, so our simplistic component matcher always finds them to be different. We should use Type::equals on these, and use different TypeFunctions for non-static member functions, and non-static member functions of different classes. */ if (substitute(t)) return; buf.writeByte('F'); if (t->linkage == LINKc) buf.writeByte('Y'); t->next->accept(this); argsCppMangle(t->parameters, t->varargs); buf.writeByte('E'); store(t); }
开发者ID:Arpit007,项目名称:GDC,代码行数:34,
示例11: bblFileNamevoid CiteDict::parse(){ //msg("..parsing bbl file/n"); QCString bblFileName(m_baseFileName + ".bbl"); QFile f(bblFileName); if (!f.open(IO_ReadOnly)) { err("error: could not open file %s/n",bblFileName.data()); return; } m_ordering.clear(); QTextStream t(&f); QCString label; QCString line; while (!t.eof()) { label=t.readLine(); if (label.isEmpty()) { continue; } CiteInfo* ci = m_entries.find(label); if (!ci) insert(label); // BibTeX has its own way of sorting references, // depending on the .bst file m_ordering.append(new QCString(label)); ci->text=t.readLine(); while (!(line=t.readLine()).isEmpty()) { ci->fullText += line + '/n'; } // FIXME: process LaTeX-style accents properly ci->fullText = substitute(substitute(substitute(ci->fullText, "{", ""), "}", ""), "~", " "); //printf("BIB ENTRY: %s -> %s: %s/n", ci->label.data(), ci->text.data(), ci->fullText.data()); }}
开发者ID:jscipione,项目名称:Doxygen_Haiku,代码行数:47,
示例12: get_arg_stop_spacesstruct session *parse_tintin_command(struct session *ses, char *input){ char line[BUFFER_SIZE]; struct session *sesptr; input = get_arg_stop_spaces(ses, input, line, 0); substitute(ses, line, line, SUB_VAR|SUB_FUN); if (is_number(line)) { int cnt = atoi(line); input = get_arg_in_braces(ses, input, line, TRUE); while (cnt-- > 0) { ses = script_driver(ses, -1, line); } return ses; } for (sesptr = gts ; sesptr ; sesptr = sesptr->next) { if (!strcmp(sesptr->name, line)) { if (*input) { input = get_arg_in_braces(ses, input, line, TRUE); substitute(ses, line, line, SUB_VAR|SUB_FUN); script_driver(sesptr, -1, line); return ses; } else { return activate_session(sesptr); } } } tintin_printf(ses, "#ERROR: #UNKNOWN TINTIN-COMMAND '%s'.", line); return ses;}
开发者ID:skout23,项目名称:snowy,代码行数:47,
示例13: substituteQString DebconfFrontend::property(const QString &key, PropertyKey p) const{ QString r = m_data.value(key).value(p); if (p == Description || p == Choices) { return substitute(key, r); } return r;}
开发者ID:KDE,项目名称:libdebconf-kde,代码行数:8,
示例14: substituteExpressionBuilder::EBTermNode * ExpressionBuilder::EBSubstitutionRuleTyped<Node_T>::apply(const ExpressionBuilder::EBTermNode * node) const{ const Node_T * match_node = dynamic_cast<const Node_T *>(node); if (match_node == NULL) return NULL; else return substitute(*match_node);}
开发者ID:jasonmhite,项目名称:moose,代码行数:8,
示例15: process_packet void process_packet(const T* src) { substitute(m_kfilter, to_pointer(make_univector(src, m_packet_size) * m_input_gain)); const T filtered_sum_of_squares = sumsqr(truncate(m_kfilter, m_packet_size)); m_short_sum_of_squares.ringbuf_write(m_short_sum_of_squares_cursor, filtered_sum_of_squares); m_momentary_sum_of_squares.ringbuf_write(m_momentary_sum_of_squares_cursor, filtered_sum_of_squares); }
开发者ID:dlevin256,项目名称:kfr,代码行数:8,
示例16: substitute static inline std::string substitute(boost::format& message, const T& argument, const Args&... args) { return substitute(message % argument, args...); }
开发者ID:zloidemon,项目名称:cocaine-core,代码行数:8,
示例17: set_promptvoidset_prompt(int to, Source *s){ cur_prompt = (uint8_t)to; switch (to) { /* command */ case PS1: /* * Substitute ! and !! here, before substitutions are done * so ! in expanded variables are not expanded. * NOTE: this is not what AT&T ksh does (it does it after * substitutions, POSIX doesn't say which is to be done. */ { struct shf *shf; char * volatile ps1; Area *saved_atemp; int saved_lineno; ps1 = str_val(global("PS1")); shf = shf_sopen(NULL, strlen(ps1) * 2, SHF_WR | SHF_DYNAMIC, NULL); while (*ps1) if (*ps1 != '!' || *++ps1 == '!') shf_putchar(*ps1++, shf); else shf_fprintf(shf, "%lu", s ? (unsigned long)s->line + 1 : 0UL); ps1 = shf_sclose(shf); saved_lineno = current_lineno; if (s) current_lineno = s->line + 1; saved_atemp = ATEMP; newenv(E_ERRH); if (kshsetjmp(e->jbuf)) { prompt = safe_prompt; /* * Don't print an error - assume it has already * been printed. Reason is we may have forked * to run a command and the child may be * unwinding its stack through this code as it * exits. */ } else { char *cp = substitute(ps1, 0); strdupx(prompt, cp, saved_atemp); } current_lineno = saved_lineno; quitenv(NULL); } break; /* command continuation */ case PS2: prompt = str_val(global("PS2")); break; }}
开发者ID:whitecatboard,项目名称:LiteBSD,代码行数:58,
示例18: substituteQCString NamespaceDef::displayName() const{ QCString result=name(); if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) { result = substitute(result,"::","."); } return result; }
开发者ID:tch-opensrc,项目名称:TC72XX_LxG1.0.10mp5_OpenSrc,代码行数:9,
示例19: formatstaticinlinestd::stringformat(const attribute::set_view_t& attributes, const std::string& fmt, Args&&... args){ return substitute(attributes, boost::format(fmt), args...);}
开发者ID:bioothod,项目名称:blackhole,代码行数:9,
示例20: substitute_decl// FIXME: Rebuild the variable as if parsed.Decl&substitute_decl(Context& cxt, Variable_decl& d, Substitution& sub){ Name& n = d.name(); Type& t = substitute(cxt, d.type(), sub); Builder build(cxt); return build.make_variable(n, t);}
开发者ID:Jenny-fa,项目名称:banjo,代码行数:10,
示例21: substituteList<T>substitute(Context& cxt, List<T>& list, Substitution& sub){ List<T> ret; ret.reserve(list.size()); for (T& x : list) ret.push_back(substitute(cxt, x, sub)); return ret;}
开发者ID:Jenny-fa,项目名称:banjo,代码行数:9,
示例22: mainmain (int argc, char **argv, char **env){ char *embedding[] = { "", "-e", "0" }; char *text, **match_list; int num_matches, i; int j; my_perl = perl_alloc(); perl_construct( my_perl ); perl_parse(my_perl, NULL, 3, embedding, NULL); text = (char *) malloc(sizeof(char) * 486); /** A long string follows! **/ sprintf(text, "%s", "When he is at a convenience store and the bill comes to some amount like 76 cents, Maynard is aware that there is something he *should* do, something that will enable him to get back a quarter, but he has no idea *what*. He fumbles through his red squeezey changepurse and gives the boy three extra pennies with his dollar, hoping that he might luck into the correct amount. The boy gives him back two of his own pennies and then the big shiny quarter that is his prize. -RICHH"); if (match(text, "m/quarter/")) /** Does text contain 'quarter'? **/ printf("match: Text contains the word 'quarter'./n/n"); else printf("match: Text doesn't contain the word 'quarter'./n/n"); if (match(text, "m/eighth/")) /** Does text contain 'eighth'? **/ printf("match: Text contains the word 'eighth'./n/n"); else printf("match: Text doesn't contain the word 'eighth'./n/n"); /** Match all occurrences of /wi../ **/ num_matches = matches(text, "m/(wi..)/g", &match_list); printf("matches: m/(wi..)/g found %d matches.../n", num_matches); for (i = 0; i < num_matches; i++) printf("match: %s/n", match_list[i]); printf("/n"); for (i = 0; i < num_matches; i++) { free(match_list[i]); } free(match_list); /** Remove all vowels from text **/ num_matches = substitute(&text, "s/[aeiou]//gi"); if (num_matches) { printf("substitute: s/[aeiou]//gi...%d substitutions made./n", num_matches); printf("Now text is: %s/n/n", text); } /** Attempt a substitution **/ if (!substitute(&text, "s/Perl/C/")) { printf("substitute: s/Perl/C...No substitution made./n/n"); } free(text); perl_destruct(my_perl); perl_free(my_perl);}
开发者ID:gitpan,项目名称:ExtUtils-Embed,代码行数:44,
示例23: matchExcludedSymbolsstatic bool matchExcludedSymbols(const char *name){ static QStrList &exclSyms = Config_getList("EXCLUDE_SYMBOLS"); if (exclSyms.count()==0) return FALSE; // nothing specified const char *pat = exclSyms.first(); QCString symName = name; while (pat) { QCString pattern = pat; bool forceStart=FALSE; bool forceEnd=FALSE; if (pattern.at(0)=='^') pattern=pattern.mid(1),forceStart=TRUE; if (pattern.at(pattern.length()-1)=='$') pattern=pattern.left(pattern.length()-1),forceEnd=TRUE; if (pattern.find('*')!=-1) // wildcard mode { QRegExp re(substitute(pattern,"*",".*"),TRUE); int i,pl; i = re.match(symName,0,&pl); //printf(" %d = re.match(%s) pattern=%s/n",i,symName.data(),pattern.data()); if (i!=-1) // wildcard match { int sl=symName.length(); // check if it is a whole word match if ((i==0 || pattern.at(0)=='*' || (!isId(symName.at(i-1)) && !forceStart)) && (i+pl==sl || pattern.at(i+pl)=='*' || (!isId(symName.at(i+pl)) && !forceEnd)) ) { //printf("--> name=%s pattern=%s match at %d/n",symName.data(),pattern.data(),i); return TRUE; } } } else if (!pattern.isEmpty()) // match words { int i = symName.find(pattern); if (i!=-1) // we have a match! { int pl=pattern.length(); int sl=symName.length(); // check if it is a whole word match if ((i==0 || (!isId(symName.at(i-1)) && !forceStart)) && (i+pl==sl || (!isId(symName.at(i+pl)) && !forceEnd)) ) { //printf("--> name=%s pattern=%s match at %d/n",symName.data(),pattern.data(),i); return TRUE; } } } pat = exclSyms.next(); } //printf("--> name=%s: no match/n",name); return FALSE;}
开发者ID:jscipione,项目名称:Doxygen_Haiku,代码行数:56,
示例24: substitutevoid LSystem::next(){ std::vector<Symbol> new_state; for( int i = 0; i < state.size() ; i++) { substitute(state[i],new_state); } state = new_state; iteration++;}
开发者ID:JJGO,项目名称:Parallel-LSystem,代码行数:10,
注:本文中的substitute函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ substr函数代码示例 C++ subst函数代码示例 |