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 GeneratorBase 45 extends CommandOnASTBase 46 implements Generator 47 { 48 54 55 private OptionArgument ofile_; 57 63 70 public 71 GeneratorBase(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 92 98 104 110 116 122 127 public String 128 getOutputFileName() 129 { 130 return ofile_.getArgument(); 131 } 132 133 140 public boolean 141 indent(String inputfile) 142 { 143 org.objectweb.openccm.generator.common.lib.Indentor ind = 144 new org.objectweb.openccm.generator.common.lib.Indentor(); 145 try 146 { 147 ind.indent(inputfile); 148 } 149 catch(java.io.IOException e) 150 { 151 getConsole().error("I/O Exception with file " + inputfile); 152 report_exception(e); 153 return false; 154 } 155 return true; 156 } 157 158 } 164 | Popular Tags |