File: README

package info (click to toggle)
dia2code 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,384 kB
  • sloc: cpp: 8,163; sh: 4,280; php: 289; cs: 267; java: 219; makefile: 49; ansic: 38
file content (1104 lines) | stat: -rw-r--r-- 31,172 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
Dia2Code v. 1.0.0

SUMMARY

This program generates code for many languages from an UML Dia Diagram.


DESCRIPTION

This program is a small utility that makes code from a Dia diagram. Supported
target languages are: C++(99,11), C#, Java, PHP5.
Starting version 1.0.0, the program was completely rewritten in C++.
Target languages still to be ported from the dia2code-0.8.x C implementation are:
ActionScript3, Ada, C, Python, Ruby, shapefiles, and SQL create statement files.

Its intended purpose is to ease the programmer's work by generating
the structure of the classes in an Object Oriented language
(like C++, Java and C#) from a graphical representation of them
(a Dia Diagram).


STATUS

Dia2Code generates C++(99,11), C#, Java, PHP.
Templates and packages are supported.
In the future, it will be able to generate ActionScript, Ada, C, IDL, Python, Ruby,
shape files, and SQL's CREATE TABLE statements.
For the time being, if you require any of these languages, please continue to use
the dia2code-0.8.x C based implementation.

The generation of #include and import directives is automatically done
considering the types used in each class but they may be added by dependencies.
Classes are automatically searched in the types of:
attributes, method's return types, method's parameters, parents, dependencies
and associations.

Dia2Code handles Associations, Dependencies, Realizations, Implements and
Generalizations.

Feel free to have a try and send me your comments.


LICENSE

This program is distributed under the GNU GPLv3.
Read the COPYING file for details.


REQUIREMENTS

Works under Linux (i386 and x64) and Win32/Win64.
Feedback about other platforms is welcome.

- Dia (I work with 0.97.2 but older versions *may* be OK).
- libxml2 headers and development libraries (I use 2.9 but it *may* be
  OK if you use any version greater than 2.0).
- A C++ compiler which supports C++11 standard (>=gcc 4.6).
- automake and autoconf (actually, optional)


INSTALLATION

Usually:

        $ ./configure --with-corba

        $ make

        $ make check

        # make install

Read the INSTALL file for details.

If that doesn't work for you, try (from the src's dia2code directory):

        $ g++ -std=c++11 -I/usr/include/libxml2 *.cpp -O2 -o dia2codetest -lxml2 -I..

        $ strip dia2code

To cross-compiling from Linux (build=x86_64-pc-linux-gnu):
        - To Win32, with package cross-i686-pc-mingw32/gcc:
        # ./configure --disable-static --enable-shared --build=x86_64-pc-linux-gnu --host=i686-pc-mingw32

        - To Win64, with package cross-x86_64-w64-mingw32/gcc:
        # ./configure --disable-static --enable-shared --build=x86_64-pc-linux-gnu --host=x86_64-w64-mingw32

        - To Linux32:
        # ./configure --disable-static --enable-shared -m32

        - To Linux64:
        # ./configure --disable-static --enable-shared -m64


OPERATION

    $ dia2code <parameters>

Where <parameters> can be any combination of:

-h --help            Print this help and exit.
-d <dir>             Output generated files to <dir>, default is "."
--buildtree          Convert package names to a directory tree.
                     Imply -1. Off by default.
-l <license>         License file to prepend to generated files.
-nc                  Do not overwrite files that already exist.
-cl <classlist>      Generate code only for the classes specified in
                     the comma-separated <classlist>.
                     E.g: Base,Derived.
-v                   Invert the class list selection.  When used
                     without -cl prevents any file from being created.
--version            Show version x.y.z.
--tab <number>       Set number of spaces for one indentation.
                     Default: 4. Maximum: 8.
-ext <extension>     Use <extension> as the file extension.
                     Here are the defaults:
                     ada:"ads", c:"h", cpp:"hpp", idl:"idl",
                     java:"java", php:"php", python:"py",
                     csharp:"cs".
                     Not applicable to shp, sql.
