1 26 27 package org.objectweb.openccm.command.lib; 28 29 import org.objectweb.openccm.command.api.Generator; 31 import org.objectweb.util.cmdline.api.CommandLine; 32 import org.objectweb.util.cmdline.api.OptionArgument; 33 import org.objectweb.util.cmdline.lib.DefaultOptionArgument; 34 35 43 44 public abstract class CompilerGeneratorBase 45 extends CompilerBase 46 implements Generator 47 { 48 54 55 private OptionArgument ofile_; 57 63 70 public 71 CompilerGeneratorBase(CommandLine commandLine, 72 String filename) 73 { 74 super(commandLine); 76 77 ofile_ = new DefaultOptionArgument( 79 "-o", 80 "outputfile", 81 "Set the output file name, default is " + filename, 82 filename); 83 commandLine.addOption(ofile_); 84 } 85 86 91 public 92 CompilerGeneratorBase(CommandLine commandLine) 93 { 94 super(commandLine); 96 } 97 98 104 110 116 122 128 134 140 145 public String 146 getOutputFileName() 147 { 148 return ofile_.getArgument(); 149 } 150 151 158 public boolean 159 indent(String inputfile) 160 { 161 org.objectweb.openccm.generator.common.lib.Indentor ind = 162 new org.objectweb.openccm.generator.common.lib.Indentor(); 163 try 164 { 165 ind.indent(inputfile); 166 } 167 catch(java.io.IOException e) 168 { 169 getConsole().error("I/O Exception with file " + inputfile); 170 report_exception(e); 171 return false; 172 } 173 return true; 174 } 175 176 } 182 | Popular Tags |