]> AND Private Git Repository - these_kahina.git/blob - upmethodology-code.sty
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
suppression thesis.pdf
[these_kahina.git] / upmethodology-code.sty
1 % Source Code Description for Unified Process Methodology
2 %
3 % Copyright (c) 2006-2007 Stephane GALLAND <galland@arakhne.org>
4
5 % This program is free library; you can redistribute it and/or modify
6 % it under the terms of the GNU Lesser General Public License as
7 % published by the Free Software Foundation; either version 3 of the
8 % License, or any later version.
9 %
10 % This library is distributed in the hope that it will be useful, but
11 % WITHOUT ANY WARRANTY; without even the implied warranty of
12 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 % Lesser General Public License for more details.
14 %
15 % You should have received a copy of the GNU Lesser General Public
16 % License along with this library; see the file COPYING.  If not,
17 % write to the Free Software Foundation, Inc., 59 Temple Place - Suite
18 % 330, Boston, MA 02111-1307, USA.
19 %
20 % Creation date: 2006-04-27
21 % Modifications:
22 %   2009-10-30   Clean code.
23 %
24
25 \global\edef\upm@package@code@ver{2009/10/30}
26
27 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
28 \ProvidesPackage{upmethodology-code}[\upm@package@code@ver]
29
30 \RequirePackage{upmethodology-p-common}
31
32 \def\upm@code@eat@spaces#1{#1}
33 \def\upm@code@makemul#1{\upm@code@eat@spaces{#1}\bgroup\textbf{s}\egroup\xspace}
34
35 %-----
36 %Language
37 %0: UML
38 %1: java
39 %2: C++
40 \newcount\upm@code@current@lang
41
42 \DeclareOption{uml}{\upm@code@current@lang=0}
43 \DeclareOption{java}{\upm@code@current@lang=1}
44 \DeclareOption{cpp}{\upm@code@current@lang=2}
45
46 \ExecuteOptions{uml}
47 \ProcessOptions
48
49 %-----
50 %Language changes
51 \newcommand{\upmcodelang}[1]{%
52         \ifthenelse{\equal{#1}{java}}{%
53                 \upm@code@current@lang=1%
54         }{%
55         \ifthenelse{\equal{#1}{cpp}}{%
56                 \upm@code@current@lang=2%
57         }{%
58                 \upm@code@current@lang=0%
59         }%
60         }%
61         \upm@code@declarations%
62 }
63
64 \def\upm@code@declarations {
65 %-----
66 %PROTOTYPES
67 \gdef\jclass##1{\mbox{\textsc{##1}}\xspace}
68 \gdef\jinterface##1{\mbox{\textit{##1}}\xspace}
69 \gdef\jpackage##1{\mbox{\textsc{##1}}\xspace}
70 \gdef\jfunc##1{\texttt{##1}\xspace}
71
72 %-----
73 %TYPES
74 \if\the\upm@code@current@lang 1
75         %Java
76         \gdef\jclazz{\textbf{Class}\xspace}
77         \gdef\jvoid{\textbf{void}\xspace}
78         \gdef\jint{\textbf{int}\xspace}
79         \gdef\jlong{\textbf{long}\xspace}
80         \gdef\jfloat{\textbf{float}\xspace}
81         \gdef\jboolean{\textbf{boolean}\xspace}
82         \gdef\jdouble{\textbf{double}\xspace}
83         \gdef\jchar{\textbf{char}\xspace}
84         \gdef\jstring{\jclass{String}\xspace}
85         \gdef\jarray##1{{{##1}\bgroup\textbf{\string[\string]}\egroup}\xspace}
86         \gdef\jcollection##1{{\jclass{Collection}\textless{##1}\bgroup\textgreater\egroup}\xspace}
87         \gdef\jset##1{{\jclass{Set}\textless{##1}\bgroup\textgreater\egroup}\xspace}
88 \else\if\the\upm@code@current@lang 2
89         %C++
90         \gdef\jclazz{\textbf{class}\xspace}
91         \gdef\jvoid{\textbf{void}\xspace}
92         \gdef\jint{\textbf{int}\xspace}
93         \gdef\jlong{\textbf{long}\xspace}
94         \gdef\jfloat{\textbf{float}\xspace}
95         \gdef\jboolean{\textbf{bool}\xspace}
96         \gdef\jdouble{\textbf{double}\xspace}
97         \gdef\jchar{\textbf{char}\xspace}
98         \gdef\jstring{\jclass{std\string:\string:string}\xspace}
99         \gdef\jarray##1{{{##1}\bgroup\textbf{\string[\string]}\egroup}\xspace}
100         \gdef\jcollection##1{{\jclass{std\string:\string:vector}\textless{##1}\bgroup\textgreater\egroup}\xspace}
101         \gdef\jset##1{{\jclass{std\string:\string:set}\textless{##1}\bgroup\textgreater\egroup}\xspace}
102 \else
103         %UML
104         \gdef\jclazz{\textbf{class}\xspace}
105         \gdef\jvoid{\textbf{void}\xspace}
106         \gdef\jint{\textbf{integer}\xspace}
107         \gdef\jlong{\textbf{long integer}\xspace}
108         \gdef\jfloat{\textbf{float}\xspace}
109         \gdef\jboolean{\textbf{boolean}\xspace}
110         \gdef\jdouble{\textbf{double}\xspace}
111         \gdef\jchar{\textbf{character}\xspace}
112         \gdef\jstring{\textbf{string}\xspace}
113         \gdef\jcollection##1{{\textbf{collection of} \upm@code@makemul{##1}\bgroup\egroup}\xspace}
114         \gdef\jarray##1{{\textbf{array of} \upm@code@makemul{##1}\bgroup\egroup}\xspace}
115         \gdef\jset##1{{\textbf{set of} \upm@code@makemul{##1}\bgroup\egroup}\xspace}
116 \fi\fi
117
118 %-----
119 %CONSTANTS
120 \if\the\upm@code@current@lang 1
121         %Java
122         \gdef\jtrue{\textsc{true}\xspace}
123         \gdef\jfalse{\textsc{false}\xspace}
124 \else\if\upm@code@current@lang 2
125         %C++
126         \gdef\jtrue{\textsc{true}\xspace}
127         \gdef\jfalse{\textsc{false}\xspace}
128 \else
129         \gdef\jtrue{\textsc{true}\xspace}
130         \gdef\jfalse{\textsc{false}\xspace}
131 \fi\fi
132
133 %-----
134 %OPERATIONS
135 \gdef\jop##1{\bgroup\jcode{##1}\egroup}
136 \gdef\jcall##1##2{\mbox{\jfunc{##1}\bgroup\texttt{\string({##2}\string)}\egroup}\xspace}
137 \gdef\jcode##1{\texttt{##1}\xspace}
138
139 }
140
141 \upm@code@declarations
142
143 \endinput