[Telepathy-commits] [telepathy-qt4/master] Moved Feature to it's own header.
Andre Moreira Magalhaes (andrunko)
andre.magalhaes at collabora.co.uk
Fri Mar 6 10:07:06 PST 2009
---
TelepathyQt4/Client/Feature | 13 ++++++
TelepathyQt4/Client/feature.cpp | 65 +++++++++++++++++++++++++++++++
TelepathyQt4/Client/feature.h | 66 ++++++++++++++++++++++++++++++++
TelepathyQt4/Client/readiness-helper.h | 17 +--------
TelepathyQt4/Makefile.am | 3 +
5 files changed, 148 insertions(+), 16 deletions(-)
create mode 100644 TelepathyQt4/Client/Feature
create mode 100644 TelepathyQt4/Client/feature.cpp
create mode 100644 TelepathyQt4/Client/feature.h
diff --git a/TelepathyQt4/Client/Feature b/TelepathyQt4/Client/Feature
new file mode 100644
index 0000000..145336c
--- /dev/null
+++ b/TelepathyQt4/Client/Feature
@@ -0,0 +1,13 @@
+#ifndef _TelepathyQt4_Client_Feature_HEADER_GUARD_
+#define _TelepathyQt4_Client_Feature_HEADER_GUARD_
+
+#ifndef IN_TELEPATHY_QT4_HEADER
+#define IN_TELEPATHY_QT4_HEADER
+#endif
+
+#include <TelepathyQt4/Client/feature.h>
+
+#undef IN_TELEPATHY_QT4_HEADER
+
+#endif
+// vim:set ft=cpp:
diff --git a/TelepathyQt4/Client/feature.cpp b/TelepathyQt4/Client/feature.cpp
new file mode 100644
index 0000000..dee5d3e
--- /dev/null
+++ b/TelepathyQt4/Client/feature.cpp
@@ -0,0 +1,65 @@
+/*
+ * This file is part of TelepathyQt4
+ *
+ * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2009 Nokia Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <TelepathyQt4/Client/Feature>
+
+namespace Telepathy
+{
+namespace Client
+{
+
+struct Feature::Private : public QSharedData
+{
+ Private(bool critical) : critical(critical) {}
+
+ bool critical;
+};
+
+Feature::Feature(const QString &className, uint id, bool critical)
+ : QPair<QString, uint>(className, id),
+ mPriv(new Private(critical))
+{
+}
+
+Feature::Feature(const Feature &other)
+ : QPair<QString, uint>(other.first, other.second),
+ mPriv(other.mPriv)
+{
+}
+
+Feature::~Feature()
+{
+}
+
+Feature &Feature::operator=(const Feature &other)
+{
+ *this = other;
+ this->mPriv = other.mPriv;
+ return *this;
+}
+
+bool Feature::isCritical() const
+{
+ return mPriv->critical;
+}
+
+} // Telepathy::Client
+} // Telepathy
diff --git a/TelepathyQt4/Client/feature.h b/TelepathyQt4/Client/feature.h
new file mode 100644
index 0000000..6e2f22a
--- /dev/null
+++ b/TelepathyQt4/Client/feature.h
@@ -0,0 +1,66 @@
+/*
+ * This file is part of TelepathyQt4
+ *
+ * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2009 Nokia Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _TelepathyQt4_cli_feature_h_HEADER_GUARD_
+#define _TelepathyQt4_cli_feature_h_HEADER_GUARD_
+
+#ifndef IN_TELEPATHY_QT4_HEADER
+#error IN_TELEPATHY_QT4_HEADER
+#endif
+
+#include <QPair>
+#include <QSet>
+#include <QSharedDataPointer>
+#include <QString>
+
+namespace Telepathy
+{
+namespace Client
+{
+
+class Feature : public QPair<QString, uint>
+{
+public:
+ Feature(const QString &className, uint id, bool critical = false);
+ Feature(const Feature &other);
+ ~Feature();
+
+ Feature &operator=(const Feature &other);
+
+ bool isCritical() const;
+
+private:
+ struct Private;
+ friend struct Private;
+ QSharedDataPointer<Private> mPriv;
+};
+
+typedef QSet<Feature> Features;
+
+inline Features operator|(const Feature &feature1, const Feature &feature2)
+{
+ return Features() << feature1 << feature2;
+}
+
+} // Telepathy::Client
+} // Telepathy
+
+#endif
diff --git a/TelepathyQt4/Client/readiness-helper.h b/TelepathyQt4/Client/readiness-helper.h
index c0cf916..5f5ec43 100644
--- a/TelepathyQt4/Client/readiness-helper.h
+++ b/TelepathyQt4/Client/readiness-helper.h
@@ -27,6 +27,7 @@
#endif
#include <TelepathyQt4/Client/DBusProxy>
+#include <TelepathyQt4/Client/Feature>
#include <QMap>
#include <QSet>
@@ -39,22 +40,6 @@ namespace Client
class PendingReady;
-class Feature : public QPair<QString, uint>
-{
-public:
- Feature(const QString &className, uint id, bool critical = false)
- : QPair<QString, uint>(className, id), critical(critical)
- {
- }
-
- bool isCritical() const { return critical; }
-
-private:
- bool critical;
-};
-
-typedef QSet<Feature> Features;
-
class ReadinessHelper : public QObject
{
Q_OBJECT
diff --git a/TelepathyQt4/Makefile.am b/TelepathyQt4/Makefile.am
index 72197e6..e3cafce 100644
--- a/TelepathyQt4/Makefile.am
+++ b/TelepathyQt4/Makefile.am
@@ -47,6 +47,7 @@ libtelepathy_qt4_la_SOURCES = \
Client/contact-manager.cpp \
Client/dbus.cpp \
Client/dbus-proxy.cpp \
+ Client/feature.cpp \
Client/file-transfer.cpp \
Client/media-session-handler.cpp \
Client/media-stream-handler.cpp \
@@ -144,6 +145,7 @@ tpqt4clientinclude_HEADERS = \
Client/ContactManager \
Client/DBus \
Client/DBusProxy \
+ Client/Feature \
Client/FileTransfer \
Client/MediaSessionHandler \
Client/MediaStreamHandler \
@@ -212,6 +214,7 @@ tpqt4clientinclude_HEADERS = \
Client/contact-manager.h \
Client/dbus.h \
Client/dbus-proxy.h \
+ Client/feature.h \
Client/file-transfer.h \
Client/media-session-handler.h \
Client/media-stream-handler.h \
--
1.5.6.5
More information about the telepathy-commits
mailing list