#include "TRootSnifferStore.h"
TRootSnifferStore::TRootSnifferStore() :
TObject(),
fResPtr(0),
fResClass(0),
fResMember(0),
fResNumChilds(-1)
{
}
TRootSnifferStore::~TRootSnifferStore()
{
}
void TRootSnifferStore::SetResult(void *_res, TClass *_rescl,
TDataMember *_resmemb, Int_t _res_chld)
{
fResPtr = _res;
fResClass = _rescl;
fResMember = _resmemb;
fResNumChilds = _res_chld;
}
void TRootSnifferStoreXml::CreateNode(Int_t lvl, const char *nodename)
{
buf->Append(TString::Format("%*s<%s", lvl * 2, "", nodename));
}
void TRootSnifferStoreXml::SetField(Int_t, const char *field, const char *value,
Int_t)
{
if (strpbrk(value, "<>&\'\"") == 0) {
buf->Append(TString::Format(" %s=\"%s\"", field, value));
} else {
buf->Append(TString::Format(" %s=\"", field));
const char *v = value;
while (*v != 0) {
switch (*v) {
case '<' :
buf->Append("<");
break;
case '>' :
buf->Append(">");
break;
case '&' :
buf->Append("&");
break;
case '\'' :
buf->Append("≈");
break;
case '\"' :
buf->Append(""");
break;
default:
buf->Append(*v);
break;
}
v++;
}
buf->Append("\"");
}
}
void TRootSnifferStoreXml::BeforeNextChild(Int_t, Int_t nchld, Int_t)
{
if (nchld == 0) buf->Append(">\n");
}
void TRootSnifferStoreXml::CloseNode(Int_t lvl, const char *nodename,
Int_t numchilds)
{
if (numchilds > 0)
buf->Append(TString::Format("%*s</%s>\n", lvl * 2, "", nodename));
else
buf->Append(TString::Format("/>\n"));
}
void TRootSnifferStoreJson::CreateNode(Int_t lvl, const char *nodename)
{
buf->Append(TString::Format("%*s\"%s\" : {", lvl * 4, "", nodename));
}
void TRootSnifferStoreJson::SetField(Int_t lvl, const char *field,
const char *value, Int_t nfld)
{
if (nfld == 0)
buf->Append("\n");
else
buf->Append(",\n");
buf->Append(TString::Format("%*s\"%s\" : \"%s\"", lvl * 4 + 2, "", field, value));
}
void TRootSnifferStoreJson::BeforeNextChild(Int_t lvl, Int_t nchld, Int_t nfld)
{
if (nchld == 0) {
if (nfld == 0)
buf->Append("\n");
else
buf->Append(",\n");
buf->Append(TString::Format("%*s\"childs\" : [\n", lvl * 4 + 2, ""));
} else {
buf->Append(",\n");
}
}
void TRootSnifferStoreJson::CloseNode(Int_t lvl, const char *, Int_t numchilds)
{
if (numchilds > 0)
buf->Append(TString::Format("\n%*s]", lvl * 4 + 2, ""));
buf->Append(TString::Format("\n%*s}", lvl * 4, ""));
}
TRootSnifferStore.cxx:100 TRootSnifferStore.cxx:101 TRootSnifferStore.cxx:102 TRootSnifferStore.cxx:103 TRootSnifferStore.cxx:104 TRootSnifferStore.cxx:105 TRootSnifferStore.cxx:106 TRootSnifferStore.cxx:107 TRootSnifferStore.cxx:108 TRootSnifferStore.cxx:109 TRootSnifferStore.cxx:110 TRootSnifferStore.cxx:111 TRootSnifferStore.cxx:112 TRootSnifferStore.cxx:113 TRootSnifferStore.cxx:114 TRootSnifferStore.cxx:115 TRootSnifferStore.cxx:116 TRootSnifferStore.cxx:117 TRootSnifferStore.cxx:118 TRootSnifferStore.cxx:119 TRootSnifferStore.cxx:120 TRootSnifferStore.cxx:121 TRootSnifferStore.cxx:122 TRootSnifferStore.cxx:123 TRootSnifferStore.cxx:124 TRootSnifferStore.cxx:125 TRootSnifferStore.cxx:126 TRootSnifferStore.cxx:127 TRootSnifferStore.cxx:128 TRootSnifferStore.cxx:129 TRootSnifferStore.cxx:130 TRootSnifferStore.cxx:131 TRootSnifferStore.cxx:132 TRootSnifferStore.cxx:133 TRootSnifferStore.cxx:134 TRootSnifferStore.cxx:135 TRootSnifferStore.cxx:136 TRootSnifferStore.cxx:137 TRootSnifferStore.cxx:138 TRootSnifferStore.cxx:139 TRootSnifferStore.cxx:140 TRootSnifferStore.cxx:141 TRootSnifferStore.cxx:142 TRootSnifferStore.cxx:143 TRootSnifferStore.cxx:144 TRootSnifferStore.cxx:145 TRootSnifferStore.cxx:146 TRootSnifferStore.cxx:147 TRootSnifferStore.cxx:148 TRootSnifferStore.cxx:149 TRootSnifferStore.cxx:150 TRootSnifferStore.cxx:151 TRootSnifferStore.cxx:152 TRootSnifferStore.cxx:153 TRootSnifferStore.cxx:154 TRootSnifferStore.cxx:155 TRootSnifferStore.cxx:156 TRootSnifferStore.cxx:157 TRootSnifferStore.cxx:158 TRootSnifferStore.cxx:159 TRootSnifferStore.cxx:160 TRootSnifferStore.cxx:161 TRootSnifferStore.cxx:162 TRootSnifferStore.cxx:163 TRootSnifferStore.cxx:164 TRootSnifferStore.cxx:165 TRootSnifferStore.cxx:166 TRootSnifferStore.cxx:167 TRootSnifferStore.cxx:168 TRootSnifferStore.cxx:169 TRootSnifferStore.cxx:170 TRootSnifferStore.cxx:171 TRootSnifferStore.cxx:172 TRootSnifferStore.cxx:173 TRootSnifferStore.cxx:174 TRootSnifferStore.cxx:175 TRootSnifferStore.cxx:176