LeechCraft Monocle  0.6.70-16373-g319c272718
Modular document viewer for LeechCraft
ibackendplugin.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include <QString>
12 #include <QMetaType>
13 #include "idocument.h"
14 
15 namespace LC
16 {
17 namespace Monocle
18 {
20  typedef std::shared_ptr<IRedirectProxy> IRedirectProxy_ptr;
21 
39  {
40  public:
43  virtual ~IBackendPlugin () {}
44 
50  enum class LoadCheckResult
51  {
54  Cannot,
55 
58  Can,
59 
63  Redirect
64  };
65 
91  virtual LoadCheckResult CanLoadDocument (const QString& filename) = 0;
92 
115  virtual IDocument_ptr LoadDocument (const QString& filename) = 0;
116 
136  virtual IRedirectProxy_ptr GetRedirection (const QString& filename)
137  {
138  Q_UNUSED (filename)
139  return {};
140  }
141 
156  virtual QStringList GetSupportedMimes () const = 0;
157 
168  virtual bool IsThreaded () const
169  {
170  return false;
171  }
172  };
173 }
174 }
175 
176 Q_DECLARE_INTERFACE (LC::Monocle::IBackendPlugin,
177  "org.LeechCraft.Monocle.IBackendPlugin/1.0")
LoadCheckResult
Describes the result of checking whether a file can be loaded.
virtual IRedirectProxy_ptr GetRedirection(const QString &filename)
Returns the redirection proxy for the given document.
virtual ~IBackendPlugin()
Virtual destructor.
virtual IDocument_ptr LoadDocument(const QString &filename)=0
Loads the given document.
std::shared_ptr< IRedirectProxy > IRedirectProxy_ptr
The file cannot be loaded by this backend.
virtual LoadCheckResult CanLoadDocument(const QString &filename)=0
Checks whether the given document can be loaded.
Interface for redirecting document opening requests.
std::shared_ptr< IDocument > IDocument_ptr
Shared pointer to a document.
Definition: idocument.h:198
virtual bool IsThreaded() const
Returns whether the backend supports threads.
virtual QStringList GetSupportedMimes() const =0
Returns the MIME types supported by the backend.
The file can be loaded by this backend.
The file cannot be loaded by this backend, but can be converted to another format.
Definition: iannotation.h:20
Basic interface for plugins providing support for various document formats for Monocle.