File indexing completed on 2025-01-12 06:47:31
0001 /*************************************************************************** 0002 cvariable.cpp - one variable 0003 ------------------------------ 0004 begin : Po sep 8 2003 0005 copyright : (C) 2003-2008 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 #include "cvariable.h" 0019 #include "cvalue.h" 0020 0021 cVariable::cVariable () 0022 { 0023 _name = QString(); 0024 val = nullptr; 0025 } 0026 0027 cVariable::~cVariable () 0028 { 0029 delete val; 0030 } 0031 0032 QString cVariable::value () 0033 { 0034 if (val) return val->asString (); 0035 return QString(); 0036 } 0037 0038 void cVariable::setValue (const QString &newvalue) 0039 { 0040 cValue *oldv = val; 0041 val = new cValue (newvalue); 0042 delete oldv; 0043 } 0044 0045 void cVariable::setValue (const cValue *v) 0046 { 0047 cValue *oldv = val; 0048 val = new cValue (*v); 0049 delete oldv; 0050 } 0051