/** * @file Common/prop.h * @brief Implementation of the iProp interface * @author Enar Vaikene * * Copyright (c) 2011 Enar Vaikene * * This file is part of the eVaf C++ cross-platform application development framework. * * This file can be used under the terms of the GNU General Public License * version 3.0 as published by the Free Software Foundation and appearing in * the file LICENSE included in the packaging of this file. Please review the * the following information to ensure the GNU General Public License version * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. * * Alternatively, this file may be used in accordance with the Commercial License * Agreement provided with the Software. */ #ifndef __COMMON_PROP_H # define __COMMON_PROP_H #include "iprop.h" #include class QSettings; namespace eVaf { namespace Common { namespace Internal { /** * Implementation of the iProp interface. * * This class implements the iProp interface for global properties and variables. * Persistent properties are stored in the file '.\.dat' in the directory * returned with the eVaf::Common::iApp::dataRootDir() function. The file is in the * QSettings::IniFormat format. */ class Prop : public iProp { Q_OBJECT public: Prop(); virtual ~Prop(); /** * Returns the current implementation of the iProp interface */ iProp * _interface() const; /** * Initializes the iProp interface implementation * @return True if succeeded; false if not */ bool init(); /** * Finalizes the iProp interface implementation */ void done(); /* iProp interface */ virtual QVariant getValue(QString const & name, QVariant const & defaultValue) const; virtual void setValue(QString const & name, QVariant const & value, bool persistent = false); private: // Members /// List of properties QHash mProps; /// Persistent property values QSettings * mPersistentProps; }; } // namespace eVaf::Common::Internal } // namespace eVaf::Common } // namespace eVaf #endif // prop.h