File tree Expand file tree Collapse file tree 2 files changed +84
-0
lines changed Expand file tree Collapse file tree 2 files changed +84
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* **************************************************************************
2
+ qgscapabilitiescache.h
3
+ ----------------------
4
+ begin : May 11th, 2011
5
+ copyright : (C) 2011 by Marco Hugentobler
6
+ email : marco dot hugentobler at sourcepole dot ch
7
+ ***************************************************************************/
8
+
9
+ /* **************************************************************************
10
+ * *
11
+ * This program is free software; you can redistribute it and/or modify *
12
+ * it under the terms of the GNU General Public License as published by *
13
+ * the Free Software Foundation; either version 2 of the License, or *
14
+ * (at your option) any later version. *
15
+ * *
16
+ ***************************************************************************/
17
+
18
+ #include " qgscapabilitiescache.h"
19
+
20
+ QgsCapabilitiesCache::QgsCapabilitiesCache ()
21
+ {
22
+ }
23
+
24
+ QgsCapabilitiesCache::~QgsCapabilitiesCache ()
25
+ {
26
+ }
27
+
28
+ const QDomDocument* QgsCapabilitiesCache::searchCapabilitiesDocument ( const QString& configFilePath ) const
29
+ {
30
+ QHash< QString, QDomDocument >::const_iterator it = mCachedCapabilities .find ( configFilePath );
31
+ if ( it == mCachedCapabilities .constEnd () )
32
+ {
33
+ return 0 ;
34
+ }
35
+ else
36
+ {
37
+ return &(it.value ());
38
+ }
39
+ }
40
+
41
+ void QgsCapabilitiesCache::insertCapabilitiesDocument ( const QString& configFilePath, const QDomDocument* doc )
42
+ {
43
+ mCachedCapabilities .insert ( configFilePath, doc->cloneNode ().toDocument () );
44
+ }
Original file line number Diff line number Diff line change
1
+ /* **************************************************************************
2
+ qgscapabilitiescache.h
3
+ ----------------------
4
+ begin : May 11th, 2011
5
+ copyright : (C) 2011 by Marco Hugentobler
6
+ email : marco dot hugentobler at sourcepole dot ch
7
+ ***************************************************************************/
8
+
9
+ /* **************************************************************************
10
+ * *
11
+ * This program is free software; you can redistribute it and/or modify *
12
+ * it under the terms of the GNU General Public License as published by *
13
+ * the Free Software Foundation; either version 2 of the License, or *
14
+ * (at your option) any later version. *
15
+ * *
16
+ ***************************************************************************/
17
+
18
+ #ifndef QGSCAPABILITIESCACHE_H
19
+ #define QGSCAPABILITIESCACHE_H
20
+
21
+ #include < QDomDocument>
22
+ #include < QHash>
23
+
24
+ /* *A cache for capabilities xml documents (by configuration file path)*/
25
+ class QgsCapabilitiesCache
26
+ {
27
+ public:
28
+ QgsCapabilitiesCache ();
29
+ ~QgsCapabilitiesCache ();
30
+
31
+ /* *Returns cached capabilities document (or 0 if document for configuration file not in cache)*/
32
+ const QDomDocument* searchCapabilitiesDocument ( const QString& configFilePath ) const ;
33
+ /* *Inserts new capabilities document (creates a copy of the document, does not take ownership)*/
34
+ void insertCapabilitiesDocument ( const QString& configFilePath, const QDomDocument* doc );
35
+
36
+ private:
37
+ QHash< QString, QDomDocument > mCachedCapabilities ;
38
+ };
39
+
40
+ #endif // QGSCAPABILITIESCACHE_H
You can’t perform that action at this time.
0 commit comments