kdecore Library API Documentation

kresolverworkerbase.cpp

00001 /* -*- C++ -*- 00002 * Copyright (C) 2003 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 <qcstring.h> 00028 #include <qstring.h> 00029 00030 #include "kresolver.h" 00031 #include "kresolver_p.h" 00032 #include "kresolverworkerbase.h" 00033 00034 using namespace KNetwork; 00035 using namespace KNetwork::Internal; 00036 00037 KResolverWorkerBase::KResolverWorkerBase() 00038 : th(0L), input(0L), m_finished(0), m__reserved(0) 00039 { 00040 } 00041 00042 KResolverWorkerBase::~KResolverWorkerBase() 00043 { 00044 } 00045 00046 QString KResolverWorkerBase::nodeName() const 00047 { 00048 if (input) 00049 return input->node; 00050 return QString::null; 00051 } 00052 00053 QString KResolverWorkerBase::serviceName() const 00054 { 00055 if (input) 00056 return input->service; 00057 return QString::null; 00058 } 00059 00060 int KResolverWorkerBase::flags() const 00061 { 00062 if (input) 00063 return input->flags; 00064 return 0; 00065 } 00066 00067 int KResolverWorkerBase::familyMask() const 00068 { 00069 if (input) 00070 return input->familyMask; 00071 return 0; 00072 } 00073 00074 int KResolverWorkerBase::socketType() const 00075 { 00076 if (input) 00077 return input->socktype; 00078 return 0; 00079 } 00080 00081 int KResolverWorkerBase::protocol() const 00082 { 00083 if (input) 00084 return input->protocol; 00085 return 0; 00086 } 00087 00088 QCString KResolverWorkerBase::protocolName() const 00089 { 00090 QCString res; 00091 if (input) 00092 res = input->protocolName; 00093 return res; 00094 } 00095 00096 void KResolverWorkerBase::finished() 00097 { 00098 m_finished = true; 00099 } 00100 00101 bool KResolverWorkerBase::postprocess() 00102 { 00103 return true; // no post-processing is a always successful postprocessing 00104 } 00105 00106 bool KResolverWorkerBase::enqueue(KResolverWorkerBase* worker) 00107 { 00108 RequestData *myself = th->data; 00109 RequestData *newrequest = new RequestData; 00110 newrequest->obj = 0; 00111 newrequest->input = input; // same input 00112 newrequest->requestor = myself; 00113 newrequest->nRequests = 0; 00114 newrequest->worker = worker; 00115 myself->nRequests++; 00116 KResolverManager::manager()->dispatch(newrequest); 00117 return true; 00118 } 00119 00120 void KResolverWorkerFactoryBase::registerNewWorker(KResolverWorkerFactoryBase* factory) 00121 { 00122 KResolverManager::manager()->registerNewWorker(factory); 00123 }
KDE Logo
This file is part of the documentation for kdecore Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:40:09 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003