]> Shamusworld >> Repos - architektonas/blob - src/base/rs_variable.h
Fixed thumbnail rendering in LibraryWidget and DXF detection.
[architektonas] / src / base / rs_variable.h
1 #ifndef RS_VARIABLE_H
2 #define RS_VARIABLE_H
3
4 #include <QtCore>
5 #include "rs.h"
6 #include "vector.h"
7 #include "rs_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 RS_Variable
17 {
18         public:
19                 typedef struct {
20                         QString s;
21                         int i;
22                         double d;
23                         Vector v;
24                 } RS_VariableContents;
25
26                 RS_Variable();
27                 RS_Variable(const Vector & v, int c);
28                 RS_Variable(const QString & v, int c);
29                 RS_Variable(int v, int c);
30                 RS_Variable(double v, int c);
31                 virtual ~RS_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, RS_Variable& v);
45
46         private:
47                 RS_VariableContents contents;
48                 RS2::VariableType type;
49                 int code;
50 };
51
52 #endif