QGIS API Documentation
4.3.0-Master (4ecdf0f3f59)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
externalstorage
qgsexternalstorageregistry.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsexternalstorageregistry.cpp
3
--------------------------------------
4
Date : March 2021
5
Copyright : (C) 2021 by Julien Cabieces
6
Email : julien dot cabieces at oslandia 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
#include "
qgsexternalstorageregistry.h
"
17
18
#include "
qgsexternalstorage.h
"
19
#include "
qgshttpexternalstorage_p.h
"
20
#include "
qgssimplecopyexternalstorage_p.h
"
21
22
QgsExternalStorageRegistry::QgsExternalStorageRegistry
()
23
{
24
registerExternalStorage
(
new
QgsSimpleCopyExternalStorage() );
25
registerExternalStorage
(
new
QgsWebDavExternalStorage() );
26
registerExternalStorage
(
new
QgsAwsS3ExternalStorage() );
27
}
28
29
QgsExternalStorageRegistry::~QgsExternalStorageRegistry
()
30
{
31
qDeleteAll( mBackends );
32
}
33
34
QgsExternalStorage
*
QgsExternalStorageRegistry::externalStorageFromType
(
const
QString &type )
const
35
{
36
auto
it = std::find_if( mBackends.begin(), mBackends.end(), [type](
QgsExternalStorage
*storage ) { return storage->type() == type; } );
37
38
return
it != mBackends.end() ? *it :
nullptr
;
39
}
40
41
QList<QgsExternalStorage *>
QgsExternalStorageRegistry::externalStorages
()
const
42
{
43
return
mBackends;
44
}
45
46
void
QgsExternalStorageRegistry::registerExternalStorage
(
QgsExternalStorage
*storage )
47
{
48
if
( !mBackends.contains( storage ) )
49
mBackends.append( storage );
50
}
51
52
void
QgsExternalStorageRegistry::unregisterExternalStorage
(
QgsExternalStorage
*storage )
53
{
54
const
int
index = mBackends.indexOf( storage );
55
if
( index >= 0 )
56
{
57
delete
mBackends.takeAt( index );
58
}
59
}
QgsExternalStorageRegistry::externalStorageFromType
QgsExternalStorage * externalStorageFromType(const QString &type) const
Returns external storage implementation if the storage type matches one.
Definition
qgsexternalstorageregistry.cpp:34
QgsExternalStorageRegistry::registerExternalStorage
void registerExternalStorage(QgsExternalStorage *storage)
Registers a storage backend and takes ownership of it.
Definition
qgsexternalstorageregistry.cpp:46
QgsExternalStorageRegistry::externalStorages
QList< QgsExternalStorage * > externalStorages() const
Returns a list of registered project storage implementations.
Definition
qgsexternalstorageregistry.cpp:41
QgsExternalStorageRegistry::QgsExternalStorageRegistry
QgsExternalStorageRegistry()
Constructor - creates a registry of external storage backends.
Definition
qgsexternalstorageregistry.cpp:22
QgsExternalStorageRegistry::~QgsExternalStorageRegistry
~QgsExternalStorageRegistry()
Definition
qgsexternalstorageregistry.cpp:29
QgsExternalStorageRegistry::unregisterExternalStorage
void unregisterExternalStorage(QgsExternalStorage *storage)
Unregisters a storage backend and destroys its instance.
Definition
qgsexternalstorageregistry.cpp:52
QgsExternalStorage
Abstract interface for external storage - to be implemented by various backends and registered in Qgs...
Definition
qgsexternalstorage.h:37
qgsexternalstorage.h
qgsexternalstorageregistry.h
qgshttpexternalstorage_p.h
qgssimplecopyexternalstorage_p.h
Generated on
for QGIS API Documentation by
1.17.0