[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/multimedia/amarok/src/meta
From: Alejandro Daniel Wainzinger <aikawarazuni () gmail ! com>
Date: 2009-07-11 16:52:29
Message-ID: 1247331149.152529.30893.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 994982 by awainzinger:
Move Capability stuff into its own class MetaCapability, separate from MetaBase, \
since classes that don't have a prettyName like MetaBase can make use of the \
Capability paradigm.
M +16 -16 Meta.cpp
M +34 -26 Meta.h
--- trunk/extragear/multimedia/amarok/src/meta/Meta.cpp #994981:994982
@@ -201,6 +201,22 @@
Q_UNUSED( year );
}
+//Meta::MetaCapability
+
+bool
+Meta::MetaCapability::hasCapabilityInterface( Meta::Capability::Type type ) const
+{
+ Q_UNUSED( type );
+ return false;
+}
+
+Meta::Capability*
+Meta::MetaCapability::createCapabilityInterface( Meta::Capability::Type type )
+{
+ Q_UNUSED( type );
+ return 0;
+}
+
//Meta::MetaBase
void
@@ -216,22 +232,6 @@
m_observers.remove( observer );
}
-
-bool
-Meta::MetaBase::hasCapabilityInterface( Meta::Capability::Type type ) const
-{
- Q_UNUSED( type );
- return false;
-}
-
-Meta::Capability*
-Meta::MetaBase::createCapabilityInterface( Meta::Capability::Type type )
-{
- Q_UNUSED( type );
- return 0;
-}
-
-
//Meta::Track
QString
--- trunk/extragear/multimedia/amarok/src/meta/Meta.h #994981:994982
@@ -99,8 +99,41 @@
QSet<YearPtr> m_yearSubscriptions;
};
- class AMAROK_EXPORT MetaBase : public QSharedData
+ class AMAROK_EXPORT MetaCapability
{
+ public:
+ virtual ~MetaCapability() {}
+
+ virtual bool hasCapabilityInterface( Meta::Capability::Type type ) const;
+
+ virtual Meta::Capability* createCapabilityInterface( Meta::Capability::Type \
type ); +
+ /**
+ * Retrieves a specialized interface which represents a capability of \
this + * MetaBase object.
+ *
+ * @returns a pointer to the capability interface if it exists, 0 \
otherwise + */
+ template <class CapIface> CapIface *create()
+ {
+ Meta::Capability::Type type = CapIface::capabilityInterfaceType();
+ Meta::Capability *iface = createCapabilityInterface(type);
+ return qobject_cast<CapIface *>(iface);
+ }
+
+ /**
+ * Tests if a MetaBase object provides a given capability interface.
+ *
+ * @returns true if the interface is available, false otherwise
+ */
+ template <class CapIface> bool is() const
+ {
+ return hasCapabilityInterface( CapIface::capabilityInterfaceType() );
+ }
+ };
+
+ class AMAROK_EXPORT MetaBase : public QSharedData, public MetaCapability
+ {
friend class Observer;
Q_PROPERTY( QString name READ name )
@@ -124,33 +157,8 @@
virtual void addMatchTo( QueryMaker *qm ) = 0;
- virtual bool hasCapabilityInterface( Meta::Capability::Type type ) \
const;
- virtual Meta::Capability* createCapabilityInterface( \
Meta::Capability::Type type );
- /**
- * Retrieves a specialized interface which represents a capability of \
this
- * MetaBase object.
- *
- * @returns a pointer to the capability interface if it exists, 0 \
otherwise
- */
- template <class CapIface> CapIface *create()
- {
- Meta::Capability::Type type = CapIface::capabilityInterfaceType();
- Meta::Capability *iface = createCapabilityInterface(type);
- return qobject_cast<CapIface *>(iface);
- }
-
- /**
- * Tests if a MetaBase object provides a given capability interface.
- *
- * @returns true if the interface is available, false otherwise
- */
- template <class CapIface> bool is() const
- {
- return hasCapabilityInterface( CapIface::capabilityInterfaceType() \
);
- }
-
protected:
virtual void subscribe( Observer *observer );
virtual void unsubscribe( Observer *observer );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic