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