这篇教程C++ stringIn函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中stringIn函数的典型用法代码示例。如果您正苦于以下问题:C++ stringIn函数的具体用法?C++ stringIn怎么用?C++ stringIn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了stringIn函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: hRangeQuerystruct psl *loadPslsFromDb(struct sqlConnection *conn, int numTables, char **tables, char *chrom, unsigned int chromStart, unsigned int chromEnd)/* load up all of the psls that align on a given section of the database */{struct sqlResult *sr = NULL;char **row = NULL;int rowOffset = -100;struct psl *pslList = NULL;struct psl *psl = NULL;int i=0;/* for each table load up the relevant psls */for(i = 0; i < numTables; i++) { sr = hRangeQuery(conn, tables[i], chrom, chromStart, chromEnd, NULL, &rowOffset); while ((row = sqlNextRow(sr)) != NULL) { psl = pslLoad(row+rowOffset); slSafeAddHead(&pslList, psl); if(weightMrna && (stringIn("refSeqAli",tables[i]) || stringIn("mrna", tables[i]))) { psl = clonePsl(psl); slSafeAddHead(&pslList, psl); } } sqlFreeResult(&sr); }slReverse(&pslList);return pslList;}
开发者ID:apmagalhaes,项目名称:kentUtils,代码行数:29,
示例2: faSimplifyvoid faSimplify(char *inName, char *startPat, char *endPat, char *outName)/* faFlyBaseToUcsc - Convert Flybase peptide fasta file to UCSC format. */{struct lineFile *lf = lineFileOpen(inName, TRUE);FILE *f = mustOpen(outName, "w");char *line;int startSize = strlen(startPat);while (lineFileNext(lf, &line, NULL)) { if (line[0] == '>') { char *s = stringIn(startPat, line), *e; if (s == NULL) errAbort("No %s line %d of %s", startPat, lf->lineIx, lf->fileName); s += startSize; e = stringIn(endPat, s); if (e == NULL) errAbort("No %s line %d of %s", endPat, lf->lineIx, lf->fileName); *e = 0; fprintf(f, ">%s%s%s/n", prefix, s, suffix); } else { fprintf(f, "%s/n", line); } }carefulClose(&f);lineFileClose(&lf);}
开发者ID:sktu,项目名称:kentUtils,代码行数:30,
示例3: extractNullTerminatedStringsQList<QString> extractNullTerminatedStrings(const void *src, size_t srcSize, QTextCodec *codec){ QList<QString> result; size_t ptr = static_cast<size_t>(0); size_t strStart = static_cast<size_t>(0); const quint8 *source = reinterpret_cast<const quint8 *>(src); while(ptr < srcSize) { if(source[ptr] == 0) { size_t strLen = ptr - strStart + static_cast<size_t>(1); if(strLen > static_cast<size_t>(1)) { QScopedArrayPointer<quint8> stringIn(new quint8[strLen]); memcpy( reinterpret_cast<void *>(stringIn.data()), reinterpret_cast<const void *>(source + strStart), strLen); strStart = ptr + static_cast<size_t>(1); QScopedPointer<QTextDecoder> decoder(codec->makeDecoder()); if (decoder.isNull()) { throw std::runtime_error("Unable to create text decoder"); } result.append(decoder->toUnicode(reinterpret_cast<const char *> ( stringIn.data()), static_cast<int> (strLen - static_cast<size_t>(1)))); } else { strStart = ptr + static_cast<size_t>(1); result.append(QString()); } } ptr++; } if(ptr - strStart > static_cast<size_t>(0)) { size_t strLen = ptr - strStart; QScopedArrayPointer<quint8> stringIn(new quint8[strLen]); memcpy(reinterpret_cast<void *>(stringIn.data()), reinterpret_cast<const void *>(source + strStart), strLen); QScopedPointer<QTextDecoder> decoder(codec->makeDecoder()); if (decoder.isNull()) { throw std::runtime_error("Unable to create text decoder"); } result.append(decoder->toUnicode(reinterpret_cast<const char *> ( stringIn.data()), strLen)); } return result;}
开发者ID:rel-eng,项目名称:QWinHelp,代码行数:53,
示例4: endFromFileNameint endFromFileName(char *fileName)/* Try and figure out end from file name */{if (stringIn("_R1_", fileName)) return 1;else if (stringIn("_R2_", fileName)) return 2;else if (stringIn("_1.", fileName)) return 1;else if (stringIn("_2.", fileName)) return 2;errAbort("Couldn't deduce paired end from file name %s", fileName);return 0;}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:14,
示例5: lookupNamechar* lookupName( struct sqlConnection *conn , char *id){char *name = cloneString(id);char infoTable[128];safef(infoTable, sizeof(infoTable), "%sInfo","bdgpGene");if (hTableExists(infoTable)) { struct sqlConnection *conn = hAllocConn(); char *symbol = NULL; char *ptr = strchr(name, '-'); char query[256]; char buf[64]; if (ptr != NULL) *ptr = 0; safef(query, sizeof(query), "select symbol from %s where bdgpName = '%s';", infoTable, name); symbol = sqlQuickQuery(conn, query, buf, sizeof(buf)); hFreeConn(&conn); if (symbol != NULL) { char *ptr = stringIn("{}", symbol); if (ptr != NULL) *ptr = 0; freeMem(name); name = cloneString(symbol); } }return(name);}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:29,
示例6: hashNewstruct hash *hashTextFields(struct sqlConnection *conn, char *table)/* Return hash with just text (char, varchar, blob, text) fields in it, and no values */{struct hash *hash = hashNew(0);struct sqlResult *sr = sqlDescribe(conn, table);char **row;while ((row = sqlNextRow(sr)) != NULL) { char *field = row[0]; char *type = row[1]; if (stringIn("char", type) || stringIn("blob", type) || stringIn("text", type)) hashAdd(hash, field, NULL); }sqlFreeResult(&sr);return hash;}
开发者ID:davidhoover,项目名称:kent,代码行数:16,
示例7: currentVmPeaklong long currentVmPeak()/* return value of peak Vm memory usage (if /proc/ business exists) */{long long vmPeak = 0;pid_t pid = getpid();char temp[256];safef(temp, sizeof(temp), "/proc/%d/status", (int) pid);struct lineFile *lf = lineFileMayOpen(temp, TRUE);if (lf) { char *line; while (lineFileNextReal(lf, &line)) { // typical line: 'VmPeak: 62646196 kB' // seems to always be kB if (stringIn("VmPeak", line)) { char *words[3]; chopByWhite(line, words, 3); vmPeak = sqlLongLong(words[1]); // assume always 2nd word break; } } lineFileClose(&lf); }return vmPeak;}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:28,
示例8: noteIdsvoid noteIds(struct tenFields *tfList, char *inGff, FILE *cdsFile, FILE *otherFile)/* Look for cases where tenth field is of form * ID=XXX;Note=YYY. In these cases move XXX to * the ninth field, and store the ID, the * third (type) field, and the YYY in f */{struct tenFields *tf;struct hash *uniqHash = newHash(19);for (tf = tfList; tf != NULL; tf = tf->next) { char *s = tf->fields[9]; if (startsWith("ID=", s)) { char *id = s+3, *note = ""; char *e = strchr(s, ';'); if (!hashLookup(uniqHash, id)) { hashAdd(uniqHash, id, NULL); if (e != NULL) { *e++ = 0; s = stringIn("Note=", e); if (s != NULL) { note = s+5; cgiDecode(note, note, strlen(note)); } } } tf->fields[8] = id; } }hashFree(&uniqHash);}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:35,
示例9: laneFromFileNameint laneFromFileName(char *fileName)/* Deduce lane from file name. If there is something of form _L123_ in the midst of * file name we'll call it lane. Otherwise return 0 (they start counting at 1) */{char *pat = "_L";int patLen = strlen(pat);char *s = fileName;while ((s = stringIn(pat, s)) != NULL) { s += patLen; char *e = strchr(s, '_'); if (e == NULL) break; int midSize = e - s; if (midSize == 3) { char midBuf[midSize+1]; memcpy(midBuf, s, midSize); midBuf[midSize] = 0; if (isAllDigits(midBuf)) return atoi(midBuf); } }return 0;}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:25,
示例10: outputChunkvoid outputChunk(struct psl **pPslList, char *tempDir, int midIx, boolean noHead)/* Sort and write out pslList and free it. */{char fileName[512];FILE *f;struct psl *psl;if (*pPslList == NULL) return; /* Empty. */psl = *pPslList;//slSort(pPslList, pslCmpTarget);makeMidName(tempDir, midIx, fileName);if (stripVer) { char *s = stringIn(".",psl->qName); if (s != NULL) *s = 0; }if (chunkSize ==1) safef(fileName, sizeof(fileName), "%s/%s.psl",tempDir,psl->qName);f = mustOpen(fileName, "w");if (!noHead) pslWriteHead(f);for (psl = *pPslList; psl != NULL; psl = psl->next) pslTabOut(psl, f);fclose(f);pslFreeList(pPslList);}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:28,
示例11: dyStringSubstruct dyString * dyStringSub(char *orig, char *in, char *out)/* Make up a duplicate of orig with all occurences of in substituted * with out. */{int inLen = strlen(in), outLen = strlen(out), origLen = strlen(orig);struct dyString *dy = newDyString(origLen + 2*outLen);char *s, *e;if (orig == NULL) return NULL;for (s = orig; ;) { e = stringIn(in, s); if (e == NULL) { e = orig + origLen; dyStringAppendN(dy, s, e - s); break; } else { dyStringAppendN(dy, s, e - s); dyStringAppendN(dy, out, outLen); s = e + inLen; } }return dy;}
开发者ID:ajsteele,项目名称:r-bioc-rtracklayer,代码行数:27,
示例12: inclChrombool inclChrom(char *name)/* check if a chromosome should be included */{return !((noRandom && (endsWith(name, "_random") || startsWith("chrUn", name) || sameWord("chrNA", name) /* danRer */ || sameWord("chrU", name))) /* dm */ || (noHap && stringIn( "_hap", name)));}
开发者ID:elmargb,项目名称:kentUtils,代码行数:9,
示例13: nearCountUniqAccRowsint nearCountUniqAccRows(struct htmlPage *page)/* Count number of unique rows in table containing just hyperlinked * accessions. */{char *s, *e, *row, *acc;int count = 0;struct hash *uniqHash = hashNew(0);if (page == NULL) return -1;/* Set s to first row. */s = stringIn(nearStartTablePat, page->htmlText);if (s == NULL) return -1;s += strlen(nearStartTablePat);for (;;) { e = stringIn(nearEndRowPat, s); if (e == NULL) break; row = cloneStringZ(s, e-s); acc = qaStringBetween(row, ">", "</a>"); if (acc == NULL) { warn("Can't find acc text between > and </a> while counting uniq row %s", row); freez(&row); break; } if (!hashLookup(uniqHash, acc)) { hashAdd(uniqHash, acc, NULL); ++count; } freez(&row); freez(&acc); s = e + strlen(nearEndRowPat); }hashFree(&uniqHash);return count;}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:43,
示例14: orgFitsboolean orgFits(struct hash *hash)/* Return TRUE if it's an organism that passes filter. */{char *bf;if (organism == NULL) return TRUE;bf = hashFindVal(hash, "BF");if (bf == NULL) return FALSE;return stringIn(organism, bf) != NULL;}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:11,
示例15: qaCountBetweenint qaCountBetween(char *s, char *startPattern, char *endPattern, char *midPattern)/* Count the number of midPatterns that occur between start and end pattern. */{int count = 0;char *e;s = stringIn(startPattern, s);if (s != NULL) { s += strlen(startPattern); e = stringIn(endPattern, s); while (s < e) { if (startsWith(midPattern, s)) ++count; s += 1; } }return count;}
开发者ID:kenongit,项目名称:sequencing,代码行数:20,
示例16: cloneStringstatic char *cloneAndCut(char *s, char *cutAt)/* Return copy of string that may have stuff cut off end. */{char *clone = cloneString(s);if (cutAt != NULL) { char *end = stringIn(cutAt, clone); if (end != NULL) *end = 0; }return clone;}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:12,
示例17: getNullTerminatedStringQString getNullTerminatedString(const void *src, size_t offset, size_t srcSize, QTextCodec *codec, size_t &stringLength){ size_t ptr = offset; size_t strEnd = offset; bool nullFound = false; while(ptr < srcSize) { if((reinterpret_cast<const quint8 *>(src))[ptr] == 0) { strEnd = ptr; nullFound = true; break; } else { ptr++; } } if(!nullFound) { throw std::runtime_error("No end of string found"); } if((strEnd + static_cast<size_t>(1)) < offset) { throw std::runtime_error("No end of string found"); } size_t strLen = strEnd - offset + static_cast<size_t>(1); stringLength = strLen; if(strLen > static_cast<size_t>(1)) { QScopedArrayPointer<quint8> stringIn(new quint8[strLen]); memcpy(reinterpret_cast<void *>(stringIn.data()), reinterpret_cast<const void *>(reinterpret_cast<const quint8 *>(src) + offset), strLen); QScopedPointer<QTextDecoder> decoder(codec->makeDecoder()); if (decoder.isNull()) { throw std::runtime_error("Unable to create text decoder"); } return decoder->toUnicode(reinterpret_cast<const char *> (stringIn.data( )), static_cast<int> (strLen - static_cast<size_t>(1))); } else { return QString(); }}
开发者ID:rel-eng,项目名称:QWinHelp,代码行数:52,
示例18: weedLinesvoid weedLines(char *weedFile, char *file, char *output, boolean invert, char *invertOutput)/* weedLines - Selectively remove lines from file. */{struct hash *hash = hashWordsInFile(weedFile, 16);struct hashEl *weedList = hashElListHash(hash);verbose(2, "%d words in weed file %s/n", hash->elCount, weedFile);struct lineFile *lf = lineFileOpen(file, TRUE);char *line, *word;FILE *f = mustOpen(output, "w");FILE *fInvert = NULL;boolean embedded = optionExists("embedded");if (invertOutput != NULL) fInvert = mustOpen(invertOutput, "w");while (lineFileNext(lf, &line, NULL)) { boolean doWeed = FALSE; char *dupe = NULL; if (embedded) { struct hashEl *hel; for (hel = weedList; hel != NULL; hel = hel->next) { if (stringIn(hel->name, line)) doWeed = TRUE; } } else { dupe = cloneString(line); while ((word = nextWord(&line)) != NULL) { if (hashLookup(hash, word)) doWeed = TRUE; } line = dupe; } if (invert) doWeed = !doWeed; if (!doWeed) fprintf(f, "%s/n", line); else { if (fInvert != NULL) fprintf(fInvert, "%s/n", line); } freez(&dupe); }}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:50,
示例19: AllocVarstruct blastQuery *blastFileNextQuery(struct blastFile *bf)/* Read all alignments associated with next query. Return NULL at EOF. */{char *line;struct blastQuery *bq;struct blastGappedAli *bga;AllocVar(bq);verbose(TRACE_LEVEL, "blastFileNextQuery/n");/* find and parse Query= */line = bfSearchForLine(bf, "Query=");if (line == NULL) return NULL;parseQueryLines(bf, line, bq);/* find and parse Database: */line = bfSearchForLine(bf, "Database:");if (line == NULL) bfUnexpectedEof(bf);parseDatabaseLines(bf, line, bq);/* Seek to beginning of first gapped alignment. */for (;;) { line = bfNeedNextLine(bf); if (line[0] == '>') { lineFileReuse(bf->lf); break; } else if (isRoundLine(line)) parseRoundLine(line, bq); else if (stringIn("No hits found", line) != NULL) break; }/* Read in gapped alignments. */while ((bga = blastFileNextGapped(bf, bq)) != NULL) { slAddHead(&bq->gapped, bga); }slReverse(&bq->gapped);if (verboseLevel() >= DUMP_LEVEL) { verbose(DUMP_LEVEL, "blastFileNextQuery result:/n"); blastQueryPrint(bq, stderr); }return bq;}
开发者ID:blumroy,项目名称:kentUtils,代码行数:50,
示例20: replaceTextBetweenvoid replaceTextBetween(char *start, char *end, char *outerFile, char *middleFile)/* replaceTextBetween - Replaces a section of text in the middle of a file.. */{/* Read outer file into memory. */char *outer;size_t outerSize;readInGulp(outerFile, &outer, &outerSize);/* Figure out the boundaries of the region we want to replace. */char *s = stringIn(start, outer);if (s == NULL) errAbort("Can't find '%s' in %s", start, outerFile);char *e = stringIn(end, s);if (e == NULL) errAbort("Can't find '%s' in %s", end, outerFile);if (withEnds) { e += strlen(end); }else { s += strlen(start); }/* Read middle file into memory. */char *middle;size_t middleSize;readInGulp(middleFile, &middle, &middleSize);/* Write out file in three parts. */int startSize = s - outer;mustWrite(stdout, outer, startSize);mustWrite(stdout, middle, middleSize);int endSize = outer + outerSize - e;mustWrite(stdout, e, endSize);}
开发者ID:sktu,项目名称:kentUtils,代码行数:37,
示例21: loadPslsFromDatabasevoid loadPslsFromDatabase(struct sqlConnection *conn, char *db, char *chrom) /** Load all of the desired alignments into the chromkeeper structure from the desired pslTables. */{int i = 0;struct sqlResult *sr = NULL;char **row = NULL;int rowOffset = 0;struct psl *pslList = NULL, *psl = NULL;for(i = 0; i < numDbTables; i++) { sr = hChromQuery(conn, dbTables[i], chrom, NULL, &rowOffset); while((row = sqlNextRow(sr)) != NULL) { psl = pslLoad(row+rowOffset); slAddHead(&pslList, psl); minPslStart = min(psl->tStart, minPslStart); maxPslEnd = max(psl->tEnd, maxPslEnd); /* This just adds the mrna twice to the list, cheat way to add more weight to certain tables. */ if(weightMrna && (stringIn("refSeqAli", dbTables[i]) || stringIn("mrna", dbTables[i]))) { psl = clonePsl(psl); slAddHead(&pslList, psl); } } sqlFreeResult(&sr); }chromPslBin = binKeeperNew(minPslStart, maxPslEnd);agxSeenBin = binKeeperNew(minPslStart, maxPslEnd);for(psl = pslList; psl != NULL; psl = psl->next) { binKeeperAdd(chromPslBin, psl->tStart, psl->tEnd, psl); }}
开发者ID:apmagalhaes,项目名称:kentUtils,代码行数:36,
示例22: handleCIDstatic void handleCID(char **html, char *ctMain)/* Handle CID replacements if needed */{if (optionExists("cid") && ctMain && sameWord(ctMain,"text/html")) { struct hashEl *el, *list = hashElListHash(cidHash); for(el=list;el;el=el->next) { char *cid=addSuffix("cid:",el->name); if (stringIn(cid,*html)) { char *new = replaceChars(*html, cid, el->val); freez(html); *html = new; } freez(&cid); // support for content-location if (stringIn(el->name,*html)) { char *new = replaceChars(*html, el->name, el->val); freez(html); *html = new; } }
开发者ID:blumroy,项目名称:kentUtils,代码行数:24,
示例23: stringInchar *qaStringBetween(char *text, char *startPattern, char *endPattern)/* Return text that occurs between startPattern and endPattern, * or NULL if no startPattern. (Will return up to 100 characters * after startPattern if there is no endPattern) */{char *startMid = stringIn(startPattern, text);if (startMid != NULL) { char *endMid; int midSize; startMid += strlen(startPattern); endMid = stringIn(startMid, endPattern); if (endMid == NULL) { midSize = strlen(startMid); if (midSize > 100) midSize = 100; } else midSize = endMid - startMid; return cloneStringZ(startMid, midSize); }return NULL;}
开发者ID:kenongit,项目名称:sequencing,代码行数:24,
示例24: testColInfovoid testColInfo(struct htmlPage *dbPage, char *org, char *db, char *col) /* Click on all colInfo columns. */{struct htmlPage *infoPage = quickSubmit(dbPage, NULL, org, db, col, NULL, "colInfo", colInfoVarName, col);if (infoPage != NULL) { if (stringIn("No additional info available", infoPage->htmlText)) qaStatusSoftError(nearTestList->status, "%s failed - no %s.html?", colInfoVarName, col); }quickErrReport();htmlPageFree(&infoPage);}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:15,
示例25: readFixedLengthStringFromBufferQString readFixedLengthStringFromBuffer(const void *buffer, size_t bufferSize, size_t pos, uint length, QTextCodec *codec){ if(codec == NULL) { throw std::runtime_error("Codec is NULL"); } QScopedArrayPointer<quint8> stringIn( new quint8[static_cast<size_t>(length)]); if((pos + static_cast<size_t>(length)) <= bufferSize) { size_t last = pos + static_cast<size_t>(length); size_t strPtr = static_cast<size_t>(0); for(size_t ptr = pos; ptr < last; ptr++) { stringIn[strPtr] = (reinterpret_cast<const quint8 *>(buffer))[ptr]; strPtr++; } } else { size_t last = bufferSize; size_t strPtr = static_cast<size_t>(0); for(size_t ptr = pos; ptr < last; ptr++) { stringIn[strPtr] = (reinterpret_cast<const quint8 *>(buffer))[ptr]; strPtr++; } for(size_t ptr = strPtr; ptr < static_cast<size_t>(length); ptr++) { stringIn[ptr] = 0; } } uint stringLength = qstrnlen( reinterpret_cast<char *> (stringIn.data()), length); QScopedPointer<QTextDecoder> decoder(codec->makeDecoder()); if (decoder.isNull()) { throw std::runtime_error("Unable to create text decoder"); } return decoder->toUnicode( reinterpret_cast<const char *> (stringIn.data()), static_cast<int> (stringLength));}
开发者ID:rel-eng,项目名称:QWinHelp,代码行数:47,
注:本文中的stringIn函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ stringLength函数代码示例 C++ string2ll函数代码示例 |