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

« back to all changes in this revision

Viewing changes to extra/kipi-plugins/dlnaexport/extra/hupnp_av/src/cds_model/cds_objects/hcontainer.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) 2011 Tuomo Penttinen, all rights reserved.
 
3
 *
 
4
 *  Author: Tuomo Penttinen <tp@herqq.org>
 
5
 *
 
6
 *  This file is part of Herqq UPnP Av (HUPnPAv) library.
 
7
 *
 
8
 *  Herqq UPnP Av is free software: you can redistribute it and/or modify
 
9
 *  it under the terms of the GNU 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 Av 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 General Public License for more details.
 
17
 *
 
18
 *  You should have received a copy of the GNU General Public License
 
19
 *  along with Herqq UPnP Av. If not, see <http://www.gnu.org/licenses/>.
 
20
 */
 
21
 
 
22
#ifndef HCONTAINER_H_
 
23
#define HCONTAINER_H_
 
24
 
 
25
#include <HUpnpAv/HObject>
 
26
 
 
27
namespace Herqq
 
28
{
 
29
 
 
30
namespace Upnp
 
31
{
 
32
 
 
33
namespace Av
 
34
{
 
35
 
 
36
class HContainerEventInfoPrivate;
 
37
 
 
38
/*!
 
39
 * \brief This class is used to contain information of an HContainer modification event.
 
40
 *
 
41
 * \headerfile hcontainer.h HContainerEventInfo
 
42
 *
 
43
 * \ingroup hupnp_av_cds_objects
 
44
 *
 
45
 * \remarks This class is not thread-safe.
 
46
 *
 
47
 * \sa HContainer
 
48
 */
 
49
class H_UPNP_AV_EXPORT HContainerEventInfo
 
50
{
 
51
private:
 
52
 
 
53
    QSharedDataPointer<HContainerEventInfoPrivate> h_ptr;
 
54
 
 
55
public:
 
56
 
 
57
    /*!
 
58
     * \brief This enumeration defines the different event types instances of this class
 
59
     * are used to depict.
 
60
     */
 
61
    enum EventType
 
62
    {
 
63
        /*!
 
64
         * This event type is not defined.
 
65
         */
 
66
        Undefined,
 
67
 
 
68
        /*!
 
69
         * This value is used when a child object has been added into
 
70
         * this container.
 
71
         */
 
72
        ChildAdded,
 
73
 
 
74
        /*!
 
75
         * This value is used when a child object has been removed from
 
76
         * this container.
 
77
         */
 
78
        ChildRemoved,
 
79
 
 
80
        /*!
 
81
         * This value is used when a child object of a container has been
 
82
         * modified.
 
83
         */
 
84
        ChildModified
 
85
    };
 
86
 
 
87
    /*!
 
88
     * \brief Creates a new, invalid instance.
 
89
     *
 
90
     * \sa isValid()
 
91
     */
 
92
    HContainerEventInfo();
 
93
 
 
94
    /*!
 
95
     * \brief Creates a new instance.
 
96
     *
 
97
     * \param type specifies the type of the event.
 
98
     *
 
99
     * \param childId specifies the ID of the child object that was the "target"
 
100
     * of this event.
 
101
     */
 
102
    HContainerEventInfo(
 
103
        EventType type, const QString& childId, quint32 updateId = 0);
 
104
 
 
105
    /*!
 
106
     * \brief Copy constructor.
 
107
     *
 
108
     * Creates a copy of \c other.
 
109
     */
 
110
    HContainerEventInfo(const HContainerEventInfo&);
 
111
 
 
112
    /*!
 
113
     * \brief Assignment operator.
 
114
     *
 
115
     * Copies the contents of \c other to this.
 
116
     */
 
117
    HContainerEventInfo& operator=(const HContainerEventInfo&);
 
118
 
 
119
    /*!
 
120
     * \brief Destroys the instance.
 
121
     */
 
122
    ~HContainerEventInfo();
 
123
 
 
124
    /*!
 
125
     * \brief Indicates if the instance contains any data.
 
126
     *
 
127
     * \return \e true if the instance does not contain any data.
 
128
     */
 
129
    bool isValid() const;
 
130
 
 
131
    /*!
 
132
     * \brief Returns the type of the event.
 
133
     *
 
134
     * \return The type of the event.
 
135
     *
 
136
     * \sa setType()
 
137
     */
 
138
    EventType type() const;
 
139
 
 
140
    /*!
 
141
     * \brief Returns the ID of the child object that was the "target"
 
142
     * of this event.
 
143
     *
 
144
     * \return The ID of the child object that was the "target"
 
145
     * of this event.
 
146
     *
 
147
     * \sa setChildId()
 
148
     */
 
149
    QString childId() const;
 
150
 
 
151
    /*!
 
152
     * \brief Returns the value of the state variable \c SystemUpdateId at the time this
 
153
     * event was generated.
 
154
     *
 
155
     * \return the value of the state variable \c SystemUpdateId at the time this
 
156
     * event was generated.
 
157
     *
 
158
     * \sa setUpdateId()
 
159
     */
 
160
    quint32 updateId() const;
 
161
 
 
162
    /*!
 
163
     * \brief Specifies the type of the event.
 
164
     *
 
165
     * \param type specifies the type of the event.
 
166
     *
 
167
     * \sa type()
 
168
     */
 
169
    void setType(EventType type);
 
170
 
 
171
    /*!
 
172
     * \brief Specifies the ID of the child object that was the "target"
 
173
     * of this event.
 
174
     *
 
175
     * \param arg specifies the ID of the child object that was the "target"
 
176
     * of this event.
 
177
     *
 
178
     * \sa childId()
 
179
     */
 
180
    void setChildId(const QString& arg);
 
181
 
 
182
    /*!
 
183
     * \brief Specifies the value of the state variable \c SystemUpdateId at the time this
 
184
     * event was generated.
 
185
     *
 
186
     * \param arg specifies the value of the state variable \c SystemUpdateId at the time this
 
187
     * event was generated.
 
188
     *
 
189
     * \sa updateId()
 
190
     */
 
191
    void setUpdateId(quint32 arg);
 
192
};
 
193
 
 
194
/*!
 
195
 * Compares the two objects for equality.
 
196
 *
 
197
 * \return \e true in case the objects are logically equivalent.
 
198
 *
 
199
 * \relates HContainerEventInfo
 
200
 */
 
201
H_UPNP_AV_EXPORT bool operator==(const HContainerEventInfo&, const HContainerEventInfo&);
 
202
 
 
203
/*!
 
204
 * Compares the two objects for inequality.
 
205
 *
 
206
 * \return \e true in case the objects are not logically equivalent.
 
207
 *
 
208
 * \relates HContainerEventInfo
 
209
 */
 
210
inline bool operator!=(const HContainerEventInfo& obj1, const HContainerEventInfo& obj2)
 
211
{
 
212
    return !(obj1 == obj2);
 
213
}
 
214
 
 
215
class HContainerPrivate;
 
216
 
 
217
/*!
 
218
 * \brief This class is used to represent a collection of individual content objects
 
219
 * and other collections of individual content objects.
 
220
 *
 
221
 * The class identifier specified by the AV Working
 
222
 * Committee is \c object.container .
 
223
 *
 
224
 * \headerfile hcontainer.h HContainer
 
225
 *
 
226
 * \ingroup hupnp_av_cds_objects
 
227
 *
 
228
 * \remarks This class is not thread-safe.
 
229
 */
 
230
class H_UPNP_AV_EXPORT HContainer :
 
231
    public HObject
 
232
{
 
233
Q_OBJECT
 
234
H_DISABLE_COPY(HContainer)
 
235
H_DECLARE_PRIVATE(HContainer)
 
236
 
 
237
protected:
 
238
 
 
239
    /*!
 
240
     * Constructs a new instance.
 
241
     *
 
242
     * \param clazz specifies the UPnP class of the object. This cannot be empty.
 
243
     *
 
244
     * \param cdsType specifies the CDS type of the object. This cannot be
 
245
     * HObject::UndefinedCdsType.
 
246
     *
 
247
     * \sa isInitialized()
 
248
     */
 
249
    HContainer(const QString& clazz = sClass(), CdsType cdsType = sType());
 
250
 
 
251
    //
 
252
    // \internal
 
253
    //
 
254
    HContainer(HContainerPrivate&);
 
255
 
 
256
    /*!
 
257
     * Specifies the number of child objects the container is supposed to contain.
 
258
     *
 
259
     * \param arg specifies the number of child objects the container is supposed to contain.
 
260
     *
 
261
     * \sa expectedChildCount()
 
262
     */
 
263
    void setExpectedChildCount(quint32 arg);
 
264
 
 
265
    virtual bool validate() const;
 
266
 
 
267
    // Documented in HClonable
 
268
    virtual HContainer* newInstance() const;
 
269
    // Documented in HClonable
 
270
    virtual void doClone(HClonable* target) const;
 
271
 
 
272
public:
 
273
 
 
274
     /*!
 
275
     * \brief Creates a new instance.
 
276
     *
 
277
     * \param title specifies the title of the object.
 
278
     *
 
279
     * \param parentId specifies the ID of the object that contains this
 
280
     * object. If the object has no parent, this has to be left empty.
 
281
     *
 
282
     * \param id specifies the ID of this object. If this is not specified,
 
283
     * a unique identifier within the running process is created for the object.
 
284
     *
 
285
     * \sa isValid()
 
286
     */
 
287
    HContainer(
 
288
        const QString& title,
 
289
        const QString& parentId = QString(),
 
290
        const QString& id = QString());
 
291
 
 
292
    /*!
 
293
     * \brief Destroys the instance.
 
294
     */
 
295
    virtual ~HContainer();
 
296
 
 
297
    /*!
 
298
     * \brief Returns the IDs of the individual content objects that this container
 
299
     * contains.
 
300
     *
 
301
     * \return The IDs of the individual content objects that this container
 
302
     * contains.
 
303
     *
 
304
     * \sa setChildIds(), expectedChildCount()
 
305
     */
 
306
    QSet<QString> childIds() const;
 
307
 
 
308
    /*!
 
309
     * \brief Indicates if a search can be performed to this container.
 
310
     *
 
311
     * \return \e true if a search can be performed to this container.
 
312
     *
 
313
     * \sa setSearchable()
 
314
     */
 
315
    bool searchable() const;
 
316
 
 
317
    /*!
 
318
     * \brief Returns the container update ID.
 
319
     *
 
320
     * \return The container update ID, which is the value of the state variable
 
321
     * \c SystemUpdateID at the time of the most recent \e Container \e Modification
 
322
     * of this instance.
 
323
     *
 
324
     * \sa setContainerUpdateId()
 
325
     */
 
326
    quint32 containerUpdateId() const;
 
327
 
 
328
    /*!
 
329
     * \brief Returns the total number of child objects that have been deleted
 
330
     * from this container since the last initialization.
 
331
     *
 
332
     * \return the total number of child objects that have been deleted
 
333
     * from this container since the last initialization.
 
334
     *
 
335
     * \sa setTotalDeletedChildCount()
 
336
     */
 
337
    quint32 totalDeletedChildCount() const;
 
338
 
 
339
    /*!
 
340
     * \brief Returns the class types that can be created within this container.
 
341
     *
 
342
     * \return The class types that can be created within this container.
 
343
     *
 
344
     * \sa setCreateClassInfos()
 
345
     */
 
346
    QList<HCdsClassInfo> createClassInfos() const;
 
347
 
 
348
    /*!
 
349
     * \brief Returns the class types that can be used in searches targeted to this
 
350
     * container.
 
351
     *
 
352
     * \return The class types that can be used in searches targeted to this
 
353
     * container.
 
354
     *
 
355
     * \sa setSearchClassInfos(), ContentDirectory:3, Appendix B.1.11.
 
356
     */
 
357
    QList<HCdsClassInfo> searchClassInfos() const;
 
358
 
 
359
    /*!
 
360
     * Returns the number of child objects the container is supposed to contain.
 
361
     *
 
362
     * At server-side the expected child count always equals to the size of
 
363
     * childIds(). However, at client-side the number of child objects of a
 
364
     * container are may be known before the actual child objects are available.
 
365
     * Further, child objects may be added to a container object progressively
 
366
     * and because of that non-zero size of childIds() does not mean that every
 
367
     * child object of a container has been retrieved.
 
368
     *
 
369
     * You should never consider the size of childIds() as the number of all child
 
370
     * objects of a container at client-side, unless the size equals to the
 
371
     * value this method returns.
 
372
     *
 
373
     * \return the number of child objects the container is supposed to contain.
 
374
     *
 
375
     * \sa setExpectedChildCount(), childIds()
 
376
     */
 
377
    quint32 expectedChildCount() const;
 
378
 
 
379
    /*!
 
380
     * Indicates if the container contains the specified child ID.
 
381
     *
 
382
     * \param childId specifies the child ID to check.
 
383
     *
 
384
     * \return \e true if the container contains the specified child ID.
 
385
     */
 
386
    bool hasChildId(const QString& childId) const;
 
387
 
 
388
    /*!
 
389
     * \brief Sets the IDs of the individual content objects that this container contains.
 
390
     *
 
391
     * \param childIds specifies the IDs of the individual content objects that this
 
392
     * container contains.
 
393
     */
 
394
    void setChildIds(const QSet<QString>& childIds);
 
395
 
 
396
    /*!
 
397
     * Adds the specified IDs of the individual content objects to this container.
 
398
     *
 
399
     * \param childIds specifies the IDs of the individual content objects to
 
400
     * be added to this container.
 
401
     */
 
402
    void addChildIds(const QSet<QString>& childIds);
 
403
 
 
404
    /*!
 
405
     * Adds an ID of an individual content object to this container.
 
406
     *
 
407
     * \param childId specifies the ID of the individual content object to
 
408
     * be added to this container.
 
409
     */
 
410
    void addChildId(const QString& childId);
 
411
 
 
412
    /*!
 
413
     * Removes the specified child ID.
 
414
     *
 
415
     * \param childId specifies the child ID to be removed.
 
416
     */
 
417
    void removeChildId(const QString& childId);
 
418
 
 
419
    /*!
 
420
     * Removes the specified child IDs.
 
421
     *
 
422
     * \param childIds specifies the child IDs to be removed.
 
423
     */
 
424
    void removeChildIds(const QSet<QString>& childIDs);
 
425
 
 
426
    /*!
 
427
     * \brief Specifies the class types that can be created within this
 
428
     * container.
 
429
     *
 
430
     * \param arg specifies the class types that can be created within this
 
431
     * container.
 
432
     *
 
433
     * \sa searchClassInfos()
 
434
     */
 
435
    void setCreateClassInfos(const QList<HCdsClassInfo>& arg);
 
436
 
 
437
    /*!
 
438
     * \brief Specifies the container update ID.
 
439
     *
 
440
     * \param arg specifies the container update ID.
 
441
     *
 
442
     * \sa containerUpdateId()
 
443
     */
 
444
    void setContainerUpdateId(quint32 arg);
 
445
 
 
446
    /*!
 
447
     * \brief Specifies whether a search can be performed to this container.
 
448
     *
 
449
     * \param arg specifies whether a search can be performed to this container.
 
450
     *
 
451
     * \sa searchable()
 
452
     */
 
453
    void setSearchable(bool arg);
 
454
 
 
455
    /*!
 
456
     * \brief Specifies class types that can be used in searches targeted to this
 
457
     * container.
 
458
     *
 
459
     * \param arg specifies the class types that can be used in searches
 
460
     * targeted to this container.
 
461
     *
 
462
     * \sa searchClassInfos()
 
463
     */
 
464
    void setSearchClassInfos(const QList<HCdsClassInfo>& arg);
 
465
 
 
466
    /*!
 
467
     * Specifies the total number of child objects that have been deleted
 
468
     * from this container since the last initialization.
 
469
     *
 
470
     * \param arg specifies the total number of child objects that have been deleted
 
471
     * from this container since the last initialization.
 
472
     *
 
473
     * \sa totalDeletedChildCount()
 
474
     */
 
475
    void setTotalDeletedChildCount(quint32 arg);
 
476
 
 
477
    /*!
 
478
     * \brief Returns the class identifier specified by the AV Working Committee.
 
479
     *
 
480
     * \return The class identifier specified by the AV Working Committee.
 
481
     */
 
482
    inline static QString sClass() { return "object.container"; }
 
483
 
 
484
    /*!
 
485
     * \brief Returns the CdsType value of this class.
 
486
     *
 
487
     * \return The CdsType value of this class.
 
488
     */
 
489
    inline static CdsType sType() { return Container; }
 
490
 
 
491
    /*!
 
492
     * Creates a new instance with no title or parentID.
 
493
     *
 
494
     * \return a pointer to the newly created instance.
 
495
     *
 
496
     * \remarks the ownership of the object is transferred to the caller. Make sure
 
497
     * to delete the object.
 
498
     */
 
499
    inline static HContainer* create() { return new HContainer(); }
 
500
 
 
501
Q_SIGNALS:
 
502
 
 
503
    /*!
 
504
     * \brief This signal is emitted when a container has been modified.
 
505
     *
 
506
     * \param source specifies the HContainer that sent the event.
 
507
     *
 
508
     * \param eventInfo specifies information of the \e Container \e Modification that
 
509
     * occurred.
 
510
     *
 
511
     * \note Since HContainer knows only the IDs of its child objects, HContainer
 
512
     * does not monitor its child objects for changes. Because of this, an
 
513
     * HContainer instance will never emit this signal when a child object
 
514
     * has been modified. However, this type of functionality is provided by
 
515
     * HAbstractCdsDataSource.
 
516
     *
 
517
     * \sa HAbstractCdsDataSource
 
518
     */
 
519
    void containerModified(
 
520
        Herqq::Upnp::Av::HContainer* source,
 
521
        const Herqq::Upnp::Av::HContainerEventInfo& eventInfo);
 
522
};
 
523
 
 
524
}
 
525
}
 
526
}
 
527
 
 
528
#endif /* HCONTAINER_H_ */