annotate rdf/RDFTransformFactory.h @ 1879:652c5360e682

Ensure transforms are populated before instantiateDefaultPluginFor runs - otherwise if we have prior knowledge of a transform id, we can find ourselves trying to instantiate it before the plugin factory has heard of it and e.g. knows which server to use
author Chris Cannam
date Thu, 25 Jun 2020 12:20:06 +0100
parents ad5f892c0c4d
children
rev   line source
Chris@439 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@439 2
Chris@439 3 /*
Chris@439 4 Sonic Visualiser
Chris@439 5 An audio file viewer and annotation editor.
Chris@439 6 Centre for Digital Music, Queen Mary, University of London.
Chris@439 7 This file copyright 2008 QMUL.
Chris@439 8
Chris@439 9 This program is free software; you can redistribute it and/or
Chris@439 10 modify it under the terms of the GNU General Public License as
Chris@439 11 published by the Free Software Foundation; either version 2 of the
Chris@439 12 License, or (at your option) any later version. See the file
Chris@439 13 COPYING included with this distribution for more information.
Chris@439 14 */
Chris@439 15
Chris@1581 16 #ifndef SV_RDF_TRANSFORM_FACTORY_H
Chris@1581 17 #define SV_RDF_TRANSFORM_FACTORY_H
Chris@439 18
Chris@439 19 #include <QObject>
Chris@439 20 #include <QString>
Chris@439 21
Chris@439 22 #include <vector>
Chris@439 23
Chris@439 24 #include "transform/Transform.h"
Chris@439 25
Chris@439 26 class RDFTransformFactoryImpl;
Chris@439 27 class ProgressReporter;
Chris@439 28
Chris@439 29 class RDFTransformFactory : public QObject
Chris@439 30 {
Chris@439 31 Q_OBJECT
Chris@439 32
Chris@439 33 public:
Chris@439 34 static QString getKnownExtensions();
Chris@439 35
Chris@439 36 RDFTransformFactory(QString url);
Chris@439 37 virtual ~RDFTransformFactory();
Chris@439 38
Chris@1163 39 /** isRDF() may be queried at any point after construction. It
Chris@1163 40 returns true if the file was parseable as RDF.
Chris@1163 41 */
Chris@1163 42 bool isRDF();
Chris@1163 43
Chris@1163 44 /** isOK() may be queried at any point after getTransforms() has
Chris@1163 45 been called. It is true if the file was parseable as RDF and
Chris@1163 46 any transforms in it could be completely constructed.
Chris@1163 47
Chris@1163 48 Note that even if isOK() returns true, it is still possible
Chris@1163 49 that the file did not define any transforms; in this case,
Chris@1163 50 getTransforms() would have returned an empty list.
Chris@1163 51
Chris@1163 52 If isOK() is called before getTransforms() has been invoked to
Chris@1163 53 query the file, it will return true iff isRDF() is true.
Chris@1163 54 */
Chris@1163 55 bool isOK();
Chris@1163 56
Chris@1163 57 /** Return any error string resulting from loading or querying the
Chris@1163 58 file. This will be non-empty if isRDF() or isOK() returns
Chris@1163 59 false.
Chris@1163 60 */
Chris@439 61 QString getErrorString() const;
Chris@439 62
Chris@439 63 std::vector<Transform> getTransforms(ProgressReporter *reporter);
Chris@439 64
Chris@494 65 static QString writeTransformToRDF(const Transform &, QString uri);
Chris@494 66
Chris@439 67 protected:
Chris@439 68 RDFTransformFactoryImpl *m_d;
Chris@439 69 };
Chris@439 70
Chris@439 71 #endif