/***************************************************************************
                        qfield.h
                        ---------------
  begin                : Jun 2020
  copyright            : (C) 2020 by Ivan Ivanov
  email                : ivan@opengis.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 QFIELD_H
#define QFIELD_H

#include <QString>

/**
 * Contains "polyfills" for backporting c++ features from standards > c++17 and Qt global methods
 * added later than our minimum version, as well nice some sugar.
 */
namespace qfield
{
  /**
   * Can be used to iterate over `QMap`s in a convenient way.
   *
   * \code{.cpp}
   * for (auto [key, value]: asKeyValueRange(map))
   * {
   *   // do something with `key` and `value`
   * }
   * \endcode
   */
  template<typename T> class asKeyValueRange
  {
    public:
      explicit asKeyValueRange( T &data )
        : mData { data }
      {
      }

      auto begin() { return mData.keyValueBegin(); }

      auto end() { return mData.keyValueEnd(); }

    private:
      T &mData;
  };

  static inline const QString gitRev{ QStringLiteral( "GITDIR-NOTFOUND" ) };
  static inline const QString appVersion{ QStringLiteral( "0" ) };
  static inline const QString appVersionStr{ QStringLiteral( "local - dev" ) };
  static inline const QString appName{ QStringLiteral( "QField" ) };
}; // namespace qfield

#define WITH_SENTRY 0
#define QGIS_PREFIX_PATH "C:/src/osgeo4w/src/qfield-dev/osgeo4w/osgeo4w/apps/qgis-qt6-dev"

#endif // QFIELD_H
