increase version number to 0.1
[ecparse.git] / CollectionReader.h
1 /**
2  * © 2008 by David Roden <droden@gmail.com>
3  */
4
5 #pragma once
6
7 #include <stdint.h>
8 #include "ReaderInput.h"
9 #include "ED2KLink.h"
10 #include "GrowingBuffer.h"
11 #include "StringTag.h"
12 #include "BlobTag.h"
13 #include "HashTag.h"
14
15 class CollectionReader {
16
17 public:
18         CollectionReader(ReaderInput* readerInput);
19         ~CollectionReader();
20
21         ED2KLink* getNextLink();
22
23 private:
24         void identifyCollectionType();
25         bool isLineBreakPresent();
26         bool ensureBufferCapacity(size_t byteCount);
27         void readMoreBytes();
28
29         BlobTag* readBlobTag(bool header = false);
30         StringTag* readStringTag(bool header = false);
31         HashTag* readHashTag();
32
33 private:
34         ReaderInput* readerInput;
35         GrowingBuffer growingBuffer;
36         uint32_t version;
37         bool firstLink;
38         bool isTextCollection;
39         uint32_t fileCollectionCount;
40         uint32_t collectionFileIndex;
41
42 };
43