[Uml-devel] Re: DataTypes and Codegenerators
thomas at pressroom.com
Sun Mar 16 19:24:15 UTC 2003
On Sunday 16 March 2003 03:13 pm, various people wrote:
> On Sat, 15 Mar 2003, BARTKO, Zoltan wrote:
> > I have a need to develop a SQL-code generator for Umbrello. There is one,
> > and yes, I do help Nikolaus Gradwohl (the original author) with it.
> > Since SQL is mostly different than Java, Cpp, or any object-oriented
> > language, even if PostgreSQL claims to be an ORDBMS, (My final year
> > project I am working on was designed in UML and the backend should be
> > written in SQL) I was thinking of the following:
> > * Add the possibility of switching sets of types with "a flick of the
> > wrist" and be able to choose the set of types that should appear in the
> > pull-down lists when defining the types of attributes and operators:
> > * UML default
> > * Java
> > * Cpp
> > * SQL
> > * etc.
> Maybe adding a virtual method getDefaultAttributesTypeList() to
> codegenerator could work, then the list is populated with those values in
> the current Active Language.
I think the actual solution here is to allow the code generator to map from
the UML type to whatever is desired. I agree that for each language, you
may want a variety of datatype name mappings, for example in C++ the
UML "int" => uint8 or "int" (or ..) and UML "string" to char or QString
(or some other string var). Same argument with Java "int" to "Integer" or "int"
.. and so on.
The thing here is NOT to code this into the general codegenerator class since its
language specific. IF we had a template system (such as Im working on)
you could then select these sorts of parameters (and store your preferences in
the template) based on the code you want to generate. This is just the
sort of thing that you would find in a "global" parameter set I have previously described,
and I plan to make it available (various code generator maintainers can then
configure the available typename mappings to their heart's content without disturbing
the other codegenerator code).
I understand the point about most people not using Qt libraries, so, for the time being,
the C++ codegenerator patch I am preparing will have some global variables,
TYPENAME_STRING and TYPENAME_VECTOR which will be set to "char" and
"vector" (is that a legal construct in C++??, can someone suggest something better
like just list the objects, e.g. Obj ?). Of course, you can always edit the C++ code
generator and recompile to have your preferred typenames.
> Jonathan Riddell
> Uml-devel mailing list
> umbrello-devel at kde.org
> End of Uml-devel Digest
More information about the umbrello-devel