cedric buerfent <ce***********@web.de> writes:
I ve a question concerning automatic generated source code.
When I program the declarations of a class (and save it in a file
called myclass.hh for example), its a boring work to create the .cc
"basics" (I mean the empty method bodies like void
myclass::afunction() {} , the constructors, the destructors, copy
constructors etc...)
Is there a way to automate this task?
Yup.
I preprocess my sources with GNU m4. My custom macros expand certain
text in the headers, and expand all the appropriate member variables
into "properties", each with a getter, setter, property, changed
signal and some other stuff (kind of like Glib::Object properties, but
not so advanced). In the header, it expands into all the prototypes
and member variables; in the source, it expands into the functions
themselves, plus boilerplate init code to place into the constructors.
This makes adding/changing "trivial" bits as simple as adding/changing
1 line in a header, leaving me free to concentrate on the interesting
stuff rather than cranking out hundreds of identical code snippets.
It seems you want something a bit less exciting: a template generator.
Why not write one yourself, which asks you a few questions (name of
the class, extra details etc.) and spits out a sample header.
Personally, I have a set of standard templates for headers and source
files, which I just copy and fill out--a simple search and replace
fills out the class name and include guards.
--
Roger Leigh
Printing on GNU/Linux?
http://gimp-print.sourceforge.net/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----