• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

Solid

Solid::Predicate

Solid::Predicate Class Reference

This class implements predicates for devices. More...

#include <predicate.h>

List of all members.


Public Types

enum  ComparisonOperator { Equals, Mask }

Public Member Functions

bool isValid () const
bool matches (const Device &device) const
Predicate operator& (const Predicate &other)
Predicate & operator&= (const Predicate &other)
Predicate & operator= (const Predicate &other)
Predicate operator| (const Predicate &other)
Predicate & operator|= (const Predicate &other)
 Predicate (const QString &ifaceName)
 Predicate (const DeviceInterface::Type &ifaceType)
 Predicate (const QString &ifaceName, const QString &property, const QVariant &value, ComparisonOperator compOperator=Equals)
 Predicate (const DeviceInterface::Type &ifaceType, const QString &property, const QVariant &value, ComparisonOperator compOperator=Equals)
 Predicate (const Predicate &other)
 Predicate ()
QString toString () const
QSet< DeviceInterface::Type > usedTypes () const
 ~Predicate ()

Static Public Member Functions

static Predicate fromString (const QString &predicate)

Detailed Description

This class implements predicates for devices.

A predicate is a logical condition that a given device can match or not. It's a constraint about the value a property must have in a given device interface, or any combination (conjunction, disjunction) of such constraints.

FIXME: Add an example.

Definition at line 44 of file predicate.h.


Member Enumeration Documentation

enum Solid::Predicate::ComparisonOperator

The comparison operator which can be used for matching within the predicate.

  • Equals, the property and the value will match for strict equality
  • Mask, the property and the value will match if the bitmasking is not null
Enumerator:
Equals 
Mask 

Definition at line 53 of file predicate.h.


Constructor & Destructor Documentation

Solid::Predicate::Predicate (  ) 

Constructs an invalid predicate.

Definition at line 52 of file predicate.cpp.

Solid::Predicate::Predicate ( const Predicate &  other  ) 

Copy constructor.

Parameters:
other the predicate to copy

Definition at line 57 of file predicate.cpp.

Solid::Predicate::Predicate ( const DeviceInterface::Type &  ifaceType,
const QString &  property,
const QVariant &  value,
ComparisonOperator  compOperator = Equals 
)

Constructs a predicate matching the value of a property in a given device interface.

Parameters:
ifaceType the device interface type the device must have
property the property name of the device interface
value the value the property must have to make the device match
compOperator the operator to apply between the property and the value when matching

Definition at line 63 of file predicate.cpp.

Solid::Predicate::Predicate ( const QString &  ifaceName,
const QString &  property,
const QVariant &  value,
ComparisonOperator  compOperator = Equals 
)

Constructs a predicate matching the value of a property in a given device interface.

Parameters:
ifaceName the name of the device interface the device must have
property the property name of the device interface
value the value the property must have to make the device match
compOperator the operator to apply between the property and the value when matching

Definition at line 75 of file predicate.cpp.

Solid::Predicate::Predicate ( const DeviceInterface::Type &  ifaceType  )  [explicit]

Constructs a predicate matching devices being of a particular device interface.

Parameters:
ifaceType the device interface the device must have

Definition at line 92 of file predicate.cpp.

Solid::Predicate::Predicate ( const QString &  ifaceName  )  [explicit]

Constructs a predicate matching devices being of a particular device interface.

Parameters:
ifaceName the name of the device interface the device must have

Definition at line 100 of file predicate.cpp.

Solid::Predicate::~Predicate (  ) 

Destroys a Predicate object.

Definition at line 113 of file predicate.cpp.


Member Function Documentation

Solid::Predicate Solid::Predicate::fromString ( const QString &  predicate  )  [static]

Converts a string to a predicate.

Parameters:
predicate the string to convert
Returns:
a new valid predicate if the given string is syntactically correct, Predicate() otherwise

Definition at line 35 of file predicateparse.cpp.

bool Solid::Predicate::isValid (  )  const

Indicates if the predicate is valid.

Predicate() is the only invalid predicate.

Returns:
true if the predicate is valid, false otherwise

Definition at line 184 of file predicate.cpp.

bool Solid::Predicate::matches ( const Device &  device  )  const

Checks if a device matches the predicate.

Parameters:
device the device to match against the predicate
Returns:
true if the given device matches the predicate, false otherwise

Definition at line 189 of file predicate.cpp.

Solid::Predicate Solid::Predicate::operator& ( const Predicate &  other  ) 

'And' operator.

Parameters:
other the second operand
Returns:
a new 'and' predicate having 'this' and 'other' as operands

Definition at line 148 of file predicate.cpp.

Solid::Predicate & Solid::Predicate::operator&= ( const Predicate &  other  ) 

'AndEquals' operator.

Parameters:
other the second operand
Returns:
assigns to 'this' a new 'and' predicate having 'this' and 'other' as operands

Definition at line 160 of file predicate.cpp.

Solid::Predicate & Solid::Predicate::operator= ( const Predicate &  other  ) 

Assignement operator.

Parameters:
other the predicate to assign
Returns:
this predicate after having assigned 'other' to it

Definition at line 123 of file predicate.cpp.

Solid::Predicate Solid::Predicate::operator| ( const Predicate &  other  ) 

'Or' operator.

Parameters:
other the second operand
Returns:
a new 'or' predicate having 'this' and 'other' as operands

Definition at line 166 of file predicate.cpp.

Solid::Predicate & Solid::Predicate::operator|= ( const Predicate &  other  ) 

'OrEquals' operator.

Parameters:
other the second operand
Returns:
assigns to 'this' a new 'or' predicate having 'this' and 'other' as operands

Definition at line 178 of file predicate.cpp.

QString Solid::Predicate::toString (  )  const

Converts the predicate to its string form.

Returns:
a string representation of the predicate

Definition at line 263 of file predicate.cpp.

QSet< Solid::DeviceInterface::Type > Solid::Predicate::usedTypes (  )  const

Retrieves the device interface types used in this predicate.

Returns:
all the device interface types used in this predicate

Definition at line 238 of file predicate.cpp.


The documentation for this class was generated from the following files:
  • predicate.h
  • predicate.cpp
  • predicateparse.cpp

Solid

Skip menu "Solid"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal