KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gcc > generator > CodeWriter


1 /*
2  * Copyright 2004 The Apache Software Foundation or its licensors, as
3  * applicable.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14  * implied.
15  *
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */

19 package gcc.generator;
20
21 import java.io.File;
22
23 public abstract class CodeWriter
24 {
25     protected GenOptions _genOptions;
26
27     protected File _file;
28
29     protected String _fileName;
30     protected String _fileExt = ".java";
31
32     public CodeWriter( GenOptions genOptions, String fileName, String ext )
33     {
34         _genOptions = genOptions;
35         _fileName = fileName;
36         _fileExt = ext;
37     }
38
39     public GenOptions getGenOptions()
40     {
41         return _genOptions;
42     }
43
44     public void setGenOptions(GenOptions genOptions)
45     {
46         _genOptions = genOptions;
47     }
48
49     public void setFileName( String val )
50     {
51         _fileName = val;
52     }
53
54     public String getFileName()
55     {
56         return _fileName;
57     }
58
59     public void setFileExt( String val )
60     {
61         _fileExt = val;
62     }
63
64     public String getFileExt()
65     {
66         return _fileExt;
67     }
68
69     public abstract void openFile() throws GenException;
70     public abstract void closeFile() throws GenException;
71 }
72
73
Popular Tags