This file is indexed.

/usr/include/qgis/qgsosmdatabase.h is in libqgis-dev 2.14.11+dfsg-3+deb9u1.

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
/***************************************************************************
  qgsosmdatabase.h
  --------------------------------------
  Date                 : January 2013
  Copyright            : (C) 2013 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 OSMDATABASE_H
#define OSMDATABASE_H

#include <QString>
#include <QStringList>

#include "qgsosmbase.h"

#include "qgsgeometry.h"

class QgsOSMNodeIterator;
class QgsOSMWayIterator;

typedef QPair<QString, int> QgsOSMTagCountPair;

/**
 * Class that encapsulates access to OpenStreetMap data stored in a database
 * previously imported from XML file.
 *
 * Internal database structure consists of the following tables:
 * - nodes
 * - nodes_tags
 * - ways
 * - ways_tags
 * - ways_nodes
 *
 * The topology representation can be translated to simple features representation
 * using exportSpatiaLite() method into SpatiaLite layers (tables). These can be
 * easily used in QGIS like any other layers.
 */
class ANALYSIS_EXPORT QgsOSMDatabase
{
  public:
    explicit QgsOSMDatabase( const QString& dbFileName = QString() );
    ~QgsOSMDatabase();

    void setFileName( const QString& dbFileName ) { mDbFileName = dbFileName; }
    QString filename() const { return mDbFileName; }
    bool isOpen() const;

    bool open();
    bool close();

    QString errorString() const { return mError; }

    // data access

    int countNodes() const;
    int countWays() const;

    //! @note not available in Python bindings
    QgsOSMNodeIterator listNodes() const;

    //! @note not available in Python bindings
    QgsOSMWayIterator listWays() const;

    QgsOSMNode node( QgsOSMId id ) const;
    QgsOSMWay way( QgsOSMId id ) const;
    //OSMRelation relation( OSMId id ) const;

    QgsOSMTags tags( bool way, QgsOSMId id ) const;

    //! @note available in Python bindings
    QList<QgsOSMTagCountPair> usedTags( bool ways ) const;

    QgsPolyline wayPoints( QgsOSMId id ) const;

    // export to spatialite

    enum ExportType { Point, Polyline, Polygon };
    bool exportSpatiaLite( ExportType type, const QString& tableName,
                           const QStringList& tagKeys = QStringList(),
                           const QStringList& noNullTagKeys = QStringList() );

  protected:
    bool prepareStatements();
    int runCountStatement( const char* sql ) const;

    /**
     * @note not available in Python bindings
     */
    void deleteStatement( sqlite3_stmt*& stmt );

    void exportSpatiaLiteNodes( const QString& tableName, const QStringList& tagKeys, const QStringList& notNullTagKeys = QStringList() );
    void exportSpatiaLiteWays( bool closed, const QString& tableName, const QStringList& tagKeys, const QStringList& notNullTagKeys = QStringList() );
    bool createSpatialTable( const QString& tableName, const QString& geometryType, const QStringList& tagKeys );
    bool createSpatialIndex( const QString& tableName );

    QString quotedIdentifier( QString id );
    QString quotedValue( QString value );

  private:
    //! database file name
    QString mDbFileName;

    QString mError;

    //! pointer to sqlite3 database that keeps OSM data
    sqlite3* mDatabase;

    sqlite3_stmt* mStmtNode;
    sqlite3_stmt* mStmtNodeTags;
    sqlite3_stmt* mStmtWay;
    sqlite3_stmt* mStmtWayNode;
    sqlite3_stmt* mStmtWayNodePoints;
    sqlite3_stmt* mStmtWayTags;

    QgsOSMDatabase( const QgsOSMDatabase& rh );
    QgsOSMDatabase& operator=( const QgsOSMDatabase& rh );
};


/** Encapsulate iteration over table of nodes/
 * @note not available in Python bindings
*/
class ANALYSIS_EXPORT QgsOSMNodeIterator
{
  public:
    ~QgsOSMNodeIterator();

    QgsOSMNode next();
    void close();

  protected:
    /** @note not available in Python bindings
     */
    QgsOSMNodeIterator( sqlite3* handle );

    sqlite3_stmt* mStmt;

    friend class QgsOSMDatabase;
};



/** Encapsulate iteration over table of ways
 * @note not available in Python bindings
 */
class ANALYSIS_EXPORT QgsOSMWayIterator
{
  public:
    ~QgsOSMWayIterator();

    QgsOSMWay next();
    void close();

  protected:
    /** @note not available in Python bindings
     */
    QgsOSMWayIterator( sqlite3* handle );

    sqlite3_stmt* mStmt;

  private:

    friend class QgsOSMDatabase;
};



#endif // OSMDATABASE_H