moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kturtle / src / value.h
blob63864854b977f88431791d029e47fb4ead3d2d1a
1 /*
2 Copyright (C) 2003 by Walter Schreppers
3 Copyright (C) 2004 by Cies Breijs
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of version 2 of the GNU General Public
7 License as published by the Free Software Foundation.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef _VALUE_H_
21 #define _VALUE_H_
23 #include <qstring.h>
24 #include <qtextstream.h>
27 enum valueType
29 emptyValue,
30 boolValue,
31 numberValue,
32 stringValue
35 class Value
37 public:
38 Value();
39 Value(const Value&);
40 ~Value() {}
43 void resetValue() { init(); }
45 int Type() const;
46 void setType(int);
48 void setBool(bool);
49 bool Bool() const;
51 double Number() const;
52 void setNumber(double);
53 bool setNumber(const QString&);
55 QString String() const;
56 void setString(double);
57 void setString(const QString&);
59 Value& operator=(const Value&);
60 Value& operator=(const QString&);
61 Value& operator=(double);
63 Value& operator+(const Value&);
64 Value& operator-(const Value&);
65 Value& operator*(const Value&);
66 Value& operator/(const Value&);
68 bool operator==(const Value&) const;
69 bool operator!=(const Value&) const;
70 bool operator< (const Value&) const;
71 bool operator<=(const Value&) const;
72 bool operator> (const Value&) const;
73 bool operator>=(const Value&) const;
76 private:
77 void init();
79 int type;
80 bool m_bool;
81 double m_double;
82 QString m_string;
85 #endif // _VALUE_H_