From e6d66163e377f6a0761c687913ebf8624508401e Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 17 Jan 2021 12:42:22 +0200 Subject: [PATCH] Make the File reference in PackSource::Object const --- source/packsource.cpp | 4 ++-- source/packsource.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) 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; } }; -- 2.45.2