summaryrefslogtreecommitdiffstats
path: root/src/Data.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data.cpp')
-rw-r--r--src/Data.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/Data.cpp b/src/Data.cpp
new file mode 100644
index 0000000..2ce610d
--- /dev/null
+++ b/src/Data.cpp
@@ -0,0 +1,57 @@
1/*
2 * Data.cpp
3 *
4 * Copyright (c) 2009 Jonathan Beck 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/Data.h>
23
24namespace PList
25{
26
27Data::Data() : Node(PLIST_DATA)
28{
29}
30
31Data::Data(std::vector<char>& buff) : Node(PLIST_DATA)
32{
33 plist_set_data_val(_node, &buff[0], buff.size());
34}
35
36Data::~Data()
37{
38}
39
40void Data::SetValue(std::vector<char>& buff)
41{
42 plist_set_data_val(_node, &buff[0], buff.size());
43}
44
45std::vector<char> Data::GetValue()
46{
47 char* buff = NULL;
48 uint64_t length = 0;
49 plist_get_data_val(_node, &buff, &length);
50 std::vector<char> ret(buff, buff + length);
51 free(buff);
52 return ret;
53}
54
55
56
57};