From: Mikko Rasa Date: Sun, 17 Jan 2021 10:42:22 +0000 (+0200) Subject: Make the File reference in PackSource::Object const X-Git-Url: http://git.tdb.fi/?p=libs%2Fdatafile.git;a=commitdiff_plain;h=e6d66163e377f6a0761c687913ebf8624508401e Make the File reference in PackSource::Object const --- diff --git a/source/packsource.cpp b/source/packsource.cpp index f4c06b5..ec7232a 100644 --- a/source/packsource.cpp +++ b/source/packsource.cpp @@ -113,7 +113,7 @@ void PackSource::load(Collection &coll, const CollectionItemTypeBase &type, cons if(i==objects.end()) return; - File &file = i->second->get_file(); + const File &file = i->second->get_file(); RefPtr in = file.open(); Parser parser(*in, file.get_full_name()); @@ -201,7 +201,7 @@ void PackSource::File::collect_objects(ObjectMap &objs) const } -PackSource::Object::Object(File &f, const string &n, const string &k): +PackSource::Object::Object(const File &f, const string &n, const string &k): file(f), name(n), keyword(k) diff --git a/source/packsource.h b/source/packsource.h index 35ec8b8..56590b1 100644 --- a/source/packsource.h +++ b/source/packsource.h @@ -97,14 +97,14 @@ private: class Object { private: - File &file; + const File &file; std::string name; std::string keyword; public: - Object(File &, const std::string &, const std::string &); + Object(const File &, const std::string &, const std::string &); - File &get_file() const { return file; } + const File &get_file() const { return file; } const std::string &get_name() const { return name; } const std::string &get_keyword() const { return keyword; } };