X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fcollection.h;fp=source%2Fcollection.h;h=473b58ed76329cf72d971f728d29ba0aae296760;hb=7e81da8d9a6e689e271f4f0450a69d8a14f515bb;hp=aa3c18a0fcc1a5e27f5d4ddc1278b58e65904877;hpb=708ef339d3e4d3661c8b3a75e3b01bafbed0f568;p=libs%2Fdatafile.git diff --git a/source/collection.h b/source/collection.h index aa3c18a..473b58e 100644 --- a/source/collection.h +++ b/source/collection.h @@ -1,6 +1,7 @@ #ifndef MSP_DATAFILE_COLLECTION_H_ #define MSP_DATAFILE_COLLECTION_H_ +#include #include #include #include @@ -104,7 +105,7 @@ public: if(!item) throw std::invalid_argument("Collection::add(item)"); - typedef typename RemoveConst::Type NCT; + typedef typename std::remove_cv::type NCT; RefPtr ptr(item); try { @@ -122,7 +123,7 @@ public: template T &get(const std::string &name) const { - return extract::Type>(get_item(items, name)); + return extract::type>(get_item(items, name)); } /** Gets a typed object from the collection. If the name is not found, @@ -131,7 +132,7 @@ public: template T &get(const std::string &name) { - typedef typename RemoveConst::Type NCT; + typedef typename std::remove_cv::type NCT; return extract(get_var(name, get_type(name))); } @@ -142,13 +143,13 @@ public: T *find(const std::string &name) const { ItemMap::const_iterator i = items.find(name); - return (i!=items.end() ? extract::Type>(i->second) : 0); + return (i!=items.end() ? extract::type>(i->second) : 0); } template T *find(const std::string &name) { - typedef typename RemoveConst::Type NCT; + typedef typename std::remove_cv::type NCT; const Variant *var = find_var(name, get_type(name)); return (var ? &extract(*var) : 0); } @@ -187,7 +188,7 @@ public: std::list get_names() const { std::list names; - gather_items::Type>(0, &names, 0, false); + gather_items::type>(0, &names, 0, false); return names; } @@ -197,7 +198,7 @@ public: std::list get_names() { std::list names; - gather_items::Type>(0, &names, 0, true); + gather_items::type>(0, &names, 0, true); return names; } @@ -206,7 +207,7 @@ public: std::list get_list() const { std::vector vars; - gather_items::Type>(&vars, 0, 0, false); + gather_items::type>(&vars, 0, 0, false); return extract_list(vars); } @@ -215,12 +216,12 @@ public: template std::list get_list() { - CollectionItemTypeBase *type = get_type::Type>(); + CollectionItemTypeBase *type = get_type::type>(); if(type) load_items_from_sources(*type); std::vector vars; - gather_items::Type>(&vars, 0, type, true); + gather_items::type>(&vars, 0, type, true); return extract_list(vars); } @@ -242,19 +243,19 @@ public: /// Checks whether a typed object exists in the collection. template bool contains(const std::string &name) const - { return get_status::Type>(name)==1; } + { return get_status::type>(name)==1; } /** Checks whether a typed object exists in the collection or is loadable from a source. */ template bool contains(const std::string &name) - { return get_status::Type>(name)>0; } + { return get_status::type>(name)>0; } /// Returns the name of an item in the collection. template const std::string &get_name(T *d) const { - typedef RefPtr::Type> RPNCT; + typedef RefPtr::type> RPNCT; for(ItemMap::const_iterator i=items.begin(); i!=items.end(); ++i) if(i->second.check_type())