DocWire SDK
DocWire SDK: Award-winning modern data processing in C++20. SourceForge Community Choice & Microsoft support. AI-driven processing. Supports nearly 100 data formats, including email boxes and OCR. Boost efficiency in text extraction, web data extraction, data mining, document analysis. Offline processing possible for security and confidentiality
thread_safe_ole_stream_reader.h
1 /*********************************************************************************************************************************************/
2 /* DocWire SDK: Award-winning modern data processing in C++20. SourceForge Community Choice & Microsoft support. AI-driven processing. */
3 /* Supports nearly 100 data formats, including email boxes and OCR. Boost efficiency in text extraction, web data extraction, data mining, */
4 /* document analysis. Offline processing possible for security and confidentiality */
5 /* */
6 /* Copyright (c) SILVERCODERS Ltd, http://silvercoders.com */
7 /* Project homepage: https://github.com/docwire/docwire */
8 /* */
9 /* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-DocWire-Commercial */
10 /*********************************************************************************************************************************************/
11 
12 #ifndef DOCWIRE_THREAD_SAFE_OLE_STREAM_READER_H
13 #define DOCWIRE_THREAD_SAFE_OLE_STREAM_READER_H
14 
15 #include "core_export.h"
16 #include <cstdint>
17 #include <cstdio>
18 #include "pimpl.h"
19 #include <string>
20 #include <vector>
21 #include "wv2/src/olestream.h"
22 
23 namespace docwire
24 {
25 
26 class thread_safe_ole_storage;
27 using namespace wvWare;
28 class data_stream;
29 
30 class DOCWIRE_CORE_EXPORT thread_safe_ole_stream_reader : public wvWare::OLEStreamReader, public with_pimpl<thread_safe_ole_stream_reader>
31 {
32  friend class thread_safe_ole_storage;
33  public:
34  struct stream
35  {
36  uint64_t m_size;
37  std::vector<uint32_t> m_file_positions;
38  uint32_t m_sector_size;
39  data_stream* m_data_stream;
40  };
42  public:
44  std::string getLastError() const;
45  bool isValid() const override;
46  int tell() const override;
47  size_t size() const override;
48  bool seek(int offset, int whence = SEEK_SET) override;
49  bool readU8(U8& data);
50  U8 readU8() override;
51  bool readS8(S8& data);
52  S8 readS8() override;
53  bool readU16(U16& data);
54  U16 readU16() override;
55  bool readS16(S16& data);
56  S16 readS16() override;
57  bool readU32(U32& data);
58  U32 readU32() override;
59  bool readS32(S32& data);
60  S32 readS32() override;
61  bool read(U8 *buffer, size_t length) override;
62 };
63 
64 } // namespace docwire
65 
66 #endif // DOCWIRE_THREAD_SAFE_OLE_STREAM_READER_H
The main namespace for the DocWire SDK.
Definition: ai_elements.h:19