-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExcelIterator.h
More file actions
75 lines (56 loc) · 1.84 KB
/
Copy pathExcelIterator.h
File metadata and controls
75 lines (56 loc) · 1.84 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <Foundation/FileIterator.h>
#include <memory>
#include <vector>
#define DECLARE_PRIVATE_MEMBER_PTR(T, V) struct T; std::shared_ptr<T> V
namespace Excel
{
using CellRow = std::vector<std::string>;
using FileIteratorPtr = std::unique_ptr<Foundation::FileIterator>;
/// Provide a sequence of string vectors from Excel files
class CellRowIterator : public Foundation::Iterator<CellRow>
{
private: // Attributes
DECLARE_PRIVATE_MEMBER_PTR(Impl, m_impl);
public: // ...structors
CellRowIterator(FileIteratorPtr xlFileSource, const std::string& sheetPattern);
public: // Property modifiers
void PutCellPattern(const std::string& cells);
void PutNamePattern(const std::string& names);
public: // Accessors
/// Is this iterator beyond the end or before the start?
bool Off() const override;
public: // Methods
/// Move to the first item
void Start() override;
/// Move to the next item. Precondition: !Off()
void Forth() override;
protected: // Support methods
/// Load the first sheet in the current file.
bool StartBook();
/// Get the first sheet row
bool StartSheet();
/// Set m_item.
bool SetItem();
};
/// Provide a sequence of string vectors from Excel files
class SheetIterator : public Foundation::Iterator<CellRow>
{
private: // Attributes
DECLARE_PRIVATE_MEMBER_PTR(Impl, m_impl);
public: // ...structors
SheetIterator(FileIteratorPtr xlFileSource);
public: // Accessors
/// Is this iterator beyond the end or before the start?
bool Off() const override;
public: // Methods
/// Move to the first item
void Start() override;
/// Move to the next item. Precondition: !Off()
void Forth() override;
protected: // Support methods
/// Load the first sheet in the current file.
void StartBook();
/// Set m_item.
void SetItem();
};
} // namespace Excel