~ubuntu-branches/ubuntu/trusty/digikam/trusty

« back to all changes in this revision

Viewing changes to extra/kipi-plugins/dlnaexport/extra/hupnp/src/devicemodel/hasyncop.h

  • Committer: Package Import Robot
  • Author(s): Rohan Garg
  • Date: 2012-11-26 18:24:20 UTC
  • mfrom: (1.9.1) (3.1.23 experimental)
  • Revision ID: package-import@ubuntu.com-20121126182420-qoy6z0nx4ai0wzcl
Tags: 4:3.0.0~beta3-0ubuntu1
* New upstream release
  - Add build-deps :  libhupnp-dev, libqtgstreamer-dev, libmagickcore-dev
* Merge from debian, remaining changes:
  - Make sure libqt4-opengl-dev, libgl1-mesa-dev and libglu1-mesa-dev only
    install on i386,amd64 and powerpc
  - Depend on libtiff-dev instead of libtiff4-dev
  - Drop digikam breaks/replaces kipi-plugins-common since we're past the
    LTS release now
  - digikam to recommend mplayerthumbs | ffmpegthumbs. We currently only
    have latter in the archives, even though former is also supposed to
    be part of kdemultimedia. (LP: #890059)
  - kipi-plugins to recommend www-browser rather than konqueror directly
    since 2.8 no direct usage of konqueror is present in the flickr
    plugin anymore (LP: #1011211)
  - Keep kubuntu_mysqld_executable_name.diff
  - Don't install libkipi translations
  - Keep deps on libcv-dev, libcvaux-dev
  - Keep split packaging of libraries
  - Replace icons from KDE 3 time in debian/xpm.d/*.xpm with the new
    versions (LP: #658047)
* Update debian/not-installed

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (C) 2010, 2011 Tuomo Penttinen, all rights reserved.
 
3
 *
 
4
 *  Author: Tuomo Penttinen <tp@herqq.org>
 
5
 *
 
6
 *  This file is part of Herqq UPnP (HUPnP) library.
 
7
 *
 
8
 *  Herqq UPnP is free software: you can redistribute it and/or modify
 
9
 *  it under the terms of the GNU Lesser General Public License as published by
 
10
 *  the Free Software Foundation, either version 3 of the License, or
 
11
 *  (at your option) any later version.
 
12
 *
 
13
 *  Herqq UPnP is distributed in the hope that it will be useful,
 
14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
16
 *  GNU Lesser General Public License for more details.
 
17
 *
 
18
 *  You should have received a copy of the GNU Lesser General Public License
 
19
 *  along with Herqq UPnP. If not, see <http://www.gnu.org/licenses/>.
 
20
 */
 
21
 
 
22
#ifndef HASYNCOP_H_
 
23
#define HASYNCOP_H_
 
24
 
 
25
#include <HUpnpCore/HUpnp>
 
26
 
 
27
class QString;
 
28
 
 
29
namespace Herqq
 
30
{
 
31
 
 
32
namespace Upnp
 
33
{
 
34
 
 
35
class HAsyncOpPrivate;
 
36
 
 
37
/*!
 
38
 * \brief This abstract class is used as a base for identifying an asynchronous
 
39
 * operation and detail information of it.
 
40
 *
 
41
 * Some HUPnP components provide an asynchronous interface for running possible
 
42
 * long-standing operations. A most notable example of this is the client-side
 
43
 * action invocation initiated with HClientAction::beginInvoke(). In cases
 
44
 * like this, the class running the operation returns a derivative of this class,
 
45
 * which is used to identify and describe the running operation.
 
46
 *
 
47
 * \section Usage
 
48
 *
 
49
 * The component that runs an asynchronous operation provides an instance
 
50
 * derived from this class when the operation is started. A copy of that instance is
 
51
 * provided also when the component signals the operation is complete.
 
52
 * The provided instance uniquely identifies the operation, carries information
 
53
 * whether the operation eventually succeeded or not and it may contain an error
 
54
 * description in case of an error.
 
55
 *
 
56
 * For example:
 
57
 *
 
58
 * \code
 
59
 *
 
60
 * HClientActionOp op = someActionObject->beginInvoke();
 
61
 *
 
62
 * //
 
63
 * // The operation completes, after which you can:
 
64
 * //
 
65
 *
 
66
 * int retVal = op.returnValue();
 
67
 * // retrieve a return value indicating whether the operation succeeded.
 
68
 *
 
69
 * QString errDescr = op.errorDescription();
 
70
 * // retrieve an error description if the operation failed.
 
71
 *
 
72
 * \endcode
 
73
 *
 
74
 * \note HAsyncOp and any derivative class provided by HUPnP use \e explicit
 
75
 * \e sharing, which basically means that every copy of an instance references
 
76
 * the same underlying data and any change to that data is visible to all of the
 
77
 * copies.
 
78
 *
 
79
 * \headerfile hasyncop.h HAsyncOp
 
80
 *
 
81
 * \ingroup hupnp_devicemodel
 
82
 *
 
83
 * \remarks This class is not thread-safe.
 
84
 *
 
85
 * \sa HClientActionOp
 
86
 */
 
87
class H_UPNP_CORE_EXPORT HAsyncOp
 
88
{
 
89
H_DECLARE_PRIVATE(HAsyncOp)
 
90
friend H_UPNP_CORE_EXPORT bool operator==(const HAsyncOp&, const HAsyncOp&);
 
91
 
 
92
protected:
 
93
 
 
94
    HAsyncOpPrivate* h_ptr;
 
95
 
 
96
    //
 
97
    // \internal
 
98
    //
 
99
    HAsyncOp(HAsyncOpPrivate&);
 
100
 
 
101
    //
 
102
    // \internal
 
103
    //
 
104
    HAsyncOp(qint32 returnCode, const QString& errorDescription,
 
105
            HAsyncOpPrivate& dd);
 
106
 
 
107
    /*!
 
108
     * Creates a new valid instance.
 
109
     *
 
110
     * Creates a new valid instance, i.e isNull() always returns \e false.
 
111
     *
 
112
     * \sa isNull()
 
113
     */
 
114
    HAsyncOp();
 
115
 
 
116
    /*!
 
117
     * Creates a new invalid instance.
 
118
     *
 
119
     * \param returnCode specifies the return code.
 
120
     *
 
121
     * \param errorDescription specifies a human-readable description of the error
 
122
     * that occurred.
 
123
     */
 
124
    HAsyncOp(qint32 returnCode, const QString& errorDescription);
 
125
 
 
126
    /*!
 
127
     * \brief Copy constructor.
 
128
     *
 
129
     * Creates a shallow copy of \a other increasing the reference count of
 
130
     * \a other.
 
131
     */
 
132
    HAsyncOp(const HAsyncOp&);
 
133
 
 
134
    /*!
 
135
     * \brief Assignment operator.
 
136
     *
 
137
     * Switches this instance to refer to the contents of \a other increasing the
 
138
     * reference count of \a other.
 
139
     */
 
140
    HAsyncOp& operator=(const HAsyncOp&);
 
141
 
 
142
public:
 
143
 
 
144
    /*!
 
145
     * \brief Destroys the instance.
 
146
     *
 
147
     * Decreases the reference count or destroys the instance once the reference
 
148
     * count drops to zero.
 
149
     */
 
150
    virtual ~HAsyncOp() = 0;
 
151
 
 
152
    /*!
 
153
     * \brief Returns a human readable error description.
 
154
     *
 
155
     * \return a human readable error description, if any.
 
156
     *
 
157
     * \sa setErrorDescription()
 
158
     */
 
159
    QString errorDescription() const;
 
160
 
 
161
    /*!
 
162
     * \brief Sets a human readable error description.
 
163
     *
 
164
     * \param arg specifies the human readable error description.
 
165
     *
 
166
     * \sa errorDescription()
 
167
     */
 
168
    void setErrorDescription(const QString& arg);
 
169
 
 
170
    /*!
 
171
     * \brief Returns the return value of the asynchronous operation.
 
172
     *
 
173
     * \sa setReturnValue()
 
174
     */
 
175
    int returnValue() const;
 
176
 
 
177
    /*!
 
178
     * \brief Sets the return value of the asynchronous operation.
 
179
     *
 
180
     * \param returnValue specifies the return value of the asynchronous operation.
 
181
     *
 
182
     * \sa returnValue()
 
183
     */
 
184
    void setReturnValue(int returnValue);
 
185
 
 
186
    /*!
 
187
     * \brief Returns an identifier of the asynchronous operation.
 
188
     *
 
189
     * \return an identifier of the asynchronous operation. The identifier
 
190
     * is "unique" within the process where the library is loaded. More specifically,
 
191
     * the ID is monotonically incremented and it is allowed to overflow.
 
192
     */
 
193
    unsigned int id() const;
 
194
 
 
195
    /*!
 
196
     * \brief Indicates whether the object identifies an asynchronous operation.
 
197
     *
 
198
     * \retval true in case the object does not identify an asynchronous operation.
 
199
     * This is usually the case when an operation was not successfully started.
 
200
     * \retval false in case the object identifies an asynchronous operation.
 
201
     */
 
202
    bool isNull() const;
 
203
 
 
204
    /*!
 
205
     * \brief Indicates whether the object identifies an asynchronous operation.
 
206
     *
 
207
     * This is a convenience method and it is semantically equivalent with isNull().
 
208
     *
 
209
     * \retval true in case the object does not identify an asynchronous operation.
 
210
     * This is usually the case when an operation was not successfully started.
 
211
     * \retval false in case the object identifies an asynchronous operation.
 
212
     */
 
213
    inline bool operator!() const
 
214
    {
 
215
        return isNull();
 
216
    }
 
217
 
 
218
    /*!
 
219
     * Aborts the execution of the operation.
 
220
     *
 
221
     * Aborts the execution of the operation.
 
222
     *
 
223
     * \remarks
 
224
     * It is up to the implementation to decide whether to implement this. The
 
225
     * default implementation does nothing.
 
226
     */
 
227
    virtual void abort();
 
228
};
 
229
 
 
230
}
 
231
}
 
232
 
 
233
#endif /* HASYNCOP_H_ */