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"); }
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"); }
void Module::toJsonBuffer(OutBuffer *buf) { buf->writestring("{\n"); if (md) JsonProperty(buf, Pname, md->toChars()); JsonProperty(buf, Pkind, kind()); JsonProperty(buf, Pfile, srcfile->toChars()); if (comment) JsonProperty(buf, Pcomment, (const char *)comment); 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"); }
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"); }
void AttribDeclaration::toJsonBuffer(OutBuffer *buf) { //printf("AttribDeclaration::toJsonBuffer()\n"); Array *d = include(NULL, NULL); if (d) { for (unsigned i = 0; i < d->dim; i++) { Dsymbol *s = (Dsymbol *)d->data[i]; //printf("AttribDeclaration::toJsonBuffer %s\n", s->toChars()); s->toJsonBuffer(buf); } } }
void AttribDeclaration::toJsonBuffer(OutBuffer *buf) { //printf("AttribDeclaration::toJsonBuffer()\n"); Array *d = include(NULL, NULL); if (d) { size_t offset = buf->offset; for (unsigned i = 0; i < d->dim; i++) { Dsymbol *s = (Dsymbol *)d->data[i]; //printf("AttribDeclaration::toJsonBuffer %s\n", s->toChars()); if (offset != buf->offset) { buf->writestring(",\n"); offset = buf->offset; } s->toJsonBuffer(buf); } JsonRemoveComma(buf); } }