QGIS API Documentation 3.99.0-Master (d270888f95f)
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#define SIP_NO_FILE
20
21#include "qgis_core.h"
23#include "qgshttpheaders.h"
24#include "qgssettingstree.h"
25
26#include <QString>
27#include <QStringList>
28
29using namespace Qt::StringLiterals;
30
36template<class T> class QgsSettingsEntryEnumFlag;
37
47{
48
49 public:
50
52 static inline QgsSettingsTreeNamedListNode *sTreeSensorThingsConnections = QgsSettingsTree::sTreeConnections->createNamedListNode(
54
55 static const QgsSettingsEntryString *settingsUrl;
56 static const QgsSettingsEntryVariantMap *settingsHeaders;
57 static const QgsSettingsEntryString *settingsUsername;
58 static const QgsSettingsEntryString *settingsPassword;
59 static const QgsSettingsEntryString *settingsAuthcfg;
61
65 QgsSensorThingsProviderConnection( const QString &name );
66
70 QgsSensorThingsProviderConnection( const QString &uri, const QVariantMap &configuration );
71
72 void store( const QString &name ) const final;
73 void remove( const QString &name ) const final;
74
83 struct Data
84 {
86 QString url;
88 QString authCfg;
90 QString username;
92 QString password;
95 };
96
103 static QString encodedUri( const Data &data );
104
111 static Data decodedUri( const QString &uri );
112
119 static QString encodedLayerUri( const Data &data );
120
124 static QStringList connectionList();
125
129 static Data connection( const QString &name );
130
134 static void addConnection( const QString &name, const Data &connection );
135
141 static QString selectedConnection();
142
148 static void setSelectedConnection( const QString &name );
149};
150
151
152#endif // QGSSENSORTHINGSCONNECTION_H
@ NamedListSelectedItemSetting
Creates a setting to store which is the current item.
Definition qgis.h:686
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.