35 if (!strstr(inclist, statement)) {
36 if (strlen(inclist)+strlen(statement) >= 50000) {
37 Fatal(
"AddUniqueStatement",
"inclist too short need %u instead of 500000",
UInt_t(strlen(inclist)+strlen(statement)));
39 strcat(inclist, statement);
40 fprintf(fp,
"%s", statement);
51 what.
Form(
"#include <%s>\n", header);
53 what.Form(
"#include \"%s\"\n", header);
75 name.Remove( limit - 32 - 5);
91 const char *
name = strname.c_str();
105 if (nest == 0 &&
name[i+1] ==
':') {
109 if (!definedInParent && cl==0 && extrainfos!=0) {
112 definedInParent =
kTRUE;
115 if (definedInParent) {
120 if (strcmp(
name + strlen(
name) - 2,
".h") == 0) {
131 if (
name[i+1] ==
'/') {
167 Int_t numberOfNamespaces = 0;
168 const char *fullname = clname;
171 if (strchr(clname,
':')) {
174 const char *
name = clname;
176 for (
Int_t cur = 0; cur <
len; ++cur) {
177 switch (clname[cur]) {
186 if (nest == 0 && clname[cur+1] ==
':') {
191 if (cl == 0 || (cl && cl->
Size() == 0)) {
193 if ((numberOfClasses == 0 || *numberOfClasses == 0) && strchr(last.
Data(),
'<') == 0) {
194 fprintf(fp,
"namespace %s {\n", last.
Data());
195 ++numberOfNamespaces;
198 fprintf(fp,
"#ifndef %s_h\n", headername.
Data());
199 fprintf(fp,
"#define %s_h\n", headername.
Data());
202 fprintf(fp,
"public:\n");
203 if (numberOfClasses) ++(*numberOfClasses);
206 name = clname + cur + 2;
210 name = clname + cur + 2;
219 istemplate = strstr(clname,
"<") != 0;
224 if (implementEmptyClass==1) {
226 fprintf(fp,
"#ifndef %s_h\n", headername.
Data());
227 fprintf(fp,
"#define %s_h\n", headername.
Data());
230 std::vector<const char*> argtype;
235 if (isdigit(protoname[pos+1])) {
236 argtype.push_back(
"int");
238 argtype.push_back(
"typename");
242 switch (protoname[i]) {
251 if (isdigit(protoname[i+1])) {
252 argtype.push_back(
"int");
254 argtype.push_back(
"typename");
265 fprintf(fp,
"template <");
267 if (
p >= argtype.size() ) {
268 fprintf(fp,
"/* missing */ T%d",
p);
270 fprintf(fp,
"%s T%d", argtype[
p],
p);
272 if (
p != (nparam - 1)) fprintf(fp,
", ");
274 if (needGenericTemplate) {
275 fprintf(fp,
"> class %s", protoname.
Data());
277 fprintf(fp,
"> class %s;\n", protoname.
Data());
278 fprintf(fp,
"template <> ");
282 if (implementEmptyClass) {
284 if (!needGenericTemplate) {
285 fprintf(fp,
"class %s", clname);
288 if (numberOfClasses) ++(*numberOfClasses);
289 fprintf(fp,
"public:\n");
290 fprintf(fp,
"operator int() { return 0; };\n");
292 fprintf(fp,
"enum %s { kDefault_%s };\n", clname, clname);
295 if (implementEmptyClass==1) {
296 if (strchr(fullname,
':') == 0) {
298 fprintf(fp,
"#ifdef __MAKECINT__\n#pragma link C++ class %s+;\n#endif\n", fullname);
300 fprintf(fp,
"#endif\n");
304 if (!(istemplate && needGenericTemplate)) {
305 fprintf(fp,
"class %s", clname);
308 return numberOfNamespaces;
327 if (clname[strlen(clname)-1]==
'>') {
328 newinfo->
SetTitle(
"Generated by MakeProject as an empty class template instantiation");
331 newinfo->
SetTitle(
"Generated by MakeProject as a namespace");
334 newinfo->
SetTitle(
"Generated by MakeProject as an enum");
337 extrainfos->
Add(newinfo);
343 info->
SetTitle(
"Generated by MakeProject as an empty class");
350 info->
SetTitle(
"Generated by MakeProject as an empty class");
375 if (nest == 0 && clname[i+1] ==
':') {
383 if (nest == 1) last = i + 1;
386 if (nest == 0)
return;
389 if ((clname[i] ==
',' && nest == 1) || (clname[i] ==
'>' && nest == 0)) {
390 TString incName(clname + last, i - last);
392 if (clname[i] ==
'>' && nest == 1) incName.
Append(
">");
394 if (isdigit(incName[0])) {
432 if (strchr(clname,
'<')) {
436 UInt_t numberOfClasses = 0;
439 if (!implementEmptyClass) fprintf(fp,
";\n");
440 for (
UInt_t i = 0;i < numberOfClasses;++i) {
441 fprintf(fp,
"}; // end of class.\n");
442 fprintf(fp,
"#endif\n");
444 for (
UInt_t i = 0;i < numberOfNamespaces;++i) {
445 fprintf(fp,
"} // end of namespace.\n");
467 if (nest == 1) last = i + 1;
470 if (nest==0)
return ninc;
473 if ((clname[i] ==
',' && nest == 1) || (clname[i] ==
'>' && nest == 0)) {
474 TString incName(clname + last, i - last);
476 if (clname[i] ==
'>' && nest == 1) incName.
Append(
">");
478 if (isdigit(incName[0])) {
481 const char *
what =
"";
490 what =
"forward_list";
501 what =
"unordered_map";
509 what =
"unordered_set";
515 what =
"ROOT/RVec.hxx";
518 what =
"undetermined_stl_container";
522 fprintf(fp,
"namespace std {} using namespace std;\n");
527 }
else if (strncmp(incName.
Data(),
"auto_ptr<", std::char_traits<char>::length(
"auto_ptr<")) == 0) {
534 if (!forward && cl) {
539 if (include && include[0]) {
541 if (strncmp(include,
"include/", 8) == 0) {
544 if (strncmp(include,
"include\\", 9) == 0) {
555 }
else if (incName.
Length() && incName[0] !=
' ' &&
gROOT->GetType(incName) == 0) {
557 if (emptyclass && extrainfos) {
573 std::vector<std::string> inside;
588 what.ReplaceAll(
"std::",
"");
615 std::vector<std::string> inside;
622 what = inside[1].c_str();
663 constexpr auto auto_ptr_len =
str_length(
"auto_ptr<");
664 if (strncmp(
name,
"auto_ptr<", auto_ptr_len) == 0) {
665 newname =
"unique_ptr<";
666 newname += (
name + auto_ptr_len);
667 }
else if (strchr(
name,
'<')!=0) {
668 std::vector<std::string> inside;
674 for(
unsigned int i = 1; i<narg; ++i) {
678 if (nestedLoc) narg = nestedLoc;
681 if (!inside[narg-1].empty() && inside[narg-1][0] ==
'*')
686 static const char* allocPrefix =
"std::allocator<";
687 static const unsigned int allocPrefixLen (strlen(allocPrefix));
693 if (narg>2 && strncmp(inside[2].c_str(),allocPrefix,allocPrefixLen)==0) {
701 if (narg>4 && strncmp(inside[4].c_str(),allocPrefix,allocPrefixLen)==0) {
707 if (narg>5 && strncmp(inside[5].c_str(),allocPrefix,allocPrefixLen)==0) {
713 if (narg>6 && strncmp(inside[6].c_str(),allocPrefix,allocPrefixLen)==0) {
740 inside.push_back(
"std::vector");
741 inside.push_back(
what);
749 inside[0] =
"std::vector";
753 if (strncmp(inside[0].c_str(),
"std::",5) != 0) {
754 inside[0] =
"std::" + inside[0];
757 static const char *stlnames[] = {
"pair",
"greater",
"less",
"allocator" };
758 for(
unsigned int in = 0; in <
sizeof(stlnames)/
sizeof(stlnames[0]); ++in) {
759 if (strncmp( inside[0].c_str(), stlnames[in], strlen(stlnames[in])) == 0 ) {
760 inside[0] =
"std::" + inside[0];
767 newname.
Append(inside[1]);
768 for(
unsigned int j=2; j<narg; ++j) {
769 if (!inside[j].empty()) {
771 newname.
Append(inside[j]);
774 if (newname[newname.
Length()-1]==
'>') {
779 if (nestedLoc) newname.
Append(inside[nestedLoc]);
780 }
else if ( newname ==
"string" ) {
781 newname =
"std::string";
void Fatal(const char *location, const char *msgfmt,...)
Use this function in case of a fatal error. It will abort the program.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
static constexpr int str_length(const char *str)
If we have a map, multimap, set or multiset, plus unordered partners, and the key is a class,...
TClass instances represent classes, structs and namespaces in the ROOT type system.
Bool_t HasInterpreterInfo() const
Int_t Size() const
Return size of object of this class.
const char * GetDeclFileName() const
Return name of the file containing the declaration of this class.
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.
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
void Add(TObject *obj) override
This code implements the MD5 message-digest algorithm.
const char * AsString() const
Return message digest as string.
void Update(const UChar_t *buf, UInt_t len)
Update TMD5 object to reflect the concatenation of another buffer full of bytes.
void Final()
MD5 finalization, ends an MD5 message-digest operation, writing the the message digest and zeroizing ...
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...
static TString GetHeaderName(const char *name, const TList *extrainfos, Bool_t includeNested=kFALSE)
Return the header name containing the description of name.
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 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 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'.
static void AddUniqueStatement(FILE *fp, const char *statement, char *inclist)
Add an include statement, if it has not already been added.
static void AddInclude(FILE *fp, const char *header, Bool_t system, char *inclist)
Add an include statement, if it has not already been added.
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.
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 #...
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.
static TString UpdateAssociativeToVector(const char *name)
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual TClass * GetClassPointer() const
Returns a pointer to the TClass of this element.
const char * GetTypeName() const
virtual Bool_t IsBase() const
Return kTRUE if the element represent a base class.
Describes a persistent version of a class.
Int_t GetClassVersion() const override
void SetClassVersion(Int_t vers) override
Ssiz_t First(char c) const
Find first occurrence of a character c.
const char * Data() const
TString & Remove(Ssiz_t pos)
TString & Append(const char *cs)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Abstract Interface class describing Streamer information for one class.
virtual TObjArray * GetElements() const =0
ROOT::ESTLType STLKind(std::string_view type)
Converts STL container name to number.
bool IsStdClass(const char *type)
return true if the class belongs to the std namespace
bool IsStdPair(std::string_view name)
std::string GetLong64_Name(const char *original)
Replace 'long long' and 'unsigned long long' by 'Long64_t' and 'ULong64_t'.
ROOT::ESTLType IsSTLCont(std::string_view type)
type : type name: vector<list<classA,allocator>,allocator> result: 0 : not stl container code of cont...
std::string ShortType(const char *typeDesc, int mode)
Return the absolute type of typeDesc.
int GetSplit(const char *type, std::vector< std::string > &output, int &nestedLoc, EModType mode=TClassEdit::kNone)
Stores in output (after emptying it) the split type.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.