parse header only on first link
[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
14 class CollectionReader {
15
16 public:
17         CollectionReader(ReaderInput* readerInput);
18         ~CollectionReader();
19
20         ED2KLink* getNextLink();
21
22 private:
23         void identifyCollectionType();
24         bool isLineBreakPresent();
25         bool ensureBufferCapacity(size_t byteCount);
26         void readMoreBytes();
27
28         BlobTag* readBlobTag(bool hader);
29         StringTag* readStringTag(bool header);
30
31 private:
32         ReaderInput* readerInput;
33         GrowingBuffer growingBuffer;
34         uint32_t version;
35         bool firstLink;
36         bool isTextCollection;
37         uint32_t fileCollectionCount;
38         uint32_t collectionFileIndex;
39
40 };
41