Code generator for accessors methods

Luca Bellonda lbellonda at gmail.com
Wed Nov 2 22:31:00 UTC 2011


Hi to all, I just started a project on Google Code to generate getters
and setters for C++ classes when using Qt,
code.google.com/p/qaccessorsgen (GPL license).

The project is not ready to production, although it can be already
useful, it can save a lot of typing.

It is split in two parts, ui and backend library, so you can use the
generator as a plugin for your IDE, since it returns metainformations
(getters name, etc...) about generated code.
The library will be extended to use conventions like member variable
prefix, use automatically 'is' for boolean variables and so on...

You will find a sample output at the end of the mail for the arguments:
"MyClass QString name"

If you think that it will be useful to KDevelop as a plugin, you can contact me.

bye

Luca Bellonda



----------------------------
DECLARATIONS:
QString _name;

Q_PROPERTY(QString name READ name WRITE setName)

QString name();

void setName(const QString& value);

----------------------------
IMPLEMENTATION:
QString MyClass::name()
{
    return _name ;
}


void MyClass::setName(const QString& value)
{
    _name = value ;
}




More information about the KDevelop-devel mailing list