]> Shamusworld >> Repos - architektonas/blob - src/base/variable.h
Fixed problem with MDI activation.
[architektonas] / src / base / variable.h
1 #ifndef __VARIABLE_H__
2 #define __VARIABLE_H__
3
4 #include <QtCore>
5 #include "enums.h"
6 #include "vector.h"
7 #include "debug.h"
8
9 /**
10  * A variable of type int, double, string or vector.
11  * The variable also contains its type and an int code
12  * which can identify its contents in any way.
13  *
14  * @author Andrew Mustun
15  */
16 class Variable
17 {
18         public:
19                 typedef struct {
20                         QString s;
21                         int i;
22                         double d;
23                         Vector v;
24                 } VariableContents;
25
26                 Variable();
27                 Variable(const Vector & v, int c);
28                 Variable(const QString & v, int c);
29                 Variable(int v, int c);
30                 Variable(double v, int c);
31                 virtual ~Variable();
32
33                 void setString(const QString & str);
34                 void setInt(int i);
35                 void setDouble(double d);
36                 void setVector(const Vector & v);
37                 QString getString();
38                 int getInt();
39                 double getDouble();
40                 Vector getVector();
41                 RS2::VariableType getType();
42                 int getCode();
43
44                 //friend std::ostream& operator << (std::ostream& os, Variable& v);
45
46         private:
47                 VariableContents contents;
48                 RS2::VariableType type;
49                 int code;
50 };
51
52 #endif