source: trunk/src/core/RpBoolean.cc @ 121

Last change on this file since 121 was 121, checked in by dkearney, 18 years ago

added basic doxygen tags for function definitions.

File size: 2.1 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  RpBoolean - Rappture 2.0 About XML object
4 *
5 * ======================================================================
6 *  AUTHOR:  Derrick Kearney, Purdue University
7 *  Copyright (c) 2004-2005  Purdue Research Foundation
8 *
9 *  See the file "license.terms" for information on usage and
10 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 * ======================================================================
12 */
13
14 #include "RpBoolean.h"
15
16/**********************************************************************/
17// METHOD: setDefaultValue()
18/// Set the default value of this object
19/**
20 */
21
22RpBoolean&
23RpBoolean::setDefaultValue(std::string newDefaultVal)
24{
25    std::string* def = NULL;
26   
27    def = (std::string*) RpVariable::getDefaultValue();
28
29    if (!def) {
30        RpVariable::setDefaultValue(new std::string (newDefaultVal));
31    }
32    else {
33        *def = newDefaultVal;
34    }
35
36    return *this;
37}
38
39/**********************************************************************/
40// METHOD: setCurrentValue()
41/// Set the current value of this object.
42/**
43 */
44
45RpBoolean&
46RpBoolean::setCurrentValue(std::string newCurrentVal)
47{
48    std::string* cur = (std::string*) RpVariable::getCurrentValue();
49    std::string* def = (std::string*) RpVariable::getDefaultValue();
50
51    if (cur == def) {
52        RpVariable::setCurrentValue(new std::string (newCurrentVal));
53    }
54    else {
55        *cur = newCurrentVal;
56    }
57
58    return *this;
59}
60
61
62/**********************************************************************/
63// METHOD: getDefaultValue()
64/// Report the default value of this object.
65/**
66 */
67
68std::string
69RpBoolean::getDefaultValue(void* null_val) const
70{
71    return *((std::string*) RpVariable::getDefaultValue());
72}
73
74/**********************************************************************/
75// METHOD: getCurrentValue()
76/// Report the current value of this object.
77/**
78 */
79
80std::string
81RpBoolean::getCurrentValue(void* null_val) const
82{
83    return *((std::string*) RpVariable::getCurrentValue());
84}
85
86// -------------------------------------------------------------------- //
87
Note: See TracBrowser for help on using the repository browser.