1 /***************************************************************************
2                           qgsprojectfiletransform.h  -  description
3                              -------------------
4     begin                : Sun 15 dec 2007
5     copyright            : (C) 2007 by Magnus Homann
6     email                : magnus at homann.se
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 QGSPROJECTFILETRANSFORM_H
19 #define QGSPROJECTFILETRANSFORM_H
20 
21 #include "qgis_core.h"
22 #include <QString>
23 #include <QDomDocument>
24 #include "qgsprojectversion.h"
25 
26 
27 class QgsRasterLayer;
28 
29 /**
30  * \ingroup core
31  * \brief Class to convert from older project file versions to newer.
32  *
33  * This class provides possibility to store a project file as a QDomDocument,
34  * and provides the ability to specify version of the project file, and
35  * perform upgrades to a more recent version
36  */
37 class CORE_EXPORT QgsProjectFileTransform
38 {
39   public:
40     //Default constructor
41     //QgsProjectfiletransform() {}
42 
43     /**
44      * Create an instance from a Dom and a supplied version
45      * \param domDocument The Dom document to use as content
46      * \param version Version number
47      */
QgsProjectFileTransform(QDomDocument & domDocument,const QgsProjectVersion & version)48     QgsProjectFileTransform( QDomDocument &domDocument,
49                              const QgsProjectVersion &version )
50     {
51       mDom = domDocument;
52       mCurrentVersion = version;
53     }
54 
55 
56     bool updateRevision( const QgsProjectVersion &version );
57 
58     /**
59      * Prints the contents via QgsDebugMsg()
60      */
61     void dump();
62 
63     static void convertRasterProperties( QDomDocument &doc, QDomNode &parentNode, QDomElement &rasterPropertiesElem, QgsRasterLayer *rlayer );
64 
65     /**
66      * The current dom document
67      *
68      * \since QGIS 3.12
69      */
70     QDomDocument &dom();
71 
72     /**
73      * The current project version
74      *
75      * \since QGIS 3.12
76      */
77     QgsProjectVersion currentVersion() const;
78 
79   private:
80 
81     QDomDocument mDom;
82     QgsProjectVersion mCurrentVersion;
83 };
84 
85 
86 #endif //QGSPROJECTFILETRANSFORM_H
87 
88