This file is indexed.

/usr/include/solid/predicate.h is in kdelibs5-dev 4:4.8.2-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
/*
    Copyright 2006 Kevin Ottens <ervin@kde.org>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) version 3, or any
    later version accepted by the membership of KDE e.V. (or its
    successor approved by the membership of KDE e.V.), which shall
    act as a proxy defined in Section 6 of version 3 of the license.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef SOLID_PREDICATE_H
#define SOLID_PREDICATE_H

#include <QtCore/QVariant>
#include <QtCore/QSet>

#include <solid/solid_export.h>

#include <solid/deviceinterface.h>

namespace Solid
{
    class Device;

    /**
     * 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.
     */
    class SOLID_EXPORT Predicate
    {
    public:
        /**
         * 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
         */
        enum ComparisonOperator { Equals, Mask };

        /**
         * The predicate type which controls how the predicate is handled
         *
         * - PropertyCheck, the predicate contains a comparison that needs to be matched using a ComparisonOperator
         * - Conjunction, the two contained predicates need to be true for this predicate to be true
         * - Disjunction, either of the two contained predicates may be true for this predicate to be true
         * - InterfaceCheck, the device type is compared
         */
        enum Type { PropertyCheck, Conjunction, Disjunction, InterfaceCheck };

        /**
         * Constructs an invalid predicate.
         */
        Predicate();

        /**
         * Copy constructor.
         *
         * @param other the predicate to copy
         */
        Predicate(const Predicate &other);

        /**
         * Constructs a predicate matching the value of a property in
         * a given device interface.
         *
         * @param ifaceType the device interface type the device must have
         * @param property the property name of the device interface
         * @param value the value the property must have to make the device match
         * @param compOperator the operator to apply between the property and the value when matching
         */
        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.
         *
         * @param ifaceName the name of the device interface the device must have
         * @param property the property name of the device interface
         * @param value the value the property must have to make the device match
         * @param compOperator the operator to apply between the property and the value when matching
         */
        Predicate(const QString &ifaceName,
                   const QString &property, const QVariant &value,
                   ComparisonOperator compOperator = Equals);

        /**
         * Constructs a predicate matching devices being of a particular device interface
         *
         * @param ifaceType the device interface the device must have
         */
        explicit Predicate(const DeviceInterface::Type &ifaceType);

        /**
         * Constructs a predicate matching devices being of a particular device interface
         *
         * @param ifaceName the name of the device interface the device must have
         */
        explicit Predicate(const QString &ifaceName);

        /**
         * Destroys a Predicate object.
         */
        ~Predicate();


        /**
         * Assignement operator.
         *
         * @param other the predicate to assign
         * @return this predicate after having assigned 'other' to it
         */
        Predicate &operator=(const Predicate &other);


        /**
         * 'And' operator.
         *
         * @param other the second operand
         * @return a new 'and' predicate having 'this' and 'other' as operands
         */
        Predicate operator &(const Predicate &other);

        /**
         * 'AndEquals' operator.
         *
         * @param other the second operand
         * @return assigns to 'this' a new 'and' predicate having 'this' and 'other' as operands
         */
        Predicate &operator &=(const Predicate &other);

        /**
         * 'Or' operator.
         *
         * @param other the second operand
         * @return a new 'or' predicate having 'this' and 'other' as operands
         */
        Predicate operator|(const Predicate &other);

        /**
         * 'OrEquals' operator.
         *
         * @param other the second operand
         * @return assigns to 'this' a new 'or' predicate having 'this' and 'other' as operands
         */
        Predicate &operator|=(const Predicate &other);

        /**
         * Indicates if the predicate is valid.
         *
         * Predicate() is the only invalid predicate.
         *
         * @return true if the predicate is valid, false otherwise
         */
        bool isValid() const;

        /**
         * Checks if a device matches the predicate.
         *
         * @param device the device to match against the predicate
         * @return true if the given device matches the predicate, false otherwise
         */
        bool matches(const Device &device) const;

        /**
         * Retrieves the device interface types used in this predicate.
         *
         * @return all the device interface types used in this predicate
         */
        QSet<DeviceInterface::Type> usedTypes() const;

        /**
         * Converts the predicate to its string form.
         *
         * @return a string representation of the predicate
         */
        QString toString() const;

        /**
         * Converts a string to a predicate.
         *
         * @param predicate the string to convert
         * @return a new valid predicate if the given string is syntactically
         * correct, Predicate() otherwise
         */
        static Predicate fromString(const QString &predicate);

        /**
        * Retrieves the predicate type, used to determine how to handle the predicate
        *
        * @since 4.4
        * @return the predicate type
        */
        Type type() const;

        /**
         * Retrieves the interface type.
         *
         * @note This is only valid for InterfaceCheck and PropertyCheck types
         * @since 4.4
         * @return a device interface type used by the predicate
         */
        DeviceInterface::Type interfaceType() const;

        /**
         * Retrieves the property name used when retrieving the value to compare against
         *
         * @note This is only valid for the PropertyCheck type
         * @since 4.4
         * @return a property name
         */
        QString propertyName() const;

        /**
         * Retrieves the value used when comparing a devices property to see if it matches the predicate
         *
         * @note This is only valid for the PropertyCheck type
         * @since 4.4
         * @return the value used
         */
        QVariant matchingValue() const;

        /**
         * Retrieves the comparison operator used to compare a property's value
         *
         * @since 4.4
         * @note This is only valid for Conjunction and Disjunction types
         * @return the comparison operator used
         */
        ComparisonOperator comparisonOperator() const;

        /**
         * A smaller, inner predicate which is the first to appear and is compared with the second one
         *
         * @since 4.4
         * @note This is only valid for Conjunction and Disjunction types
         * @return The predicate used for the first operand
         */
        Predicate firstOperand() const;

        /**
         * A smaller, inner predicate which is the second to appear and is compared with the first one
         *
         * @since 4.4
         * @note This is only valid for Conjunction and Disjunction types
         * @return The predicate used for the second operand
         */
        Predicate secondOperand() const;

    private:
        class Private;
        Private * const d;
    };
}

#endif