R
Roberto Gori
Phlip said:If a legacy code had a poor design, I would work harder to fix that than
to adapt to it.
However, you can easily get your technique here:
http://www.codeproject.com/macro/metamacros.asp
i'm already faced to this kind of approach to link an enum to a vector of
strings but ...
could you give me an example on how to apply it to my case?
Are you thinking to something like this?
META(foo, bar, _m(type1) ident1, _m(type2) ident2, ...)
in this case is up to the developer to establish what's the type e what's
the identifier of the argument. Moreover for some types as the function
pointer type it's not simple to use that syntax without a typedef.
Since a complex system could contains a lot of events i would like to
generate automatically all the interfaces.
I would like to write in a text file something like that:
event_a, arg1_of_a, arg2_of_a, arg3_of_a
event_b, arg1_of_b, arg2_of_b
event_c, arg1_of_c, arg2_of_c, arg3_of_c, arg4_of_c
and for each declaration i would like to generate a header and a source
files (event_?.h event_a.cpp) containing the implementation of the
event/observer pattern for each event. The classes differ for the argument
list only.