summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2009-10-15 19:28:30 +0200
committerGravatar Jonathan Beck2009-10-15 19:28:30 +0200
commit8186a9d371b2a31122643f75c65cef4e438ac97b (patch)
treef059e0199ac4b8b0425c910a11f595b42490448a
parenta922b714c9b75fdc67735d674758d4eaedfd32f9 (diff)
downloadlibplist-8186a9d371b2a31122643f75c65cef4e438ac97b.tar.gz
libplist-8186a9d371b2a31122643f75c65cef4e438ac97b.tar.bz2
Fix various mistakes in C++ bindings.
-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 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef STRING_H
-#define STRING_H
+#ifndef ARRAY_H
+#define ARRAY_H
#include <plist/Structure.h>
#include <vector>
@@ -49,4 +49,4 @@ class Array : public Structure
};
-#endif // STRING_H
+#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
{
public :
Boolean();
+ Boolean(plist_t node);
Boolean(bool b);
virtual ~Boolean();
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
{
public :
Data();
+ Data(plist_t node);
Data(std::vector<char>& buff);
virtual ~Data();
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
{
public :
Date();
+ Date(plist_t node);
Date(uint64_t i);
virtual ~Date();
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
{
public :
Integer();
+ Integer(plist_t node);
Integer(uint64_t i);
virtual ~Integer();
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
{
public :
virtual ~Node();
- Node(plist_t node);
Node(Node& node);
Node& operator=(const Node& node);
@@ -40,6 +39,7 @@ class Node
protected:
Node();
+ Node(plist_t node);
Node(plist_type type);
plist_t _node;
};
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
{
public :
Real();
+ Real(plist_t node);
Real(double d);
virtual ~Real();
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
{
public :
String();
+ String(plist_t node);
String(std::string& s);
virtual ~String();
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 @@
#include <stdlib.h>
#include <plist/Array.h>
#include <plist/Dictionary.h>
+#include <plist/Boolean.h>
+#include <plist/Integer.h>
+#include <plist/Real.h>
+#include <plist/String.h>
+#include <plist/Date.h>
+#include <plist/Data.h>
namespace PList
{
@@ -48,13 +54,24 @@ Array::Array(plist_t node) : Structure()
_array.push_back( new Array(subnode) );
break;
case PLIST_BOOLEAN:
+ _array.push_back( new Boolean(subnode) );
+ break;
case PLIST_UINT:
+ _array.push_back( new Integer(subnode) );
+ break;
case PLIST_REAL:
+ _array.push_back( new Real(subnode) );
+ break;
case PLIST_STRING:
+ _array.push_back( new String(subnode) );
+ break;
case PLIST_DATE:
+ _array.push_back( new Date(subnode) );
+ break;
case PLIST_DATA:
+ _array.push_back( new Data(subnode) );
+ break;
default:
- _array.push_back( new Node(subnode) );
break;
}
}
@@ -85,13 +102,24 @@ Array::Array(Array& a)
_array.push_back( new Array(subnode) );
break;
case PLIST_BOOLEAN:
+ _array.push_back( new Boolean(subnode) );
+ break;
case PLIST_UINT:
+ _array.push_back( new Integer(subnode) );
+ break;
case PLIST_REAL:
+ _array.push_back( new Real(subnode) );
+ break;
case PLIST_STRING:
+ _array.push_back( new String(subnode) );
+ break;
case PLIST_DATE:
+ _array.push_back( new Date(subnode) );
+ break;
case PLIST_DATA:
+ _array.push_back( new Data(subnode) );
+ break;
default:
- _array.push_back( new Node(subnode) );
break;
}
}
@@ -122,13 +150,24 @@ Array& Array::operator=(const Array& a)
_array.push_back( new Array(subnode) );
break;
case PLIST_BOOLEAN:
+ _array.push_back( new Boolean(subnode) );
+ break;
case PLIST_UINT:
+ _array.push_back( new Integer(subnode) );
+ break;
case PLIST_REAL:
+ _array.push_back( new Real(subnode) );
+ break;
case PLIST_STRING:
+ _array.push_back( new String(subnode) );
+ break;
case PLIST_DATE:
+ _array.push_back( new Date(subnode) );
+ break;
case PLIST_DATA:
+ _array.push_back( new Data(subnode) );
+ break;
default:
- _array.push_back( new Node(subnode) );
break;
}
}
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)
{
}
+Boolean::Boolean(plist_t node) : Node(node)
+{
+}
+
Boolean::Boolean(bool b) : Node(PLIST_BOOLEAN)
{
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)
{
}
+Data::Data(plist_t node) : Node(node)
+{
+}
+
Data::Data(std::vector<char>& buff) : Node(PLIST_DATA)
{
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)
{
}
+Date::Date(plist_t node) : Node(node)
+{
+}
+
Date::Date(uint64_t i) : Node(PLIST_DATE)
{
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 @@
#include <stdlib.h>
#include <plist/Dictionary.h>
#include <plist/Array.h>
+#include <plist/Boolean.h>
+#include <plist/Integer.h>
+#include <plist/Real.h>
+#include <plist/String.h>
+#include <plist/Date.h>
+#include <plist/Data.h>
namespace PList
{
@@ -50,13 +56,24 @@ Dictionary::Dictionary(plist_t node) : Structure()
_map[std::string(key)] = new Array(subnode);
break;
case PLIST_BOOLEAN:
+ _map[std::string(key)] = new Boolean(subnode);
+ break;
case PLIST_UINT:
+ _map[std::string(key)] = new Integer(subnode);
+ break;
case PLIST_REAL:
+ _map[std::string(key)] = new Real(subnode);
+ break;
case PLIST_STRING:
+ _map[std::string(key)] = new String(subnode);
+ break;
case PLIST_DATE:
+ _map[std::string(key)] = new Date(subnode);
+ break;
case PLIST_DATA:
+ _map[std::string(key)] = new Data(subnode);
+ break;
default:
- _map[std::string(key)] = new Node(subnode);
break;
}
@@ -96,13 +113,24 @@ Dictionary::Dictionary(Dictionary& d)
_map[std::string(key)] = new Array(subnode);
break;
case PLIST_BOOLEAN:
+ _map[std::string(key)] = new Boolean(subnode);
+ break;
case PLIST_UINT:
+ _map[std::string(key)] = new Integer(subnode);
+ break;
case PLIST_REAL:
+ _map[std::string(key)] = new Real(subnode);
+ break;
case PLIST_STRING:
+ _map[std::string(key)] = new String(subnode);
+ break;
case PLIST_DATE:
+ _map[std::string(key)] = new Date(subnode);
+ break;
case PLIST_DATA:
+ _map[std::string(key)] = new Data(subnode);
+ break;
default:
- _map[std::string(key)] = new Node(subnode);
break;
}
@@ -142,13 +170,24 @@ Dictionary& Dictionary::operator=(const Dictionary& d)
_map[std::string(key)] = new Array(subnode);
break;
case PLIST_BOOLEAN:
+ _map[std::string(key)] = new Boolean(subnode);
+ break;
case PLIST_UINT:
+ _map[std::string(key)] = new Integer(subnode);
+ break;
case PLIST_REAL:
+ _map[std::string(key)] = new Real(subnode);
+ break;
case PLIST_STRING:
+ _map[std::string(key)] = new String(subnode);
+ break;
case PLIST_DATE:
+ _map[std::string(key)] = new Date(subnode);
+ break;
case PLIST_DATA:
+ _map[std::string(key)] = new Data(subnode);
+ break;
default:
- _map[std::string(key)] = new Node(subnode);
break;
}
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)
{
}
+Integer::Integer(plist_t node) : Node(node)
+{
+}
+
Integer::Integer(uint64_t i) : Node(PLIST_UINT)
{
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)
{
}
+Real::Real(plist_t node) : Node(node)
+{
+}
+
Real::Real(double d) : Node(PLIST_REAL)
{
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)
{
}
+String::String(plist_t node) : Node(node)
+{
+}
+
String::String(std::string& s) : Node(PLIST_STRING)
{
plist_set_string_val(_node, s.c_str());