mirror of https://github.com/OpenMW/openmw.git
Use forward declaration for some VFS types
This will allow to save on preprocessed code size in the future changes.ini_importer_tests
parent
5ae878c248
commit
a2147d70cc
@ -0,0 +1,21 @@
|
||||
#ifndef OPENMW_COMPONENTS_VFS_FILE_H
|
||||
#define OPENMW_COMPONENTS_VFS_FILE_H
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
#include <components/files/istreamptr.hpp>
|
||||
|
||||
namespace VFS
|
||||
{
|
||||
class File
|
||||
{
|
||||
public:
|
||||
virtual ~File() = default;
|
||||
|
||||
virtual Files::IStreamPtr open() = 0;
|
||||
|
||||
virtual std::filesystem::path getPath() = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,14 @@
|
||||
#ifndef OPENMW_COMPONENTS_VFS_FILEMAP_H
|
||||
#define OPENMW_COMPONENTS_VFS_FILEMAP_H
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace VFS
|
||||
{
|
||||
class File;
|
||||
|
||||
using FileMap = std::map<std::string, File*, std::less<>>;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,53 @@
|
||||
#ifndef OPENMW_COMPONENTS_VFS_RECURSIVEDIRECTORYITERATOR_H
|
||||
#define OPENMW_COMPONENTS_VFS_RECURSIVEDIRECTORYITERATOR_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "filemap.hpp"
|
||||
|
||||
namespace VFS
|
||||
{
|
||||
class RecursiveDirectoryIterator
|
||||
{
|
||||
public:
|
||||
RecursiveDirectoryIterator(FileMap::const_iterator it)
|
||||
: mIt(it)
|
||||
{
|
||||
}
|
||||
|
||||
const std::string& operator*() const { return mIt->first; }
|
||||
|
||||
const std::string* operator->() const { return &mIt->first; }
|
||||
|
||||
RecursiveDirectoryIterator& operator++()
|
||||
{
|
||||
++mIt;
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend bool operator==(const RecursiveDirectoryIterator& lhs, const RecursiveDirectoryIterator& rhs) = default;
|
||||
|
||||
private:
|
||||
FileMap::const_iterator mIt;
|
||||
};
|
||||
|
||||
class RecursiveDirectoryRange
|
||||
{
|
||||
public:
|
||||
RecursiveDirectoryRange(RecursiveDirectoryIterator first, RecursiveDirectoryIterator last)
|
||||
: mBegin(first)
|
||||
, mEnd(last)
|
||||
{
|
||||
}
|
||||
|
||||
RecursiveDirectoryIterator begin() const { return mBegin; }
|
||||
|
||||
RecursiveDirectoryIterator end() const { return mEnd; }
|
||||
|
||||
private:
|
||||
RecursiveDirectoryIterator mBegin;
|
||||
RecursiveDirectoryIterator mEnd;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue