]> git.tdb.fi Git - libs/datafile.git/commitdiff
Use the auto type in a few places that were missed previously
authorMikko Rasa <tdb@tdb.fi>
Tue, 12 Dec 2023 09:45:25 +0000 (11:45 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 12 Dec 2023 10:10:31 +0000 (12:10 +0200)
source/binarywriter.cpp
source/collection.cpp
source/collection.h
source/directorysource.cpp
source/packsource.cpp

index 87111f00d091ecada4056e70f5c5c299190f20bc..7558125702c462c312650e77532f1a40bbc8d19e 100644 (file)
@@ -117,7 +117,7 @@ void BinaryWriter::write_int(IntType::Store n)
 
 void BinaryWriter::write_string(const StringType::Store &s)
 {
-       StringMap::const_iterator i = strings.find(s);
+       auto i = strings.find(s);
        if(i!=strings.end())
                write_int(-static_cast<int>(i->second));
        else
index b9b17f43f831b4d326949884fc8685679d58726f..6e857b5c38a0f0b6bcce45f58fc3e2f1fd6fe6f5 100644 (file)
@@ -33,7 +33,7 @@ const Variant &Collection::get_var(const string &name, const CollectionItemTypeB
 
 const Variant *Collection::find_var(const string &name, const CollectionItemTypeBase *type)
 {
-       ItemMap::iterator i = items.find(name);
+       auto i = items.find(name);
        if(i!=items.end())
                return &i->second;
 
@@ -77,7 +77,7 @@ void Collection::gather_items(vector<const Variant *> *vars, list<string> *names
 
 unsigned Collection::get_status(const string &name, const CollectionItemTypeBase &type) const
 {
-       ItemMap::const_iterator i = items.find(name);
+       auto i = items.find(name);
        if(i==items.end())
        {
                auto j = find_if(sources, [&name, &type](const CollectionSource *s){ return s->is_loadable(type, name); });
index 45dd103e8e949d43482780ecffea02e75e1b598a..f2e156e6634ef8917a117e77444039f0227976e8 100644 (file)
@@ -123,7 +123,7 @@ public:
        template<typename T>
        T *find(const std::string &name) const
        {
-               ItemMap::const_iterator i = items.find(name);
+               auto i = items.find(name);
                return (i!=items.end() ? extract<typename std::remove_cv<T>::type>(i->second) : 0);
        }
 
@@ -216,7 +216,7 @@ private:
                if(CollectionItemTypeBase *type = get_type<T>())
                        return get_status(name, *type);
 
-               ItemMap::const_iterator i = items.find(name);
+               auto i = items.find(name);
                return (i!=items.end() && i->second.has_type<std::shared_ptr<T>>());
        }
 
index a933977a8535f2d35d2f914a825f993c9ba0d840..d57397a186109b2f1575af54f0cb4315728e1eab 100644 (file)
@@ -51,7 +51,7 @@ unique_ptr<IO::Seekable> DirectorySource::open(const string &name) const
 
 bool DirectorySource::lookup_file(const string &name, FS::Path &result) const
 {
-       ObjectMap::const_iterator i = objects.find(name);
+       auto i = objects.find(name);
        if(i==objects.end())
                return false;
 
index 84cdebd933accac92bc28bfad524ffd307505727..560c3732c70e40664ec4b8117925bf7d6afc8663 100644 (file)
@@ -38,9 +38,9 @@ PackSource &PackSource::operator=(const PackSource &other)
 
 void PackSource::translate_maps(const PackSource &other)
 {
-       for(list<Pack>::const_iterator i=packs.begin(), j=other.packs.begin(); (i!=packs.end() && j!=other.packs.end()); ++i, ++j)
+       for(auto i=packs.begin(), j=other.packs.begin(); (i!=packs.end() && j!=other.packs.end()); ++i, ++j)
                i->translate_files(files, *j);
-       for(FileMap::const_iterator i=files.begin(), j=other.files.begin(); (i!=files.end() && j!=other.files.end()); ++i, ++j)
+       for(auto i=files.begin(), j=other.files.begin(); (i!=files.end() && j!=other.files.end()); ++i, ++j)
                i->second->translate_objects(objects, *j->second);
 }