diff options
Diffstat (limited to 'src/Boolean.cpp')
| -rw-r--r-- | src/Boolean.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Boolean.cpp b/src/Boolean.cpp index e58472f..2a5e303 100644 --- a/src/Boolean.cpp +++ b/src/Boolean.cpp @@ -18,7 +18,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <stdlib.h> +#include <cstdlib> +#include "plist.h" #include <plist/Boolean.h> namespace PList @@ -32,13 +33,15 @@ Boolean::Boolean(plist_t node, Node* parent) : Node(node, parent) { } -Boolean::Boolean(PList::Boolean& b) : Node(PLIST_BOOLEAN) +Boolean::Boolean(const PList::Boolean& b) : Node(PLIST_BOOLEAN) { plist_set_bool_val(_node, b.GetValue()); } -Boolean& Boolean::operator=(PList::Boolean& b) +Boolean& Boolean::operator=(const PList::Boolean& b) { + if (this == &b) return *this; + plist_free(_node); _node = plist_copy(b.GetPlist()); return *this; @@ -53,7 +56,7 @@ Boolean::~Boolean() { } -Node* Boolean::Clone() +Node* Boolean::Clone() const { return new Boolean(*this); } @@ -63,11 +66,11 @@ void Boolean::SetValue(bool b) plist_set_bool_val(_node, b); } -bool Boolean::GetValue() +bool Boolean::GetValue() const { uint8_t b = 0; plist_get_bool_val(_node, &b); return b != 0 ; } -}; +} // namespace PList |
