QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
Loading...
Searching...
No Matches
qgssensorthingsconnection.h
Go to the documentation of this file.
1/***************************************************************************
2 qgssensorthingsconnection.h
3 ---------------------
4 Date : December 2023
5 Copyright : (C) 2023 by Nyall Dawson
6 Email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSSENSORTHINGSCONNECTION_H
17#define QGSSENSORTHINGSCONNECTION_H
18
19
20#include "qgis_core.h"
22#include "qgshttpheaders.h"
23#include "qgssettingstree.h"
24
25#include <QString>
26#include <QStringList>
27
28#define SIP_NO_FILE
29
30using namespace Qt::StringLiterals;
31
37template<class T> class QgsSettingsEntryEnumFlag;
38
48{
49 public:
51 static inline QgsSettingsTreeNamedListNode *sTreeSensorThingsConnections
53
54 static const QgsSettingsEntryString *settingsUrl;
55 static const QgsSettingsEntryVariantMap *settingsHeaders;
56 static const QgsSettingsEntryString *settingsUsername;
57 static const QgsSettingsEntryString *settingsPassword;
58 static const QgsSettingsEntryString *settingsAuthcfg;
60
64 QgsSensorThingsProviderConnection( const QString &name );
65
69 QgsSensorThingsProviderConnection( const QString &uri, const QVariantMap &configuration );
70
71 void store( const QString &name ) const final;
72 void remove( const QString &name ) const final;
73
82 struct Data
83 {
85 QString url;
87 QString authCfg;
89 QString username;
91 QString password;
94 };
95
102 static QString encodedUri( const Data &data );
103
110 static Data decodedUri( const QString &uri );
111
118 static QString encodedLayerUri( const Data &data );
119
123 static QStringList connectionList();
124
128 static Data connection( const QString &name );
129
133 static void addConnection( const QString &name, const Data &connection );
134
140 static QString selectedConnection();
141
147 static void setSelectedConnection( const QString &name );
148};
149
150
151#endif // QGSSENSORTHINGSCONNECTION_H
@ NamedListSelectedItemSetting
Creates a setting to store which is the current item.
Definition qgis.h:693
QVariantMap configuration() const
Returns the connection configuration parameters.
QgsAbstractProviderConnection(const QString &name)
Creates a new connection with name by reading its configuration from the settings.
virtual void remove(const QString &name) const =0
Deletes the connection from the settings.
virtual void store(const QString &name) const =0
Stores the connection in the settings.
QString uri() const
Returns the connection data source URI string representation.
Implements simple HTTP header management.
static QString selectedConnection()
Returns the name of the last used connection.
static QString encodedUri(const Data &data)
Returns connection data encoded as a string.
static QString encodedLayerUri(const Data &data)
Returns connection data encoded as a string containing a URI for a SensorThings vector data provider.
static void setSelectedConnection(const QString &name)
Stores the name of the last used connection.
static QStringList connectionList()
Returns a list of the stored connection names.
static Data connection(const QString &name)
Returns connection details for the stored connection with the specified name.
PRIVATE QgsSensorThingsProviderConnection(const QString &name)
Constructor for QgsSensorThingsProviderConnection, using the stored settings with the specified conne...
static Data decodedUri(const QString &uri)
Returns a connection uri decoded to a data structure.
static void addConnection(const QString &name, const Data &connection)
Stores a new connection, under the specified connection name.
A boolean settings entry.
A double settings entry.
A template class for enum and flag settings entry.
An integer settings entry.
A string settings entry.
A string list settings entry.
A named list tree node for the settings tree to help organizing and introspecting the tree.
static QgsSettingsTreeNode * sTreeConnections
Represents decoded data of a SensorThings connection.
QString authCfg
Authentication configuration id.