当前位置: 首页>>代码示例>>C++>>正文


C++ dyStringAppend函数代码示例

本文整理汇总了C++中dyStringAppend函数的典型用法代码示例。如果您正苦于以下问题:C++ dyStringAppend函数的具体用法?C++ dyStringAppend怎么用?C++ dyStringAppend使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dyStringAppend函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: addClusterMapItem

void addClusterMapItem(struct hacTree *ht, int x1, int y1, int x2, int y2, struct titleHelper *helper)
/* If using imageV2, add mouseover text (no link) with info about this cluster. */
{
if (theImgBox && curImgTrack)
    {
    struct dyString *dy = dyStringNew(0);
    struct hapCluster *c = (struct hapCluster *)ht->itemOrCluster;
    dyStringPrintf(dy, "N=%d ", c->leafCount);
    while (dyStringLen(dy) < 7)
	dyStringAppendC(dy, ' ');
    if (helper->startIx > 0)
	dyStringAppend(dy, "...");
    int i, nHapsForClustering = helper->endIx - helper->startIx;
    for (i=0;  i < nHapsForClustering;  i++)
	{
	boolean isCenter = (helper->startIx+i == helper->centerIx);
	char *allele = isRef(c, i) ? helper->refs[i] : helper->alts[i];
	if (isCenter)
	    dyStringAppendC(dy, '[');
	int altCount = c->leafCount - c->refCounts[i] - c->unkCounts[i];
	if (c->refCounts[i] > 0 && altCount > 0)
	    dyStringAppendC(dy, '*');
	else if (strlen(allele) == 1)
	    dyStringAppendC(dy, allele[0]);
	else
	    dyStringPrintf(dy, "(%s)", allele);
	if (isCenter)
	    dyStringAppendC(dy, ']');
	}
    if (helper->endIx < helper->nRecords)
	dyStringAppend(dy, "...");
    imgTrackAddMapItem(curImgTrack, TITLE_BUT_NO_LINK, dy->string,
		       x1, y1, x2, y2, helper->track);
    }
}
开发者ID:maximilianh,项目名称:kent,代码行数:35,代码来源:vcfTrack.c

示例2: mapBoxForCenterVariant

void mapBoxForCenterVariant(struct vcfRecord *rec, struct hvGfx *hvg, struct track *tg,
			    int xOff, int yOff, int width)
/* Special mouseover for center variant */
{
struct dyString *dy = dyStringNew(0);
unsigned int chromStartMap = vcfRecordTrimIndelLeftBase(rec);
unsigned int chromEndMap = vcfRecordTrimAllelesRight(rec);
gtSummaryString(rec, dy);
dyStringAppend(dy, "   Haplotypes sorted on ");
char *centerChrom = cartOptionalStringClosestToHome(cart, tg->tdb, FALSE, "centerVariantChrom");
if (centerChrom == NULL || !sameString(chromName, centerChrom))
    dyStringAppend(dy, "middle variant by default. ");
else
    dyStringAppend(dy, "this variant. ");
dyStringAppend(dy, "To anchor sorting to a different variant, click on that variant and "
	       "then click on the 'Use this variant' button below the variant name.");
const double scale = scaleForPixels(width);
int x1 = round((double)(rec->chromStart-winStart)*scale) + xOff;
int x2 = round((double)(rec->chromEnd-winStart)*scale) + xOff;
int w = x2-x1;
if (w <= 1)
    {
    x1--;
    w = 3;
    }
mapBoxHgcOrHgGene(hvg, chromStartMap, chromEndMap, x1, yOff, w, tg->height, tg->track,
		  rec->name, dy->string, NULL, TRUE, NULL);
}
开发者ID:maximilianh,项目名称:kent,代码行数:28,代码来源:vcfTrack.c

示例3: 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

示例4: 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

示例5: appendMimeTerminus

static void appendMimeTerminus(struct dyString *dy, char *boundary)
/* Append MIME boundary terminator to dy. */
{
dyStringAppend(dy, "\r\n--");
dyStringAppend(dy, boundary);
dyStringAppend(dy, "--\r\n");
}
开发者ID:elmargb,项目名称:kentUtils,代码行数:7,代码来源:htmlPage.c

示例6: writeGap

void writeGap(struct dyString *aRes, int aGap, char *aSeq, struct dyString *bRes, int bGap, char *bSeq)
/* Write double - gap.  Something like:
 *     ....123.... or --c
 *     ...4123....    ag-  */

