diff options
author | Jonathan Beck | 2009-10-15 19:28:30 +0200 |
---|---|---|
committer | Jonathan Beck | 2009-10-15 19:28:30 +0200 |
commit | 8186a9d371b2a31122643f75c65cef4e438ac97b (patch) | |
tree | f059e0199ac4b8b0425c910a11f595b42490448a /src | |
parent | a922b714c9b75fdc67735d674758d4eaedfd32f9 (diff) | |
download | libplist-8186a9d371b2a31122643f75c65cef4e438ac97b.tar.gz libplist-8186a9d371b2a31122643f75c65cef4e438ac97b.tar.bz2 |
Fix various mistakes in C++ bindings.
Diffstat (limited to 'src')
-rw-r--r-- | src/Array.cpp | 45 | ||||
-rw-r--r-- | src/Boolean.cpp | 4 | ||||
-rw-r--r-- | src/Data.cpp | 4 | ||||
-rw-r--r-- | src/Date.cpp | 4 | ||||
-rw-r--r-- | src/Dictionary.cpp | 45 | ||||
-rw-r--r-- | src/Integer.cpp | 4 | ||||
-rw-r--r-- | src/Real.cpp | 4 | ||||
-rw-r--r-- | src/String.cpp | 4 |
8 files changed, 108 insertions, 6 deletions
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()); |