⚠️ Important note: still in development. Some bugs may appear
class.py className [...] create .cpp and .hpp files. You can specify as many class names as you want. Class are canonical
-I option create interface
-p prefix fileName with "Class" ex : ClassWarrior.hpp
-s suffix filename with ".class" ex : Warrior.class.hpp
class.sh className [...] same as class.py but with no option available
update.py [...] check all .cpp and .hpp files in actual directory and generate only necessary setter and getter. You can specify class name in arguments for specific class.
getSet.sh [...] same as update.py but in shell
run command with bash bash ./class.sh
or python3 python3 ./class.py
- Create class
python3 ./class.py Warrior
That will create 2 files, Warrior.cpp
#include "Warrior.hpp"
Warrior::Warrior(void){}
Warrior::Warrior(Warrior const & src)
{
*this = src;
}
Warrior::~Warrior(void)
{
}
Warrior & Warrior::operator=(Warrior const & rhs)
{
return *this;
}and Warrior.hpp
#ifndef WARRIOR
# define WARRIOR
class Warrior
{
public:
Warrior(void);
Warrior(Warrior const & src);
~Warrior(void);
Warrior & operator=(Warrior const &rhs);
private:
};
#endif
- Insert attributes you want
class Warrior
{
int mana;
public:
int life;
Warrior(void);
Warrior(Warrior const & src);
~Warrior(void);
Warrior & operator=(Warrior const &rhs);
private:
char *name;
};
⚠️ Only privates attributes will be considered
- launch update
python3 ./update.py
- Look at the results
class Warrior
{
int mana;
public:
int life;
Warrior(void);
Warrior(Warrior const & src);
~Warrior(void);
Warrior & operator=(Warrior const &rhs);
int getMana(void) const;
int setMana(int Mana);
char *getName(void) const;
int setName(char *Name);
private:
char *name;
};int Warrior::getMana(void) const
{
return this->mana;
}
int Warrior::setMana(int Mana)
{
this->mana = Mana;
return 0;
}
char *Warrior::getName(void) const
{
return this->name;
}
int Warrior::setName(char *Name)
{
this->name = Name;
return 0;
}