]> git.tdb.fi Git - libs/datafile.git/blobdiff - tool/tool.cpp
Update the tool to use the new RegisteredApplication class
[libs/datafile.git] / tool / tool.cpp
index 36ee5c4abd6e760162934417a8d8ae4b1f355333..4e6608766a8e7cbacb47900e337ba0c80436e6f6 100644 (file)
@@ -1,10 +1,3 @@
-/* $Id$
-
-This file is part of libmspdatafile
-Copyright © 2008  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #include <msp/core/getopt.h>
 #include <msp/io/buffered.h>
 #include <msp/io/console.h>
@@ -30,24 +23,24 @@ DataTool::DataTool(int argc, char **argv):
        getopt.add_option('o', "output", out_fn, GetOpt::REQUIRED_ARG);
        getopt(argc, argv);
 
-       const vector<string> &args=getopt.get_args();
+       const vector<string> &args = getopt.get_args();
        if(!args.empty())
-               in_fn=args[0];
+               in_fn = args[0];
 }
 
 int DataTool::main()
 {
        IO::Base *in;
        if(in_fn=="-")
-               in=&IO::cin;
+               in = &IO::cin;
        else
-               in=new IO::File(in_fn);
+               in = new IO::File(in_fn);
 
        IO::Base *out;
        if(out_fn=="-")
-               out=&IO::cout;
+               out = &IO::cout;
        else
-               out=new IO::File(out_fn, IO::M_WRITE);
+               out = new IO::File(out_fn, IO::M_WRITE);
 
        {
                IO::Buffered in_buf(*in);
@@ -66,7 +59,7 @@ int DataTool::main()
                {
                        while(parser)
                        {
-                               DataFile::Statement st=parser.parse();
+                               DataFile::Statement st = parser.parse();
                                if(st.valid)
                                {
                                        writer.write(st);
@@ -83,5 +76,3 @@ int DataTool::main()
 
        return 0;
 }
-
-Application::RegApp<DataTool> DataTool::reg;