-bext <extension>    Use <extension> as the body (implementation) file
                     extension. Only applies to ada and c.
                     Here are the defaults:
                     ada:"adb", c:"c".
-nl                  Create new line on new brace. Off by default.
-1                   One header contains only one header. If two classes
                     have the same name, they will be overwritten without
                     --buildtree.
                     Off by default but java.
-t <target>          Selects the output language. <target> can be one of:
                     ada,as3,c,cpp,cpp11,csharp,idl,java,php,php5,python,
                     ruby,shp,sql.
<diagramfile>        The Dia file that holds the diagram to be read.

The only mandatory parameters are the diagram file name and the target.

Note: Parameters can be specified in any order.


EXAMPLES

    $ dia2code -t java test.dia

    Will generate the *.java files for the classes in the test.dia diagram
    and put them in the current directory.

    $ dia2code -t cpp -nc -d ~/C++ hw.dia

    Will generate the *.cpp and *.h files for the classes in the test.dia
    diagram and put them in the directory ~/C++. It won't overwrite any
    existant file.

    $ dia2code -t java -cl Base,Derived test.dia

    Will create the Java files only for classes "Base" and "Derived".

    $ dia2code -t cpp -cl B*,*Foo test.dia

    Will create the *.hpp files for classes that begin with "B" or
    end with "Foo".
    NOTE: You can only specify one asterisk and either at the beginning or end
    of the pattern.
    NOTE2: You may have to quote the asterisks when typing on the shell
    (e.g. "\*" instead of "*")

    $ dia2code -t cpp -cl Foo -v foobar.dia

    Will create C++ code for all classes but "Foo".

    $ dia2code -t cpp -v test.dia

    Will not create any files. Don't know if it may be useful, but it surely
    is syntactically correct.


NOTES ON UML

What you should put into your diagram

These are mandatory:

- A non-empty class or package name.
- For each attribute, the name and type.
- For each method, the name.
- For each method's parameter, the name and type.

These are optional:

- The stereotype of the class.
- The default value of attributes.
- The default value of parameters.
- The return type of a method. If no type is declared, dia2code
  will output no type at all for it.


OUTPUT

This section shows some examples of UML diagram converted to code without use
of stereotype.
Lines starting with double stars are comments to explain the process of the
generation of the code.

Common:
If -1 and --buildtree are not specified, the name of each file will be the
class name (if not in a package) and the name of the top package either.
If -1 or --buildtree is specified, the filename will be the class name.


C++ generator:
** The license if specified in command line (-l option).
/*
File bit-by-bit.
 */

** Header guard
#ifndef README__HPP
#define README__HPP

** Dependencies
#include "dependencies.hpp"

** Templates
template <type template>

** Namespace if classes are in package.
namespace package {
    ** Class with inheritance if necessary.
    class Class : public ParentClass {
        ** Visibility of the attribute / operation. Public, private, protected
        ** are supported. Implementation is not, default will be public.
        ** Attributes will be printed first, then operations.
        // Attributes
        ** Default values are ignored for attributes.
        public :
            ** Comments are in doxygen format.
            /// Comment for the first
            /// attribute.
            type1 nom1;
        private :
            /// Example of static attribute.
            static type2 nom2;
        protected :
            type3 nom3;
        // Operations
        public :
            /**
             * \class AbstractOperation
             * \brief Multiple line
             *        comment
             */
            ** An abstract operation must not be defined thus " = 0".
            virtual AbstractOperation () = 0;
            ** A virtual operation must be defined in the source code.
            virtual VirtualOperation ();
            NonAbstractOperation ();
            /**
             * \brief comment
             * \param in (in)
             * \param inOut (in/out) comment2
             * \param undef (???)
             * \param out (out)
             */
            virtual type test (type1 in, type2 inOut, type3 undef = 0, type4 out) = 0;
            static test2 ();
            test3 () const;
    };
}

** End of header guard
#endif


C++11 generator:
** The license if specified in command line (-l option).
/*
File bit-by-bit.
 */

** Header guard
#ifndef README__HPP
#define README__HPP

