]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/collection.h
Add a getter for fallback in Collection
[libs/datafile.git] / source / collection.h
index 174c7fcabce52812083a7d8184670d2b24eda32e..06b8e348cbe3d2a7e16ce2735971802efa73a863 100644 (file)
@@ -83,7 +83,7 @@ public:
 private:
        typedef std::map<std::string, Variant> ItemMap;
        typedef std::list<CollectionItemTypeBase *> TypeList;
-       typedef std::list<CollectionSource *> SourceList;
+       typedef std::list<const CollectionSource *> SourceList;
 
        TypeList types;
        ItemMap items;
@@ -255,13 +255,16 @@ private:
        template<typename T>
        CollectionItemTypeBase *get_type() const;
 
+       /// Gets a descriptor with the same type as another descriptor.
+       CollectionItemTypeBase *get_type(const CollectionItemTypeBase &) const;
+
        /// Returns the descriptor for an item, or null if it's of an unknown type.
        CollectionItemTypeBase *get_type_for_item(const Variant &) const;
 
 protected:
        /** Adds a source for automatically loading items.  Sources are consulted
        in the order they are added. */
-       void add_source(CollectionSource &);
+       void add_source(const CollectionSource &);
 
 public:
        /** Opens a raw resource, without interpreting it as object data.  Null is
@@ -281,6 +284,8 @@ protected:
        /** Sets a fallback collection, which will be consulted if an item is not
        found. */
        void set_fallback(Collection *);
+
+       Collection *get_fallback() const { return fallback; }
 };
 
 template<typename T>