diff options
author | Jonathan Beck | 2009-10-16 22:26:13 +0200 |
---|---|---|
committer | Jonathan Beck | 2009-10-16 22:26:13 +0200 |
commit | 32be8ec384bfd78e189d3de6609e50cf4dd072a2 (patch) | |
tree | ac7edad0f19be2a31efaaaaa3acd477dd2f3c233 /src/Boolean.cpp | |
parent | 8aeef4dd2331445fea8a7a40466b19973e9d09c4 (diff) | |
download | libplist-32be8ec384bfd78e189d3de6609e50cf4dd072a2.tar.gz libplist-32be8ec384bfd78e189d3de6609e50cf4dd072a2.tar.bz2 |
Fix Node lifecycle and change argument as reference to const reference.
Diffstat (limited to 'src/Boolean.cpp')
-rw-r--r-- | src/Boolean.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Boolean.cpp b/src/Boolean.cpp index cc704c9..03d17c8 100644 --- a/src/Boolean.cpp +++ b/src/Boolean.cpp @@ -32,6 +32,17 @@ Boolean::Boolean(plist_t node) : Node(node) { } +Boolean::Boolean(PList::Boolean& b) : Node(PLIST_BOOLEAN) +{ + plist_set_bool_val(_node, b.GetValue()); +} + +Boolean& Boolean::operator=(PList::Boolean& b) +{ + plist_free(_node); + _node = plist_copy(b.GetPlist()); +} + Boolean::Boolean(bool b) : Node(PLIST_BOOLEAN) { plist_set_bool_val(_node, b); @@ -41,6 +52,11 @@ Boolean::~Boolean() { } +Node* Boolean::Clone() +{ + return new Boolean(*this); +} + void Boolean::SetValue(bool b) { plist_set_bool_val(_node, b); |