** Dependencies
#include "dependencies.hpp"

** Templates
template <type template>

** Namespace if class are in package.
namespace package {
    ** Class with inheritance if necessary.
    public class Class : public ParentClass {
        ** Visibility of the attribute / operation. Public, private, protected
        ** are supported. Implementation is not, default will be public.
        ** Attributes will be print first, then operations.
        // Attributes
        ** Default values are ignored for attributes.
        public :
            ** Comments are in doxygen format.
            /// Comment for the first
            /// attribute.
            type1 nom1;
        private :
            /// Exemple of static attribut.
            static type2 nom2;
        protected :
            type3 nom3;
        // Operations
        public :
            /**
             * \class AbstractOperation
             * \brief Multiple line
             *        comment
             */
            ** An abstract operation must not be defined thus " = 0".
            virtual AbstractOperation () = 0;
            ** A virtual operation must be defined in the source code.
            virtual VirtualOperation ();
            NonAbstractOperation ();
            /**
             * \brief comment
             * \param in (in)
             * \param inOut (in/out) comment2
             * \param undef (???)
             * \param out (out)
             */
            virtual type test (type1 in, type2 inOut, type3 undef = 0, type4 out) = 0;
            static test2 ();
            constexpr test3 ();
    };
}

** End of header guard
#endif


C# generator:
https://msdn.microsoft.com/en-us/library/ms228500%28v=vs.90%29.aspx

XML Documentation Comments
https://msdn.microsoft.com/en-us/library/b2s063f7.aspx

** The license if specified in command line (-l option).
/*
File bit-by-bit.
 */

** No header guard

** Dependencies
using dependencies;

** Templates
template <type template>

** Namespace if classes are in package.
namespace package {
    ** Class with inheritance and templates if necessary.
    public class Class <template> : ParentClass where template : type  {
        ** Attributes will be printed first, then operations.
        // Attributes
        ** Comments are in XML format.
        /// <summary>com1</summary>
        public type1 nom1 = val1;
        private static type2 nom2;
        protected type3 nom3 = val3;
        // Operations
        public abstract AbstractOperation ();
        public virtual VirtualOperation ();
        public NonAbstractOperation ();
        /// <summary>comment</summary>
        /// <param name="in">(in)</param>
        /// <param name="inOut">(in/out) comment2</param>
        /// <param name="undef">(???)</param>
        /// <param name="out">(out)</param>
        /// <returns>type</returns>
        public abstract type test (type1 in, type2 inOut, type3 undef = 0, type4 out);
        public static test2 ();
        ** There is no const function in C#.
        public test3 ();
    };
}


Java generator:
Convention naming:
http://www.oracle.com/technetwork/java/codeconventions-135099.html

Packages: all-lowercase ASCII letters and should be one of the top-level domain
names, currently com, edu, gov, mil, net, org, or one of the English two-letter
codes identifying countries as specified in ISO Standard 3166, 1981.
com.sun.eng
com.apple.quicktime.v2
edu.cmu.cs.bovik.cheese

Classes or Interfaces:
Class names should be nouns, in mixed case with the first letter of each
internal word capitalized.
class Raster;
class ImageSprite

Methods:
Methods should be verbs, in mixed case with the first letter lowercase, with
the first letter of each internal word capitalized.
run ();
runFast ();

Variables:
Except for variables, all instance, class, and class constants are in mixed
case with a lowercase first letter. Internal words start with capital letters.
Variable names should not start with underscore _ or dollar sign $ characters,
even though both are allowed.
int             i;
char            c;
float           myWidth;

Constants:
The names of variables declared class constants and of ANSI constants should be
all uppercase with words separated by underscores ("_").
static final int MAX_WIDTH = 999;


** The license if specified in command line (-l option).
/*
File bit-by-bit.
 */

** No header guard

** Dependencies
import Dependencies;

** If class are in package.
package Pack;

