34 if (!strstr(inclist, statement)) {
35 if (strlen(inclist)+strlen(statement) >= 50000) {
36 Fatal(
"AddUniqueStatement",
"inclist too short need %u instead of 500000",
UInt_t(strlen(inclist)+strlen(statement)));
38 strcat(inclist, statement);
39 fprintf(fp,
"%s", statement);
50 what.
Form(
"#include <%s>\n", header);
52 what.
Form(
"#include \"%s\"\n", header);
63 if (name.
Length() >= limit) {
71 name.
Remove( limit - 32 - 5);
87 const char *
name = strname.c_str();
88 Int_t len = strlen(name);
90 for (
Int_t i = 0; i < len; ++i) {
101 if (nest == 0 && name[i+1] ==
':') {
105 if (!definedInParent && cl==0 && extrainfos!=0) {
108 definedInParent =
kTRUE;
111 if (definedInParent) {
116 if (strcmp(name + strlen(name) - 2,
".h") == 0) {
127 if (name[i+1] ==
'/') {
163 Int_t numberOfNamespaces = 0;
164 const char *fullname = clname;
167 if (strchr(clname,
':')) {
169 Int_t len = strlen(clname);
170 const char *
name = clname;
172 for (
Int_t cur = 0; cur < len; ++cur) {
173 switch (clname[cur]) {
182 if (nest == 0 && clname[cur+1] ==
':') {
187 if (cl == 0 || (cl && cl->
Size() == 0)) {
188 TString last(name, cur - (name - clname));
189 if ((numberOfClasses == 0 || *numberOfClasses == 0) && strchr(last.
Data(),
'<') == 0) {
190 fprintf(fp,
"namespace %s {\n", last.
Data());
191 ++numberOfNamespaces;
194 fprintf(fp,
"#ifndef %s_h\n", headername.
Data());
195 fprintf(fp,
"#define %s_h\n", headername.
Data());
198 fprintf(fp,
"public:\n");
199 if (numberOfClasses) ++(*numberOfClasses);
202 name = clname + cur + 2;
206 name = clname + cur + 2;
215 istemplate = strstr(clname,
"<") != 0;
220 if (implementEmptyClass==1) {
222 fprintf(fp,
"#ifndef %s_h\n", headername.
Data());
223 fprintf(fp,
"#define %s_h\n", headername.
Data());
226 std::vector<const char*> argtype;
231 if (isdigit(protoname[pos+1])) {
232 argtype.push_back(
"int");
234 argtype.push_back(
"typename");
238 switch (protoname[i]) {
247 if (isdigit(protoname[i+1])) {
248 argtype.push_back(
"int");
250 argtype.push_back(
"typename");
261 fprintf(fp,
"template <");
262 for (
UInt_t p = 0; p < nparam; ++p) {
263 if (p >= argtype.size() ) {
264 fprintf(fp,
"/* missing */ T%d", p);
266 fprintf(fp,
"%s T%d", argtype[p], p);
268 if (p != (nparam - 1)) fprintf(fp,
", ");
270 if (needGenericTemplate) {
271 fprintf(fp,
"> class %s", protoname.
Data());
273 fprintf(fp,
"> class %s;\n", protoname.
Data());
274 fprintf(fp,
"template <> ");
278 if (implementEmptyClass) {
280 if (!needGenericTemplate) {
281 fprintf(fp,
"class %s", clname);
284 if (numberOfClasses) ++(*numberOfClasses);
285 fprintf(fp,
"public:\n");
286 fprintf(fp,
"operator int() { return 0; };\n");
288 fprintf(fp,
"enum %s { kDefault_%s };\n", clname, clname);
291 if (implementEmptyClass==1) {
292 if (strchr(fullname,
':') == 0) {
294 fprintf(fp,
"#ifdef __MAKECINT__\n#pragma link C++ class %s+;\n#endif\n", fullname);
296 fprintf(fp,
"#endif\n");
300 if (!(istemplate && needGenericTemplate)) {
301 fprintf(fp,
"class %s", clname);
304 return numberOfNamespaces;
323 if (clname[strlen(clname)-1]==
'>') {
324 newinfo->
SetTitle(
"Generated by MakeProject as an empty class template instantiation");
327 newinfo->
SetTitle(
"Generated by MakeProject as a namespace");
330 newinfo->
SetTitle(
"Generated by MakeProject as an enum");
333 extrainfos->
Add(newinfo);
339 info->
SetTitle(
"Generated by MakeProject as an empty class");
346 info->
SetTitle(
"Generated by MakeProject as an empty class");
363 UInt_t len = strlen(clname);
368 for (
UInt_t i = 0; i < len; ++i) {
371 if (nest == 0 && clname[i+1] ==
':') {
379 if (nest == 1) last = i + 1;
382 if (nest == 0)
return;
385 if ((clname[i] ==
',' && nest == 1) || (clname[i] ==
'>' && nest == 0)) {
386 TString incName(clname + last, i - last);
388 if (clname[i] ==
'>' && nest == 1) incName.
Append(
">");
390 if (isdigit(incName[0])) {
428 if (strchr(clname,
'<')) {
432 UInt_t numberOfClasses = 0;
435 if (!implementEmptyClass) fprintf(fp,
";\n");
436 for (
UInt_t i = 0;i < numberOfClasses;++i) {
437 fprintf(fp,
"}; // end of class.\n");
438 fprintf(fp,
"#endif\n");
440 for (
UInt_t i = 0;i < numberOfNamespaces;++i) {
441 fprintf(fp,
"} // end of namespace.\n");
454 UInt_t len = strlen(clname);
459 for (
UInt_t i = 0; i < len; ++i) {
463 if (nest == 1) last = i + 1;
466 if (nest==0)
return ninc;
469 if ((clname[i] ==
',' && nest == 1) || (clname[i] ==
'>' && nest == 0)) {
470 TString incName(clname + last, i - last);
472 if (clname[i] ==
'>' && nest == 1) incName.
Append(
">");
474 if (isdigit(incName[0])) {
477 const char *
what =
"";
486 what =
"forward_list";
497 what =
"unordered_map";
505 what =
"unordered_set";
510 what =
"undetermined_stl_container";
514 fprintf(fp,
"namespace std {} using namespace std;\n");
516 }
else if (strncmp(incName.
Data(),
"pair<", strlen(
"pair<")) == 0) {
519 }
else if (strncmp(incName.
Data(),
"auto_ptr<", strlen(
"auto_ptr<")) == 0) {
526 if (!forward && cl) {
531 if (include && include[0]) {
533 if (strncmp(include,
"include/", 8) == 0) {
536 if (strncmp(include,
"include\\", 9) == 0) {
547 }
else if (incName.
Length() && incName[0] !=
' ' &&
gROOT->GetType(incName) == 0) {
549 if (emptyclass && extrainfos) {
565 std::vector<std::string> inside;
592 if (strncmp(clname,
"auto_ptr<", strlen(
"auto_ptr<")) == 0) {
610 std::vector<std::string> inside;
616 if (strncmp(inside[1].c_str(),
"pair<",strlen(
"pair<"))==0) {
617 what = inside[1].c_str();
653 if (strchr(name,
'<')!=0) {
654 std::vector<std::string> inside;
657 if (nestedLoc) --narg;
660 for(
unsigned int i = 1; i<narg; ++i) {
664 static const char* allocPrefix =
"std::allocator<";
665 static const unsigned int allocPrefixLen (strlen(allocPrefix));
671 if (narg>2 && strncmp(inside[2].c_str(),allocPrefix,allocPrefixLen)==0) {
679 if (narg>4 && strncmp(inside[4].c_str(),allocPrefix,allocPrefixLen)==0) {
685 if (narg>5 && strncmp(inside[5].c_str(),allocPrefix,allocPrefixLen)==0) {
691 if (narg>6 && strncmp(inside[6].c_str(),allocPrefix,allocPrefixLen)==0) {
712 if (what[what.size()-1]==
'>') {
718 inside.push_back(
"std::vector");
719 inside.push_back(what);
727 inside[0] =
"std::vector";
731 if (strncmp(inside[0].c_str(),
"std::",5) != 0) {
732 inside[0] =
"std::" + inside[0];
735 static const char *stlnames[] = {
"pair",
"greater",
"less",
"allocator" };
736 for(
unsigned int in = 0; in <
sizeof(stlnames)/
sizeof(stlnames[0]); ++in) {
737 if (strncmp( inside[0].c_str(), stlnames[in], strlen(stlnames[in])) == 0 ) {
738 inside[0] =
"std::" + inside[0];
745 newname.
Append(inside[1]);
746 for(
unsigned int j=2; j<narg; ++j) {
747 if (!inside[j].empty()) {
749 newname.
Append(inside[j]);
752 if (newname[newname.
Length()-1]==
'>') {
757 if (nestedLoc) newname.
Append(inside[nestedLoc]);
758 }
else if ( newname ==
"string" ) {
759 newname =
"std::string";
Describe Streamer information for one class version.
static void GenerateMissingStreamerInfo(TList *extrainfos, const char *clname, Bool_t iscope)
Generate an empty StreamerInfo for the given type (no recursion) if it is not not known in the list o...
ROOT::ESTLType IsSTLCont(std::string_view type)
type : type name: vector<list<classA,allocator>,allocator> result: 0 : not stl container code of cont...
const char * GetTypeName() const
void Final()
MD5 finalization, ends an MD5 message-digest operation, writing the the message digest and zeroizing ...
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
void Fatal(const char *location, const char *msgfmt,...)
int GetSplit(const char *type, std::vector< std::string > &output, int &nestedLoc, EModType mode=TClassEdit::kNone)
Stores in output (after emptying it) the splited type.
static TString GetHeaderName(const char *name, const TList *extrainfos, Bool_t includeNested=kFALSE)
Return the header name containing the description of name.
TString & ReplaceAll(const TString &s1, const TString &s2)
virtual void SetName(const char *name)
Change (i.e.
static void ChopFileName(TString &name, Int_t limit)
Chop the name by replacing the ending (before a potential extension) with a md5 summary of the name...
static void GeneratePostDeclaration(FILE *fp, const TVirtualStreamerInfo *info, char *inclist)
Add to the header file anything that need to appear after the class declaration (this includes some #...
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual Bool_t IsBase() const
Return kTRUE if the element represent a base class.
const char * Data() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
const char * AsString() const
Return message digest as string.
This code implements the MD5 message-digest algorithm.
ROOT::ESTLType STLKind(std::string_view type)
Converts STL container name to number.
TString & Append(const char *cs)
static UInt_t GenerateForwardDeclaration(FILE *fp, const char *clname, char *inclist, Bool_t implementEmptyClass, Bool_t needGenericTemplate, const TList *extrainfos)
Insert a (complete) forward declaration for the class 'clname'.
std::string GetLong64_Name(const char *original)
Replace 'long long' and 'unsigned long long' by 'Long64_t' and 'ULong64_t'.
Int_t GetClassVersion() const
static void AddInclude(FILE *fp, const char *header, Bool_t system, char *inclist)
Add an include statement, if it has not already been added.
void Update(const UChar_t *buf, UInt_t len)
Update TMD5 object to reflect the concatenation of another buffer full of bytes.
Bool_t HasInterpreterInfo() const
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
static void AddUniqueStatement(FILE *fp, const char *statement, char *inclist)
Add an include statement, if it has not already been added.
virtual const char * GetName() const
Returns name of object.
The ROOT global object gROOT contains a list of all defined classes.
void SetClassVersion(Int_t vers)
bool IsStdClass(const char *type)
return true if the class belongs to the std namespace
static void GenerateMissingStreamerInfos(TList *extrainfos, TStreamerElement *element)
Generate an empty StreamerInfo for types that are used in templates parameters but are not known in t...
static UInt_t GenerateIncludeForTemplate(FILE *fp, const char *clname, char *inclist, Bool_t forward, const TList *extrainfos)
Add to the header file, the #include needed for the argument of this template.
TString & Remove(Ssiz_t pos)
virtual TObjArray * GetElements() const =0
virtual TClass * GetClassPointer() const
Returns a pointer to the TClass of this element.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
static TString UpdateAssociativeToVector(const char *name)
If we have a map, multimap, set or multiset, plus unordered partners, and the key is a class...
const char * GetDeclFileName() const
virtual void Add(TObject *obj)
std::string ShortType(const char *typeDesc, int mode)
Return the absolute type of typeDesc.
Abstract Interface class describing Streamer information for one class.
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
static UInt_t GenerateClassPrefix(FILE *fp, const char *clname, Bool_t top, TString &protoname, UInt_t *numberOfClasses, Int_t implementEmptyClass=kFALSE, Bool_t needGenericTemplate=kFALSE)
Write the start of the class (forward) declaration.
Int_t Size() const
Return size of object of this class.
Ssiz_t First(char c) const
Find first occurrence of a character c.