Soprano  2.9.4
backend.h
Go to the documentation of this file.
1 /*
2  * This file is part of Soprano Project.
3  *
4  * Copyright (C) 2007-2008 Sebastian Trueg <trueg@kde.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef _SOPRANO_BACKEND_H_
23 #define _SOPRANO_BACKEND_H_
24 
25 #include "plugin.h"
26 #include "error.h"
27 #include "soprano_export.h"
28 #include "sopranotypes.h"
29 
30 #include <QtCore/QStringList>
31 #include <QtCore/QVariant>
32 #include <QtCore/QSharedDataPointer>
33 
34 
35 namespace Soprano
36 {
37  class StorageModel;
38 
53  {
54  public:
60 
64  BackendSetting( BackendOption option );
65 
69  BackendSetting( BackendOption s, const QVariant& value_ );
70 
74  BackendSetting( const QString& userOption, const QVariant& value_ );
75 
79  BackendSetting( const BackendSetting& other );
80 
84  ~BackendSetting();
85 
89  BackendSetting& operator=( const BackendSetting& other );
90 
95  BackendOption option() const;
96 
100  QString userOptionName() const;
101 
105  QVariant value() const;
106 
110  void setValue( const QVariant& value );
111 
112  private:
113  class Private;
115  };
116 
123 
138  SOPRANO_EXPORT bool isOptionInSettings( const BackendSettings& settings, BackendOption option, const QString& userOptionName = QString() );
139 
154  SOPRANO_EXPORT BackendSetting& settingInSettings( BackendSettings& settings, BackendOption option, const QString& userOptionName = QString() );
155 
168  SOPRANO_EXPORT BackendSetting& settingInSettings( BackendSettings& settings, const QString& userOptionName );
169 
184  SOPRANO_EXPORT BackendSetting settingInSettings( const BackendSettings& settings, BackendOption option, const QString& userOptionName = QString() );
185 
198  SOPRANO_EXPORT BackendSetting settingInSettings( const BackendSettings& settings, const QString& userOptionName = QString() );
199 
215  SOPRANO_EXPORT QVariant valueInSettings( const BackendSettings& settings, BackendOption option, const QString& userOptionName = QString() );
216 
231  SOPRANO_EXPORT QVariant valueInSettings( const BackendSettings& settings, const QString& userOptionName, const QVariant& defaultValue = QVariant() );
232 
247  SOPRANO_EXPORT QVariant valueInSettingsWithDefault( const BackendSettings& settings, BackendOption option, const QVariant& defaultValue );
248 
249 
264  {
265  public:
266  Backend( const QString& name );
267  virtual ~Backend();
268 
280  virtual StorageModel* createModel( const BackendSettings& settings = BackendSettings() ) const = 0;
281 
297  virtual bool deleteModelData( const BackendSettings& settings ) const = 0;
298 
306  virtual BackendFeatures supportedFeatures() const = 0;
307 
317  virtual QStringList supportedUserFeatures() const;
318 
325  bool supportsFeatures( BackendFeatures feature, const QStringList& userFeatures = QStringList() ) const;
326 
327  private:
328  class Private;
329  Private* const d;
330  };
331 }
332 
333 Q_DECLARE_INTERFACE(Soprano::Backend, "org.soprano.plugins.Backend/2.1")
334 
335 #endif
Soprano::Backend defines the interface for a Soprano backend plugin.
Definition: backend.h:263
Base class for all Model implementations that store data (as compared to FilterModel).
Definition: storagemodel.h:44
SOPRANO_EXPORT QUrl value()
Core class of Soprano&#39;s exception system.
Definition: error.h:234
SOPRANO_EXPORT Model * createModel(const BackendSettings &settings=BackendSettings())
SOPRANO_EXPORT QUrl name()
Wraps one setting for Model creation.
Definition: backend.h:52
#define SOPRANO_EXPORT
Base class for all plugins in Soprano.
Definition: plugin.h:44
QList< BackendSetting > BackendSettings
Definition: backend.h:122