** Class with inheritance and templates if necessary.
public class Class <template extends type> extends ParentClass {
    ** Attributes will be printed first, then operations.
    // Attributes
    ** Comments are in doxygen format.
    /**
     * comment.
     */
    public type1 nom1 = val1;
    private static type2 nom2;
    protected type3 nom3 = val3;
    // Operations
    public abstract AbstractOperation ();
    public VirtualOperation ();
    public final NonAbstractOperation ();
    /**
     * comment
     * @param in (in)
     * @param inOut (in/out) comment2
     * @param undef (???)
     * @param out (out)
     * @return type
     */
    ** There is no default param in Java.
    public abstract type test (type1 in, type2 inOut, type3 undef = 0, type4 out);
    public static test2 ();
    ** There is no const function in Java.
    public test3 ();
}


STEREOTYPES

Multiple stereotypes can be applied on each class, attribute, operation,
inheritance and dependence by separating them with a "," without space.
For example (without quotes): "interface,getset".


- Inheritance or Realization of an interface:

By default, all inheritances are public. Some languages, like C++, allow a
different visibility like protected or private.
Possible value: public, private, protected, implementation.

C++ and C++11 generator:
** The stereotype of Generalization (or Realizes) of three classes are public,
** protected and private.
** Implementation visibility is not applicable to C++ generator.
class InheritanceClasseChildren : public InheritanceClasseImplement, protected InheritanceClasseProtected, private InheritancePack1::InheritanceClassePrivate {
};

C# generator:
** Generalization are public only.
class InheritanceClasseChildren : InheritanceClasseImplement : InheritanceClasseProtected : InheritanceClassePrivate {
};

Java generator:
** In Java, Generalization are public only.
class InheritanceClasseChildren extends InheritanceClasseImplement extends InheritanceClasseProtected extends InheritancePack1.InheritanceClassePrivate {
};



- Classes:

CORBAValue:
----------
  To enable Corba to a class, the stereotype must be CORBAValue.

GetSet
------
  Generate all get/set functions of all attributes. Their visibility will be
  public. If you want to be able to customize the visibility of the functions
  or generate get/set only for specifics attributes, use instead GetSet
  stereotype on operation.

  A "T getA ();" method, with return type conformant to the type of the
  attribute. If the type of the attribute is boolean (boolean, Boolean or bool)
  then the name will be: "T isA ()".

  A "void setA (T value);" method, with a parameter, "value", with type
  conformant to the type of the attribute.

C++ generator:
** The stereotype of the class is GetSet.
// Stereotype : GetSet
public class GetSet {
    // Attributes
    private :
        char * nom;
        bool boole;
    // Operations
    public :
        char * getNom () const;
        void setNom (char * value);
        bool isBoole () const;
        void setBoole (bool value);
}


C++11 generator:
** The stereotype of the class is GetSet.
// Stereotype : GetSet
public class GetSet {
    // Attributes
    private :
        char * nom;
        bool boole;
    // Operations
    public :
        constexpr char * getNom ();
        void setNom (char * value);
        constexpr bool isBoole ();
        void setBoole (bool value);
}


C# generator:
// Stereotype : GetSet
public class GetSet {
    // Attributes
    public type nom;
    /// <summary>com2</summary>
    private bool boole;
    // Operations
    public type Nom {
        get {
        }
        set {
        }
    }
    public bool Boole {
        get {
        }
        set {
        }
    }
}


Java generator:
** The stereotype of the class is GetSet.
// Stereotype : GetSet
public class GetSet {
    // Attributes
    private char * nom;
    private bool boole;
    // Operations
    public char * getNom () {
    }
    public void setNom (char * value) {
    }
    public bool isBoole () {
    }
    public void setBoole (bool value) {
    }
}


const, constant, Const, Constant or CORBAConstant:
-----  --------  -----  --------    -------------

TODO


enum, enumeration, Enum, Enumeration or CORBAEnum:
----  -----------  ----  -----------    ---------

Generate an enum class. Only attributes will be used. Template or function are
ignored.


C++ generator:
/// Comment of the enum
enum enumeration {
    /// Comment ENUM_1
    ENUM_1 = 0,
    /// Comment ENUM_2
    ENUM_2,
    /// Comment ENUM_3
    ENUM_3
};


