Debian Codegraph @

texmf-dist/doc/metapost/metauml/manual/fig/test_class_templates.mp

raw
1 % Part of the MetaUML manual.
2 % Copyright (C) 2005 Ovidiu Gheorghies
3 %
4 % This program is free software; you can redistribute it and/or
5 % modify it under the terms of the GNU General Public License
6 % as published by the Free Software Foundation; either version 2
7 % of the License, or (at your option) any later version.
8 %
9 % This program is distributed in the hope that it will be useful,
10 % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 % GNU General Public License for more details.
13 %
14 % You should have received a copy of the GNU General Public License
15 % along with this program; if not, write to the Free Software
16 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 input metauml;
19
20 beginfig(1);
21 save P,template;
22
23 Class.P("Person")()();
24 Template.template("foo", "bar");
25
26 drawObjectAt(P)(P.nw=(0,0));
27
28 Template_attachToClass.template(P);
29 drawObject(template);
30 endfig;
31
32 beginfig(2);
33 save P,template;
34
35 Class.P("Person")()();
36 Template.template("foo: int");
37 Template_attachToClass.template(P);
38
39 drawObjectAt(P)(P.nw=(0,0));
40 drawObject(template);
41 endfig;
42
43 beginfig(3);
44 save CA, TA, CB, TB, CC, TC;
45 Class.CA("VeryVeryLongClassName")()();
46 ClassTemplate.TA("int foo")(CA);
47
48 Class.CB("Shortie")("abracadabra: long long int")();
49 ClassTemplate.TB("T")(CB);
50
51 Class.CC("Shortie")("abracadabra: long long int")();
52 ClassTemplate.TC("TrulyAmazingLongTypename")(CC);
53
54 CA.s = CB.n + (0,14);
55 CB.s = CC.n + (0,14);
56
57 drawObjects(CA, TA, CB, TB, CC, TC);
58 endfig;
59
60
61
62 end