本文整理汇总了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");
}
示例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");
}
示例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");
}