C++11 generator:
/// Comment of the enum
enum class enumeration {
    /// Comment ENUM_1
    ENUM_1 = 0,
    /// Comment ENUM_2
    ENUM_2,
    /// Comment ENUM_3
    ENUM_3
};


C# generator:
/// <summary>Comment of the enum</summary>
public enum enumeration {
    /// <summary>enum1</summary>
    ENUM_1 = 0,
    /// <summary>enum2</summary>
    ENUM_2,
    ENUM_3
};


Java generator:
/**
 * Comment of the enum
 */
public enum enumeration {
    /// Comment ENUM_1
    ENUM_1 = 0,
    /// Comment ENUM_2
    ENUM_2,
    ENUM_3
};


struct, structure, Struct, Structure, or CORBAStruct:
------  ---------  ------  ---------     -----------

A structure is almost the same as a class.


C++ and C++11 generator:
** In C++, all attributes and operations are public.
/// Comment about the structure.
struct structure {
    // Attributes
    /// com1
    type1 nom1;
    /// com2-1
    /// com2-2
    type2 nom2;
    type3 nom3;
    // Operations
    void operation (type1 attr1);
};


C# generator:
public struct structure {
    /// <summary>com1</summary>
    public type1 nom1;
    /// <summary>com2-1
    /// com2-2</summary>
    public type2 nom2;
    public type3 nom3;
    public void operation (type1 attr1) {
    }
};


Java generator:
** In Java, structure is not defined. The equivalent is a class.
/**
 * Comment about the structure.
 */
public class structure {
    // Attributes
    /**
     * com1
     */
    public type1 nom1;
    /**
     * com2-1
     * com2-2
     */
    private type2 nom2;
    protected type3 nom3;
    // Operations
    public void operation (type1 attr1) {
    }
};


typedef, Typedef or CORBATypedef:
-------  -------    ------------

A typedef defines a type as a derivated of another one.
The name of the new type is the name of the classe.
The name of the derivated type is the name of the first attribute.
All other information is ignored.
Not applicable in Java.


C++ and C++11 generator:
#include "Pack.hpp"

typedef PrimitiveType NewType1;
typedef Pack::ClassType NewType2;

C# generator:
using Pack;

public class AliasOfMyClass : MyClass {}
public class ArrayOfBool : bool[3][10] {}


Java generator:
import Pack.ClassType;

class NewType1 extends PrimitiveType {}
class NewType2 extends Pack.ClassType {}


extern:
------
Define a external class. Usefull for external dependencies when you don't want
to generate the class' source.
IMPORTANT for C++ generator: because extern can define a system header <list>
or a header for another <Class.hpp>, no extension will be automatically added.
If a class implements such external class, the extension (if so) will be
removed.


C++ and C++11 generator:
#include <Pack/Class.hpp>


C# generator:
using Pack;


Java generator:
import Pack.Class;


interface, Interface:
---------  ---------
Define a interface. The class will be automatically considers as a interface if
a Realization or a Implementation link are pointing to it.


C++ and C++11 generator:
class Interface2 {
};


C# generator:
public interface Interface2 {
}


Java generator:
public interface Interface2 {
}


dllexport, DllExport:
---------  ---------
Force some signature to be store in a Microsoft Library Manager (lib).


C++ and C++11 generator:
class DllExport operations {
}
// Don't forget to add a #define:
// #define DllExport __declspec (dllexport)


C# generator:
Java generator:
PHP gerenator:
not supported


- Operation:

delete, Delete:
------  ------
In C++11, a deleted function must be defined in the header.
Not applicable in C# and Java.

C++ generator:
** In C++, there is no keyword for function hiding (as `delete` in C++11).
** So the common way to delete a function (like copy constructor) is to make
** the function private and not define it in source.
class operations {
    private :
        test5 ();
}


C++11 generator:
class operations {
    public :
        test5 () = delete;
}


C# generator:
** Not applicable in C#.
class operations {
    public test5 () {
    }
}


