1 | #include <iostream> |
---|
2 | #include <string> |
---|
3 | #include <sstream> |
---|
4 | #include <stdlib.h> |
---|
5 | #include <errno.h> |
---|
6 | |
---|
7 | |
---|
8 | // #include "RpLibrary.h" |
---|
9 | |
---|
10 | #ifndef _RpVARIABLE_H |
---|
11 | #include "RpVariable.h" |
---|
12 | #endif |
---|
13 | |
---|
14 | #ifndef _RpSTRING_H |
---|
15 | #define _RpSTRING_H |
---|
16 | |
---|
17 | class RpString : public RpVariable |
---|
18 | { |
---|
19 | public: |
---|
20 | |
---|
21 | // users member fxns |
---|
22 | |
---|
23 | virtual RpString& setDefaultValue (std::string newDefaultVal); |
---|
24 | virtual RpString& setCurrentValue (std::string newCurrentVal); |
---|
25 | virtual RpString& setSize (std::string newSize); |
---|
26 | virtual RpString& setHeight (int newHeight); |
---|
27 | virtual RpString& setWidth (int newWidth); |
---|
28 | |
---|
29 | // base class makes |
---|
30 | // these functions virtual and derived class has a different |
---|
31 | // return type. compiler doesnt like this. need to find another |
---|
32 | // way around this |
---|
33 | // |
---|
34 | // if we keep the null_val=NULL will that give us undefined behavior? |
---|
35 | // |
---|
36 | std::string getDefaultValue (void* null_val=NULL) const; |
---|
37 | std::string getCurrentValue (void* null_val=NULL) const; |
---|
38 | std::string getSize () const; |
---|
39 | int getHeight () const; |
---|
40 | int getWidth () const; |
---|
41 | |
---|
42 | // place the information from this object into the xml library 'lib' |
---|
43 | // virtual RpString& put(RpLibrary lib); |
---|
44 | // RpString& put() const; |
---|
45 | |
---|
46 | RpString ( |
---|
47 | std::string path, |
---|
48 | std::string defaultVal |
---|
49 | ) |
---|
50 | : RpVariable (path, new std::string (defaultVal) ), |
---|
51 | width (0), |
---|
52 | height (0) |
---|
53 | {} |
---|
54 | |
---|
55 | RpString ( |
---|
56 | std::string path, |
---|
57 | std::string defaultVal, |
---|
58 | std::string sizeWxH |
---|
59 | ) |
---|
60 | : RpVariable (path, new std::string (defaultVal) ), |
---|
61 | width (0), |
---|
62 | height (0) |
---|
63 | { |
---|
64 | setSize(sizeWxH); |
---|
65 | } |
---|
66 | |
---|
67 | RpString ( |
---|
68 | std::string path, |
---|
69 | std::string defaultVal, |
---|
70 | std::string sizeWxH, |
---|
71 | std::string label, |
---|
72 | std::string desc |
---|
73 | ) |
---|
74 | : RpVariable (path, new std::string (defaultVal), label, desc), |
---|
75 | width (0), |
---|
76 | height (0) |
---|
77 | { |
---|
78 | setSize(sizeWxH); |
---|
79 | } |
---|
80 | |
---|
81 | // copy constructor |
---|
82 | RpString ( const RpString& myRpString ) |
---|
83 | : RpVariable(myRpString), |
---|
84 | width (myRpString.width), |
---|
85 | height (myRpString.height) |
---|
86 | {} |
---|
87 | |
---|
88 | // default destructor |
---|
89 | virtual ~RpString () |
---|
90 | { |
---|
91 | // clean up dynamic memory |
---|
92 | } |
---|
93 | |
---|
94 | private: |
---|
95 | int width; |
---|
96 | int height; |
---|
97 | std::string hints; |
---|
98 | |
---|
99 | |
---|
100 | |
---|
101 | }; |
---|
102 | |
---|
103 | /*--------------------------------------------------------------------------*/ |
---|
104 | /*--------------------------------------------------------------------------*/ |
---|
105 | |
---|
106 | #endif |
---|