1 % Source Code Description for Unified Process Methodology
3 % Copyright (c) 2006-2007 Stephane GALLAND <galland@arakhne.org>
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.
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.
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.
20 % Creation date: 2006-04-27
22 % 2009-10-30 Clean code.
25 \global\edef\upm@package@code@ver{2009/10/30}
27 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
28 \ProvidesPackage{upmethodology-code}[\upm@package@code@ver]
30 \RequirePackage{upmethodology-p-common}
32 \def\upm@code@eat@spaces#1{#1}
33 \def\upm@code@makemul#1{\upm@code@eat@spaces{#1}\bgroup\textbf{s}\egroup\xspace}
40 \newcount\upm@code@current@lang
42 \DeclareOption{uml}{\upm@code@current@lang=0}
43 \DeclareOption{java}{\upm@code@current@lang=1}
44 \DeclareOption{cpp}{\upm@code@current@lang=2}
51 \newcommand{\upmcodelang}[1]{%
52 \ifthenelse{\equal{#1}{java}}{%
53 \upm@code@current@lang=1%
55 \ifthenelse{\equal{#1}{cpp}}{%
56 \upm@code@current@lang=2%
58 \upm@code@current@lang=0%
61 \upm@code@declarations%
64 \def\upm@code@declarations {
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}
74 \if\the\upm@code@current@lang 1
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
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}
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}
120 \if\the\upm@code@current@lang 1
122 \gdef\jtrue{\textsc{true}\xspace}
123 \gdef\jfalse{\textsc{false}\xspace}
124 \else\if\upm@code@current@lang 2
126 \gdef\jtrue{\textsc{true}\xspace}
127 \gdef\jfalse{\textsc{false}\xspace}
129 \gdef\jtrue{\textsc{true}\xspace}
130 \gdef\jfalse{\textsc{false}\xspace}
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}
141 \upm@code@declarations