Java generator:
** Not applicable in Java.
class operations {
    public test5 () {
    }
}


GetSet:
------
This feature will generate the same output as GetSet for class except it will
respect the visibility of the operation. You also need to define the attribute.


dllexport, DllExport:
---------  ---------
Force some signature to be stored in a Microsoft Library Manager (lib).


C++ and C++11 generator:
class operations {
  DllExport test ();
}
// Don't forget to add a #define:
// #define DllExport __declspec (dllexport)


C# generator:
Java generator:
PHP gerenator:
not supported


- Attributes:

Some stereotypes are supported that all begin with "CORBA". These are:
CORBAConstant, CORBAEnum, CORBAException, CORBANative, CORBATypedef,
CORBAStruct, CORBAUnion, CORBAValue.
When generating IDL, the corresponding IDL syntax is generated for the UML
class. When generating other languages, a rough mapping from the IDL to the
other language is generated.

The following conventions are followed by the code generation for CORBA
stereotypes:

Constant   First attribute's type contains the const type; first attribute's
           value contains the const's value. Everything else unused.
Enum       Attribute names contain the enum literals, everything else unused.
Exception  TODO.
Native     TODO.
Typedef    First attribute's type contains the original type;
           first attribute's value optionally contains the dimensions
           in case of an array. Everything else unused.
Struct     Attribute names and types contain the struct members.
           Everything else unused.
Union      First attribute's type contains the switch type. Only
           enum types are supported as the switch type.
           Following attributes contain the union cases as follows:
           Attribute value contains the switch value for the case
           (only exactly one value possible per case); attribute
           name and type contains the union member name and type
           for that case.
           Everything else unused.
Value      Use much like a normal class. Staticness not supported.


- Dependency:

NoLoop, noloop
------  ------
In C/C++, circular dependencies are really messy with include and only the user
can handle it. Adding a "NoLoop" stereotype will disable the "#include" for the
connection.


MISCELLANEOUS

Visibility

Dia2Code does not handle the "implementation" visibility for methods.
So when you have a class that implements a method that was declared
abstract in a base class, you have to give it the same visibility of the
parent class' method. The visibility of the method is not printed if it is
"implementation"; this may be a source of bugs.


Method's return type

If you leave the "type" entry in the method declaration empty, then no
type will be declared for it. This is useful with constructors, when the
return type is implicit (both in C++ and Java). If the return type is
void, you should explicitly declare it in the UML diagram.


Packages

The UML standard states that there are two ways of representing packages:
a large box with all the elements inside (Large Package in Dia) or a small box
(Small Package in Dia) to which the package's elements connect with a symbol
that Dia does not include: a line with a crossed out circle in the end of the
container. You can put a normal line with a "Coordiate origin" arrow at one
end, of course, and will be aesthetically correct, but of no use to Dia2Code.

Dia2code, currently, checks only for intersections of packages (Large or
Small) with other objects like classes and other packages, so it will
be mostly useful with diagrams that use Large Packages instead of Small
ones.


INFORMATION FOR DEVELOPERS

How it works:

1. Parse the diagram file with xmlParseFile().
2. Parse the tree generated in 1 for UML classes to build an
   umlclasslist (type defined here).
3. Parse the tree again for UML Generalizations, Realizations,
   Implements, Dependencies, Associations and packages to add information
   to the class list.
4. Generate the structure of the classes (write it into files)
   from the class list.

Steps 1-3 are done in parse_diagram ().
Step 4 is done in GenerateCode* ().
Both functions are called from main ().


Code Generators:

**IMPORTANT**: When a modification is done in a generator, BE SURE to do the
same with all generators if necessary.

A code generator (class derived from GenerateCode) is a class that takes 
reference to a DiaGram class.

The DiaGram class contains:
  - std::list <umlClassNode> uml; // a list of all class nodes.

