summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/plist/Array.h6
-rw-r--r--include/plist/Boolean.h1
-rw-r--r--include/plist/Data.h1
-rw-r--r--include/plist/Date.h1
-rw-r--r--include/plist/Integer.h1
-rw-r--r--include/plist/Node.h2
-rw-r--r--include/plist/Real.h1
-rw-r--r--include/plist/String.h1
-rw-r--r--src/Array.cpp45
-rw-r--r--src/Boolean.cpp4
-rw-r--r--src/Data.cpp4
-rw-r--r--src/Date.cpp4
-rw-r--r--src/Dictionary.cpp45
-rw-r--r--src/Integer.cpp4
-rw-r--r--src/Real.cpp4
-rw-r--r--src/String.cpp4
16 files changed, 118 insertions, 10 deletions
diff --git a/include/plist/Array.h b/include/plist/Array.h
index 8f8d992..f990928 100644
--- a/include/plist/Array.h
+++ b/include/plist/Array.h
@@ -19,8 +19,8 @@
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */ 20 */
21 21
22#ifndef STRING_H 22#ifndef ARRAY_H
23#define STRING_H 23#define ARRAY_H
24 24
25#include <plist/Structure.h> 25#include <plist/Structure.h>
26#include <vector> 26#include <vector>
@@ -49,4 +49,4 @@ class Array : public Structure
49 49
50}; 50};
51 51
52#endif // STRING_H 52#endif // ARRAY_H
diff --git a/include/plist/Boolean.h b/include/plist/Boolean.h
index 89761ca..01b5b85 100644
--- a/include/plist/Boolean.h
+++ b/include/plist/Boolean.h
@@ -31,6 +31,7 @@ class Boolean : public Node
31{ 31{
32 public : 32 public :
33 Boolean(); 33 Boolean();
34 Boolean(plist_t node);
34 Boolean(bool b); 35 Boolean(bool b);
35 virtual ~Boolean(); 36 virtual ~Boolean();
36 37
diff --git a/include/plist/Data.h b/include/plist/Data.h
index f7e5cd2..92bda0a 100644
--- a/include/plist/Data.h
+++ b/include/plist/Data.h
@@ -32,6 +32,7 @@ class Data : public Node
32{ 32{
33 public : 33 public :
34 Data(); 34 Data();
35 Data(plist_t node);
35 Data(std::vector<char>& buff); 36 Data(std::vector<char>& buff);
36 virtual ~Data(); 37 virtual ~Data();
37 38
diff --git a/include/plist/Date.h b/include/plist/Date.h
index df185db..78d8601 100644
--- a/include/plist/Date.h
+++ b/include/plist/Date.h
@@ -31,6 +31,7 @@ class Date : public Node
31{ 31{
32 public : 32 public :
33 Date(); 33 Date();
34 Date(plist_t node);
34 Date(uint64_t i); 35 Date(uint64_t i);
35 virtual ~Date(); 36 virtual ~Date();
36 37
diff --git a/include/plist/Integer.h b/include/plist/Integer.h
index 8f1ecdb..823e3a0 100644
--- a/include/plist/Integer.h
+++ b/include/plist/Integer.h
@@ -31,6 +31,7 @@ class Integer : public Node
31{ 31{
32 public : 32 public :
33 Integer(); 33 Integer();
34 Integer(plist_t node);
34 Integer(uint64_t i); 35 Integer(uint64_t i);
35 virtual ~Integer(); 36 virtual ~Integer();
36 37
diff --git a/include/plist/Node.h b/include/plist/Node.h
index 0f6100e..3be900a 100644
--- a/include/plist/Node.h
+++ b/include/plist/Node.h
@@ -31,7 +31,6 @@ class Node
31{ 31{
32 public : 32 public :
33 virtual ~Node(); 33 virtual ~Node();
34 Node(plist_t node);
35 Node(Node& node); 34 Node(Node& node);
36 Node& operator=(const Node& node); 35 Node& operator=(const Node& node);
37 36
@@ -40,6 +39,7 @@ class Node
40 39
41 protected: 40 protected:
42 Node(); 41 Node();
42 Node(plist_t node);
43 Node(plist_type type); 43 Node(plist_type type);
44 plist_t _node; 44 plist_t _node;
45}; 45};
diff --git a/include/plist/Real.h b/include/plist/Real.h
index 272f431..8d898c7 100644
--- a/include/plist/Real.h
+++ b/include/plist/Real.h
@@ -31,6 +31,7 @@ class Real : public Node
31{ 31{
32 public : 32 public :
33 Real(); 33 Real();
34 Real(plist_t node);
34 Real(double d); 35 Real(double d);
35 virtual ~Real(); 36 virtual ~Real();
36 37
diff --git a/include/plist/String.h b/include/plist/String.h
index 14becac..5314065 100644
--- a/include/plist/String.h
+++ b/include/plist/String.h
@@ -32,6 +32,7 @@ class String : public Node
32{ 32{
33 public : 33 public :
34 String(); 34 String();
35 String(plist_t node);
35 String(std::string& s); 36 String(std::string& s);
36 virtual ~String(); 37 virtual ~String();
37 38
diff --git a/src/Array.cpp b/src/Array.cpp
index 6f1d3f9..0505a27 100644
--- a/src/Array.cpp
+++ b/src/Array.cpp
@@ -21,6 +21,12 @@
21#include <stdlib.h> 21#include <stdlib.h>
22#include <plist/Array.h> 22#include <plist/Array.h>
23#include <plist/Dictionary.h> 23#include <plist/Dictionary.h>
24#include <plist/Boolean.h>
25#include <plist/Integer.h>
26#include <plist/Real.h>
27#include <plist/String.h>
28#include <plist/Date.h>
29#include <plist/Data.h>
24 30
25namespace PList 31namespace PList
26{ 32{
@@ -48,13 +54,24 @@ Array::Array(plist_t node) : Structure()
48 _array.push_back( new Array(subnode) ); 54 _array.push_back( new Array(subnode) );
49 break; 55 break;
50 case PLIST_BOOLEAN: 56 case PLIST_BOOLEAN:
57 _array.push_back( new Boolean(subnode) );
58 break;
51 case PLIST_UINT: 59 case PLIST_UINT:
60 _array.push_back( new Integer(subnode) );
61 break;
52 case PLIST_REAL: 62 case PLIST_REAL:
63 _array.push_back( new Real(subnode) );
64 break;
53 case PLIST_STRING: 65 case PLIST_STRING:
66 _array.push_back( new String(subnode) );
67 break;
54 case PLIST_DATE: 68 case PLIST_DATE:
69 _array.push_back( new Date(subnode) );
70 break;
55 case PLIST_DATA: 71 case PLIST_DATA:
72 _array.push_back( new Data(subnode) );
73 break;
56 default: 74 default:
57 _array.push_back( new Node(subnode) );
58 break; 75 break;
59 } 76 }
60 } 77 }
@@ -85,13 +102,24 @@ Array::Array(Array& a)
85 _array.push_back( new Array(subnode) ); 102 _array.push_back( new Array(subnode) );
86 break; 103 break;
87 case PLIST_BOOLEAN: 104 case PLIST_BOOLEAN:
105 _array.push_back( new Boolean(subnode) );
106 break;
88 case PLIST_UINT: 107 case PLIST_UINT:
108 _array.push_back( new Integer(subnode) );
109 break;
89 case PLIST_REAL: 110 case PLIST_REAL:
111 _array.push_back( new Real(subnode) );
112 break;
90 case PLIST_STRING: 113 case PLIST_STRING:
114 _array.push_back( new String(subnode) );
115 break;
91 case PLIST_DATE: 116 case PLIST_DATE:
117 _array.push_back( new Date(subnode) );
118 break;
92 case PLIST_DATA: 119 case PLIST_DATA:
120 _array.push_back( new Data(subnode) );
121 break;
93 default: 122 default:
94 _array.push_back( new Node(subnode) );
95 break; 123 break;
96 } 124 }
97 } 125 }
@@ -122,13 +150,24 @@ Array& Array::operator=(const Array& a)
122 _array.push_back( new Array(subnode) ); 150 _array.push_back( new Array(subnode) );
123 break; 151 break;
124 case PLIST_BOOLEAN: 152 case PLIST_BOOLEAN:
153 _array.push_back( new Boolean(subnode) );
154 break;
125 case PLIST_UINT: 155 case PLIST_UINT:
156 _array.push_back( new Integer(subnode) );
157 break;
126 case PLIST_REAL: 158 case PLIST_REAL:
159 _array.push_back( new Real(subnode) );
160 break;
127 case PLIST_STRING: 161 case PLIST_STRING:
162 _array.push_back( new String(subnode) );
163 break;
128 case PLIST_DATE: 164 case PLIST_DATE:
165 _array.push_back( new Date(subnode) );
166 break;
129 case PLIST_DATA: 167 case PLIST_DATA:
168 _array.push_back( new Data(subnode) );
169 break;
130 default: 170 default:
131 _array.push_back( new Node(subnode) );
132 break; 171 break;
133 } 172 }
134 } 173 }
diff --git a/src/Boolean.cpp b/src/Boolean.cpp
index 5797d88..cc704c9 100644
--- a/src/Boolean.cpp
+++ b/src/Boolean.cpp
@@ -28,6 +28,10 @@ Boolean::Boolean() : Node(PLIST_BOOLEAN)
28{ 28{
29} 29}
30 30
31Boolean::Boolean(plist_t node) : Node(node)
32{
33}
34
31Boolean::Boolean(bool b) : Node(PLIST_BOOLEAN) 35Boolean::Boolean(bool b) : Node(PLIST_BOOLEAN)
32{ 36{
33 plist_set_bool_val(_node, b); 37 plist_set_bool_val(_node, b);
diff --git a/src/Data.cpp b/src/Data.cpp
index 2ce610d..53adfa4 100644
--- a/src/Data.cpp
+++ b/src/Data.cpp
@@ -28,6 +28,10 @@ Data::Data() : Node(PLIST_DATA)
28{ 28{
29} 29}
30 30
31Data::Data(plist_t node) : Node(node)
32{
33}
34
31Data::Data(std::vector<char>& buff) : Node(PLIST_DATA) 35Data::Data(std::vector<char>& buff) : Node(PLIST_DATA)
32{ 36{
33 plist_set_data_val(_node, &buff[0], buff.size()); 37 plist_set_data_val(_node, &buff[0], buff.size());
diff --git a/src/Date.cpp b/src/Date.cpp
index 56e1e8e..f6a6f42 100644
--- a/src/Date.cpp
+++ b/src/Date.cpp
@@ -28,6 +28,10 @@ Date::Date() : Node(PLIST_DATE)
28{ 28{
29} 29}
30 30
31Date::Date(plist_t node) : Node(node)
32{
33}
34
31Date::Date(uint64_t i) : Node(PLIST_DATE) 35Date::Date(uint64_t i) : Node(PLIST_DATE)
32{ 36{
33 plist_set_date_val(_node, i, 0); 37 plist_set_date_val(_node, i, 0);
diff --git a/src/Dictionary.cpp b/src/Dictionary.cpp
index 5bace76..6879e33 100644
--- a/src/Dictionary.cpp
+++ b/src/Dictionary.cpp
@@ -21,6 +21,12 @@
21#include <stdlib.h> 21#include <stdlib.h>
22#include <plist/Dictionary.h> 22#include <plist/Dictionary.h>
23#include <plist/Array.h> 23#include <plist/Array.h>
24#include <plist/Boolean.h>
25#include <plist/Integer.h>
26#include <plist/Real.h>
27#include <plist/String.h>
28#include <plist/Date.h>
29#include <plist/Data.h>
24 30
25namespace PList 31namespace PList
26{ 32{
@@ -50,13 +56,24 @@ Dictionary::Dictionary(plist_t node) : Structure()
50 _map[std::string(key)] = new Array(subnode); 56 _map[std::string(key)] = new Array(subnode);
51 break; 57 break;
52 case PLIST_BOOLEAN: 58 case PLIST_BOOLEAN:
59 _map[std::string(key)] = new Boolean(subnode);
60 break;
53 case PLIST_UINT: 61 case PLIST_UINT:
62 _map[std::string(key)] = new Integer(subnode);
63 break;
54 case PLIST_REAL: 64 case PLIST_REAL:
65 _map[std::string(key)] = new Real(subnode);
66 break;
55 case PLIST_STRING: 67 case PLIST_STRING:
68 _map[std::string(key)] = new String(subnode);
69 break;
56 case PLIST_DATE: 70 case PLIST_DATE:
71 _map[std::string(key)] = new Date(subnode);
72 break;
57 case PLIST_DATA: 73 case PLIST_DATA:
74 _map[std::string(key)] = new Data(subnode);
75 break;
58 default: 76 default:
59 _map[std::string(key)] = new Node(subnode);
60 break; 77 break;
61 } 78 }
62 79
@@ -96,13 +113,24 @@ Dictionary::Dictionary(Dictionary& d)
96 _map[std::string(key)] = new Array(subnode); 113 _map[std::string(key)] = new Array(subnode);
97 break; 114 break;
98 case PLIST_BOOLEAN: 115 case PLIST_BOOLEAN:
116 _map[std::string(key)] = new Boolean(subnode);
117 break;
99 case PLIST_UINT: 118 case PLIST_UINT:
119 _map[std::string(key)] = new Integer(subnode);
120 break;
100 case PLIST_REAL: 121 case PLIST_REAL:
122 _map[std::string(key)] = new Real(subnode);
123 break;
101 case PLIST_STRING: 124 case PLIST_STRING:
125 _map[std::string(key)] = new String(subnode);
126 break;
102 case PLIST_DATE: 127 case PLIST_DATE:
128 _map[std::string(key)] = new Date(subnode);
129 break;
103 case PLIST_DATA: 130 case PLIST_DATA:
131 _map[std::string(key)] = new Data(subnode);
132 break;
104 default: 133 default:
105 _map[std::string(key)] = new Node(subnode);
106 break; 134 break;
107 } 135 }
108 136
@@ -142,13 +170,24 @@ Dictionary& Dictionary::operator=(const Dictionary& d)
142 _map[std::string(key)] = new Array(subnode); 170 _map[std::string(key)] = new Array(subnode);
143 break; 171 break;
144 case PLIST_BOOLEAN: 172 case PLIST_BOOLEAN:
173 _map[std::string(key)] = new Boolean(subnode);
174 break;
145 case PLIST_UINT: 175 case PLIST_UINT:
176 _map[std::string(key)] = new Integer(subnode);
177 break;
146 case PLIST_REAL: 178 case PLIST_REAL:
179 _map[std::string(key)] = new Real(subnode);
180 break;
147 case PLIST_STRING: 181 case PLIST_STRING:
182 _map[std::string(key)] = new String(subnode);
183 break;
148 case PLIST_DATE: 184 case PLIST_DATE:
185 _map[std::string(key)] = new Date(subnode);
186 break;
149 case PLIST_DATA: 187 case PLIST_DATA:
188 _map[std::string(key)] = new Data(subnode);
189 break;
150 default: 190 default:
151 _map[std::string(key)] = new Node(subnode);
152 break; 191 break;
153 } 192 }
154 193
diff --git a/src/Integer.cpp b/src/Integer.cpp
index d4a7645..2a7429a 100644
--- a/src/Integer.cpp
+++ b/src/Integer.cpp
@@ -28,6 +28,10 @@ Integer::Integer() : Node(PLIST_UINT)
28{ 28{
29} 29}
30 30
31Integer::Integer(plist_t node) : Node(node)
32{
33}
34
31Integer::Integer(uint64_t i) : Node(PLIST_UINT) 35Integer::Integer(uint64_t i) : Node(PLIST_UINT)
32{ 36{
33 plist_set_uint_val(_node, i); 37 plist_set_uint_val(_node, i);
diff --git a/src/Real.cpp b/src/Real.cpp
index 41c5d87..5416887 100644
--- a/src/Real.cpp
+++ b/src/Real.cpp
@@ -28,6 +28,10 @@ Real::Real() : Node(PLIST_REAL)
28{ 28{
29} 29}
30 30
31Real::Real(plist_t node) : Node(node)
32{
33}
34
31Real::Real(double d) : Node(PLIST_REAL) 35Real::Real(double d) : Node(PLIST_REAL)
32{ 36{
33 plist_set_real_val(_node, d); 37 plist_set_real_val(_node, d);
diff --git a/src/String.cpp b/src/String.cpp
index 24b4ce8..7bf744c 100644
--- a/src/String.cpp
+++ b/src/String.cpp
@@ -28,6 +28,10 @@ String::String() : Node(PLIST_STRING)
28{ 28{
29} 29}
30 30
31String::String(plist_t node) : Node(node)
32{
33}
34
31String::String(std::string& s) : Node(PLIST_STRING) 35String::String(std::string& s) : Node(PLIST_STRING)
32{ 36{
33 plist_set_string_val(_node, s.c_str()); 37 plist_set_string_val(_node, s.c_str());