]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/catalogue.h
Convert Catalogue to a Collection
[r2c2.git] / source / libr2c2 / catalogue.h
index c8b006ab42820b8b7b786e3ca494292fed7874a3..e8a474432251adfafec5e514fb794a93575e6942 100644 (file)
@@ -1,78 +1,45 @@
-/* $Id$
-
-This file is part of R²C²
-Copyright © 2006-2010  Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
 #ifndef LIBR2C2_CATALOGUE_H_
 #define LIBR2C2_CATALOGUE_H_
 
 #include <map>
-#include <msp/datafile/loader.h>
+#include <msp/datafile/collection.h>
 #include "articlenumber.h"
 #include "layout.h"
-#include "profile.h"
+#include "trackappearance.h"
 
 namespace R2C2 {
 
-class TrackType;
-class VehicleType;
+class ObjectType;
 
-class Catalogue
+class Catalogue: public Msp::DataFile::Collection
 {
 public:
-       class Loader: public Msp::DataFile::BasicLoader<Catalogue>
+       class Loader: public Msp::DataFile::Collection::Loader
        {
+       private:
+               Catalogue &cat;
+
        public:
                Loader(Catalogue &);
        private:
-               void ballast_profile();
-               void gauge(float);
                void layout();
-               void rail_profile();
                void scale(float, float);
-               void track(unsigned);
-               void track(ArticleNumber);
-               void vehicle(unsigned);
-               void vehicle(ArticleNumber);
+               void signal(const std::string &);
+               void terrain(const std::string &);
+               void track(const std::string &);
+               void track_appearance();
+               void vehicle(const std::string &);
        };
 
-       typedef std::map<ArticleNumber, TrackType *> TrackMap;
-       typedef std::map<ArticleNumber, VehicleType *> VehicleMap;
-
-       sigc::signal<void, const TrackType &> signal_track_added;
-       sigc::signal<void, const VehicleType &> signal_vehicle_added;
-
 private:
        float scale;
-       float gauge;
-       Profile rail_profile;
-       Profile ballast_profile;
-       Profile path_profile;
-       TrackMap tracks;
-       VehicleMap vehicles;
+       TrackAppearance appearance;
        Layout layout;
 
 public:
        Catalogue();
-       ~Catalogue();
 
        float get_scale() const { return scale; }
-       float get_gauge() const { return gauge; }
-       float get_rail_elevation() const;
-       const Profile &get_rail_profile() const { return rail_profile; }
-       const Profile &get_ballast_profile() const { return ballast_profile; }
-       const Profile &get_path_profile() const { return path_profile; }
-
-       void add_track(TrackType &);
-       const TrackType &get_track(const ArticleNumber &) const;
-       const TrackMap &get_tracks() const { return tracks; }
-
-       void add_vehicle(VehicleType &);
-       const VehicleType &get_vehicle(const ArticleNumber &) const;
-       const VehicleMap &get_vehicles() const { return vehicles; }
-
        Layout &get_layout() { return layout; }
 };