1 | |
---|
2 | #include <iostream> |
---|
3 | #include <string> |
---|
4 | #include <sstream> |
---|
5 | #include <stdlib.h> |
---|
6 | #include <errno.h> |
---|
7 | |
---|
8 | |
---|
9 | // #include "RpLibrary.h" |
---|
10 | |
---|
11 | #ifndef _RpABOUT_H |
---|
12 | #include "RpAbout.h" |
---|
13 | #endif |
---|
14 | |
---|
15 | #ifndef _RpVARIABLE_H |
---|
16 | #define _RpVARIABLE_H |
---|
17 | |
---|
18 | class RpVariable |
---|
19 | { |
---|
20 | public: |
---|
21 | |
---|
22 | // users member fxns |
---|
23 | |
---|
24 | virtual RpVariable& setPath (std::string newPath); |
---|
25 | virtual RpVariable& setDefaultValue (void* newDefaultVal); |
---|
26 | virtual RpVariable& setCurrentValue (void* newCurrentVal); |
---|
27 | virtual RpVariable& setLabel (std::string newLabel); |
---|
28 | virtual RpVariable& setDesc (std::string newDesc); |
---|
29 | virtual RpVariable& setHints (std::string newHints); |
---|
30 | virtual RpVariable& setColor (std::string newColor); |
---|
31 | virtual RpVariable& setIcon (std::string newIcon); |
---|
32 | |
---|
33 | virtual std::string getPath () const; |
---|
34 | /* maybe we dont need 2 get functions? */ |
---|
35 | virtual void* getDefaultValue () const; |
---|
36 | virtual void* getCurrentValue () const; |
---|
37 | virtual std::string getLabel () const; |
---|
38 | virtual std::string getDesc () const; |
---|
39 | virtual std::string getHints () const; |
---|
40 | virtual std::string getColor () const; |
---|
41 | virtual std::string getIcon () const; |
---|
42 | |
---|
43 | // place the information from this object into the xml library 'lib' |
---|
44 | // virtual RpNumber& put(RpLibrary lib); |
---|
45 | // virtual RpVariable& put() const; |
---|
46 | |
---|
47 | // we need a copy of defaultVal in currentVal, not the same pointer. |
---|
48 | // need to fix this. |
---|
49 | |
---|
50 | RpVariable ( |
---|
51 | std::string path, |
---|
52 | void* defaultVal |
---|
53 | ) |
---|
54 | : about (RpAbout()), |
---|
55 | path (path), |
---|
56 | defaultVal (defaultVal), |
---|
57 | currentVal (defaultVal) |
---|
58 | { |
---|
59 | // about's default no-arg const is called |
---|
60 | }; |
---|
61 | |
---|
62 | RpVariable ( |
---|
63 | std::string path, |
---|
64 | void* defaultVal, |
---|
65 | std::string label, |
---|
66 | std::string desc |
---|
67 | ) |
---|
68 | : about (RpAbout(label,desc)), |
---|
69 | path (path), |
---|
70 | defaultVal (defaultVal), |
---|
71 | currentVal (defaultVal) |
---|
72 | {} |
---|
73 | |
---|
74 | // copy constructor |
---|
75 | RpVariable ( const RpVariable& myRpVariable ) |
---|
76 | // will the RpAbout copy constructor be called here? |
---|
77 | : about (RpAbout(myRpVariable.about)), |
---|
78 | path (myRpVariable.path), |
---|
79 | defaultVal (myRpVariable.defaultVal), |
---|
80 | currentVal (myRpVariable.currentVal) |
---|
81 | {} |
---|
82 | |
---|
83 | // default destructor |
---|
84 | virtual ~RpVariable () |
---|
85 | { |
---|
86 | // clean up dynamic memory |
---|
87 | } |
---|
88 | |
---|
89 | private: |
---|
90 | |
---|
91 | RpAbout about; |
---|
92 | std::string path; |
---|
93 | void* defaultVal; |
---|
94 | void* currentVal; |
---|
95 | |
---|
96 | |
---|
97 | }; |
---|
98 | |
---|
99 | /*--------------------------------------------------------------------------*/ |
---|
100 | /*--------------------------------------------------------------------------*/ |
---|
101 | |
---|
102 | #endif |
---|