473,385 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

automatic source code

Hello NG,

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?
Greetings ,

Cedric Buerfent


Jul 22 '05 #1
5 1517
cedric buerfent 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?


You could use a macro key utility, such as Recorder, which came with Windows
3.1. That's just an example, it's a pathetic bit of work but it gives you
the right kind of thing to look for. I have never found such a program that
*really* pleased me. There is a thing called "Mouse and Key Recorder" which
is almost good. But it is demo ware which quits working after a while. Or
almost quits, I don't recall whether it is a full stop or a partial
disabling.

Some editors have such capability built in.
Jul 22 '05 #2
The Idea is rather simple:

- we take a header file

<click>

- we got an implementation file
I ve around 20 classes to "implement" and copy pasting is such a
straightforward-nonsense.

(I could rather spend my time in the "hardstuff" imlementationbodies )

I m using xemacs at work.

Im not sure if a "recorder" tool would satisfy our needs (for generic
use).

Perhaps its easier for me first to program such a tool :-)

(pseudo-code:
class keyword - hopp we got the class name,
new lines until class ends are our functions etc...)

Perhaps you guys know which "IDE" has this functionality-(plugin)?
(eclipse, kdevelop, xemacs, kwrite:-)? )
greetings,

cedric
On Wed, 14 Apr 2004 06:37:15 -0700, "osmium" <r1********@comcast.net>
wrote:
cedric buerfent 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?


You could use a macro key utility, such as Recorder, which came with Windows
3.1. That's just an example, it's a pathetic bit of work but it gives you
the right kind of thing to look for. I have never found such a program that
*really* pleased me. There is a thing called "Mouse and Key Recorder" which
is almost good. But it is demo ware which quits working after a while. Or
almost quits, I don't recall whether it is a full stop or a partial
disabling.

Some editors have such capability built in.


Jul 22 '05 #3
cedric buerfent wrote:
I m using xemacs at work.

Im not sure if a "recorder" tool would satisfy our needs (for generic
use).


Type "C-h C-i m emacs <RET> m keyboard macros <RET>".

--
Regards,
Buster.
Jul 22 '05 #4
Buster wrote:
Type "C-h C-i m emacs <RET> m keyboard macros <RET>".


Sorry, the "C-i" should be "i". Like this:
C-h i m e m a c s <return> m k e y b o a r d SPC m a c r o s <return>

--
Regards,
Buster.
Jul 22 '05 #5
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! =-----
Jul 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Rasmus Fogh | last post by:
Someone raised the question of automatic code generation a few weeks back. And yes, we (CCPN) are using automatic Python code generation in a major way. Basically we are making data models in...
7
by: svilen | last post by:
hello again. i'm now into using python instead of another language(s) for describing structures of data, including names, structure, type-checks, conversions, value-validations, metadata etc....
2
by: David Richards | last post by:
Hi, Hopefully someone can help me. I have setup a continuous form that displays customer names and addresses. I have then place a txt box on the form header. Using the onChange event I've setup...
7
by: Johann Blake | last post by:
It would be nice to have Visual Studio .NET automatically break into the code whenever an event is generated without having to explicity set a breakpoint. It often happens that when a piece of code...
7
by: Ben R. | last post by:
How does automatic type casting happen in vb.net? I notice that databinder.eval "uses reflectoin" to find out the type it's dealing with. Does vb.net do the same thing behind the scenes when an...
58
by: Jorge Peixoto de Morais Neto | last post by:
I was reading the code of FFmpeg and it seems that they use malloc just too much. The problems and dangers of malloc are widely known. Malloc also has some overhead (although I don't know what is...
3
by: Peter Hofmann | last post by:
When I change the source code and save it I have currently always to press explicitely F6 zu "compile" the code (and get new error list). Isn't there an automatic build function which is called...
3
by: Mark Poppers | last post by:
Assume the following sequence of user actions starting with a Form and an e.g. StatusStrip: 1.) User doubleclicks on the StatusStrip 2.) VisualStudio jumps to the new generated source code ...
0
by: cephal0n | last post by:
Hi All! I have two table tblHome1, contains all the unique PinNo and tblHome2 contains a duplicated PinNo and description. I put an automatic numbering (ProdID) and set it as my index. What I want...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.