00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
#ifndef KRESOLVERWORKERBASE_H
00026
#define KRESOLVERWORKERBASE_H
00027
00028
#include "kresolver.h"
00029
00030
00031
class QString;
00032
template <
class T>
class QValueList;
00033
00034
namespace KNetwork {
00035
00036
namespace Internal
00037 {
00038
class KResolverThread;
00039 }
00040
00059
class KResolverWorkerBase
00060 {
00061
private:
00062
00063 KNetwork::Internal::KResolverThread *th;
00064
const KResolverPrivate::InputData *input;
00065
friend class KNetwork::Internal::KResolverThread;
00066
friend class KNetwork::Internal::KResolverManager;
00067
00068
int m_finished : 1;
00069
int m__reserved : 31;
00070
00071
public:
00079
KResolverResults results;
00080
00081
public:
00082
00083 KResolverWorkerBase();
00084
00085
00086
virtual ~KResolverWorkerBase();
00087
00091
QString nodeName() const;
00092
00096
QString serviceName() const;
00097
00101
int flags() const;
00102
00106
int familyMask() const;
00107
00111
int socketType() const;
00112
00116
int protocol() const;
00117
00121
QCString protocolName() const;
00122
00129
void finished();
00130
00131 protected:
00132
00145 virtual
bool run() = 0;
00146
00166 virtual
bool preprocess() = 0;
00167
00176 virtual
bool postprocess();
00177
00181 inline
void setError(
int errorcode,
int syserror = 0)
00182 { results.setError(errorcode, syserror); }
00183
00199
bool enqueue(
KResolver* other);
00200
00204
bool enqueue(KResolverWorkerBase* worker);
00205 };
00206
00212
class KResolverWorkerFactoryBase
00213 {
00214
public:
00215
virtual KResolverWorkerBase*
create() const = 0;
00216
00217
00218
00219
00220
00221
00222 static
void registerNewWorker(KResolverWorkerFactoryBase* factory);
00223 };
00224
00230 template<class Worker>
00231 class KResolverWorkerFactory: public KResolverWorkerFactoryBase
00232 {
00233
public:
00234
virtual KResolverWorkerBase*
create()
const
00235
{
return new Worker; }
00236 };
00237
00238 }
00239
00240
#endif