63 lines
1.3 KiB
C++
63 lines
1.3 KiB
C++
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "IO/FileDescription.hpp"
|
|
#include "Data/Containers/Array.hpp"
|
|
#include <iterator>
|
|
#include <memory>
|
|
|
|
namespace OpenVulkano
|
|
{
|
|
class ArchiveReader;
|
|
|
|
class ArchiveReaderIterator
|
|
{
|
|
public:
|
|
using iterator_category = std::input_iterator_tag;
|
|
using value_type = std::pair<FileDescription, Array<char>>;
|
|
using difference_type = std::ptrdiff_t;
|
|
using pointer = const value_type*;
|
|
using reference = const value_type&;
|
|
|
|
private:
|
|
ArchiveReader* m_reader;
|
|
std::pair<FileDescription, Array<char>> m_current;
|
|
|
|
public:
|
|
explicit ArchiveReaderIterator(ArchiveReader* reader = nullptr);
|
|
|
|
reference operator*() const
|
|
{
|
|
return m_current;
|
|
}
|
|
|
|
pointer operator->() const
|
|
{
|
|
return &m_current;
|
|
}
|
|
|
|
ArchiveReaderIterator& operator++();
|
|
|
|
ArchiveReaderIterator operator++(int)
|
|
{
|
|
ArchiveReaderIterator tmp = *this;
|
|
++(*this);
|
|
return tmp;
|
|
}
|
|
|
|
bool operator==(const ArchiveReaderIterator& other) const
|
|
{
|
|
return m_reader == other.m_reader;
|
|
}
|
|
|
|
bool operator!=(const ArchiveReaderIterator& other) const
|
|
{
|
|
return !(*this == other);
|
|
}
|
|
};
|
|
} |