KDevelop API Documentation

property.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2002-2004 by Alexander Dymo  <cloudtemple@mskat.net>    *
00003  *                                                                         *
00004  *   This program is free software; you can redistribute it and/or modify  *
00005  *   it under the terms of the GNU Library General Public License as       *
00006  *   published by the Free Software Foundation; either version 2 of the    *
00007  *   License, or (at your option) any later version.                       *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU Library General Public     *
00015  *   License along with this program; if not, write to the                 *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00018  ***************************************************************************/
00019 #include "property.h"
00020 
00021 #include <qstring.h>
00022 
00023 namespace PropertyLib{
00024 
00025 Property::Property(int type, const QString &name, const QString &description,
00026     const QVariant &value, bool save, bool readOnly):
00027     m_type(type), m_name(name), m_description(description), m_value(value), m_save(save),
00028     m_readOnly(readOnly), m_visible(true)
00029 {
00030 }
00031 
00032 Property::Property(const QString &name, const QMap<QString, QVariant> &v_valueList,
00033     const QString &description, const QVariant &value, bool save, bool readOnly):
00034     valueList(v_valueList), m_type(ValueFromList), m_name(name),
00035     m_description(description), m_value(value), m_save(save), m_readOnly(readOnly),
00036     m_visible(true)
00037 {
00038 }
00039 
00040 Property::~Property()
00041 {
00042 }
00043 
00044 bool Property::allowSaving() const
00045 {
00046    return m_save;
00047 }
00048 
00049 bool Property::operator<(const Property &prop) const
00050 {
00051     if ((type() < prop.type()) && (name() < prop.name()))
00052         return true;
00053     else
00054         return false;
00055 }
00056 
00057 QString Property::name() const
00058 {
00059     return m_name;
00060 }
00061 
00062 void Property::setName(const QString &name)
00063 {
00064     m_name = name;
00065 }
00066 
00067 int Property::type() const
00068 {
00069     return m_type;
00070 }
00071 
00072 void Property::setType(int type)
00073 {
00074     m_type = type;
00075 }
00076 
00077 QVariant Property::value() const
00078 {
00079     return m_value;
00080 }
00081 
00082 void Property::setValue(const QVariant &value, bool rememberOldValue)
00083 {
00084     if (rememberOldValue)
00085         m_oldValue = m_value;
00086     else
00087         m_oldValue = value;
00088     m_value = value;
00089 }
00090 
00091 QString Property::description() const
00092 {
00093     return m_description;
00094 }
00095 
00096 void Property::setDescription(const QString &description)
00097 {
00098     m_description = description;
00099 }
00100 
00101 void Property::setValueList(const QMap<QString, QVariant> &v_valueList)
00102 {
00103     valueList = v_valueList;
00104 }
00105 
00106 bool Property::readOnly() const
00107 {
00108     return m_readOnly;
00109 }
00110 
00111 bool Property::visible() const
00112 {
00113     return m_visible;
00114 }
00115 
00116 void Property::setVisible( const bool visible )
00117 {
00118     m_visible = visible;
00119 }
00120 
00121 QVariant Property::oldValue() const
00122 {
00123     if (m_oldValue.isNull())
00124         return m_value;
00125     else
00126         return m_oldValue;
00127 }
00128 
00129 }
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:03:53 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003