Home · All Classes · All Namespaces · Modules · Functions · Files
feature.h
1 
23 #ifndef _TelepathyQt_feature_h_HEADER_GUARD_
24 #define _TelepathyQt_feature_h_HEADER_GUARD_
25 
26 #ifndef IN_TP_QT_HEADER
27 #error IN_TP_QT_HEADER
28 #endif
29 
30 #include <TelepathyQt/Global>
31 
32 #include <QMetaType>
33 #include <QPair>
34 #include <QSet>
35 #include <QSharedDataPointer>
36 #include <QString>
37 
38 namespace Tp
39 {
40 
41 class TP_QT_EXPORT Feature : public QPair<QString, uint>
42 {
43 public:
44  Feature();
45  Feature(const QString &className, uint id, bool critical = false);
46  Feature(const Feature &other);
47  ~Feature();
48 
49  bool isValid() const { return mPriv.constData() != 0; }
50 
51  Feature &operator=(const Feature &other);
52 
53  bool isCritical() const;
54 
55 private:
56  struct Private;
57  friend struct Private;
58  QSharedDataPointer<Private> mPriv;
59 };
60 
61 class TP_QT_EXPORT Features : public QSet<Feature>
62 {
63 public:
64  Features() { }
65  Features(const Feature &feature) { insert(feature); }
66  Features(const QSet<Feature> &s) : QSet<Feature>(s) { }
67 };
68 
69 inline Features operator|(const Feature &feature1, const Feature &feature2)
70 {
71  return Features() << feature1 << feature2;
72 }
73 
74 inline Features operator|(const Features &features, const Feature &feature)
75 {
76  return Features(features) << feature;
77 }
78 
79 inline uint qHash(const Features &features)
80 {
81  int ret = 0;
82  Q_FOREACH (const Feature &feature, features) {
83  int h = qHash(feature);
84  ret ^= h;
85  }
86  return ret;
87 }
88 
89 } // Tp
90 
91 Q_DECLARE_METATYPE(Tp::Feature);
92 Q_DECLARE_METATYPE(Tp::Features);
93 
94 #endif
uint qHash(const ChannelClassSpec &spec)
Definition: channel-class-spec.h:283
Features(const QSet< Feature > &s)
Definition: feature.h:66
bool isValid() const
Definition: feature.h:49
The Features class represents a list of Feature.
Definition: feature.h:61
Definition: abstract-adaptor.cpp:31
Features operator|(const Feature &feature1, const Feature &feature2)
Definition: feature.h:69
Features()
Definition: feature.h:64
The Feature class represents a feature that can be enabled on demand.
Definition: feature.h:41
Features(const Feature &feature)
Definition: feature.h:65


Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation
Telepathy-Qt 0.9.7