9#include <display/HtmlClassInspector.h>
11#include <framework/utilities/HTML.h>
16#include <TDataMember.h>
19#include <TStreamerElement.h>
20#include <TVirtualStreamerInfo.h>
29 const_cast<TObject*
>(obj)->ShowMembers(dm);
43 return info + title +
")<br> <br>";
48 title = title.Strip(TString::kBoth,
'/');
49 title = title.Strip(TString::kBoth,
'*');
50 title = title.Strip(TString::kLeading,
'!');
51 title = title.Strip(TString::kLeading,
'<');
52 title = title.Strip(TString::kBoth,
' ');
59 tmp +=
"<table width=100% cellpadding=2 bgcolor=eeeeee>";
76 const Int_t kvalue = 30;
77 const Int_t kline = 1024;
83 TDataType* membertype;
84 TString memberTypeName;
86 const char* memberFullTypeName;
91 if (TDataMember* member = cl->GetDataMember(mname)) {
92 memberTypeName = member->GetTypeName();
93 memberName = member->GetName();
94 memberFullTypeName = member->GetFullTypeName();
95 memberTitle = member->GetTitle();
96 isapointer = member->IsaPointer();
97 isbasic = member->IsBasic();
98 membertype = member->GetDataType();
99 }
else if (!cl->IsLoaded()) {
102 TVirtualStreamerInfo* info = cl->GetStreamerInfo();
104 const char* cursor = mname;
105 while ((*cursor) ==
'*') ++cursor;
106 TString elname(cursor);
107 Ssiz_t pos = elname.Index(
"[");
111 TStreamerElement* element = (TStreamerElement*)info->GetElements()->FindObject(elname.Data());
112 if (!element)
return;
113 memberFullTypeName = element->GetTypeName();
115 memberTypeName = memberFullTypeName;
116 memberTypeName = memberTypeName.Strip(TString::kTrailing,
'*');
117 if (memberTypeName.Index(
"const ") == 0) memberTypeName.Remove(0, 6);
119 memberName = element->GetName();
120 memberTitle = element->GetTitle();
121 isapointer = element->IsaPointer() || element->GetType() == TVirtualStreamerInfo::kCharStar;
122 membertype = gROOT->GetType(memberFullTypeName);
124 isbasic = membertype != 0;
130 Bool_t isdate = kFALSE;
131 if (strcmp(memberName,
"fDatime") == 0 && strcmp(memberTypeName,
"UInt_t") == 0) {
134 Bool_t isbits = kFALSE;
135 if (strcmp(memberName,
"fBits") == 0 && strcmp(memberTypeName,
"UInt_t") == 0) {
138 TClass* dataClass = TClass::GetClass(memberFullTypeName);
139 Bool_t isTString = (dataClass == TString::Class());
140 static TClassRef stdClass(
"std::string");
141 Bool_t isStdString = (dataClass == stdClass);
144 for (i = 0; i < kline; i++) line[i] =
' ';
150 char* pointer = (
char*)add;
151 char** ppointer = (
char**)(pointer);
154 char** p3pointer = (
char**)(*ppointer);
156 snprintf(&line[kvalue], kline - kvalue,
"->0");
158 snprintf(&line[kvalue], kline - kvalue,
"->%lx ", (Long_t)p3pointer);
159 else if (membertype) {
160 if (!strcmp(membertype->GetTypeName(),
"char")) {
161 i = strlen(*ppointer);
162 if (kvalue + i > kline) i = kline - 1 - kvalue;
163 Bool_t isPrintable = kTRUE;
164 for (Int_t j = 0; j < i; j++) {
165 if (!std::isprint((*ppointer)[j])) {
166 isPrintable = kFALSE;
172 std::string out(*ppointer);
173 out.copy(line + kvalue, i);
174 line[kvalue + i] = 0;
179 strncpy(&line[kvalue], membertype->AsString(p3pointer), TMath::Min(kline - 1 - kvalue,
180 (
int)strlen(membertype->AsString(p3pointer))));
182 }
else if (!strcmp(memberFullTypeName,
"char*") ||
183 !strcmp(memberFullTypeName,
"const char*")) {
184 i = strlen(*ppointer);
185 if (kvalue + i >= kline) i = kline - 1 - kvalue;
186 Bool_t isPrintable = kTRUE;
187 for (Int_t j = 0; j < i; j++) {
188 if (!std::isprint((*ppointer)[j])) {
189 isPrintable = kFALSE;
194 std::string out(*ppointer);
195 out.copy(line + kvalue, i);
198 line[kvalue + i] = 0;
203 snprintf(&line[kvalue], kline - kvalue,
"->%lx ", (Long_t)p3pointer);
205 }
else if (membertype) {
207 cdatime = (UInt_t*)pointer;
208 TDatime::GetDateTime(cdatime[0], cdate, ctime);
209 snprintf(&line[kvalue], kline - kvalue,
"%d/%d", cdate, ctime);
211 snprintf(&line[kvalue], kline - kvalue,
"0x%08x", *(UInt_t*)pointer);
213 strncpy(&line[kvalue], membertype->AsString(pointer), TMath::Min(kline - 1 - kvalue, (
int)strlen(membertype->AsString(pointer))));
217 std::string* str = (std::string*)pointer;
218 snprintf(&line[kvalue], kline - kvalue,
"%s", str->c_str());
219 }
else if (isTString) {
220 TString* str = (TString*)pointer;
221 snprintf(&line[kvalue], kline - kvalue,
"%s", str->Data());
223 snprintf(&line[kvalue], kline - kvalue,
"->%lx ", (Long_t)pointer);
230 if (TString(pname) !=
"")
231 indent =
" ";
237 m_info +=
"<td align=right>" + memberValue +
"</td>";
Pass to TObject::ShowMembers() to get tabular view of object data.
TString getTable() const
Return finished table.
void Inspect(TClass *cl, const char *pname, const char *mname, const void *add) override
Implementation mostly copied from TDumpMembers.
static TString getMemberData(const TObject *obj)
Return table with member data contents.
static TString stripTitle(TString title)
strip comment things
static TString getClassInfo(const TClass *obj)
Get class name + description from comment after ClassDef().
TString m_info
used to store output.
std::string htmlToPlainText(const std::string &html)
Reformat given HTML string into terminal-friendly plain text.
Abstract base class for different kinds of events.