]>
vaikene.ee Git - evaf/blob - src/libs/Common/prop.h
3 * @brief Implementation of the iProp interface
6 * Copyright (c) 2011-2019 Enar Vaikene
8 * This file is part of the eVaf C++ cross-platform application development framework.
10 * This file can be used under the terms of the GNU General Public License
11 * version 3.0 as published by the Free Software Foundation and appearing in
12 * the file LICENSE included in the packaging of this file. Please review the
13 * the following information to ensure the GNU General Public License version
14 * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
16 * Alternatively, this file may be used in accordance with the Commercial License
17 * Agreement provided with the Software.
20 #ifndef __COMMON_PROP_H
21 # define __COMMON_PROP_H
26 #include <QScopedPointer>
35 * Implementation of the iProp interface.
37 * This class implements the iProp interface for global properties and variables.
38 * Persistent properties are stored in the file '.\<appname\>.dat' in the directory
39 * returned with the eVaf::Common::iApp::dataRootDir() function. The file is in the
40 * QSettings::IniFormat format.
42 class Prop
: public iProp
49 * Destroys the iProp interface instance
51 static void destroyInstance();
58 * Returns the current implementation of the iProp interface
60 iProp
* _interface() const;
63 * Initializes the iProp interface implementation
64 * @return True if succeeded; false if not
69 * Finalizes the iProp interface implementation
77 virtual QVariant
getValue(QString
const & name
, QVariant
const & defaultValue
) const;
79 virtual void setValue(QString
const & name
, QVariant
const & value
, bool persistent
= false);
84 /// List of properties
85 QHash
<QString
, QVariant
> mProps
;
87 /// Persistent property values
88 QScopedPointer
<QSettings
> mPersistentProps
;
92 } // namespace eVaf::Common::Internal
93 } // namespace eVaf::Common