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

« back to all changes in this revision

Viewing changes to extra/kipi-plugins/dlnaexport/extra/hupnp/src/dataelements/hudn.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 HUDN_H_
 
23
#define HUDN_H_
 
24
 
 
25
#include <HUpnpCore/HUpnp>
 
26
 
 
27
#include <QtCore/QUuid>
 
28
#include <QtCore/QMetaType>
 
29
 
 
30
namespace Herqq
 
31
{
 
32
 
 
33
namespace Upnp
 
34
{
 
35
 
 
36
/*!
 
37
 * \brief This is a class used to depict a <em>Unique Device Name</em> (UDN), which is a
 
38
 * unique device identifier that has to remain the same over time for a
 
39
 * specific device instance.
 
40
 *
 
41
 * A valid UDN follows the format \c "uuid:"+"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
 
42
 * where the five hex fields form up a valid UUID.
 
43
 *
 
44
 * \headerfile hudn.h HUdn
 
45
 *
 
46
 * \remarks This class is not thread-safe.
 
47
 *
 
48
 * \ingroup hupnp_common
 
49
 */
 
50
class H_UPNP_CORE_EXPORT HUdn
 
51
{
 
52
friend H_UPNP_CORE_EXPORT quint32 qHash(const HUdn&);
 
53
friend H_UPNP_CORE_EXPORT bool operator==(const HUdn&, const HUdn&);
 
54
 
 
55
private:
 
56
 
 
57
    QString m_value;
 
58
 
 
59
public:
 
60
 
 
61
    /*!
 
62
     * Constructs a new, empty instance.
 
63
     *
 
64
     * Instance created by this constructor is not valid, i.e. isValid() will
 
65
     * return false.
 
66
     *
 
67
     * \sa isValid
 
68
     */
 
69
    HUdn();
 
70
 
 
71
    /*!
 
72
     * Constructs a new instance based on the provided value.
 
73
     *
 
74
     * \param value specifies the UUID of the UDN. If the provided UUID is invalid,
 
75
     * the created HUdn is invalid as well.
 
76
     *
 
77
     * \sa isValid
 
78
     */
 
79
    HUdn(const QUuid& value);
 
80
 
 
81
    /*!
 
82
     * Constructs a new instance based on the provided value.
 
83
     *
 
84
     * \param value specifies the string from which the object is constructed.
 
85
     * The argument has to contain a valid UUID and it can be prefixed with
 
86
     * "uuid:". The UUID part in turn must be formatted along the requirements of \c QUuid:
 
87
     * the string "must be formatted as five hex fields separated
 
88
     * by '-', e.g., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"
 
89
     * where 'x' is a hex digit. The curly braces shown here are optional,
 
90
     * but it is normal to include them. If the argument does not form a
 
91
     * proper UUID, the created UDN is invalid.
 
92
     *
 
93
     * \sa isValid
 
94
     */
 
95
    HUdn(const QString& value);
 
96
 
 
97
    /*!
 
98
     * \brief Destroys the instance.
 
99
     */
 
100
    ~HUdn();
 
101
 
 
102
    /*!
 
103
     * \brief Indicates if the UDN is defined or not.
 
104
     *
 
105
     * \param checkLevel specifies whether the check should be done strictly
 
106
     * according to the UDA specifications (1.0 & 1.1). That is, the UDN
 
107
     * has to contain a proper UUID. If \c checkLevel is \e false the UDN is
 
108
     * considered valid if it is not empty.
 
109
     *
 
110
     * \return true in case the UDN is valid considering the \c checkLevel argument.
 
111
     */
 
112
    inline bool isValid(HValidityCheckLevel checkLevel) const
 
113
    {
 
114
        return checkLevel == StrictChecks ? !value().isNull() : !m_value.isEmpty();
 
115
    }
 
116
 
 
117
    /*!
 
118
     * \brief Returns the UUID component of the UDN.
 
119
     *
 
120
     * \return The UUID component of the UDN.
 
121
     *
 
122
     * \remarks if the UDN is not strictly valid, i.e. isValid(true) returns
 
123
     * \e false, this method will return a null \c QUuid.
 
124
     */
 
125
    QUuid value() const;
 
126
 
 
127
    /*!
 
128
     * \brief Returns the complete UDN value.
 
129
     *
 
130
     * \returns the complete UDN value when the UDN is valid.
 
131
     * For instance, \c "uuid:5d794fc2-5c5e-4460-a023-f04a51363300" is a valid UDN.
 
132
     * Otherwise an empty string is returned.
 
133
     */
 
134
    QString toString() const;
 
135
 
 
136
    /*!
 
137
     * \brief Returns the UUID component of the UDN as string.
 
138
     *
 
139
     * \returns the UUID component of the UDN as string when the UDN is valid. For instance,
 
140
     * if the complete UDN is \c "uuid:5d794fc2-5c5e-4460-a023-f04a51363300", this method
 
141
     * will return \c "5d794fc2-5c5e-4460-a023-f04a51363300". Otherwise an
 
142
     * empty string is returned.
 
143
     */
 
144
    QString toSimpleUuid() const;
 
145
 
 
146
    /*!
 
147
     * Creates a new strictly valid UDN.
 
148
     *
 
149
     * \return a new strictly valid UDN.
 
150
     */
 
151
    static HUdn createUdn();
 
152
};
 
153
 
 
154
/*!
 
155
 * Compares the two objects for equality.
 
156
 *
 
157
 * \return true in case the object are logically equivalent.
 
158
 *
 
159
 * \relates HUdn
 
160
 */
 
161
H_UPNP_CORE_EXPORT bool operator==(const HUdn&, const HUdn&);
 
162
 
 
163
/*!
 
164
 * Compares the two objects for inequality.
 
165
 *
 
166
 * \return true in case the objects are not logically equivalent.
 
167
 *
 
168
 * \relates HUdn
 
169
 */
 
170
inline bool operator!=(const HUdn& obj1, const HUdn& obj2)
 
171
{
 
172
    return !(obj1 == obj2);
 
173
}
 
174
 
 
175
/*!
 
176
 * \brief Returns a value that can be used as a unique key in a hash-map identifying
 
177
 * the UDN object.
 
178
 *
 
179
 * \param key specifies the \em UDN from which the hash value is created.
 
180
 *
 
181
 * \return a value that can be used as a unique key in a hash-map identifying
 
182
 * the UDN object.
 
183
 *
 
184
 * \relates HUdn
 
185
 */
 
186
H_UPNP_CORE_EXPORT quint32 qHash(const HUdn& key);
 
187
 
 
188
}
 
189
}
 
190
 
 
191
Q_DECLARE_METATYPE(Herqq::Upnp::HUdn)
 
192
 
 
193
#endif /* HUDN_H_ */