SpectMorph
smstdiosubin.hh
1 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl-2.1.html
2 
3 #ifndef SPECTMORPH_STDIO_SUB_IN_HH
4 #define SPECTMORPH_STDIO_SUB_IN_HH
5 
6 #include <string>
7 #include "smgenericin.hh"
8 
9 namespace SpectMorph
10 {
11 
12 class StdioSubIn : public GenericIn
13 {
14  FILE *file;
15  size_t file_pos;
16  size_t file_len;
17 
18  StdioSubIn (FILE *file, size_t pos, size_t len);
19 public:
20  ~StdioSubIn();
21 
22  static GenericIn* open (const std::string& filename, size_t pos, size_t len);
23 
24  int get_byte(); // like fgetc
25  int read (void *ptr, size_t size);
26  bool skip (size_t size);
27  unsigned char *mmap_mem (size_t& remaining);
28  size_t get_pos();
29  GenericIn *open_subfile (size_t pos, size_t len);
30 };
31 
32 }
33 
34 #endif /* SPECTMORPH_STDIO_SUB_IN_HH */
Generic Input Stream.
Definition: smgenericin.hh:18
Definition: smstdiosubin.hh:13
unsigned char * mmap_mem(size_t &remaining)
Definition: smstdiosubin.cc:86
int read(void *ptr, size_t size)
Definition: smstdiosubin.cc:57
size_t get_pos()
Definition: smstdiosubin.cc:92
GenericIn * open_subfile(size_t pos, size_t len)
Definition: smstdiosubin.cc:98
bool skip(size_t size)
Definition: smstdiosubin.cc:72
int get_byte()
Definition: smstdiosubin.cc:42