lib: object: add functions to test active and supported features
This commit is contained in:
@@ -336,6 +336,23 @@ wp_object_get_active_features (WpObject * self)
|
||||
return priv->ft_active;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Checks if the given features are active on this object.
|
||||
* \param self the object
|
||||
* \param features the features to check
|
||||
* \returns TRUE if all the given features are active on this object
|
||||
* \ingroup wpobject
|
||||
* \since 0.5.0
|
||||
*/
|
||||
gboolean
|
||||
wp_object_test_active_features (WpObject * self, WpObjectFeatures features)
|
||||
{
|
||||
g_return_val_if_fail (WP_IS_OBJECT (self), FALSE);
|
||||
|
||||
WpObjectPrivate *priv = wp_object_get_instance_private (self);
|
||||
return (priv->ft_active & features) == features;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the supported features of this object.
|
||||
* \ingroup wpobject
|
||||
@@ -352,6 +369,20 @@ wp_object_get_supported_features (WpObject * self)
|
||||
return WP_OBJECT_GET_CLASS (self)->get_supported_features (self);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Checks if the given features are supported on this object.
|
||||
* \param self the object
|
||||
* \param features the features to check
|
||||
* \returns TRUE if all the given features are supported on this object
|
||||
* \ingroup wpobject
|
||||
* \since 0.5.0
|
||||
*/
|
||||
gboolean
|
||||
wp_object_test_supported_features (WpObject * self, WpObjectFeatures features)
|
||||
{
|
||||
return (wp_object_get_supported_features (self) & features) == features;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
wp_object_advance_transitions (WpObject * self)
|
||||
{
|
||||
|
@@ -89,9 +89,15 @@ WpCore * wp_object_get_core (WpObject * self);
|
||||
WP_API
|
||||
WpObjectFeatures wp_object_get_active_features (WpObject * self);
|
||||
|
||||
WP_API
|
||||
gboolean wp_object_test_active_features (WpObject * self, WpObjectFeatures features);
|
||||
|
||||
WP_API
|
||||
WpObjectFeatures wp_object_get_supported_features (WpObject * self);
|
||||
|
||||
WP_API
|
||||
gboolean wp_object_test_supported_features (WpObject * self, WpObjectFeatures features);
|
||||
|
||||
WP_API
|
||||
void wp_object_activate (WpObject * self,
|
||||
WpObjectFeatures features, GCancellable * cancellable,
|
||||
|
Reference in New Issue
Block a user