]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/directorycollection.h
Simplify loading collection items
[libs/datafile.git] / source / directorycollection.h
index 54bf62a90079f9dc2f5a365c24ccdfc39c8a34d9..a796054b43569d4892e919ec5a337c4daba25409 100644 (file)
@@ -22,6 +22,10 @@ protected:
        void set_directory(const FS::Path &);
        void add_directory(const FS::Path &);
 
+       /** Examines the names of files in the designated directories and adds any
+       applicable ones as future objects. */
+       void load_names();
+
        template<typename T>
        CollectionItemType<T> &add_type()
        {
@@ -36,7 +40,10 @@ private:
                if(lookup_file(name, file))
                {
                        RefPtr<T> item = new T;
-                       load(*item, file.str());
+                       ItemLoader<T> ldr(*item, *this);
+                       IO::BufferedFile in(file.str());
+                       Parser parser(in, file.str());
+                       ldr.load(parser);
                        return item.release();
                }
                else