X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=tool%2Ftool.cpp;h=b816ee33cd1e8d916d65c2b7d9315a7d8773db70;hb=ae5c70255ce06515224299985672c540d0b237a7;hp=02fba07fa022cd758722fa81e4e4ec78caf50d1c;hpb=cbd0ddd6ee033e46646bfb85d19232c816ea1eda;p=libs%2Fdatafile.git diff --git a/tool/tool.cpp b/tool/tool.cpp index 02fba07..b816ee3 100644 --- a/tool/tool.cpp +++ b/tool/tool.cpp @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of libmspdatafile -Copyright © 2008 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #include #include #include @@ -22,12 +15,16 @@ DataTool::DataTool(int argc, char **argv): in_fn("-"), out_fn("-"), binary(false), - compile(false) + compile(false), + float_size(0), + compress(false) { GetOpt getopt; getopt.add_option('b', "binary", binary, GetOpt::NO_ARG); getopt.add_option('c', "compile", compile, GetOpt::NO_ARG); + getopt.add_option('f', "float-size", float_size, GetOpt::REQUIRED_ARG); getopt.add_option('o', "output", out_fn, GetOpt::REQUIRED_ARG); + getopt.add_option('z', "compress", compress, GetOpt::NO_ARG); getopt(argc, argv); const vector &args = getopt.get_args(); @@ -54,8 +51,12 @@ int DataTool::main() DataFile::Parser parser(in_buf, in_fn); IO::Buffered out_buf(*out); DataFile::Writer writer(out_buf); + if(compress) + writer.set_compressed(); if(binary) writer.set_binary(true); + if(float_size) + writer.set_float_precision(float_size); if(compile) { @@ -83,5 +84,3 @@ int DataTool::main() return 0; } - -Application::RegApp DataTool::reg;