{
char abbrev[16];
int minToAbbreviate = 16;
if (doShort && (aGap >= minToAbbreviate || bGap >= minToAbbreviate))
    {
    fillShortGapString(abbrev, aGap, '.', 13);
    dyStringAppend(aRes, abbrev);
    fillShortGapString(abbrev, bGap, '.', 13);
    dyStringAppend(bRes, abbrev);
    }
else
    {
#ifdef OLD
    dyStringAppendMultiC(aRes, '-', aGap);
    dyStringAppendN(bRes, bSeq, aGap);
    dyStringAppendN(aRes, aSeq, bGap);
    dyStringAppendMultiC(bRes, '-', bGap);
#endif /* OLD */
    dyStringAppendMultiC(aRes, '-', bGap);
    dyStringAppendN(bRes, bSeq, bGap);
    dyStringAppendN(aRes, aSeq, aGap);
    dyStringAppendMultiC(bRes, '-', aGap);
    }
}
开发者ID:SHuang-Broad,项目名称:SnowTools,代码行数:29,代码来源:pslPretty.c

示例7: main

int main(int argc, char *argv[])
/* Process command line. */
{
optionInit(&argc, argv, options);
if (argc != 5)
    usage();
acceptString = optionVal("A", NULL);
if (acceptString)
    {
    acceptExtensionsCount = chopByChar(acceptString, ',', NULL, 0);
    AllocArray(acceptExtensions, acceptExtensionsCount);
    chopByChar(acceptString, ',', acceptExtensions, acceptExtensionsCount);
    verbose(1, "accept-option count: %d\n", acceptExtensionsCount);
    int i = 0;
    for(i=0; i<acceptExtensionsCount; ++i) 
	{
	verbose(2, "accept-option: %s\n", acceptExtensions[i]);
	}
    }
struct dyString *url = dyStringNew(4096);
struct dyString *outPath = dyStringNew(4096);
dyStringAppend(url, argv[3]);
dyStringAppend(outPath, argv[4]);
if (!paraSync(atoi(argv[1]), atoi(argv[2]), url, outPath, optionExists("newer"), optionExists("progress")))
    exit(1);
return 0;
}
开发者ID:blumroy,项目名称:kentUtils,代码行数:27,代码来源:paraSync.c

示例8: 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

示例9: doLog

void doLog()
{
FILE *logFileHandle = mustOpen("snpGetSeqDup.log", "w");
struct hashCookie cookie = hashFirst(uniqHash);
char *rsId = NULL;
int count = 0;
struct hashEl *hel = NULL;
char *fileName = NULL;
struct dyString *dy = newDyString(1024);

while ((rsId = hashNextName(&cookie)) != NULL)
    {
    count = 0;
    for (hel = hashLookup(snpHash, rsId); hel != NULL; hel = hashLookupNext(hel))
	count++;
    if (count == 1) continue;
    for (hel = hashLookup(snpHash, rsId); hel != NULL; hel = hashLookupNext(hel))
        {
	fileName = (char *)hel->val;
	dyStringAppend(dy, fileName);
	dyStringAppend(dy, " ");
	}
    fprintf(logFileHandle, "%s\t%s\n", rsId, dy->string);
    dyStringClear(dy);
    }

carefulClose(&logFileHandle);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:28,代码来源:snpGetSeqDup.c

示例10: xpLookup

static void xpLookup(struct xp *xp, struct dyString *temp, struct dyString *text)
/* Parse after '&' until ';' and look up symbol.  Put result into text. */
{
char c;
char *s;
dyStringClear(temp);
for (;;)
    {
    if ((c = xpGetChar(xp)) == 0)
	xpError(xp, "End of file in after & and before ;");
    if (isspace(c))
        xpError(xp, "& without ;");
    if (c == ';')
        break;
    dyStringAppendC(temp, c);
    }
s = temp->string;
if (s[0] == '#')
    {
    c = atoi(s+1);
    dyStringAppendC(text, c);
    }
else if ((s = hashFindVal(xp->symHash, s)) == NULL)
    {
    dyStringAppendC(text, '&');
    dyStringAppend(text, temp->string);
    dyStringAppendC(text, ';');
    }
else
    {
    dyStringAppend(text, s);
    }
}
开发者ID:JinfengChen,项目名称:pblat,代码行数:33,代码来源:xp.c

示例11: strstr

struct dyString *unrepFileName(char *fileName, boolean isSingle)
/* Return string with Rep# in fileName replaced with "Merged" */
{
char *s = strstr(fileName, "Rep");
struct dyString *dy = dyStringNew(0);
if (s == NULL)
    {
    if (isSingle)
        dyStringAppend(dy, fileName);
    else
        errAbort("No 'Rep' in fileName %s", fileName);
    }
else
    {
    char *pastRep = s + strlen("Rep");
    int digitCount = countLeadingDigits(pastRep);
    if (digitCount < 1)
        errAbort("No digits after 'Rep' in filename %s", fileName);
    pastRep += digitCount;
    dyStringAppendN(dy, fileName, s-fileName);
    dyStringAppend(dy, "Merged");
    int len = strlen(pastRep);
    if (!isSingle && endsWith(pastRep, ".gz"))
        len -= strlen(".gz");
    dyStringAppendN(dy, pastRep, len);
    }
return dy;
}
开发者ID:davidhoover,项目名称:kent,代码行数:28,代码来源:encodeMergeReplicatesBatch.c

示例12: 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

示例13: dyStringNew

static struct slName *getListFromCgapSageLibs(struct sqlConnection *conn, char *column, boolean returnIds, boolean distinct)
/* Return [unique] list of tissues sorted alphabetically. */
{
struct slName *list = NULL;
struct dyString *dy = dyStringNew(0);
char **row;
struct sqlResult *sr;
sqlDyStringPrintf(dy, "select ");
if (distinct)
    dyStringAppend(dy, "distinct ");
sqlDyStringPrintf(dy, "%s", column);
if (returnIds)
    dyStringAppend(dy, ",libId");
sqlDyStringPrintf(dy, " from cgapSageLib order by %s", column);
sr = sqlGetResult(conn, dy->string);
while ((row = sqlNextRow(sr)) != NULL)
    {
    char *word = (returnIds) ? row[1] : row[0];
    slNameAddHead(&list, word);
    }
slReverse(&list);
sqlFreeResult(&sr);
dyStringFree(&dy);
return list;
}
开发者ID:bowhan,项目名称:kent,代码行数:25,代码来源:cgapSageUi.c

示例14: lineFileOpen

struct dyString *readAndReplaceTableName(char *fileName, char *table)
/* Read file into string.  While doing so strip any leading comments
 * and insist that the first non-comment line contain the words
 * "create table" followed by a table name.  Replace the table name,
 * and copy the rest of the file verbatem. */
{
    struct lineFile *lf = lineFileOpen(fileName, TRUE);
    struct dyString *dy = dyStringNew(0);
    char *line, *word;
    if (!lineFileNextReal(lf, &line))
        errAbort("No real lines in %s\n", fileName);
    word = nextWord(&line);
    if (!sameWord(word, "create"))
        errAbort("Expecting first word in file to be CREATE. Got %s", word);
    word = nextWord(&line);
    if (word == NULL || !sameWord(word, "table"))
        errAbort("Expecting second word in file to be table. Got %s", emptyForNull(word));
    word = nextWord(&line);
    if (word == NULL)
        errAbort("Expecting table name on same line as CREATE TABLE");
    sqlDyStringPrintf(dy, "CREATE TABLE %s ", table);
    if (line != NULL)
        dyStringAppend(dy, line);
    dyStringAppendC(dy, '\n');
    while (lineFileNext(lf, &line, NULL))
    {
        dyStringAppend(dy, line);
        dyStringAppendC(dy, '\n');
    }
    lineFileClose(&lf);
    return dy;
}
开发者ID:sktu,项目名称:kentUtils,代码行数:32,代码来源:hgLoadSqlTab.c

示例15: gensatFixFull

void gensatFixFull(char *captionFile)
/* Fix missing captions. */
{
struct lineFile *lf = lineFileOpen(captionFile, TRUE);
char *row[2];
struct dyString *sql = dyStringNew(0);
struct sqlConnection *conn = sqlConnect(database);
struct hash *capHash = newHash(16);
while (lineFileRowTab(lf, row))
    {
    int captionId;
    char *submitId = row[0];
    char *caption = row[1];
    captionId = hashIntValDefault(capHash, caption, 0);
    if (captionId == 0)
        {
	dyStringClear(sql);
	dyStringAppend(sql, "insert into caption values(default, \"");
	dyStringAppend(sql, caption);
	dyStringAppend(sql, "\")");
	sqlUpdate(conn, sql->string);
	verbose(1, "%s\n", sql->string);
	captionId = sqlLastAutoId(conn);
	hashAddInt(capHash, caption, captionId);
	}
    dyStringClear(sql);
    dyStringPrintf(sql, "update imageFile set caption=%d ", captionId);
    dyStringPrintf(sql, "where submissionSet=%d ", gensatId);
    dyStringPrintf(sql, "and submitId = \"%s\"", submitId);
    sqlUpdate(conn, sql->string);
    verbose(1, "%s\n", sql->string);
    }
dyStringFree(&sql);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:34,代码来源:gensatFixFull.c


注:本文中的dyStringAppend函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。