| # kdecore Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kresolverworkerbase.cpp

    00001 /*  -*- C++ -*-
    00002  *  Copyright (C) 2003,2004 Thiago Macieira <thiago.macieira@kdemail.net>
    00003  *
    00004  *
    00005  *  Permission is hereby granted, free of charge, to any person obtaining
    00006  *  a copy of this software and associated documentation files (the
    00007  *  "Software"), to deal in the Software without restriction, including
    00008  *  without limitation the rights to use, copy, modify, merge, publish,
    00009  *  distribute, sublicense, and/or sell copies of the Software, and to
    00010  *  permit persons to whom the Software is furnished to do so, subject to
    00011  *  the following conditions:
    00012  *
    00013  *  The above copyright notice and this permission notice shall be included
    00014  *  in all copies or substantial portions of the Software.
    00015  *
    00016  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    00017  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    00018  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    00019  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    00020  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    00021  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    00022  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    00023  */
    00024
    00025 #include "config.h"
    00026
    00027 #include <assert.h>
    00028
    00029 #include <qcstring.h>
    00030 #include <qstring.h>
    00031
    00032 #include "kresolver.h"
    00033 #include "kresolver_p.h"
    00034 #include "kresolverworkerbase.h"
    00035
    00036 using namespace KNetwork;
    00037 using namespace KNetwork::Internal;
    00038
    00039 KResolverWorkerBase::KResolverWorkerBase()
    00040   : th(0L), input(0L), m_finished(0), m_reserved(0)
    00041 {
    00042 }
    00043
    00044 KResolverWorkerBase::~KResolverWorkerBase()
    00045 {
    00046 }
    00047
    00048 QString KResolverWorkerBase::nodeName() const
    00049 {
    00050   if (input)
    00051     return input->node;
    00052   return QString::null;
    00053 }
    00054
    00055 QString KResolverWorkerBase::serviceName() const
    00056 {
    00057   if (input)
    00058     return input->service;
    00059   return QString::null;
    00060 }
    00061
    00062 int KResolverWorkerBase::flags() const
    00063 {
    00064   if (input)
    00065     return input->flags;
    00066   return 0;
    00067 }
    00068
    00069 int KResolverWorkerBase::familyMask() const
    00070 {
    00071   if (input)
    00072     return input->familyMask;
    00073   return 0;
    00074 }
    00075
    00076 int KResolverWorkerBase::socketType() const
    00077 {
    00078   if (input)
    00079     return input->socktype;
    00080   return 0;
    00081 }
    00082
    00083 int KResolverWorkerBase::protocol() const
    00084 {
    00085   if (input)
    00086     return input->protocol;
    00087   return 0;
    00088 }
    00089
    00090 QCString KResolverWorkerBase::protocolName() const
    00091 {
    00092   QCString res;
    00093   if (input)
    00094     res = input->protocolName;
    00095   return res;
    00096 }
    00097
    00098 void KResolverWorkerBase::finished()
    00099 {
    00100   m_finished = true;
    00101 }
    00102
    00103 bool KResolverWorkerBase::postprocess()
    00104 {
    00105   return true;          // no post-processing is a always successful postprocessing
    00106 }
    00107
    00108 bool KResolverWorkerBase::enqueue(KResolverWorkerBase* worker)
    00109 {
    00110   RequestData *myself = th->data;
    00111   RequestData *newrequest = new RequestData;
    00112   newrequest->obj = 0;
    00113   newrequest->input = input; // same input
    00114   newrequest->requestor = myself;
    00115   newrequest->nRequests = 0;
    00116   newrequest->worker = worker;
    00117   myself->nRequests++;
    00118   KResolverManager::manager()->dispatch(newrequest);
    00119   return true;
    00120 }
    00121
    00122 bool KResolverWorkerBase::checkResolver()
    00123 {
    00124   assert(th != 0L);
    00125   return th->checkResolver();
    00126 }
    00127
    00128 void KResolverWorkerBase::acquireResolver()
    00129 {
    00130   assert(th != 0L);
    00131   th->acquireResolver();
    00132 }
    00133
    00134 void KResolverWorkerBase::releaseResolver()
    00135 {
    00136   assert(th != 0L);
    00137   th->releaseResolver();
    00138 }
    00139
    00140 void KResolverWorkerFactoryBase::registerNewWorker(KResolverWorkerFactoryBase* factory)
    00141 {
    00142   KResolverManager::manager()->registerNewWorker(factory);
    00143 }
    00144

This file is part of the documentation for kdecore Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:18:10 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003