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


C++ Dsymbol::toJsonBuffer方法代码示例

本文整理汇总了C++中Dsymbol::toJsonBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ Dsymbol::toJsonBuffer方法的具体用法?C++ Dsymbol::toJsonBuffer怎么用?C++ Dsymbol::toJsonBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dsymbol的用法示例。


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

示例1: toJsonBuffer

void EnumDeclaration::toJsonBuffer(OutBuffer *buf)
{
    //printf("EnumDeclaration::toJsonBuffer()\n");
    if (isAnonymous())
    {
        if (members)
        {
            for (size_t i = 0; i < members->dim; i++)
            {
                Dsymbol *s = (*members)[i];
                s->toJsonBuffer(buf);
                buf->writestring(",\n");
            }
            JsonRemoveComma(buf);
        }
        return;
    }

    buf->writestring("{\n");

    JsonProperty(buf, Pname, toChars());
    JsonProperty(buf, Pkind, kind());

    if (prot())
        JsonProperty(buf, Pprotection, Pprotectionnames[prot()]);

    if (comment)
        JsonProperty(buf, Pcomment, (const char *)comment);

    if (loc.linnum)
        JsonProperty(buf, Pline, loc.linnum);

    if (memtype)
        JsonProperty(buf, "base", memtype->toChars());

    if (members)
    {
        JsonString(buf, Pmembers);
        buf->writestring(" : [\n");
        size_t offset = buf->offset;
        for (size_t i = 0; i < members->dim; i++)
        {   Dsymbol *s = (*members)[i];
            if (offset != buf->offset)
            {   buf->writestring(",\n");
                offset = buf->offset;
            }
            s->toJsonBuffer(buf);
        }
        JsonRemoveComma(buf);
        buf->writestring("]\n");
    }
    JsonRemoveComma(buf);

    buf->writestring("}\n");
}
开发者ID:MartinNowak,项目名称:GDC,代码行数:55,代码来源:json.c

示例2: toJsonBuffer

void TemplateDeclaration::toJsonBuffer(OutBuffer *buf)
{
    //printf("TemplateDeclaration::toJsonBuffer()\n");

    buf->writestring("{\n");

    JsonProperty(buf, Pname, toChars());
    JsonProperty(buf, Pkind, kind());
    if (comment)
	JsonProperty(buf, Pcomment, (const char *)comment);

    if (loc.linnum)
	JsonProperty(buf, Pline, loc.linnum);

    JsonString(buf, Pmembers);
    buf->writestring(" : [\n");
    size_t offset = buf->offset;
    for (int i = 0; i < members->dim; i++)
    {	Dsymbol *s = (Dsymbol *)members->data[i];
	if (offset != buf->offset)
	{   buf->writestring(",\n");
	    offset = buf->offset;
	}
	s->toJsonBuffer(buf);
    }
    JsonRemoveComma(buf);
    buf->writestring("]\n");

    buf->writestring("}\n");
}
开发者ID:Geod24,项目名称:dnet,代码行数:30,代码来源:json.c

示例3: toJsonBuffer

void AggregateDeclaration::toJsonBuffer(OutBuffer *buf)
{
    //printf("AggregateDeclaration::toJsonBuffer()\n");
    buf->writestring("{\n");

    JsonProperty(buf, Pname, toChars());
    JsonProperty(buf, Pkind, kind());
    if (comment)
        JsonProperty(buf, Pcomment, (const char *)comment);
    if (loc.linnum)
        JsonProperty(buf, Pline, loc.linnum);

    ClassDeclaration *cd = isClassDeclaration();
    if (cd)
    {
        if (cd->baseClass)
        {
            JsonProperty(buf, "base", cd->baseClass->toChars());
        }
        if (cd->interfaces_dim)
        {
            JsonString(buf, "interfaces");
            buf->writestring(" : [\n");
            size_t offset = buf->offset;
            for (int i = 0; i < cd->interfaces_dim; i++)
            {   BaseClass *b = cd->interfaces[i];
                if (offset != buf->offset)
                {   buf->writestring(",\n");
                    offset = buf->offset;
                }
                JsonString(buf, b->base->toChars());
            }
            JsonRemoveComma(buf);
            buf->writestring("],\n");
        }
    }

    if (members)
    {
        JsonString(buf, Pmembers);
        buf->writestring(" : [\n");
        size_t offset = buf->offset;
        for (int i = 0; i < members->dim; i++)
        {   Dsymbol *s = (Dsymbol *)members->data[i];
            if (offset != buf->offset)
            {   buf->writestring(",\n");
                offset = buf->offset;
            }
            s->toJsonBuffer(buf);
        }
        JsonRemoveComma(buf);
        buf->writestring("]\n");
    }
    JsonRemoveComma(buf);

    buf->writestring("}\n");
}
开发者ID:gr0v3r,项目名称:dmd,代码行数:57,代码来源:json.c


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