You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw/components/vfs/recursivedirectoryiterator.hpp

55 lines
1.3 KiB
C++

#ifndef OPENMW_COMPONENTS_VFS_RECURSIVEDIRECTORYITERATOR_H
#define OPENMW_COMPONENTS_VFS_RECURSIVEDIRECTORYITERATOR_H
#include <string>
#include "filemap.hpp"
#include "pathutil.hpp"
namespace VFS
{
class RecursiveDirectoryIterator
{
public:
RecursiveDirectoryIterator(FileMap::const_iterator it)
: mIt(it)
{
}
const Path::Normalized& operator*() const { return mIt->first; }
const Path::Normalized* 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