Merge branch 'bug_411_timeshift_disable_without_live' into experimental
[enigma2.git] / lib / base / buffer.h
1 #ifndef __src_lib_base_buffer_h
2 #define __src_lib_base_buffer_h
3
4 #include <asm/types.h>
5 #include <list>
6
7 /**
8  * IO buffer.
9  */
10 class eIOBuffer
11 {
12         int allocationsize;
13         struct eIOBufferData
14         {
15                 __u8 *data;
16                 int len;
17         };
18         std::list<eIOBufferData> buffer;
19         void removeblock();
20         eIOBufferData &addblock();
21         int ptr;
22 public:
23         eIOBuffer(int allocationsize): allocationsize(allocationsize), ptr(0)
24         {
25         }
26         ~eIOBuffer();
27         int size() const;
28         int empty() const;
29         void clear();
30         int peek(void *dest, int len) const;
31         void skip(int len);
32         int read(void *dest, int len);
33         void write(const void *source, int len);
34         int fromfile(int fd, int len);
35         int tofile(int fd, int len);
36
37         int searchchr(char ch) const;
38 };
39
40 #endif