settingsprovider.h
1 //------------------------------------------------------------------------------
2 // settingsprovider.h
3 //------------------------------------------------------------------------------
4 // Copyright 2011 - 2013 Zalewa <zalewapl@gmail.com>. All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are met:
8 //
9 // 1. Redistributions of source code must retain the above copyright notice,
10 // this list of conditions and the following disclaimer.
11 //
12 // 2. Redistributions in binary form must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in
14 // the documentation and/or other materials provided with
15 // the distribution.
16 //
17 // THIS SOFTWARE IS PROVIDED BY ZALEWA ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
20 // EVENT SHALL ZALEWA OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
26 // WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
27 // OF SUCH DAMAGE.
28 //
29 // The views and conclusions contained in the software and documentation are
30 // those of the authors and should not be interpreted as representing official
31 // policies, either expressed or implied, of Zalewa.
32 //------------------------------------------------------------------------------
33 // Copyright (C) 2013 "Zalewa" <zalewapl@gmail.com>
34 //------------------------------------------------------------------------------
35 #ifndef idEB87F251C_EC08_4EFE_9DC1754821652427
36 #define idEB87F251C_EC08_4EFE_9DC1754821652427
37 
38 #include "global.h"
39 #include "dptr.h"
40 
41 #include <QString>
42 #include <QStringList>
43 #include <QVariant>
44 
48 class MAIN_EXPORT SettingsProvider
49 {
50  public:
52  virtual ~SettingsProvider();
53 
54  virtual QStringList allKeys() const = 0;
55  virtual QStringList allSections() const = 0;
56  virtual bool hasKey(const QString& key) const = 0;
57  virtual void remove(const QString& key) = 0;
58  virtual void setValue(const QString& key, const QVariant& value) = 0;
59  virtual QVariant value(const QString& key, QVariant defValue = QVariant()) const = 0;
60 
66  void copyFrom(const SettingsProvider& other);
67 
68  private:
70 };
71 
72 #endif // header