]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/loader.h
Use IO::BufferedFile instead of separate File and Buffered objects
[libs/datafile.git] / source / loader.h
index 126de575ba027fb0cd241ee4a8f5beb0654550b7..221361694282228b3e3e1c9b3508505d5b327f9c 100644 (file)
@@ -9,7 +9,6 @@ Distributed under the LGPL
 #define MSP_DATAFILE_LOADER_H_
 
 #include <map>
-#include <msp/io/buffered.h>
 #include <msp/io/file.h>
 #include "except.h"
 #include "loaderaction.h"
@@ -202,10 +201,9 @@ Loads an object from a file.  The object must have a public Loader class.
 template<typename T>
 void load(T &obj, const std::string &fn)
 {
-       IO::File in(fn);
-       IO::Buffered buf(in);
+       IO::BufferedFile in(fn);
 
-       Parser parser(buf, fn);
+       Parser parser(in, fn);
        typename T::Loader loader(obj);
        loader.load(parser);
 }
@@ -213,10 +211,9 @@ void load(T &obj, const std::string &fn)
 template<typename T, typename U>
 void load(T &obj, const std::string &fn, U &arg)
 {
-       IO::File in(fn);
-       IO::Buffered buf(in);
+       IO::BufferedFile in(fn);
 
-       Parser parser(buf, fn);
+       Parser parser(in, fn);
        typename T::Loader loader(obj, arg);
        loader.load(parser);
 }