File indexing completed on 2024-12-01 09:59:49

0001 /***************************************************************************
0002                           cvariable.h  -  one variable
0003                              -------------------
0004     begin                : Po sep 8 2003
0005     copyright            : (C) 2003 by Tomas Mecir
0006     email                : kmuddy@kmuddy.com
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either version 2 of the License, or     *
0014  *   (at your option) any later version.                                   *
0015  *                                                                         *
0016  ***************************************************************************/
0017 
0018 #ifndef CVARIABLE_H
0019 #define CVARIABLE_H
0020 
0021 #include "csaveablefield.h"
0022 
0023 class cValue;
0024 
0025 /**
0026 This class represents one variable.
0027   *@author Tomas Mecir
0028   */
0029 
0030 class cVariable : public cSaveableField  {
0031 public: 
0032   cVariable ();
0033   ~cVariable () override;
0034 
0035   cSaveableField *newInstance () override;
0036 
0037   /** load data from a config file */
0038   void load (KConfig *config, const QString &group) override;
0039 
0040   /** abstract; returns type of item (light-weight RTTI) */
0041   int itemType () override { return TYPE_VARIABLE; };
0042 
0043   QString name () { return _name; };
0044   /** sets new variable name; no duplicity check here - cVariableList must
0045   handle that */
0046   void setName (const QString &newname) { _name = newname; };
0047   cValue *getValue () { return val; };
0048   QString value ();
0049   void setValue (const QString &newvalue);
0050   void setValue (const cValue *v);
0051 protected:
0052   QString _name;
0053   cValue *val;
0054 };
0055 
0056 #endif