This file is indexed.

/usr/include/qgis/qgsrelationmanager.h is in libqgis-dev 2.18.17+dfsg-1.

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
/***************************************************************************
    qgsrelationmanager.h
     --------------------------------------
    Date                 : 1.3.2013
    Copyright            : (C) 2013 Matthias Kuhn
    Email                : matthias at opengis dot ch
 ***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef QGSRELATIONMANAGER_H
#define QGSRELATIONMANAGER_H

#include <QObject>
#include <QPair>
#include <QDomNode>
#include <QDomDocument>

#include "qgsrelation.h"

class QgsProject;
class QgsVectorLayer;

/** \ingroup core
 * This class manages a set of relations between layers.
 */
class CORE_EXPORT QgsRelationManager : public QObject
{
    Q_OBJECT

  public:

    /** Constructor for QgsRelationManager.
     * @param project associated project (used to notify project of changes)
     */
    explicit QgsRelationManager( QgsProject *project = nullptr );

    /**
     * Will set the specified relations and remove any relation currently set.
     *
     * @param relations A list of relations to set.
     */
    void setRelations( const QList<QgsRelation>& relations );

    /**
     * Get access to the relations managed by this class.
     *
     * @return A QMap where the key is the relation id, the value the relation object.
     */
    const QMap<QString, QgsRelation>& relations() const;

    /**
     * Add a relation.
     *
     * @param relation The relation to add.
     */
    void addRelation( const QgsRelation& relation );

    /**
     * Remove a relation.
     *
     * @param id The id of the relation to remove.
     */
    void removeRelation( const QString& id );

    /**
     * Remove a relation.
     *
     * @param relation The relation to remove.
     */
    void removeRelation( const QgsRelation& relation );

    /**
     * Get access to a relation by its id.
     *
     * @param id The id to search for
     *
     * @return A relation. Invalid if not found.
     * @see relationsByName()
     */
    QgsRelation relation( const QString& id ) const;

    /** Returns a list of relations with matching names.
     * @param name relation name to search for. Searching is case insensitive.
     * @returns a list of matching relations
     * @note added in QGIS 2.16
     * @see relation()
     */
    QList<QgsRelation> relationsByName( const QString& name ) const;

    /**
     * Remove any relation managed by this class.
     */
    void clear();

    /**
     * Get all relations where the specified layer (and field) is the referencing part (i.e. the child table with the foreign key).
     *
     * @param layer     The layer which should be searched for.
     * @param fieldIdx  The field which should be part of the foreign key. If not set will return all relations.
     *
     * @return A list of relations matching the given layer and fieldIdx.
     */
    QList<QgsRelation> referencingRelations( QgsVectorLayer *layer = nullptr, int fieldIdx = -2 ) const;

    /**
     * Get all relations where this layer is the referenced part (i.e. the parent table with the primary key being referenced from another layer).
     *
     * @param layer   The layer which should be searched for.
     *
     * @return A list of relations where the specified layer is the referenced part.
     */
    QList<QgsRelation> referencedRelations( QgsVectorLayer *layer = nullptr ) const;

  signals:
    /** This signal is emitted when the relations were loaded after reading a project */
    void relationsLoaded();

    /**
     * Emitted when relations are added or removed to the manager.
     * @note added in QGIS 2.5
     */
    void changed();

  private slots:
    void readProject( const QDomDocument &doc );
    void writeProject( QDomDocument &doc );
    void layersRemoved( const QStringList& layers );

  private:
    /** The references */
    QMap<QString, QgsRelation> mRelations;

    QgsProject* mProject;
};

#endif // QGSRELATIONMANAGER_H