forked from tokgolich/doctotext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththread_safe_ole_stream_reader.h
50 lines (46 loc) · 1.17 KB
/
thread_safe_ole_stream_reader.h
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
#ifndef DOCTOTEXT_THREAD_SAFE_OLE_STREAM_READER_H
#define DOCTOTEXT_THREAD_SAFE_OLE_STREAM_READER_H
#include <stdint.h>
#include <stdio.h>
#include <string>
#include <vector>
#include "wv2/olestream.h"
class ThreadSafeOLEStorage;
using namespace wvWare;
class DataStream;
class ThreadSafeOLEStreamReader : public AbstractOLEStreamReader
{
friend class ThreadSafeOLEStorage;
private:
struct Implementation;
Implementation* impl;
struct Stream
{
uint64_t m_size;
std::vector<uint32_t> m_file_positions;
uint32_t m_sector_size;
DataStream* m_data_stream;
};
ThreadSafeOLEStreamReader(ThreadSafeOLEStorage* storage, Stream& stream);
public:
~ThreadSafeOLEStreamReader();
std::string getLastError();
bool isValid() const;
int tell() const;
size_t size() const;
bool seek(int offset, int whence = SEEK_SET);
bool readU8(U8& data);
U8 readU8();
bool readS8(S8& data);
S8 readS8();
bool readU16(U16& data);
U16 readU16();
bool readS16(S16& data);
S16 readS16();
bool readU32(U32& data);
U32 readU32();
bool readS32(S32& data);
S32 readS32();
bool read(U8 *buffer, size_t length);
};
#endif // DOCTOTEXT_THREAD_SAFE_OLE_STREAM_READER_H