本文整理汇总了C++中dyStringCannibalize函数的典型用法代码示例。如果您正苦于以下问题:C++ dyStringCannibalize函数的具体用法?C++ dyStringCannibalize怎么用?C++ dyStringCannibalize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dyStringCannibalize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: countAlias
char *aliasString(char *id, struct sqlConnection *conn)
/* return alias string as it would be printed in html, can free after use */
{
char query[256];
struct sqlResult *sr = NULL;
char **row;
int totalCount;
int cnt = 0;
totalCount = countAlias(id,conn);
if (totalCount > 0)
{
struct dyString *aliasReturn = dyStringNew(0);
dyStringPrintf(aliasReturn, "<B>Alternate Gene Symbols:</B> ");
safef(query, sizeof(query), "select alias from kgAlias where kgId = '%s' order by alias", id);
sr = sqlGetResult(conn, query);
row = sqlNextRow(sr);
while (cnt < totalCount)
{
/* skip kgId and the maint gene symbol (curGeneName) */
if ((!sameWord(id, row[0])) && (!sameWord(row[0], curGeneName)))
{
dyStringPrintf(aliasReturn, "%s", row[0]);
if (cnt < (totalCount-1)) dyStringPrintf(aliasReturn, ", ");
cnt++;
}
row = sqlNextRow(sr);
}
dyStringPrintf(aliasReturn, "<BR>");
sqlFreeResult(&sr);
return dyStringCannibalize(&aliasReturn);
}
return NULL;
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:34,代码来源:synonym.c
示例2: dyStringNew
char *getDescription(struct hash *ra,char *alternateSetting)
// Returns allocated string that is description. Will include DEPRECATED if appropriate
{
struct dyString *dyDescription = dyStringNew(256);
char *deprecated = hashFindVal(ra, "deprecated");
if (deprecated != NULL)
dyStringPrintf(dyDescription,"DEPRECATED - %s",deprecated);
char *description = hashFindVal(ra, CV_DESCRIPTION);
if (description == NULL && alternateSetting != NULL)
description = hashFindVal(ra, alternateSetting);
if (description == NULL)
description = hashFindVal(ra, CV_TITLE);
if (description == NULL)
description = hashFindVal(ra, CV_LABEL);
if (description != NULL)
{
if (dyStringLen(dyDescription) > 0)
dyStringAppend(dyDescription,"<BR>");
dyStringAppend(dyDescription,description);
}
if (dyStringLen(dyDescription) > 0)
return dyStringCannibalize(&dyDescription);
dyStringFree(&dyDescription);
return NULL;
}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:25,代码来源:hgEncodeVocab.c
示例3: regcomp
char *replaceRegEx(char *str, char *replace, char *regEx, int flags)
{
/* Replace text matching regEx in str with replace string.
flags is passed through to regcomp as the cflags argument.
Returned string should be free'ed after use. */
regex_t re;
regmatch_t match[1];
int err = regcomp(&re, regEx, flags);
if(err)
errAbort("regcomp failed; err: %d", err);
struct dyString *dy = newDyString(0);
size_t len = strlen(str);
size_t offset = 0;
while(offset < len && !regexec(&re, str + offset, 1, match, 0))
{
dyStringAppendN(dy, str + offset, match[0].rm_so);
if(replace != NULL)
dyStringAppend(dy, replace);
offset += match[0].rm_eo;
}
if(offset < len)
{
dyStringAppend(dy, str + offset);
}
regfree(&re);
return dyStringCannibalize(&dy);
}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:27,代码来源:jsHelper.c
示例4: hashNumEntries
char *identifierWhereClause(char *idField, struct hash *idHash)
/* If the number of pasted IDs is reasonably low, return a where-clause component for the IDs. */
{
if (idHash == NULL || idField == NULL)
return NULL;
int numIds = hashNumEntries(idHash);
int maxIdsInWhere = cartUsualInt(cart, "hgt_maxIdsInWhere", DEFAULT_MAX_IDS_IN_WHERE);
if (numIds > 0 && numIds <= maxIdsInWhere)
{
struct dyString *dy = dyStringNew(16 * numIds);
dyStringPrintf(dy, "%s in (", idField);
struct hashCookie hc = hashFirst(idHash);
boolean first = TRUE;
char *id;
while ((id = hashNextName(&hc)) != NULL)
{
if (first)
first = FALSE;
else
dyStringAppend(dy, ", ");
dyStringPrintf(dy, "'%s'", id);
}
dyStringAppend(dy, ")");
return dyStringCannibalize(&dy);
}
return NULL;
}
开发者ID:maximilianh,项目名称:kent,代码行数:27,代码来源:identifiers.c
示例5: mdbSelectsAddFoundComposites
static boolean mdbSelectsAddFoundComposites(struct slPair **pMdbSelects,struct trackDb *tdbsFound)
// Adds a composite mdbSelect (if found in tdbsFound) to the head of the pairs list.
// If tdbsFound is NULL, then add dummy composite search criteria
{
// create comma separated list of composites
struct dyString *dyComposites = dyStringNew(256);
struct trackDb *tdb = tdbsFound;
for (;tdb != NULL; tdb = tdb->next)
{
if (tdbIsComposite(tdb))
dyStringPrintf(dyComposites,"%s,",tdb->track);
else if (tdbIsCompositeChild(tdb))
{
struct trackDb *composite = tdbGetComposite(tdb);
dyStringPrintf(dyComposites,"%s,",composite->track);
}
}
if (dyStringLen(dyComposites) > 0)
{
char *composites = dyStringCannibalize(&dyComposites);
composites[strlen(composites) - 1] = '\0'; // drop the last ','
slPairAdd(pMdbSelects,MDB_VAR_COMPOSITE,composites);
// Composite should not already be in the list, because it is only indirectly sortable
return TRUE;
}
//warn("No composites found");
dyStringFree(&dyComposites);
return FALSE;
}
开发者ID:maximilianh,项目名称:kent,代码行数:30,代码来源:hgFileSearch.c
示例6: dyStringNew
static char *gvfItemName(struct track *tg, void *item)
/* ISCA requested that we append abbreviated variant origin to the item names. */
{
struct bed8Attrs *gvf = item;
struct dyString *name = dyStringNew(0);
int ix = stringArrayIx("var_origin", gvf->attrTags, gvf->attrCount);
if (ix >= 0)
{
char *origin = gvf->attrVals[ix];
if (sameWord(origin, "Not tested") || sameWord(origin, "Not reported") ||
sameWord(origin, "Tested - inconclusive") || sameWord(origin, "Not Provided"))
dyStringPrintf(name, "%s_unk", gvf->name);
else if (sameWord(origin, "De novo"))
dyStringPrintf(name, "%s_dnovo", gvf->name);
else if (sameWord(origin, "Maternal"))
dyStringPrintf(name, "%s_mat", gvf->name);
else if (sameWord(origin, "Paternal"))
dyStringPrintf(name, "%s_pat", gvf->name);
else if (sameWord(origin, "Biparental"))
dyStringPrintf(name, "%s_bip", gvf->name);
else if (sameWord(origin, "Uniparental"))
dyStringPrintf(name, "%s_unip", gvf->name);
else if (sameWord(origin, "Germline"))
dyStringPrintf(name, "%s_germ", gvf->name);
else if (sameWord(origin, "Somatic"))
dyStringPrintf(name, "%s_som", gvf->name);
else
dyStringPrintf(name, "%s_%s", gvf->name, origin);
}
else
dyStringPrintf(name, "%s_unk", gvf->name);
return dyStringCannibalize(&name);
}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:33,代码来源:gvfTrack.c
示例7: strlen
char *menuBarAddUiVars(char *oldString, char *cgiPrefix, char *uiVars)
/* Look for CGI program calls in oldString, and add session vars hgsid to them */
{
int len = strlen(oldString);
char buf[4096];
/* Create a regular expression and compile it */
regex_t re;
regmatch_t match[2];
safef(buf, sizeof(buf), "%s[A-Za-z]+(%c%c?)", cgiPrefix, '\\', '?');
int err = regcomp(&re, buf, REG_EXTENDED);
if(err)
errAbort("regcomp failed; err: %d", err);
/* Search through oldString with regex, and build up new string in dy */
struct dyString *dy = newDyString(0);
int offset;
for(offset = 0; offset < len && !regexec(&re, oldString + offset, ArraySize(match), match, 0);
offset += match[0].rm_eo)
{
dyStringAppendN(dy, oldString + offset, match[0].rm_eo);
if(match[1].rm_so == match[1].rm_eo)
dyStringAppend(dy, "?");
dyStringAppend(dy, uiVars);
if(match[1].rm_so != match[1].rm_eo)
dyStringAppend(dy, "&");
}
if(offset < len)
dyStringAppend(dy, oldString + offset);
return dyStringCannibalize(&dy);
}
开发者ID:ucsc-mus-strain-cactus,项目名称:kent,代码行数:31,代码来源:web.c
示例8: dyStringNew
static char *getPartPslFile(char *outDir, int partNum)
/* compute the name for the partition psl file, creating directories.
* freeMem result */
{
struct dyString *partPath = dyStringNew(128);
char partStr[64];
int i, partStrLen;
/* part number, with leading zeros */
safef(partStr, sizeof(partStr), "%0*d", gOutLevels, partNum);
partStrLen = strlen(partStr);
dyStringAppend(partPath, outDir);
makeDir(partPath->string);
/* create with multiple levels of directories, with least-signficant part of
* number being lowest directory */
for (i = 0; i < gOutLevels; i++)
{
dyStringAppendC(partPath, '/');
dyStringAppendC(partPath, partStr[(partStrLen-gOutLevels)+i]);
makeDir(partPath->string);
}
dyStringAppendC(partPath, '/');
dyStringAppend(partPath, partStr);
dyStringAppend(partPath, ".psl");
return dyStringCannibalize(&partPath);
}
开发者ID:Nicholas-NVS,项目名称:kentUtils,代码行数:29,代码来源:pslPartition.c
示例9: addExtras
static void addExtras(char *extraFile, struct trackHubCheckOptions *checkOptions)
/* Add settings from extra file (e.g. for specific hub display site) */
{
verbose(2, "Accepting extra settings in '%s'\n", extraFile);
checkOptions->extraFile = extraFile;
checkOptions->extra = hashNew(0);
struct lineFile *lf = NULL;
if (startsWith("http", extraFile))
{
struct dyString *ds = netSlurpUrl(extraFile);
char *s = dyStringCannibalize(&ds);
lf = lineFileOnString(extraFile, TRUE, s);
}
else
{
lf = lineFileOpen(extraFile, TRUE);
}
char *line;
while (lineFileNextReal(lf, &line))
{
hashAdd(checkOptions->extra, line, NULL);
}
lineFileClose(&lf);
verbose(3, "Found %d extra settings\n", hashNumEntries(checkOptions->extra));
}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:25,代码来源:hubCheck.c
示例10: dsAssertToken
char *dsPrintCannibalizeAndClose(int token)
// Closes the top stack buffer returning content. Returned string should be freed.
{
dsAssertToken(token);
struct dyString *ds = slPopHead(&dsStack);
return dyStringCannibalize(&ds);
}
开发者ID:JinfengChen,项目名称:pblat,代码行数:7,代码来源:dsPrint.c
示例11: getItemLabel
static void getItemLabel(struct sqlConnection *conn,
char *retroInfoTbl,
unsigned labelSet,
struct linkedFeatures *lf)
/* get label for a retro item */
{
struct ucscRetroInfo *info = NULL;
info = ucscRetroInfoQuery(conn, retroInfoTbl, lf->name);
char *geneSymbol = getRetroParentSymbol(info, lf->name);
//lf->extra = geneSymbol;
struct dyString *label = dyStringNew(64);
dyStringAppend(label, "retro-");
if ((labelSet & useGene) && (retroInfoTbl != NULL))
{
if ((geneSymbol != NULL) && (strlen(geneSymbol) > 0))
dyStringAppend(label, geneSymbol);
else
labelSet |= useAcc; // no gene, so force acc
}
/* if both accession and gene are selected, add to item label */
if (labelSet & useAcc)
{
if (labelSet & useGene)
{
dyStringAppend(label, "/");
dyStringAppend(label, lf->name);
}
else
dyStringAppend(label, lf->name);
}
ucscRetroInfoFree(&info);
lf->extra = dyStringCannibalize(&label);
}
开发者ID:maximilianh,项目名称:kent,代码行数:33,代码来源:retroGene.c
示例12: dyStringNew
char *bamGetCigar(const bam1_t *bam)
/* Return a BAM-enhanced CIGAR string, decoded from the packed encoding in bam. */
{
const bam1_core_t *core = &bam->core;
struct dyString *dyCigar = dyStringNew(min(8, core->n_cigar*4));
bamUnpackCigar(bam, dyCigar);
return dyStringCannibalize(&dyCigar);
}
开发者ID:avilella,项目名称:methylQA,代码行数:8,代码来源:bamFile.c
示例13: cloneString
char *userRegionsParse(char *db, char *regionsText, int maxRegions, int maxErrs,
int *retRegionCount, char **retWarnText)
/* Parse user regions entered as BED3, BED4 or chr:start-end optionally followed by name.
* Return name of trash file containing BED for parsed regions if regionsText contains
* valid regions; otherwise NULL.
* If maxRegions <= 0, it is ignored; likewise for maxErrs.
* If retRegionCount is non-NULL, it will be set to the number of valid parsed regions
* in the trash file.
* If retWarnText is non-NULL, it will be set to a string containing warning and error
* messages encountered while parsing input. */
{
char *trashFileName = NULL;
if (isNotEmpty(regionsText))
{
char *copy = cloneString(regionsText);
struct dyString *dyWarn = dyStringNew(0);
struct bed4 *bedList = parseRegionInput(db, copy, maxRegions, maxErrs, dyWarn);
if (retWarnText != NULL)
{
if (dyWarn->stringSize > 0)
*retWarnText = dyStringCannibalize(&dyWarn);
else
{
*retWarnText = NULL;
dyStringFree(&dyWarn);
}
}
int regionCount = slCount(bedList);
if (retRegionCount != NULL)
*retRegionCount = regionCount;
if (regionCount > 0)
{
struct tempName tn;
trashDirFile(&tn, "hgtData", "user", ".region");
trashFileName = cloneString(tn.forCgi);
FILE *f = mustOpen(trashFileName, "w");
struct bed4 *bed;
for (bed = bedList; bed; bed = bed->next )
{
char *name = bed->name ? bed->name : "";
fprintf(f, "%s\t%d\t%d\t%s\n",
bed->chrom, bed->chromStart, bed->chromEnd, name);
}
carefulClose(&f);
}
freeMem(copy);
}
else
{
if (retRegionCount != NULL)
*retRegionCount = 0;
if (retWarnText != NULL)
*retWarnText = NULL;
}
return trashFileName;
}
开发者ID:davidhoover,项目名称:kent,代码行数:57,代码来源:userRegions.c
示例14: dyStringNew
char *createCtgInfoKey(char *acc, int start, int end)
/* Create a unique hash key for a ctgInfo using the contig accession and the
scaffold start and end positions */
{
struct dyString *dy = dyStringNew(256);
dyStringPrintf(dy, "%s_%d_%d", acc, start, end);
return dyStringCannibalize(&dy);
}
开发者ID:davidhoover,项目名称:kent,代码行数:9,代码来源:agpAddCtgNamesAndGaps.c
示例15: bedSqlFieldsExceptForChrom
void bedSqlFieldsExceptForChrom(struct hTableInfo *hti,
int *retFieldCount, char **retFields)
/* Given tableInfo figure out what fields are needed to
* add to a database query to have information to create
* a bed. The chromosome is not one of these fields - we
* assume that is already known since we're processing one
* chromosome at a time. Return a comma separated (no last
* comma) list of fields that can be freeMem'd, and the count
* of fields (this *including* the chromosome). */
{
struct dyString *fields = dyStringNew(128);
int fieldCount = fieldCount = hTableInfoBedFieldCount(hti);
dyStringPrintf(fields, "%s,%s", hti->startField, hti->endField);
if (fieldCount >= 4)
{
if (hti->nameField[0] != 0)
dyStringPrintf(fields, ",%s", hti->nameField);
else /* Put in . as placeholder. */
dyStringPrintf(fields, ",'.'");
}
if (fieldCount >= 5)
{
if (hti->scoreField[0] != 0)
dyStringPrintf(fields, ",%s", hti->scoreField);
else
dyStringPrintf(fields, ",0", hti->startField);
}
if (fieldCount >= 6)
{
if (hti->strandField[0] != 0)
dyStringPrintf(fields, ",%s", hti->strandField);
else
dyStringPrintf(fields, ",'.'");
}
if (fieldCount >= 8)
{
if (hti->cdsStartField[0] != 0)
dyStringPrintf(fields, ",%s,%s", hti->cdsStartField, hti->cdsEndField);
else
dyStringPrintf(fields, ",%s,%s", hti->startField, hti->endField);
}
if (fieldCount >= 12)
{
dyStringPrintf(fields, ",%s,%s,%s", hti->countField,
hti->endsSizesField, hti->startsField);
}
if (htiIsPsl(hti))
{
/* For psl format we need to know chrom size as well
* to handle reverse strand case. */
dyStringPrintf(fields, ",tSize");
}
*retFieldCount = fieldCount;
*retFields = dyStringCannibalize(&fields);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:56,代码来源:testIntersect.c
示例16: newDyString
char *sqlShortArrayToString( short *array, int arraySize)
{
int i;
struct dyString *string = newDyString(256);
for( i = 0 ; i < arraySize; i++ )
{
dyStringPrintf(string, "%d,", array[i]);
}
return dyStringCannibalize(&string);
}
开发者ID:blumroy,项目名称:kentUtils,代码行数:10,代码来源:sqlList.c
示例17: printGenomeList
static void printGenomeList(struct slName *genomes)
/* print supported assembly names from sl list */
{
/* List of associated genomes. */
struct dyString *dy = newDyString(100);
for(; genomes; genomes = genomes->next)
dyStringPrintf(dy,"%s, ", trackHubSkipHubName(genomes->name));
ourPrintCell(removeLastComma( dyStringCannibalize(&dy)));
}
开发者ID:bowhan,项目名称:kent,代码行数:10,代码来源:hgHubConnect.c
示例18: dyStringNew
char *lineFileReadAll(struct lineFile *lf)
/* Read remainder of lineFile and return it as a string. */
{
struct dyString *dy = dyStringNew(1024*4);
lf->zTerm = 0;
int size;
char *line;
while (lineFileNext(lf, &line, &size))
dyStringAppendN(dy, line, size);
return dyStringCannibalize(&dy);
}
开发者ID:bh0085,项目名称:kent,代码行数:11,代码来源:linefile.c
示例19: pf_lineIn
void pf_lineIn(_pf_Stack *stack)
/* Get next line of input from stdin. In general
* you do not want to mix calls to keyIn and lineIn,
* since keyIn is unbuffered and lineIn is buffered.
* Returns nil at EOF. */
{
char buf[256];
int i, c;
FILE *f = stdin;
for (i=0; i<sizeof(buf)-1; ++i)
{
c = fgetc(f);
if (c < 0)
{
if (i == 0)
stack[0].String = NULL;
else
{
buf[i] = 0;
stack[0].String = _pf_string_from_const(buf);
}
return;
}
buf[i] = c;
if (c == '\n')
{
buf[i] = 0;
stack[0].String = _pf_string_dupe(buf, i);
return;
}
}
/* Well, looks like it's a pretty long string!
* Let's convert to dyString based capture rather
* than using the fixed size buffer on stack. */
{
struct dyString *dy = dyStringNew(512);
struct _pf_string *string;
dyStringAppendN(dy, buf, i);
for (;;)
{
c = fgetc(f);
if (c < 0)
break;
dyStringAppendC(dy, c);
if (c == '\n')
break;
}
string = _pf_string_new(dy->string, dy->bufSize);
string->size = dy->stringSize;
dyStringCannibalize(&dy);
stack[0].String = string;
}
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:53,代码来源:argsEnv.c
示例20: joinCmd
static char* joinCmd(char **cmd)
/* join an cmd vector into a space separated string */
{
struct dyString *str = dyStringNew(512);
int i;
for (i = 0; cmd[i] != NULL; i++)
{
if (i > 0)
dyStringAppend(str, " ");
dyStringAppend(str, cmd[i]);
}
return dyStringCannibalize(&str);
}
开发者ID:kenongit,项目名称:sequencing,代码行数:13,代码来源:pipeline.c
注:本文中的dyStringCannibalize函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论