OSDN Git Service

Initial commit.
[islib/islib.git] / make_new_file.pl
1 #!/usr/bin/perl
2
3 use strict;
4
5 my $filename = $ARGV [ 0 ];
6
7 if ( -e $filename )
8 {
9     die "File `$filename' exists.\n";
10 }
11
12 open ( OUT, ">$filename" );
13
14 my $defines_file_name_macro;
15
16 $defines_file_name_macro = "DEFINES_ISLIB_$filename";
17 $defines_file_name_macro =~ tr/[a-z]/[A-Z]/;
18 $defines_file_name_macro =~ s/\./_/g;
19
20 $filename =~ /([a-zA-Z0-9_]+)\..pp/;
21
22 my $class_name = $1;
23
24 if ( $filename =~ /[a-zA-Z0-9_]+\.hpp/ )
25 {
26     print OUT <<EOT
27 #ifndef $defines_file_name_macro
28
29 #define $defines_file_name_macro
30
31 //
32 // Inclusion of standard header file
33 //
34
35 //
36 // Inclusion of system header file
37 //
38
39 //
40 // Inclusion of library header file
41 //
42
43 //
44 // Inclusion of local header file
45 //
46
47 namespace islib
48   {
49     //
50     // Declaration of class
51     //
52
53     //
54     // Definition of class
55     //
56     class $class_name
57       {
58         //
59         // Declaration of friend
60         //
61
62       public:
63         //
64         // Definition of type
65         //
66         typedef $class_name this_type;
67
68         //
69         // Declaration of constructor
70         //
71         $class_name ( /* TODO:  */ );
72
73         //
74         // Declaration of destructor
75         //
76         ~$class_name () throw ();
77
78         //
79         // Declaration of operator
80         //
81         this_type &operator = ( this_type const & );
82
83         //
84         // Declaration of method
85         //
86         /* TODO:  */ get_/* TODO:  */ () const;
87         bool is_null () const;
88         void set_/* TODO:  */ ( /* TODO:  */ );
89         void swap ( this_type & ) throw ();
90
91         //
92         // Declaration of static method
93         //
94
95       protected:
96         //
97         // Declaration of constructor
98         //
99         $class_name ();
100
101         //
102         // Declaration of member function
103         //
104
105         //
106         // Declaration of static member function
107         //
108
109       private:
110         //
111         // Declaration of data member
112         //
113
114         //
115         // Declaration of member function
116         //
117
118         //
119         // Declaration of static member function
120         //
121
122       };
123   }
124
125 #endif // $defines_file_name_macro
126
127 //
128 // End of file
129 //
130 EOT
131     ;
132 }
133 elsif ( $filename =~ /[a-zA-Z0-9_]+\.cpp/ )
134 {
135     print OUT <<EOT
136 //
137 // Inclusion of standard header file
138 //
139
140 //
141 // Inclusion of system header file
142 //
143
144 //
145 // Inclusion of library header file
146 //
147
148 //
149 // Inclusion of local header file
150 //
151 #include "$class_name.hpp"
152
153 namespace islib
154   {
155     //
156     // Declaration of class
157     //
158
159     //
160     // Definition of constructor
161     //
162     $class_name\:\:$class_name
163       (
164       ):
165       // TODO:
166       {
167       }
168
169     //
170     // Definition of constructor
171     //
172     $class_name\:\:$class_name
173       (
174         // TODO:
175       ):
176       // TODO:
177       {
178         class local
179           {
180           public:
181             local
182               (
183                 // TODO:
184               ):
185               /* TODO:  */ ( /* TODO:  */ )
186               {
187                 throw_if ( std\:\:invalid_argument ( "islib\:\:$class_name\:\:$class_name: TODO: " ), /* TODO:  */ );
188               }
189
190             ~local
191               (
192               )
193               throw
194                 (
195                 )
196               {
197               }
198
199           private:
200             // TODO:
201           }
202         a_local ( /* TODO:  */ );
203       }
204
205     //
206     // Definition of constructor
207     //
208     $class_name\:\:$class_name
209       (
210         this_type const &the_other
211       ):
212       // TODO:
213       {
214       }
215
216     //
217     // Definition of destructor
218     //
219     $class_name\:\:~$class_name
220       (
221       )
222       throw
223         (
224         )
225       {
226       }
227
228     //
229     // Definition of operator
230     //
231     $class_name\:\:this_type &
232     $class_name\:\:operator =
233       (
234         this_type const &right_value
235       )
236       {
237         this_type temporary ( right_value );
238
239         this->swap ( temporary );
240
241         return *this;
242       }
243
244     //
245     // Definition of method
246     //
247     $class_name\:\:/* TODO:  */
248     $class_name\:\:get_/* TODO:  */
249       (
250       )
251       const
252       {
253         /* TODO:  */ /* TODO:  */;
254
255         class local
256           {
257           public:
258             local
259               (
260                 /* TODO:  */ const &/* TODO:  */
261               ):
262               /* TODO:  */ ( /* TODO:  */ )
263               {
264               }
265
266             ~local
267               (
268               )
269               throw
270                 (
271                 )
272               {
273                 assert_ ( /* TODO:  */, "islib\:\:$class_name\:\:get_TODO: : `TODO: ' has failed." );
274               }
275
276           private:
277             /* TODO:  */ const &/* TODO:  */;
278           }
279         a_local ( /* TODO:  */ );
280
281         // TODO:
282
283         return /* TODO:  */;
284       }
285
286     //
287     // Definition of method
288     //
289     bool
290     $class_name\:\:is_null
291       (
292       )
293       const
294       {
295         // TODO:
296
297         return /* TODO:  */;
298       }
299
300     //
301     // Definition of method
302     //
303     void
304     $class_name\:\:set_/* TODO:  */
305       (
306         /* TODO:  */ /* TODO:  */
307       )
308       {
309         class local
310           {
311           public:
312             local
313               (
314                 /* TODO:  */ /* TODO:  */
315               ):
316               /* TODO:  */ ( /* TODO:  */ )
317               {
318                 throw_if ( std\:\:invalid_argument ( "islib\:\:$class_name\:\:set_TODO: : TODO: " ), /* TODO:  */ );
319               }
320
321             ~local
322               (
323               )
324               throw
325                 (
326                 )
327               {
328               }
329
330           private:
331             /* TODO:  */ /* TODO:  */;
332           }
333         a_local ( /* TODO:  */ );
334
335         // TODO:
336       }
337
338     //
339     // Definition of method
340     //
341     void
342     $class_name\:\:swap
343       (
344         this_type &the_other
345       )
346       throw
347         (
348         )
349       {
350         // TODO:
351       }
352   }
353
354 //
355 // End of file
356 //
357 EOT
358     ;
359 }
360 else
361 {
362     print OUT "";
363 }
364
365 close ( OUT );
366
367 0;