3 #include <tdecmdlineargs.h>
6 #include <tdeapplication.h>
7 #include <tdeaboutdata.h>
8 #include <stdsynthmodule.h>
9 #include "qiomanager.h"
17 class KIOTestSlow_impl :
public KIOTestSlow_skel,
22 list< DataPacket<mcopbyte>* > q;
23 InputStream _inputStream;
26 InputStream inputStream() {
return _inputStream; }
27 void inputStream(InputStream i) { _inputStream = i; }
31 Dispatcher::the()->ioManager()->addTimer(10,
this);
36 if(!_inputStream.isNull() && _inputStream.eof())
38 printf(
"\n[*EOF*] remaining = %d packets\n");
39 _inputStream = InputStream::null();
48 DataPacket<mcopbyte> *p = q.front();
49 char ch = p->contents[pos++];
60 list<DataPacket<mcopbyte>*>::iterator i;
61 for(i = q.begin(); i != q.end(); i++)
63 printf(
"\n[queued %8ld] ",size-pos);
70 void process_data(DataPacket<mcopbyte> *p)
78 REGISTER_IMPLEMENTATION(KIOTestSlow_impl);
83 {
"+[URL]",
I18N_NOOP(
"URL to open"), 0 },
87 #undef USE_FILEINPUTSTREAM
89 int main(
int argc,
char **argv)
96 QIOManager qiomanager;
97 Dispatcher dispatcher(&qiomanager);
98 #ifndef USE_FILEINPUTSTREAM
99 TDEIOInputStream stream;
101 FileInputStream stream;
109 #ifdef USE_FILEINPUTSTREAM
110 if(!stream.open(args->
arg(0)))
112 if(!stream.openURL(args->
arg(0)))
115 printf(
"can't open url");
124 writer.inputStream(stream);
125 connect(stream, writer);
static TDECmdLineArgs * parsedArgs(const char *id=0)
static void addCmdLineOptions(const TDECmdLineOptions *options, const char *name=0, const char *id=0, const char *afterId=0)
const char * arg(int n) const
static void init(int _argc, char **_argv, const char *_appname, const char *programName, const char *_description, const char *_version, bool noKApp=false)