This file is indexed.

/usr/include/qgis/qgsosmdownload.h is in libqgis-dev 2.0.1-2build2.

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
/***************************************************************************
  qgsosmdownload.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 OSMDOWNLOAD_H
#define OSMDOWNLOAD_H


#include <QObject>
#include <QFile>
#include <QNetworkReply>

class QgsRectangle;

/**
 * @brief OSMDownload is a utility class for downloading OpenStreetMap via Overpass API.
 *
 * To use this class, it is necessary to set query, output file name and start the request.
 * The interface is asynchronous, the caller has to wait for finished() signal that is
 * emitted whe the request has finished (successfully or with an error).
 *
 * To check whether the the request has been successful, check hasError() and use errorString()
 * to retreive error message. An error may happen either directly in start() method
 * or during the network communication.
 *
 * By default OSMDownload uses remote service at location returned by defaultServiceUrl() method.
 */
class ANALYSIS_EXPORT QgsOSMDownload : public QObject
{
    Q_OBJECT
  public:

    //! Return URL of the service that is used by default
    static QString defaultServiceUrl();

    //! Create query (in Overpass Query Language) that fetches everything in given rectangle
    static QString queryFromRect( const QgsRectangle& rect );

    QgsOSMDownload();
    ~QgsOSMDownload();

    void setServiceUrl( const QString& serviceUrl ) { mServiceUrl = serviceUrl; }
    QString serviceUrl() const { return mServiceUrl; }

    void setQuery( const QString& query ) { mQuery = query; }
    QString query() const { return mQuery; }

    void setOutputFileName( const QString& outputFileName ) { mFile.setFileName( outputFileName ); }
    QString outputFileName() const { return mFile.fileName(); }

    bool hasError() const { return !mError.isNull(); }
    QString errorString() const { return mError; }

    /**
     * @brief Starts network request for data. The prerequisite is that the query string and output
     * file name have been set.
     *
     * Only one request may be pending at one point - if you need more requests at once, use several instances.
     *
     * @return true if the network request has been issued, false otherwise (and sets error string)
     */
    bool start();

    /**
     * @brief Aborts current pending request
     * @return true if there is a pending request and has been aborted, false otherwise
     */
    bool abort();

    //! Returns true if the request has already finished
    bool isFinished() const;

  signals:
    void finished(); //!< emitted when the network reply has finished (with success or with an error)
    void downloadProgress( qint64, qint64 ); //!< normally the total length is not known (until we reach end)

  private slots:
    void onReadyRead();
    void onFinished();
    void onError( QNetworkReply::NetworkError err );

  private:
    QString mServiceUrl;
    QString mQuery;
    QString mError;

    QNetworkReply* mReply;
    QFile mFile;
};

#endif // OSMDOWNLOAD_H