• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.10.2 API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • kdecore
  • network
k3resolverworkerbase.cpp
Go to the documentation of this file.
1 /* -*- C++ -*-
2  * Copyright (C) 2003,2004 Thiago Macieira <thiago@kde.org>
3  *
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 #include "k3resolverworkerbase.h"
26 
27 #include <config.h>
28 #include <config-network.h>
29 
30 #include <assert.h>
31 
32 #include <QByteArray>
33 
34 
35 #include "k3resolver.h"
36 #include "k3resolver_p.h"
37 
38 using namespace KNetwork;
39 using namespace KNetwork::Internal;
40 
41 KResolverWorkerBase::KResolverWorkerBase()
42  : th(0L), input(0L), m_finished(0), m_reserved(0)
43 {
44 }
45 
46 KResolverWorkerBase::~KResolverWorkerBase()
47 {
48 }
49 
50 QString KResolverWorkerBase::nodeName() const
51 {
52  if (input)
53  return input->node;
54  return QString();
55 }
56 
57 QString KResolverWorkerBase::serviceName() const
58 {
59  if (input)
60  return input->service;
61  return QString();
62 }
63 
64 int KResolverWorkerBase::flags() const
65 {
66  if (input)
67  return input->flags;
68  return 0;
69 }
70 
71 int KResolverWorkerBase::familyMask() const
72 {
73  if (input)
74  return input->familyMask;
75  return 0;
76 }
77 
78 int KResolverWorkerBase::socketType() const
79 {
80  if (input)
81  return input->socktype;
82  return 0;
83 }
84 
85 int KResolverWorkerBase::protocol() const
86 {
87  if (input)
88  return input->protocol;
89  return 0;
90 }
91 
92 QByteArray KResolverWorkerBase::protocolName() const
93 {
94  QByteArray res;
95  if (input)
96  res = input->protocolName;
97  return res;
98 }
99 
100 void KResolverWorkerBase::finished()
101 {
102  m_finished = true;
103 }
104 
105 bool KResolverWorkerBase::postprocess()
106 {
107  return true; // no post-processing is a always successful postprocessing
108 }
109 
110 bool KResolverWorkerBase::enqueue(KResolver* res)
111 {
112  KResolverManager::manager()->enqueue(res, th->data);
113  return true;
114 }
115 
116 bool KResolverWorkerBase::enqueue(KResolverWorkerBase* worker)
117 {
118  RequestData *myself = th->data;
119  RequestData *newrequest = new RequestData;
120  newrequest->obj = 0;
121  newrequest->input = input; // same input
122  newrequest->requestor = myself;
123  newrequest->nRequests = 0;
124  newrequest->worker = worker;
125  myself->nRequests++;
126  KResolverManager::manager()->dispatch(newrequest);
127  return true;
128 }
129 
130 bool KResolverWorkerBase::checkResolver()
131 {
132  assert(th != 0L);
133  return th->checkResolver();
134 }
135 
136 void KResolverWorkerBase::acquireResolver()
137 {
138  assert(th != 0L);
139  th->acquireResolver();
140 }
141 
142 void KResolverWorkerBase::releaseResolver()
143 {
144  assert(th != 0L);
145  th->releaseResolver();
146 }
147 
148 void KResolverWorkerFactoryBase::registerNewWorker(KResolverWorkerFactoryBase* factory)
149 {
150  KResolverManager::manager()->registerNewWorker(factory);
151 }
152 
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Apr 16 2013 20:55:33 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.10.2 API Reference

Skip menu "kdelibs-4.10.2 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal