source: trunk/src/objects/RpString.h @ 1261

Last change on this file since 1261 was 1018, checked in by gah, 16 years ago

Massive changes: New directory/file layout

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