-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhogiterator.hpp
More file actions
58 lines (48 loc) · 1.46 KB
/
Copy pathhogiterator.hpp
File metadata and controls
58 lines (48 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef HOG_ITERATOR_HPP_GUARD
#define HOG_ITERATOR_HPP_GUARD
//===----------------------------------------------------------------------===//
//
// The Descent map loader
//
// NAME : HogIterator
// PURPOSE : Providing an iterator over items in the Descent .HOG format.
// COPYRIGHT : (c) 2011 Sean Donnellan. All Rights Reserved.
// AUTHORS : Sean Donnellan (darkdonno@gmail.com)
// DESCRIPTION : Provides a forward iterator over the files in the HOG file
// format that is used by Parallax Software in the computer game
// Descent.
//
//===----------------------------------------------------------------------===//
#include <iterator>
#include <utility>
#include <vector>
#include <stdint.h>
class HogReader;
struct HogFileItem
{
char name[13];
uint32_t size;
};
class HogReaderIterator
: public std::iterator<std::forward_iterator_tag, HogFileItem>
{
public:
HogReaderIterator() : myReader(nullptr), myProgress(false)
{
myData.name[0] = '\0';
myData.size = 0;
}
HogReaderIterator(HogReader& Reader);
HogReaderIterator& operator++();
const value_type& operator*() const;
const value_type* operator->() const;
bool operator==(const HogReaderIterator& o) const;
bool operator!=(const HogReaderIterator& o) const;
// Returns the contents of the file.
std::vector<uint8_t> FileContents();
private:
value_type myData;
HogReader* myReader;
bool myProgress;
};
#endif