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
data_stream.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_DATA_STREAM_H
13 #define DOCWIRE_DATA_STREAM_H
14 
15 #include "core_export.h"
16 #include <stdio.h>
17 #include <string>
18 #include "pimpl.h"
19 
20 namespace docwire
21 {
22 
24 {
25  public:
26  virtual ~data_stream(){}
27  virtual bool open() = 0;
28  virtual bool close() = 0;
29  virtual bool read(void* data, int element_size, size_t elements_num) = 0;
30  virtual bool seek(int offset, int whence) = 0;
31  virtual bool eof() = 0;
32  virtual int getc() = 0;
33  virtual bool unGetc(int ch) = 0;
34  virtual size_t size() = 0;
35  virtual size_t tell() = 0;
36  virtual std::string name() = 0;
37  virtual data_stream* clone() = 0;
38 };
39 
40 class DOCWIRE_CORE_EXPORT file_stream : public data_stream, public with_pimpl<file_stream>
41 {
42  public:
43  file_stream(const std::string& file_name);
44  ~file_stream();
45  bool open();
46  bool close();
47  bool read(void* data, int element_size, size_t elements_num);
48  bool seek(int offset, int whence);
49  bool eof();
50  int getc();
51  bool unGetc(int ch);
52  size_t size();
53  size_t tell();
54  std::string name();
55  data_stream* clone();
56 };
57 
58 class DOCWIRE_CORE_EXPORT buffer_stream : public data_stream, public with_pimpl<buffer_stream>
59 {
60  public:
61  buffer_stream(const char* buffer, size_t size);
62  bool open();
63  bool close();
64  bool read(void* data, int element_size, size_t elements_num);
65  bool seek(int offset, int whence);
66  bool eof();
67  int getc();
68  bool unGetc(int ch);
69  size_t size();
70  size_t tell();
71  std::string name();
72  data_stream* clone();
73 };
74 
75 } // namespace docwire
76 
77 #endif //DOCWIRE_DATA_STREAM_H
The main namespace for the DocWire SDK.
Definition: ai_elements.h:19