summaryrefslogtreecommitdiffstats
path: root/src/Real.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Real.cpp')
-rw-r--r--src/Real.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Real.cpp b/src/Real.cpp
index 768d07c..b743ab5 100644
--- a/src/Real.cpp
+++ b/src/Real.cpp
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <stdlib.h>
+#include <cstdlib>
#include <plist/Real.h>
namespace PList
@@ -32,13 +32,15 @@ Real::Real(plist_t node, Node* parent) : Node(node, parent)
{
}
-Real::Real(PList::Real& d) : Node(PLIST_UINT)
+Real::Real(const PList::Real& d) : Node(PLIST_INT)
{
plist_set_real_val(_node, d.GetValue());
}
-Real& Real::operator=(PList::Real& d)
+Real& Real::operator=(const PList::Real& d)
{
+ if (this == &d) return *this;
+
plist_free(_node);
_node = plist_copy(d.GetPlist());
return *this;
@@ -53,7 +55,7 @@ Real::~Real()
{
}
-Node* Real::Clone()
+Node* Real::Clone() const
{
return new Real(*this);
}
@@ -63,11 +65,11 @@ void Real::SetValue(double d)
plist_set_real_val(_node, d);
}
-double Real::GetValue()
+double Real::GetValue() const
{
double d = 0.;
plist_get_real_val(_node, &d);
return d;
}
-};
+} // namespace PList