3 This file is part of libmspdatafile
4 Copyright © 2008 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #include <msp/core/getopt.h>
9 #include <msp/io/buffered.h>
10 #include <msp/io/console.h>
11 #include <msp/io/file.h>
12 #include <msp/datafile/parser.h>
13 #include <msp/datafile/statement.h>
14 #include <msp/datafile/writer.h>
21 DataTool::DataTool(int argc, char **argv):
28 getopt.add_option('b', "binary", binary, GetOpt::NO_ARG);
29 getopt.add_option('c', "compile", compile, GetOpt::NO_ARG);
30 getopt.add_option('o', "output", out_fn, GetOpt::REQUIRED_ARG);
33 const vector<string> &args = getopt.get_args();
44 in = new IO::File(in_fn);
50 out = new IO::File(out_fn, IO::M_WRITE);
53 IO::Buffered in_buf(*in);
54 DataFile::Parser parser(in_buf, in_fn);
55 IO::Buffered out_buf(*out);
56 DataFile::Writer writer(out_buf);
58 writer.set_binary(true);
62 Compiler compiler(writer);
63 compiler.load(parser);
69 DataFile::Statement st = parser.parse();
87 Application::RegApp<DataTool> DataTool::reg;