The GenerateCode class contains:
  - DiaGram &   dia;           // a reference to a DiaGram class.
  - std::string license;       // file that contains the license.
  - std::string outdir;        // folder where to write the headers.
                               // empty for current folder.
  - std::string file_ext;      // extension of header.
  - std::string body_file_ext; // extension of body file (if usefull).

  - uint8_t     indent : 4; // number of space of each indent.
    uint32_t    getIndent () const;
    void        setIndent (uint8_t spaces);

  - bool        overwrite : 1; // allow overwriting existing file.
    bool        getOverwrite () const;
    void        setOverwrite (bool over);

  - bool        buildtree : 1; // create one folder for each package.
    bool        getBuildTree () const;
    void        setBuildTree (bool build);

  - bool        bOpenBraceOnNewline : 1; // open brace on new line.
    bool        getOpenBraceOnNewline () const;
    void        setOpenBraceOnNewline (bool newline);

  - bool        oneClassOneHeader : 1; // Only one class par header.
    bool        getOneClass () const;
    void        setOneClass (bool val);


New generator:

The new generator is a class that inherits from GenerateCode. All virtual
functions must be overridden. Developers can get an idea on how to write a
new generator by having a good look inside GenerateCodeCpp.cpp.

  - writeLicense ();
Write the license at the top of each header. The characters that start and end
multiple line comments must be added before and after the file.
The license is specified by the attribute license.

  - writeStartHeader (std::string & name);
Write the mechanism that avoids multiple inclusion (applies to C/C++).
  - writeEndHeader ();
Finish the mechanism that avoids multiple inclusion.

  - writeInclude (std::basic_string <char> name);
  - writeInclude (const char * name);
Write the instruction that includes a file (header).

  - writeFunctionComment (const umlOperation & ope);
Write the comment for a function and its parameters. Use well-known format.
C++ uses doxygen format.

  - writeFunction (const umlOperation & ope, int * curr_visibility);
Write the header of a function. The current visibility is used to avoid writing
it every time.

  - writeComment (const std::string & text);
  - writeComment (const char * text);
Write a single comment, not in the well-known format.

  - writeClassComment (const umlClassNode & node);
Write the comment for a class by using the well-known format.

  - writeClass (const umlClassNode & node);
Write the beginning of a class (name, inheritance and visibility).
  - writeClassEnd ();
End the class.

  - writeAttribute (const umlAttribute & attr, int * curr_visibility);
Write an attribute inside of a class.

  - writeNameSpaceStart (const umlClassNode * name);
Start a package.
  - writeNameSpaceEnd (const umlClassNode * node);
End a package.

  - writeConst (const umlClassNode & node);
Write a class which is a const type (stereotype "const", "constant" or
"CORBAConstant").

  - writeEnum (const umlClassNode & node);
Write a class which is an enum type (stereotype "enum", "enumeration" or
"CORBAEnum").

  - writeStruct (const umlClassNode & node);
Write a class which is an structure type (stereotype "struct", "structure" or
"CORBAStruct").

  - writeTypedef (const umlClassNode & node);
Write a class which is a typedef type (stereotype "typedef" or "CORBATypedef").

  - writeAssociation (const umlassoc & asso);
Write an association.

  - writeTemplates (
               const std::list <std::pair <std::string, std::string> > & tmps);
Write a template.

Add a new generator to the main program:
The following files need to be updated:
 - src/main.cpp:
     - add a new include at the top of the file with the header of the new
       generator,
     - inside the variable const char *help, add the abreviation of the
       language,
     - inside the variable const char *bighelp, change -ext, -bext and -t
       options,
     - and finally add it inside the main loop, in "case 1".
 - src/Makefile.am:
     - add the source in dia2code_SOURCES,
     - add the header in EXTRA_DIST.
 - builds/vs-community-2013/dia2code.vcxproj
     - add the new source and header files.
 - README:
     - add examples for classic usecases and for the different stereotypes.
 - tests/tests.sh:
     - add your new generator to generators.
And of course, don't forget to run "git add GenerateCodeXXX.?pp".


KNOWN BUGS

- Packages of classes are searched using the position and size instead of
  <dia:childnode parent="O0"/>


AUTHOR, MAINTAINER and THANKS

Javier O'Hara <joh314@users.sourceforge.net>