This file is indexed.

/usr/include/qgis/qgslayertreelayer.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
/***************************************************************************
  qgslayertreelayer.h
  --------------------------------------
  Date                 : May 2014
  Copyright            : (C) 2014 by Martin Dobias
  Email                : wonder dot sk at gmail dot com
 ***************************************************************************
 *                                                                         *
 *   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 QGSLAYERTREELAYER_H
#define QGSLAYERTREELAYER_H

#include "qgslayertreenode.h"

class QgsMapLayer;

/** \ingroup core
 * Layer tree node points to a map layer.
 *
 * When using with existing QgsMapLayer instance, it is expected that the layer
 * has been registered in QgsMapLayerRegistry earlier.
 *
 * The node can exist also without a valid instance of a layer (just ID). That
 * means the referenced layer does not need to be loaded in order to use it
 * in layer tree. In such case, the node will start listening to map layer
 * registry updates in expectation that the layer (identified by its ID) will
 * be loaded later.
 *
 * A map layer is supposed to be present in one layer tree just once. It is
 * however possible that temporarily a layer exists in one tree more than just
 * once, e.g. while reordering items with drag and drop.
 *
 * @note added in 2.4
 */
class CORE_EXPORT QgsLayerTreeLayer : public QgsLayerTreeNode
{
    Q_OBJECT
  public:

    //! Parameters for loose layer matching
    struct LayerMatchParams
    {
      //! Layer public source
      QString source;
      //! Layer name
      QString name;
      //! Provider
      QString providerKey;
    };

    explicit QgsLayerTreeLayer( QgsMapLayer* layer );
    QgsLayerTreeLayer( const QgsLayerTreeLayer& other );

    /**
     * Creates a layer node which will attach to a layer with matching
     * parameters. This can be used for "looser" layer matching,
     * avoiding the usual layer id check in favour of attaching to any layer
     * with an equal source/name/provider.
     */
    static QgsLayerTreeLayer* createLayerFromParams( const LayerMatchParams& source );

    explicit QgsLayerTreeLayer( const QString& layerId, const QString& name = QString() );

    QString layerId() const { return mLayerId; }

    QgsMapLayer* layer() const { return mLayer; }

    //! Get layer's name
    //! @note added in 2.18.1
    QString name() const override;
    //! Set layer's name
    //! @note added in 2.18.1
    void setName( const QString& n ) override;

    /**
     * Attempts to attach this layer node to a layer with a matching
     * QgsMapLayer::publicSource(). This can be used for "looser" layer matching,
     * avoiding the usual layer id check in favour of attaching to any layer
     * with an equal source.
     */
    void attachToSource( const LayerMatchParams &source );

    QString layerName() const;
    void setLayerName( const QString& n );

    Qt::CheckState isVisible() const { return mVisible; }
    void setVisible( Qt::CheckState visible );

    /**
     * Creates a new layer from an XML definition. If the looseMatch
     * parameter is true then legend layers will use looser matching criteria,
     * eg testing layer source instead of layer IDs.
     */
    static QgsLayerTreeLayer* readXML( QDomElement& element, bool looseMatch = false );

    virtual void writeXML( QDomElement& parentElement ) override;

    virtual QString dump() const override;

    virtual QgsLayerTreeLayer* clone() const override;

  protected slots:
    void registryLayersAdded( const QList<QgsMapLayer*>& layers );
    void registryLayersWillBeRemoved( const QStringList& layerIds );
    //! Emits a nameChanged() signal if layer's name has changed
    //! @note added in 2.18.1
    void layerNameChanged();

  signals:
    //! emitted when a previously unavailable layer got loaded
    void layerLoaded();
    //! emitted when a previously available layer got unloaded (from layer registry)
    //! @note added in 2.6
    void layerWillBeUnloaded();

  protected:
    void attachToLayer();

    QString mLayerId;
    QString mLayerName; // only used if layer does not exist

    //! Only used when loosely matching to layers - eg when creating a composer legend from template
    //! If set this will attach to the first matching layer with equal parameters
    LayerMatchParams mLooseMatchParams;

    QgsMapLayer* mLayer; // not owned! may be null
    Qt::CheckState mVisible;

  private:

    bool layerMatchesSource( QgsMapLayer *layer, const LayerMatchParams& params ) const;
};



#endif // QGSLAYERTREELAYER_H