+ template<typename T>
+ unsigned get_status(const std::string &name) const
+ {
+ // XXX Should go through all applicable types
+ if(CollectionItemTypeBase *type = get_type<T>())
+ return get_status(name, *type);
+
+ ItemMap::const_iterator i = items.find(name);
+ return (i!=items.end() && i->second.check_type<RefPtr<T> >());
+ }
+
+public:
+ /// Checks whether a typed object exists in the collection.
+ template<typename T>
+ bool contains(const std::string &name) const
+ { return get_status<typename RemoveConst<T>::Type>(name)==1; }
+
+ /** Checks whether a typed object exists in the collection or is loadable
+ from a source. */
+ template<typename T>
+ bool contains(const std::string &name)
+ { return get_status<typename RemoveConst<T>::Type>(name)>0; }
+
+ /// Returns the name of an item in the collection.