[Uml-devel] c# code generator

Ferenc Veres lion at netngine.hu
Sun Feb 18 01:33:27 UTC 2007


Hi all,

I've made the basics of a C# generator.
http://lion.xaraya.hu/csharpwriter.zip . Based on php5writer.cpp.

A few system files needs to be modified to compile and run, simply
search for csharp in the codes and uncomment. As I can see, the
necessary definitions were already there. Maybe the include on
codegenfactory.cpp and codegenerators/Makefile.am needs manual addition.

Note: I use name CSharp, not Csharp, like the old commented references,
please update while uncommenting! (I used V 1.5.61.)

It is absolutely unfinished. I have a lot of questions. If someone can
help to finish it, I'd appreciate. I'll send detailed questions here,
complete code snipsets would be the most useful reply, because I don't
know C++ well, I was just copy-pasting around! It is very hard to find
Umbrello classes and methods, even if I generated the doxygen html. :)

I've added "FIXME:" to most of these problems in the code.

1. Line #25

What is the big list of "words" in the beginning of the file, what to
put there? C# "commands"? No idea where to get a list like that. :-)

2. Line #3034

PHP5 generator used "require_once comlete-file-path-name.php" in place
of includes. I need to replace them with lines like:

using Utility.Scheduling;
using Utility.HtmlMeta;

(if we have a reference to anything file below Modules.Article, and so
on, but all matching lines should appear only once. E.g. inclusion of
two files from the same package should still result in one "using"
definition. I don't know if some string manipulation, or UML-class calls
could help! Adding our own "directory" should be suppressed.

2. Line #3050

I need a
namespace Modules.Article
{

In the beginning. Similar problem like above, but applying only to the
currently generated class' namespace.

3. Line #3090

I am not getting any output from generation of realizations. I guess
that should loop on the Interfaces assigned to the current class?

4. Line #3145

C# allows attributes in interfaces, if they are defined as Property. Not
important, maybe not even part of UML. Currently Umbrello allows adding
methods only. (A "C# property" is an active member variable. References
exactly look like if it was an attribute, but code can be included in
the implementation.)

5. Line #3263

Function parameter documentation cannot contain newlines in Visual
Studio documentation format. How to remove them in this line?

6. Line #3274

The return value documentation cannot be entered in Umbrello GUI. Maybe
not even part of UML? Thus I can put nothing useless in <returns>
documentation.

7. Line #3344

generateErrorstub is always false? I cannot see a GUI switch to allow
generation of VS2005-like default exception-throwing methods.

8. Line #3332

When writing the variable type of method properties, I get the whole
namespace name of it. I'd like to add only the last element of that. E.g.

public void GetStuff(Modules::Article::ArticleData article)
should be
public void GetStuff(ArticleData article)

9. Line #3450

Same (as 8.) applies to definitions of attributes. If I have a member
variable in that type, it is

public Modules::Article::ArticleData article;
but should be
public ArticleData article;

10. Line #3456

For public properties in C# I mostly use Property instead member
variable. I guess most programmers do. But we may need a GUI switch to
still generate normal member variables, not properties? Not Important.

11. General

I am generating Visual Studio like XML comments. I hope that's fine.
Doxygen can work with that too. I don't know what MONO users use!

Answers to only a few of these would also help! :-D Especially the ones
which would improve the output! :-)

Many thanks,
Ferenc Veres





More information about the umbrello-devel mailing list