summaryrefslogtreecommitdiffstats
path: root/src/Real.cpp
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2009-10-16 22:26:13 +0200
committerGravatar Jonathan Beck2009-10-16 22:26:13 +0200
commit32be8ec384bfd78e189d3de6609e50cf4dd072a2 (patch)
treeac7edad0f19be2a31efaaaaa3acd477dd2f3c233 /src/Real.cpp
parent8aeef4dd2331445fea8a7a40466b19973e9d09c4 (diff)
downloadlibplist-32be8ec384bfd78e189d3de6609e50cf4dd072a2.tar.gz
libplist-32be8ec384bfd78e189d3de6609e50cf4dd072a2.tar.bz2
Fix Node lifecycle and change argument as reference to const reference.
Diffstat (limited to 'src/Real.cpp')
-rw-r--r--src/Real.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Real.cpp b/src/Real.cpp
index 5416887..e527f6d 100644
--- a/src/Real.cpp
+++ b/src/Real.cpp
@@ -32,6 +32,17 @@ Real::Real(plist_t node) : Node(node)
{
}
+Real::Real(PList::Real& d) : Node(PLIST_UINT)
+{
+ plist_set_real_val(_node, d.GetValue());
+}
+
+Real& Real::operator=(PList::Real& d)
+{
+ plist_free(_node);
+ _node = plist_copy(d.GetPlist());
+}
+
Real::Real(double d) : Node(PLIST_REAL)
{
plist_set_real_val(_node, d);
@@ -41,6 +52,11 @@ Real::~Real()
{
}
+Node* Real::Clone()
+{
+ return new Real(*this);
+}
+
void Real::SetValue(double d)
{
plist_set_real_val(_node, d);