diff options
| author | 2013-03-19 16:50:47 +0100 | |
|---|---|---|
| committer | 2013-03-19 16:50:47 +0100 | |
| commit | 553c3849207a29abd1cb58f82d5994e5cd9d1f2d (patch) | |
| tree | ded1d25c25f4afe5c0b8aad7a8b16f64f8cee0f1 /src/Uid.cpp | |
| parent | 057fa38c02913703634da5c40753e1dafd626774 (diff) | |
| download | libplist-553c3849207a29abd1cb58f82d5994e5cd9d1f2d.tar.gz libplist-553c3849207a29abd1cb58f82d5994e5cd9d1f2d.tar.bz2 | |
C++: added support for PLIST_UID nodes (class Uid)
Diffstat (limited to 'src/Uid.cpp')
| -rw-r--r-- | src/Uid.cpp | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/Uid.cpp b/src/Uid.cpp new file mode 100644 index 0000000..02a59b3 --- /dev/null +++ b/src/Uid.cpp | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | /* | ||
| 2 | * Uid.cpp | ||
| 3 | * | ||
| 4 | * Copyright (c) 2012 Nikias Bassen, All Rights Reserved. | ||
| 5 | * | ||
| 6 | * This library is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU Lesser General Public | ||
| 8 | * License as published by the Free Software Foundation; either | ||
| 9 | * version 2.1 of the License, or (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This library is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 14 | * Lesser General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU Lesser General Public | ||
| 17 | * License along with this library; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | */ | ||
| 20 | |||
| 21 | #include <stdlib.h> | ||
| 22 | #include <plist/Uid.h> | ||
| 23 | |||
| 24 | namespace PList | ||
| 25 | { | ||
| 26 | |||
| 27 | Uid::Uid(Node* parent) : Node(PLIST_UID, parent) | ||
| 28 | { | ||
| 29 | } | ||
| 30 | |||
| 31 | Uid::Uid(plist_t node, Node* parent) : Node(node, parent) | ||
| 32 | { | ||
| 33 | } | ||
| 34 | |||
| 35 | Uid::Uid(PList::Uid& i) : Node(PLIST_UID) | ||
| 36 | { | ||
| 37 | plist_set_uid_val(_node, i.GetValue()); | ||
| 38 | } | ||
| 39 | |||
| 40 | Uid& Uid::operator=(PList::Uid& i) | ||
| 41 | { | ||
| 42 | plist_free(_node); | ||
| 43 | _node = plist_copy(i.GetPlist()); | ||
| 44 | return *this; | ||
| 45 | } | ||
| 46 | |||
| 47 | Uid::Uid(uint64_t i) : Node(PLIST_UID) | ||
| 48 | { | ||
| 49 | plist_set_uid_val(_node, i); | ||
| 50 | } | ||
| 51 | |||
| 52 | Uid::~Uid() | ||
| 53 | { | ||
| 54 | } | ||
| 55 | |||
| 56 | Node* Uid::Clone() | ||
| 57 | { | ||
| 58 | return new Uid(*this); | ||
| 59 | } | ||
| 60 | |||
| 61 | void Uid::SetValue(uint64_t i) | ||
| 62 | { | ||
| 63 | plist_set_uid_val(_node, i); | ||
| 64 | } | ||
| 65 | |||
| 66 | uint64_t Uid::GetValue() | ||
| 67 | { | ||
| 68 | uint64_t i = 0; | ||
| 69 | plist_get_uid_val(_node, &i); | ||
| 70 | return i; | ||
| 71 | } | ||
| 72 | |||
| 73 | }; | ||
