Solid
predicate.h
Go to the documentation of this file.
00001 /* 00002 Copyright 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 Lesser General Public 00006 License as published by the Free Software Foundation; either 00007 version 2.1 of the License, or (at your option) version 3, or any 00008 later version accepted by the membership of KDE e.V. (or its 00009 successor approved by the membership of KDE e.V.), which shall 00010 act as a proxy defined in Section 6 of version 3 of the license. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public 00018 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #ifndef SOLID_PREDICATE_H 00022 #define SOLID_PREDICATE_H 00023 00024 #include <QtCore/QVariant> 00025 #include <QtCore/QSet> 00026 00027 #include <solid/solid_export.h> 00028 00029 #include <solid/deviceinterface.h> 00030 00031 namespace Solid 00032 { 00033 class Device; 00034 00045 class SOLID_EXPORT Predicate 00046 { 00047 public: 00054 enum ComparisonOperator { Equals, Mask }; 00055 00064 enum Type { PropertyCheck, Conjunction, Disjunction, InterfaceCheck }; 00065 00069 Predicate(); 00070 00076 Predicate(const Predicate &other); 00077 00087 Predicate(const DeviceInterface::Type &ifaceType, 00088 const QString &property, const QVariant &value, 00089 ComparisonOperator compOperator = Equals); 00090 00100 Predicate(const QString &ifaceName, 00101 const QString &property, const QVariant &value, 00102 ComparisonOperator compOperator = Equals); 00103 00109 explicit Predicate(const DeviceInterface::Type &ifaceType); 00110 00116 explicit Predicate(const QString &ifaceName); 00117 00121 ~Predicate(); 00122 00123 00130 Predicate &operator=(const Predicate &other); 00131 00132 00139 Predicate operator &(const Predicate &other); 00140 00147 Predicate &operator &=(const Predicate &other); 00148 00155 Predicate operator|(const Predicate &other); 00156 00163 Predicate &operator|=(const Predicate &other); 00164 00172 bool isValid() const; 00173 00180 bool matches(const Device &device) const; 00181 00187 QSet<DeviceInterface::Type> usedTypes() const; 00188 00194 QString toString() const; 00195 00203 static Predicate fromString(const QString &predicate); 00204 00211 Type type() const; 00212 00220 DeviceInterface::Type interfaceType() const; 00221 00229 QString propertyName() const; 00230 00238 QVariant matchingValue() const; 00239 00247 ComparisonOperator comparisonOperator() const; 00248 00256 Predicate firstOperand() const; 00257 00265 Predicate secondOperand() const; 00266 00267 private: 00268 class Private; 00269 Private * const d; 00270 }; 00271 } 00272 00273 #endif
KDE 4.6 API Reference