File indexing completed on 2024-04-14 03:47:58

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2008 Henry de Valence <hdevalence@gmail.com>
0004 // SPDX-FileCopyrightText: 2010 Dennis Nienhüser <nienhueser@kde.org>
0005 // SPDX-FileCopyrightText: 2010-2013 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
0006 // SPDX-FileCopyrightText: 2011 Thibaut Gridel <tgridel@free.fr>
0007 
0008 #ifndef MARBLE_PARSINGRUNNERMANAGER_H
0009 #define MARBLE_PARSINGRUNNERMANAGER_H
0010 
0011 #include <QObject>
0012 
0013 #include "marble_export.h"
0014 
0015 #include "GeoDataDocument.h"
0016 
0017 namespace Marble
0018 {
0019 
0020 class PluginManager;
0021 
0022 class MARBLE_EXPORT ParsingRunnerManager : public QObject
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     /**
0028      * Constructor.
0029      * @param pluginManager The plugin manager that gives access to RunnerPlugins
0030      * @param parent Optional parent object
0031      */
0032     explicit ParsingRunnerManager( const PluginManager *pluginManager, QObject *parent = nullptr );
0033 
0034     ~ParsingRunnerManager() override;
0035 
0036     /**
0037      * Parse the file using the runners for various formats
0038      * @see parseFile is asynchronous with results returned using the
0039      * @see parsingFinished signal.
0040      * @see openFile is blocking.
0041      * @see parsingFinished signal indicates all runners are finished.
0042      */
0043     void parseFile( const QString &fileName, DocumentRole role = UserDocument );
0044     GeoDataDocument *openFile( const QString &fileName, DocumentRole role = UserDocument, int timeout = 30000 );
0045 
0046 Q_SIGNALS:
0047     /**
0048      * The file was parsed and potential error message
0049      */
0050     void parsingFinished( GeoDataDocument *document, const QString &error = QString() );
0051 
0052     /**
0053      * Emitted whenever all runners are finished for the query
0054      */
0055     void parsingFinished();
0056 
0057 private:
0058     Q_PRIVATE_SLOT( d, void cleanupParsingTask() )
0059     Q_PRIVATE_SLOT( d, void addParsingResult( GeoDataDocument *document, const QString &error ) )
0060 
0061     class Private;
0062     friend class Private;
0063     Private *const d;
0064 };
0065 
0066 }
0067 
0068 #endif