This file is indexed.

/usr/include/soprano/languagetag.h is in libsoprano-dev 2.7.6+dfsg.1-2wheezy1.

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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
/*
 * This file is part of Soprano Project.
 *
 * Copyright (C) 2009 Greg Beauchesne <greg_b@vision-play.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef SOPRANO_LANGUAGETAG_H
#define SOPRANO_LANGUAGETAG_H

#include <QtCore/QSharedDataPointer>
#include <QtCore/QTextStream>
#include <QtCore/QLocale>
#include <QtCore/QFlags>
#include <QtCore/QMetaType>

#include "soprano_export.h"

namespace Soprano
{
    /**
     * \class LanguageTag languagetag.h Soprano/LanguageTag
     *
     * \brief A LanguageTag represents a language according to RFC 3066 and RFC 4646.
     *
     * \author Greg Beauchesne <greg_b@vision-play.com>
     *
     * \since 2.3
     */
    class SOPRANO_EXPORT LanguageTag
    {
    public:
        enum MatchFilter {
            /**
             * Represents basic language filtering as described in RFC 3066 section 2.5
             * (or RFC 4647 section 3.3.1). Basic language filtering checks only that the
             * range string is a prefix of a language tag and that the prefix is followed
             * by "-" or the end of the string. Additionally, the language range "*"
             * matches all tags.
             */
            MatchFilterBasic = 0,

            /**
             * Represents extended language filtering as described in RFC 4647 section 3.3.2.
             * Extended language filtering breaks tags up into subtags and is permitted to
             * skip subtags in the language tag in order to match parts of the range string.
             */
            MatchFilterExtended = 1
        };

        /**
         * Flags for performing LanguageTag lookups.
         *
         * \sa lookup()
         */
        enum LookupFlag {
            LookupFlagNone = 0,
            /// Disables fallback behavior for lookup ranges
            LookupFlagNoFallback = 1
        };
        Q_DECLARE_FLAGS(LookupFlags, LookupFlag)

    public:
        /**
         * \name Constructors
         */
        //@{
        /**
         * Default constructor.
         * Creates an empty language tag.
         */
        LanguageTag();

        /**
         * Copy constructor.
         *
         * \param other The language tag from which to copy
         */
        LanguageTag( const LanguageTag &other );

        /**
         * Creates a language tag.
         *
         * \param tag The language tag string
         */
        LanguageTag( const char * tag );

        /**
         * Creates a language tag.
         *
         * \param tag The language tag string
         */
        LanguageTag( const QLatin1String &tag );

        /**
         * Creates a language tag.
         *
         * \param tag The language tag string
         */
        LanguageTag( const QString &tag );

        /**
         * Creates a language tag from a QLocale. If the language is
         * QLocale::C, then an empty LanguageTag is produced.
         *
         * \param locale the locale
         */
        explicit LanguageTag( const QLocale &locale );

        /**
         * Creates a language tag from a language and country. If \a lang is
         * QLocale::C, then an empty LanguageTag is produced.
         *
         * \param lang the language code
         * \param country the country code
         */
        LanguageTag( QLocale::Language lang, QLocale::Country country = QLocale::AnyCountry );

        /**
         * Destructor.
         */
        ~LanguageTag();
        //@}

        /**
         * \name Operators
         */
        //@{
        /**
         * Assigns \a other to this tag.
         */
        LanguageTag& operator=( const LanguageTag& other );

        /**
         * Comparison operator. Language tag comparisons are
         * case-insensitive.
         *
         * \return \c true if this tag and \p other are equal.
         */
        bool operator==( const LanguageTag& other ) const;

        /**
         * Comparison operator. Language tag comparisons are
         * case-insensitive.
         * \return \c true if this tag and \p other differ.
         */
        bool operator!=( const LanguageTag& other ) const;

        /**
         * Comparison operator.
         * \return \c true if this tag is lexically less than \p other.
         */
        bool operator<( const LanguageTag& other ) const;

        /**
         * Comparison operator.
         * \return \c true if this tag is lexically less than or equal to \p other.
         */
        bool operator<=( const LanguageTag& other ) const;

        /**
         * Comparison operator.
         * \return \c true if this tag is lexically greater than \p other.
         */
        bool operator>( const LanguageTag& other ) const;

        /**
         * Comparison operator.
         * \return \c true if this tag is lexically greater than or equal to \p other.
         */
        bool operator>=( const LanguageTag& other ) const;

        /**
         * Match this language tag against \a range using the specified
         * filtering scheme.
         *
         * \param range the range against which to match
         * \param scheme the filtering scheme to use
         *
         * \return \c true if this tag matches \a pattern, \c false if not.
         */
        bool matches( const LanguageTag& range, MatchFilter scheme = MatchFilterBasic ) const;
        //@}

        /**
         * \name Information
         */
        //@{

        /**
         * \return \c true if this language tag is empty.
         */
        bool isEmpty() const;

        /**
         * Determines if this language tag is valid. A valid language
         * tag is divided into subtags that are divided by "-". The tag
         * must adhere the following rules:
         * - Each subtag is composed only of characters in the ASCII range
         *   [a-zA-Z0-9] (letters and digits), with the exception of the
         *   first subtag, which must be composed of letters only
         * - No subtags are empty
         * - No subtags are longer than 8 characters
         * - Single-character subtags cannot end the tag unless after a
         *   private use ("x") subtag (e.g. "en-x-i" and "en-x-abcd-i" are
         *   legal; "en-x", "en-i", and "en-i-abcd-g" are illegal)
         *
         * \return \c true if this language tag is valid
         */
        bool isValid() const;

        /**
         * \return the subtag parts that make up this language tag
         */
        QStringList subTags() const;

        //@}

        /**
         * \name Conversion
         */
        //@{
        /**
         * Converts this LanguageTag to a string.
         *
         * \return the string representation of this LanguageTag
         */
        QString toString() const;

        /**
         * Converts this LanguageTag to a string formatted according to the
         * case rules in RFC 4647 section 4.4 (page 44).
         *
         * \return the pretty string representation of this LanguageTag
         */
        QString toPrettyString() const;

        /**
         * Converts this LanguageTag to a locale, using the primary language
         * tag and first two-letter language subtag, if any.
         * If the conversion could not be performed, then the "C"
         * QLocale is returned.
         *
         * \return the converted locale
         *
         * \note QLocale restricts the countries that can be paired with a
         * particular language. If the language-country pair in this tag
         * is not in the QLocale database, or if this language tag does not
         * contain country information, then the most appropriate country
         * will be used for the locale. For example, "de-US" (German as
         * spoken in the United States) is not a valid combination, and the
         * country would be changed to Germany.
         */
        QLocale toLocale() const;

        /**
         * A convenience operator to convert this LanguageTag to a string.
         *
         * \return the string representation of this LanguageTag
         *
         * \sa toString()
         */
        inline operator QString() const { return toString(); }
        //@}


        /**
         * Compares a language tag against a list of language tags and
         * selects the most suitable tag according to the rules of RFC 4647
         * Section 3.4.
         *
         * The arguments consist of \a choices, a list of tags from which
         * to select, and \a priority, a list of acceptable language ranges.
         * Both lists must be sorted in descending order of preference.
         *
         * The matching algorithm works as follows:
         * <ol>
         * <li>For each item in the \a priority list, the \a choices list is
         * scanned for matches. The wildcard value "*" is ignored in
         * lookup operations, as it would match any tag. If a match occurs,
         * the lookup is complete and the matching \a choices list index is
         * returned.</li>
         * <li>If no match has been found, the last subtag on the current
         * \a priority item is truncated, and the \a choices list is scanned
         * again. Single-character subtags are also truncated if they are at
         * the end of the tag. This repeats until there are no subtags
         * remaining. This fallback behavior can be skipped by specifying the
         * LookupFlagsNoFallback flag.</li>
         * <li>If neither the current \a priority item nor any of its
         * fallback values matched the \a choices list, then the next item
         * in the \a priority list is considered according to the above
         * steps.</li>
         * <li>If none of the \a priority items match the \a choices list,
         * then a value < 0 is returned.</li>
         * </ol>
         *
         * \param choices the list of available language choices
         * \param priority the language priority list
         * \param flags flags for the lookup operation
         * \param scheme the matching scheme to use. RFC 4647 specifies
         *            that basic (\link LanguageTag::MatchFilterBasic MatchFilterBasic\endlink)
         *            processing should be used.
         *
         * \return the index of the matching language tag in \a choices, or
         *         < 0 if no tag matched.
         */
        static int lookup(
            const QList<LanguageTag> & choices,
            const QList<LanguageTag> & priority,
            LookupFlags flags = LookupFlagNone,
            MatchFilter scheme = MatchFilterBasic
        );

        /**
         * A convenience method to select a language tag based on a single
         * search pattern.
         *
         * \param choices the list of available language choices
         * \param priority the language range against which to match
         * \param flags flags for the lookup operation
         * \param scheme the matching scheme to use. RFC 4647 specifies
         *            that basic (\link LanguageTag::MatchFilterBasic MatchFilterBasic\endlink)
         *            processing should be used.
         *
         * \return the index of the matching language tag in \a choices, or
         *         < 0 if no tag matched.
         *
         * \sa lookup(const QList<LanguageTag> &, const QList<LanguageTag> &, LookupFlags, MatchFilter)
         */
        static int lookup(
            const QList<LanguageTag> & choices,
            const LanguageTag & priority,
            LookupFlags flags = LookupFlagNone,
            MatchFilter scheme = MatchFilterBasic
        );

    private:
        class Private;
        QSharedDataPointer<Private> d;
    };

    SOPRANO_EXPORT uint qHash( const LanguageTag& node );
}

Q_DECLARE_METATYPE( Soprano::LanguageTag )
Q_DECLARE_TYPEINFO( Soprano::LanguageTag, Q_MOVABLE_TYPE );

Q_DECLARE_OPERATORS_FOR_FLAGS(Soprano::LanguageTag::LookupFlags)

SOPRANO_EXPORT QDebug operator<<( QDebug s, const Soprano::LanguageTag& );
SOPRANO_EXPORT QTextStream& operator<<( QTextStream& s, const Soprano::LanguageTag& );

#endif // SOPRANO_LANGUAGETAG_H