CCAFFEINE
0.8.8
|
00001 #ifndef __READER_H__ 00002 #define __READER_H__ 00003 00004 namespace jcpp { 00005 00006 // Depends on: 00007 /* #include <sys/types.h> */ 00008 /* #include <unistd.h> */ 00009 /* #include "jc++/jc++.h" */ 00010 /* #include "util/IO.h" */ 00011 00012 00016 class Reader { 00017 public: 00019 virtual void close()=0; 00021 virtual void mark() { 00022 en((char *)"not allowed to use mark() in Reader"); 00023 } 00025 virtual boolean markSupported() { 00026 return FALSE; 00027 } 00029 virtual int read()=0; 00031 virtual int read(char* cbuf, int length) { 00032 return read(cbuf, 0 , length); 00033 } 00036 virtual int read(char* cbuf, int off, int length)=0; 00038 virtual boolean ready()=0; 00041 virtual void reset() { 00042 en((char *)":-( Reader::reset() not supported"); 00043 } 00045 virtual long skip(long length)=0; 00046 protected: 00047 void en(char* str) { 00048 ::fprintf(stderr, "%s\n", str); 00049 } 00050 }; 00051 00052 } ENDSEMI //jcpp 00053 00054 00055 00056 #endif // __READER_H__