Solid
predicate.h
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 Copyright (C) 2006 Kevin Ottens <ervin@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 00018 */ 00019 00020 #ifndef SOLID_PREDICATE_H 00021 #define SOLID_PREDICATE_H 00022 00023 #include <QtCore/QVariant> 00024 #include <QtCore/QSet> 00025 00026 #include <solid/solid_export.h> 00027 00028 #include <solid/deviceinterface.h> 00029 00030 namespace Solid 00031 { 00032 class Device; 00033 00044 class SOLID_EXPORT Predicate 00045 { 00046 public: 00053 enum ComparisonOperator { Equals, Mask }; 00054 00058 Predicate(); 00059 00065 Predicate(const Predicate &other); 00066 00076 Predicate(const DeviceInterface::Type &ifaceType, 00077 const QString &property, const QVariant &value, 00078 ComparisonOperator compOperator = Equals); 00079 00089 Predicate(const QString &ifaceName, 00090 const QString &property, const QVariant &value, 00091 ComparisonOperator compOperator = Equals); 00092 00098 explicit Predicate(const DeviceInterface::Type &ifaceType); 00099 00105 explicit Predicate(const QString &ifaceName); 00106 00110 ~Predicate(); 00111 00112 00119 Predicate &operator=(const Predicate &other); 00120 00121 00128 Predicate operator &(const Predicate &other); 00129 00136 Predicate &operator &=(const Predicate &other); 00137 00144 Predicate operator|(const Predicate &other); 00145 00152 Predicate &operator|=(const Predicate &other); 00153 00161 bool isValid() const; 00162 00169 bool matches(const Device &device) const; 00170 00176 QSet<DeviceInterface::Type> usedTypes() const; 00177 00183 QString toString() const; 00184 00192 static Predicate fromString(const QString &predicate); 00193 00194 private: 00195 class Private; 00196 Private * const d; 00197 }; 00198 } 00199 00200 #endif