Skip to content

Commit 815a437

Browse files
committed
[json] provide workaround for TStyle::fLineStyle member
it has similar name as field in TAttLine and produces duplicated members in JSON. This makes impossible to correctly read it back
1 parent d8cd26a commit 815a437

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

io/io/src/TBufferJSON.cxx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ class Container {
127127
#include "TVirtualMutex.h"
128128
#include "TInterpreter.h"
129129
#include "TEmulatedCollectionProxy.h"
130+
#include "TStyle.h"
130131
#include "snprintf.h"
131132

132133
#include <nlohmann/json.hpp>
@@ -1218,8 +1219,14 @@ void TBufferJSON::JsonStartElement(const TStreamerElement *elem, const TClass *b
12181219

12191220
switch (special_kind) {
12201221
case 0:
1221-
if (!base_class)
1222-
elem_name = elem->GetName();
1222+
if (base_class) return;
1223+
elem_name = elem->GetName();
1224+
if (strcmp(elem_name,"fLineStyle") == 0)
1225+
if ((strcmp(elem->GetTypeName(),"TString") == 0) && (strcmp(elem->GetFullName(),"fLineStyle[30]") == 0)) {
1226+
auto st1 = fStack.at(fStack.size() - 2).get();
1227+
if (st1->IsStreamerInfo() && st1->fInfo && (strcmp(st1->fInfo->GetName(),"TStyle") == 0))
1228+
elem_name = "fLineStyles";
1229+
}
12231230
break;
12241231
case TClassEdit::kVector: elem_name = "fVector"; break;
12251232
case TClassEdit::kList: elem_name = "fList"; break;

0 commit comments

Comments
 (0)