7 #include "KVClassFactory.h" 
   12 #include "KVHashList.h" 
   30       output += (indent + _line);
 
   43    : fBaseClass(nullptr), fHasBaseClass(
kFALSE), fBaseClassTObject(
kFALSE), fInlineAllMethods(
kFALSE), fInlineAllCtors(
kFALSE),
 
   44      fInheritAllCtors(
kTRUE)
 
   85                                const Char_t* templateFile)
 
   86    : fBaseClass(nullptr), fHasBaseClass(
kFALSE), fBaseClassTObject(
kFALSE), fInlineAllMethods(
kFALSE), fInlineAllCtors(
kFALSE),
 
   87      fInheritAllCtors(
kTRUE)
 
  176          Error(
"SetTemplate", 
"Cannot find template files %s. Object made a zombie.", templateFile);
 
  184 #if ROOT_VERSION_CODE >= ROOT_VERSION(3,4,0) 
  199    ((
KVClassFactory&)obj).SetTemplate(WithTemplate(), GetTemplateBase());
 
  201    if (fMethods.GetEntries()) {
 
  202       TIter next(&fMethods);
 
  207    if (fImpInc.GetEntries()) fImpInc.Copy(((
KVClassFactory&)obj).fImpInc);
 
  220 #if ROOT_VERSION_CODE >= ROOT_VERSION(3,4,0) 
  241    file << 
"Write a detailed documentation for your class here, see doxygen manual for help.\n\n ";
 
  264    file << 
"#ifndef " << tmp.
Data() << endl;
 
  265    file << 
"#define " << tmp.
Data() << 
"\n" << endl;
 
  281          file << 
"#include \"" << str->String().Data() << 
"\"\n" << endl;
 
  312    file << 
"\n{" << endl;
 
  316    if (prem->GetEntries()) {
 
  317       file << 
"\n" << endl;
 
  319       TIter next(prem.get());
 
  329    unique_ptr<KVSeqCollection> ctor(priv->GetSubListWithMethod(
"1", 
"IsConstructor"));
 
  330    if (ctor->GetEntries()) {
 
  333       TIter next(ctor.get());
 
  340    if (priv->GetEntries()) {
 
  343       TIter next(priv.get());
 
  359    bool protected_written = 
kFALSE;
 
  363    if (prem->GetEntries()) {
 
  364       file << 
"\nprotected:" << endl;
 
  365       protected_written = 
kTRUE;
 
  367       TIter next(prem.get());
 
  377    ctor.reset(prot->GetSubListWithMethod(
"1", 
"IsConstructor"));
 
  378    if (ctor->GetEntries()) {
 
  379       if (!protected_written) {
 
  380          file << 
"\nprotected:" << endl;
 
  381          protected_written = 
kTRUE;
 
  386       TIter next(ctor.get());
 
  393    if (prot->GetEntries()) {
 
  394       if (!protected_written) {
 
  395          file << 
"\nprotected:" << endl;
 
  396          protected_written = 
kTRUE;
 
  401       TIter next(prot.get());
 
  412       if (!protected_written) {
 
  413          file << 
"\nprotected:" << endl;
 
  414          protected_written = 
kTRUE;
 
  424    file << 
"public:" << endl;
 
  427    ctor.reset(pub->GetSubListWithMethod(
"1", 
"IsConstructor"));
 
  428    unique_ptr<KVSeqCollection> pubnor(pub->GetSubListWithMethod(
"1", 
"IsNormalMethod"));
 
  429    if (ctor->GetEntries()) {
 
  431       TIter next(ctor.get());
 
  444       if (pubnor->GetEntries()) 
file << endl;
 
  448    if (pubnor->GetEntries()) {
 
  450       TIter next(pubnor.get());
 
  460    file << 
"};\n\n#endif" << endl;      
 
  485          file_cpp << 
"#include \"" << str->String().Data() << 
"\"" << endl;
 
  488    file_cpp << endl << 
"ClassImp(" << 
fClassName.
Data() << 
")\n" << endl << endl;
 
  492    if (ctor->GetEntries()) {
 
  494       TIter next(ctor.get());
 
  499             file_cpp << 
line.Data() << endl;
 
  508       file_cpp << 
line.Data() << endl;
 
  513    if (normeth->GetEntries()) {
 
  515       TIter next(normeth.get());
 
  520             file_cpp << 
line.Data() << endl << endl;
 
  527    cout << 
"<KVClassFactory::WriteClassImp> : File " << 
GetImpFileName() << 
" generated." << endl;
 
  551    cout << 
"<KVClassFactory::WriteClassHeader> : File " << 
GetHeaderFileName() << 
" generated." << endl;
 
  635                                const Char_t* templateFile)
 
  711    KVClassFactory cf(classname, classdesc, base_class, withTemplate, templateFile);
 
  737       Warning(
"GenerateCode", 
"Object is zombie. No code will be generated.");
 
  806          TString mem_name = 
m->GetRealName();
 
  809          if (mem_type == 
"Bool_t") meth = 
AddMethod(
Form(
"SetIs%s", mem_name.
Data()), 
"void");
 
  879    Ssiz_t beg_cur_line = beg;
 
  882    while (pos < 
file.Length()) {
 
  884       if (
file(pos) == 
' ' || 
file(pos) == 
'\t') {
 
  888       else if (
file(pos) == 
'\n') {
 
  891          if (nonWS) 
return beg_cur_line;
 
  895       else if (
file(pos) == 
'/') {
 
  897          if (
file(pos + 1) == 
'*') {
 
  900             if (nonWS) 
return beg_cur_line;
 
  902             if (
len > -1) pos = 
len + 2;
 
  910          else if (
file(pos + 1) == 
'/') {
 
  913             if (nonWS) 
return beg_cur_line;
 
  934    if (nonWS && pos > -1) 
return beg_cur_line;
 
  958    ifstream file_h_template;
 
  964            "<KVClassFactory::WriteClassWithTemplateHeader>: cannot open " <<
 
  971    file_h_template.close();
 
  975    if ((class_ind = headFile.
Index(
"ClassDef")) > -1) {
 
  978       Ssiz_t end_of_line = class_ind;
 
  979       while (headFile(--end_of_line) != 
'\n') ;
 
  981       TString part1 = headFile(0, end_of_line + 1);
 
  999          KVString acc_types[] = {
"private", 
"protected", 
"public", 
"-"};
 
 1001          while (acc_types[iac] != 
"-") {
 
 1003             if (sublist->GetEntries()) {
 
 1004                part_add += acc_types[iac];
 
 1006                TIter next(sublist.get());
 
 1020       headFile = part1 + part_add + part2 + part3;
 
 1025    file_h << 
"\n#endif" << endl;      
 
 1028    cout << 
"<KVClassFactory::WriteClassWithTemplateHeader> : File " << 
GetHeaderFileName() << 
" generated." << endl;
 
 1047    file_cpp << 
"#include \"" << 
fClassName.
Data() << 
".h\"" << endl;
 
 1052          file_cpp << 
"#include \"" << str->String().Data() << 
"\"" << endl;
 
 1055    file_cpp << endl << 
"ClassImp(" << 
fClassName.
Data() << 
")\n" << endl;
 
 1058    ifstream file_cpp_template;
 
 1064       cout << 
"<KVClassFactory::WriteClassWithTemplateImp>: cannot open " 
 1069    cppFile.
ReadFile(file_cpp_template);
 
 1070    file_cpp_template.close();
 
 1081          file_cpp << 
line.Data();
 
 1086    cout << 
"<KVClassFactory::WriteClassWithTemplateImp> : File " << 
GetImpFileName() << 
" generated." << endl;
 
 1110       const Char_t* templateFile)
 
 1128    if (strcmp(base_class, 
"")) {
 
 1241    if (strcmp(argument_type, 
"")) {
 
 1244       meth->
AddArgument(argument_type, argument_name, default_value);
 
 1248       meth->
SetName(
"default_ctor");
 
 1266                                        const Char_t* argument_name, 
const Char_t* default_value)
 
 1275       Error(
"AddMethodArgument",
 
 1276             "Method %s not found.", method_name);
 
 1279    meth->
AddArgument(argument_type, argument_name, default_value);
 
 1296       Error(
"AddMethodBody",
 
 1297             "Method %s not found.", method_name);
 
 1314       Error(
"AddMethodComment",
 
 1315             "Method %s not found.", method_name);
 
 1368    Info(
"Print", 
"object name = %s, address = %p", 
GetName(), 
this);
 
 1373    cout << 
"---------> Methods" << endl;
 
 1375    cout << 
"---------> Header Includes" << endl;
 
 1377    cout << 
"---------> Implementation Includes" << endl;
 
 1391    for (
int i = 0; i < npars; i++) {
 
 1394          AddMember(par->
GetName(), 
"TString", 
"member automatically generated by KVClassFactory::AddGetSetMethods");
 
 1398       else if (par->
IsInt()) {
 
 1399          AddMember(par->
GetName(), 
"Int_t", 
"member automatically generated by KVClassFactory::AddGetSetMethods");
 
 1402          AddMember(par->
GetName(), 
"Double_t", 
"member automatically generated by KVClassFactory::AddGetSetMethods");
 
 1404       else if (par->
IsBool()) {
 
 1405          AddMember(par->
GetName(), 
"Bool_t", 
"member automatically generated by KVClassFactory::AddGetSetMethods");
 
 1422       if (!
m->IsConstructor() && !
m->IsDestructor()) 
m->SetInline(yes);
 
 1459    KVString body(
"This method copies the current state of 'this' object into 'obj'\n");
 
 1460    body += 
"You should add here any member variables, for example:\n";
 
 1461    body += 
"(supposing a member variable ";
 
 1463    body += 
"::fToto)\n";
 
 1464    body += 
"   CastedObj.fToto = fToto;\n";
 
 1466    body += 
"   CastedObj.SetToto( GetToto() );";
 
 1471    body += 
"::Copy(obj);\n";
 
 1475    body += 
"& CastedObj = (";
 
 1482          body += 
"   CastedObj.Set";
 
 1483          body += 
m->GetRealName();
 
 1485          body += 
m->GetRealName();
 
 1541    Int_t add_to_base(1);
 
 1544       adding_to_base = 
kTRUE;
 
 1554       if (adding_to_base) {
 
 1563    ctor->
SetMethodComment(
"Constructor with initial values for all member variables");
 
 1582    KVString body = 
"   if(this != &other) { // check for self-assignment\n";
 
 1584       body += 
"      other.Copy(*this);\n";
 
 1592             body += 
m->GetRealName();
 
 1593             body += 
"( other.Get";
 
 1594             body += 
m->GetRealName();
 
 1600    body += 
"   return (*this);";
 
 1623    if (fVirtual) decl += 
"virtual ";
 
 1624    if (IsNormalMethod()) {
 
 1625       decl += GetReturnType();
 
 1631       decl += GetClassName();
 
 1634    for (
int i = 1; i <= fNargs; i++) {
 
 1635       decl += fFields.GetStringValue(
Form(
"Arg_%d", i));
 
 1636       if (fFields.HasParameter(
Form(
"Arg_%d_name", i))) {
 
 1638          decl += fFields.GetStringValue(
Form(
"Arg_%d_name", i));
 
 1641          decl += 
Form(
" arg%d", i);
 
 1642       if (fFields.HasParameter(
Form(
"Arg_%d_default", i))) {
 
 1644          decl += fFields.GetStringValue(
Form(
"Arg_%d_default", i));
 
 1646       if (i < fNargs) decl += 
", ";
 
 1649    if (fConst) decl += 
" const";
 
 1655    write_method_body(decl);
 
 1682    if (IsInline()) indentation = 
"   ";
 
 1684    decl += __add_indented_line(
"{", indentation);
 
 1685    if (!strcmp(GetAccess(), 
"private")) decl += __add_indented_line(
"   // PRIVATE method", indentation);
 
 1686    else if (!strcmp(GetAccess(), 
"protected")) decl += __add_indented_line(
"   // PROTECTED method", indentation);
 
 1687    if (fFields.HasParameter(
"Body")) {
 
 1689       decl += __add_indented_line(fFields.GetStringValue(
"Body"), indentation);
 
 1692       if (fFields.HasParameter(
"ReturnType") && strcmp(fFields.GetStringValue(
"ReturnType"), 
"void")) {
 
 1694          return_dir += GetReturnType();
 
 1695          return_dir += 
")0;";
 
 1696          __add_indented_line(return_dir, indentation);
 
 1699    decl += __add_indented_line(
"}", indentation, 
kFALSE);
 
 1709    if (IsInline()) indentation = 
"   ";
 
 1710    if ((fNargs && !IsCopyCtor()) ||
 
 1711          ((IsCopyCtor() || IsDefaultCtor()) && fFields.HasParameter(
"BaseClass"))
 
 1712          || (IsCopyCtor() && !fParentClass->IsBaseClassTObject())) {
 
 1714       if (fFields.HasParameter(
"BaseClass")) {
 
 1716          decl += fFields.GetStringValue(
"BaseClass");
 
 1718          if (!IsCopyCtor() && fNargs) {
 
 1719             Int_t base_args = 0;
 
 1720             for (
int i = 1; i <= fNargs; i++) {
 
 1721                if (fFields.HasParameter(
Form(
"Arg_%d_baseclass", i))) {
 
 1723                   if (fFields.HasParameter(
Form(
"Arg_%d_name", i))) {
 
 1724                      if (base_args > 1) decl += 
", ";
 
 1725                      decl += fFields.GetStringValue(
Form(
"Arg_%d_name", i));
 
 1728                      if (base_args > 1) decl += 
", ";
 
 1729                      decl += 
Form(
"arg%d", i);
 
 1734          else if (IsCopyCtor() && !fParentClass->IsBaseClassTObject()) {
 
 1736             decl += fFields.GetStringValue(
"Arg_1_name");
 
 1739          if ((fNargs && !IsCopyCtor() && fParentClass->GetNumberOfMemberVariables())
 
 1740                || (IsCopyCtor() && !fParentClass->IsBaseClassTObject() && fParentClass->GetNumberOfMemberVariables())) decl += 
", ";
 
 1742       if (fParentClass->GetNumberOfMemberVariables()) {
 
 1744          if (!IsCopyCtor() && fNargs) {
 
 1746             for (
int i = 1; i <= fNargs; i++) {
 
 1747                if (fFields.HasStringParameter(
Form(
"Arg_%d_memvar", i))) {
 
 1748                   if (mem_vars) decl += 
", ";
 
 1749                   decl += fFields.GetStringValue(
Form(
"Arg_%d_memvar", i));
 
 1751                   decl += fFields.GetStringValue(
Form(
"Arg_%d_name", i));
 
 1757          else if ((IsCopyCtor() && !fParentClass->IsBaseClassTObject())) {
 
 1758             TIter it(fParentClass->GetListOfMembers());
 
 1762                if (imem) decl += 
", ";
 
 1765                decl += fFields.GetStringValue(
"Arg_1_name");
 
 1767                decl += 
m->GetRealName();
 
 1775    decl += __add_indented_line(
"{", indentation);
 
 1776    if (!strcmp(GetAccess(), 
"private")) decl += __add_indented_line(
"   // PRIVATE constructor", indentation);
 
 1777    else if (!strcmp(GetAccess(), 
"protected")) decl += __add_indented_line(
"   // PROTECTED constructor", indentation);
 
 1778    if (fFields.HasParameter(
"Body")) {
 
 1780       decl += __add_indented_line(fFields.GetStringValue(
"Body"), indentation);
 
 1782    decl += __add_indented_line(
"}", indentation, 
kFALSE);
 
 1797    if (fFields.HasParameter(
"Comment")) {
 
 1799       KVString comment(fFields.GetStringValue(
"Comment"));
 
 1800       comment.
Begin(
"\n");
 
 1803       while (!comment.
End()) {
 
 1805          if (
line.Length() > longest) longest = 
line.Length();
 
 1809       while (longest--) decl += 
"/";
 
 1811       comment.
Begin(
"\n");
 
 1812       while (!comment.
End()) {
 
 1820    decl += GetReturnType();
 
 1821    if (IsNormalMethod()) {
 
 1826    if (IsNormalMethod())
 
 1833    for (
int i = 1; i <= fNargs; i++) {
 
 1834       decl += fFields.GetStringValue(
Form(
"Arg_%d", i));
 
 1835       if (fFields.HasParameter(
Form(
"Arg_%d_name", i))) {
 
 1837          decl += fFields.GetStringValue(
Form(
"Arg_%d_name", i));
 
 1840          decl += 
Form(
" arg%d", i);
 
 1841       if (i < fNargs) decl += 
", ";
 
 1844    if (fConst) decl += 
" const";
 
 1845    write_method_body(decl);
 
 1916    if (!(i > 0 && i <= fNargs + 1)) {
 
 1917       Error(
"AddArgument(Int_t i, ...)", 
"Must be called with i>0 & i<=%d", fNargs + 1);
 
 1921    if (i == fNargs + 1) { 
 
 1922       AddArgument(
type, argname, defaultvalue);
 
 1926    for (
int j = fNargs; j >= i; --j) {
 
 1927       if (fFields.HasStringParameter(
Form(
"Arg_%d", j))) {
 
 1928          fFields.SetValue(
Form(
"Arg_%d", j + 1), fFields.GetStringValue(
Form(
"Arg_%d", j)));
 
 1929          fFields.RemoveParameter(
Form(
"Arg_%d", j));
 
 1931       if (fFields.HasStringParameter(
Form(
"Arg_%d_name", j))) {
 
 1932          fFields.SetValue(
Form(
"Arg_%d_name", j + 1), fFields.GetStringValue(
Form(
"Arg_%d_name", j)));
 
 1933          fFields.RemoveParameter(
Form(
"Arg_%d_name", j));
 
 1935       if (fFields.HasIntParameter(
Form(
"Arg_%d_baseclass", j))) {
 
 1936          fFields.SetValue(
Form(
"Arg_%d_baseclass", j + 1), fFields.GetIntValue(
Form(
"Arg_%d_baseclass", j)));
 
 1937          fFields.RemoveParameter(
Form(
"Arg_%d_baseclass", j));
 
 1939       if (fFields.HasStringParameter(
Form(
"Arg_%d_default", j))) {
 
 1940          fFields.SetValue(
Form(
"Arg_%d_default", j + 1), fFields.GetStringValue(
Form(
"Arg_%d_default", j)));
 
 1941          fFields.RemoveParameter(
Form(
"Arg_%d_default", j));
 
 1946    fFields.SetValue(
Form(
"Arg_%d", i), _type);
 
 1947    if (strcmp(defaultvalue, 
"")) {
 
 1949       fFields.SetValue(
Form(
"Arg_%d_default", i), _s);
 
 1951    if (strcmp(argname, 
"")) {
 
 1953       fFields.SetValue(
Form(
"Arg_%d_name", i), _s);
 
 1967    cout << 
"KVClassMethod object -----> " << 
GetName() << endl;
 
 1969    cout << 
"This method is " << GetAccess() << endl;
 
 1970    if (fConst) cout << 
"This method is CONST" << endl;
 
 1971    if (fVirtual) cout << 
"This method is VIRTUAL" << endl;
 
 1982    cout << 
"KVClassMember object -----> " << 
GetType() << 
" " << 
GetName() << endl;
 
 1983    cout << 
"This member is " << GetAccess() << endl;
 
 2007    TIter next_ctor(constructors.get());
 
 2009    while ((method = (
TMethod*)next_ctor())) {
 
 2019       for (
int i = 1; i < method->
GetNargs(); i++) {
 
 2042       d->SetAccess(access);
 
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 filename
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
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 type
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
Base class for KaliVeda framework.
virtual const Char_t * GetType() const
static const Char_t * GetTEMPLATEDIRFilePath(const Char_t *namefile="")
static Bool_t SearchKVFile(const Char_t *name, TString &fullpath, const Char_t *kvsubdir="")
static Bool_t SearchAndOpenKVFile(const Char_t *name, KVSQLite::database &dbfile, const Char_t *kvsubdir="")
virtual void Copy(TObject &) const
Make a copy of this object.
Constructor for a class generated with KVClassFactory.
void SetBaseClassArgument(Int_t i)
void SetCopyCtor(Bool_t c=kTRUE)
virtual void write_method_body(KVString &decl)
void SetMemberVariableNameForArgument(Int_t i, const Char_t *memvar)
Destructor for a class generated with KVClassFactory.
Member variable in a class generated with KVClassFactory.
virtual void WriteDeclaration(KVString &)
Write declaration in the KVString object.
void Print(Option_t *="") const
print the KVClass member
void SetAccess(const Char_t *acc="public")
set access type : public, protected or private
const Char_t * GetRealName() const
get short name without leading 'f'
const Char_t * GetComment() const
get access type : public, protected or private
void Copy(TObject &obj) const
copy this to obj
Method in a class generated with KVClassFactory.
virtual void write_method_body(KVString &decl)
void SetMethodComment(const KVString &com)
void Print(Option_t *="") const
print the KVClass method
KVClassMethod(Bool_t Virtual=kFALSE, Bool_t Const=kFALSE, Bool_t Inline=kFALSE)
void SetConst(Bool_t c=kTRUE)
void WriteImplementation(KVString &decl)
void SetBaseClass(const Char_t *name)
void Copy(TObject &obj) const
copy this to obj
void WriteDeclaration(KVString &)
void AddArgument(const Char_t *type, const Char_t *argname="", const Char_t *defaultvalue="")
void SetReturnType(const Char_t *type)
void SetClassName(const Char_t *name)
void SetVirtual(Bool_t c=kTRUE)
Bool_t IsNormalMethod() const
void SetInline(Bool_t yes=kTRUE)
void SetMethodBody(const KVString &body)
Factory class for generating skeleton files for new classes.
void Print(Option_t *opt="") const
Print infos on object.
Bool_t fInlineAllCtors
kTRUE if all ctor implementations written in header
void WriteWhoWhen(std::ofstream &)
const Char_t * GetClassDesc() const
Bool_t WithMultipleBaseClasses() const
void SetTemplate(Bool_t temp, const Char_t *temp_file)
KVList fMembers
list of member variables for class
Bool_t fInlineAllMethods
kTRUE if all (non-ctor) method implementations written in header
void AddMethodComment(const Char_t *method_name, const KVString &comment)
Set the comments for method 'method_name' added to the class using AddMethod.
void WriteClassWithTemplateImp()
Writes the implementation file for the class.
KVString fTemplateClassName
name of template dummy class
void GenerateGettersAndSetters()
KVList fMethods
list of methods added to class
void AddTObjectCopyMethod()
void GenerateCode()
Generate header and implementation file for currently-defined class.
TDatime fNow
for dating files
Bool_t fHasBaseClass
kTRUE if class derived from another
void SetClassName(const Char_t *n)
const Char_t * GetImpFileName() const
KVString fTemplateCPP
full path to template .cpp
void AddMemberInitialiserConstructor(KVClassConstructor *=nullptr)
TClass * fBaseClass
description of base class
void WriteClassHeader()
Write the class header file.
KVString fClassDesc
class description
Bool_t fInheritAllCtors
kTRUE if all ctor from base class should be inherited
const Char_t * GetHeaderFileName() const
KVClassFactory()
Default ctor.
KVString fClassPath
directory in which to write source files, if not working directory
KVClassConstructor * GetDefaultCtor() const
static void MakeClass(const Char_t *classname, const Char_t *classdesc, const Char_t *base_class="", Bool_t withTemplate=kFALSE, const Char_t *templateFile="")
void AddHeaderIncludeFile(const Char_t *filename)
void Copy(TObject &obj) const
Copy the state of this KVClassFactory to the one referenced by 'obj'.
void AddDestructor(const TString &access="public")
Add default destructor to class.
void WriteClassDec(std::ofstream &)
void AddImplIncludeFile(const Char_t *filename)
KVString fTemplateH
full path to template .h
KVString fBaseClassName
name of base class
Bool_t CheckTemplateFiles(const Char_t *base_class, const Char_t *templateFile)
void AddDefaultConstructor()
const Char_t * GetClassName() const
void SetClassDesc(const Char_t *d)
void AddCopyConstructor()
void WritePreProc(std::ofstream &)
Int_t GetNumberOfMemberVariables() const
void AddMethodBody(const Char_t *method_name, const KVString &body)
Ssiz_t FindNextUncommentedLine(TString &, Ssiz_t beg=0)
const Char_t * GetBaseClass() const
void WriteClassWithTemplateHeader()
void AddAssignmentOperator()
void InlineAllMethods(bool yes=true)
Bool_t fBaseClassTObject
kTRUE if class derived from TObject
KVList fHeadInc
list of 'includes' to be added to header file
KVString fTemplateBase
template base name passed to SetTemplate method
void AddMethodArgument(const Char_t *method_name, const Char_t *argument_type, const Char_t *argument_name="", const Char_t *default_value="")
void InlineAllConstructors(bool yes=true)
KVString fClassName
name of class to generate
KVClassDestructor * GetDestructor() const
void SetBaseClass(const Char_t *b)
void AddGetSetMethods(const KVNameValueList &)
For each named parameter in the list, we add protected member variables with the name and type of the...
Bool_t fWithTemplate
true if class has a template
KVClassConstructor * AddConstructor(const Char_t *argument_type="", const Char_t *argument_name="", const Char_t *default_value="", const Char_t *access="public")
KVClassMember * AddMember(const Char_t *name, const Char_t *type, const Char_t *comment, const Char_t *access="protected")
KVString fAuthor
user who called ClassFactory to generate class
KVList fImpInc
list of 'includes' to be added to implementation file
void AddAllBaseConstructors()
KVClassMethod * AddMethod(const Char_t *name, const Char_t *return_type, const Char_t *access="public", Bool_t isVirtual=kFALSE, Bool_t isConst=kFALSE)
Extended version of ROOT THashList.
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
KVNamedParameter * GetParameter(Int_t idx) const
return the parameter object with index idx
Int_t GetNpar() const
return the number of stored parameters
A generic named parameter storing values of different types.
KVSeqCollection * GetSubListWithName(const Char_t *retvalue) const
KVSeqCollection * GetSubListWithMethod(const Char_t *retvalue, const Char_t *method) const
T * get_object(const TString &name) const
virtual Int_t GetSize() const
virtual void Add(TObject *obj)
virtual TObject * FindObjectByName(const Char_t *name) const
KVSeqCollection * GetSubListWithLabel(const Char_t *retvalue) const
virtual TObject * FindObject(const char *name) const
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
void Begin(TString delim) const
KVString Next(Bool_t strip_whitespace=kFALSE) const
TList * GetListOfMethods(Bool_t load=kTRUE)
virtual void Print(Option_t *option, const char *wildcard, Int_t recurse=1) const
virtual void AddAll(const TCollection *col)
virtual Int_t GetEntries() const
const char * AsString() const
TObject * First() const override
TObject * At(Int_t idx) const override
const char * GetFullTypeName() const
const char * GetDefault() const
virtual TList * GetListOfMethodArgs()
const char * GetName() const override
virtual void SetName(const char *name)
virtual const char * GetName() const
virtual void Warning(const char *method, const char *msgfmt,...) const
R__ALWAYS_INLINE Bool_t IsZombie() const
virtual void Copy(TObject &object) const
virtual void Error(const char *method, const char *msgfmt,...) const
virtual void Info(const char *method, const char *msgfmt,...) const
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
const char * Data() const
TString & Append(char c, Ssiz_t rep=1)
TString & Prepend(char c, Ssiz_t rep=1)
std::istream & ReadFile(std::istream &str)
TString & Remove(EStripType s, char c)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TString & ReplaceAll(const char *s1, const char *s2)
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
virtual UserGroup_t * GetUserInfo(const char *user=nullptr)
virtual const char * BaseName(const char *pathname)
RPY_EXPORTED bool IsDestructor(TCppMethod_t method)
Type GetType(const std::string &Name)