diff options
author | Aki <please@ignore.pl> | 2022-04-12 19:18:05 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-04-12 19:18:05 +0200 |
commit | 63e7217838a6f795bc2e40a475f2a61100f89dad (patch) | |
tree | cf21ec16983e6986ade1a20d06255876dd787533 /StarsEx/DataSource.h | |
parent | dc55c64d0d7fef87fce72c272d02f874efff4397 (diff) | |
download | starshatter-63e7217838a6f795bc2e40a475f2a61100f89dad.zip starshatter-63e7217838a6f795bc2e40a475f2a61100f89dad.tar.gz starshatter-63e7217838a6f795bc2e40a475f2a61100f89dad.tar.bz2 |
Removed prefix from data sources
This to avoid any potential issues due to use of mutable state across
several objects that is in the end expected to be the same. This fits
well as a function parameter.
Diffstat (limited to 'StarsEx/DataSource.h')
-rw-r--r-- | StarsEx/DataSource.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/StarsEx/DataSource.h b/StarsEx/DataSource.h index cc69870..86a496f 100644 --- a/StarsEx/DataSource.h +++ b/StarsEx/DataSource.h @@ -26,14 +26,12 @@ public: int Id() const; Group GetGroup() const; - void SetPrefix(const char* prefix=nullptr); - virtual bool Find(const char* name) const = 0; - virtual int ListFiles(Text filter, List<Text>& items, bool recurse=false) const = 0; - virtual int Load(const char* name, std::uint8_t*& buf, bool null_terminate=false) const = 0; + virtual bool Find(const Text& prefix, const char* name) const = 0; + virtual int ListFiles(const Text& prefix, Text filter, List<Text>& items, bool recurse=false) const = 0; + virtual int Load(const Text& prefix, const char* name, std::uint8_t*& buf, bool null_terminate=false) const = 0; protected: - Text m_prefix; Group m_group; const int m_id; static int s_next_id; @@ -47,9 +45,9 @@ public: explicit ArchiveDataSource(DataArchive* archive, Group group=Group::DEFAULT); ~ArchiveDataSource() override; - bool Find(const char* name) const override; - int ListFiles(Text filter, List<Text>& items, bool recurse=false) const override; - int Load(const char* name, std::uint8_t*& buf, bool null_terminate=false) const override; + bool Find(const Text& prefix, const char* name) const override; + int ListFiles(const Text& prefix, Text filter, List<Text>& items, bool recurse=false) const override; + int Load(const Text& prefix, const char* name, std::uint8_t*& buf, bool null_terminate=false) const override; protected: DataArchive* m_archive; @@ -62,9 +60,9 @@ public: explicit FileSystemDataSource(const char* path=".", Group group=Group::DEFAULT); ~FileSystemDataSource() override; - bool Find(const char* name) const override; - int ListFiles(Text filter, List<Text>& items, bool recurse=false) const override; - int Load(const char* name, std::uint8_t*& buf, bool null_terminate=false) const override; + bool Find(const Text& prefix, const char* name) const override; + int ListFiles(const Text& prefix, Text filter, List<Text>& items, bool recurse=false) const override; + int Load(const Text& prefix, const char* name, std::uint8_t*& buf, bool null_terminate=false) const override; protected: const char* m_path; |