summaryrefslogtreecommitdiffstats
path: root/include/plist
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2009-10-16 22:26:13 +0200
committerGravatar Jonathan Beck2009-10-16 22:26:13 +0200
commit32be8ec384bfd78e189d3de6609e50cf4dd072a2 (patch)
treeac7edad0f19be2a31efaaaaa3acd477dd2f3c233 /include/plist
parent8aeef4dd2331445fea8a7a40466b19973e9d09c4 (diff)
downloadlibplist-32be8ec384bfd78e189d3de6609e50cf4dd072a2.tar.gz
libplist-32be8ec384bfd78e189d3de6609e50cf4dd072a2.tar.bz2
Fix Node lifecycle and change argument as reference to const reference.
Diffstat (limited to 'include/plist')
-rw-r--r--include/plist/Array.h6
-rw-r--r--include/plist/Boolean.h4
-rw-r--r--include/plist/Data.h8
-rw-r--r--include/plist/Date.h4
-rw-r--r--include/plist/Dictionary.h12
-rw-r--r--include/plist/Integer.h4
-rw-r--r--include/plist/Node.h8
-rw-r--r--include/plist/Real.h4
-rw-r--r--include/plist/String.h8
-rw-r--r--include/plist/Utils.h4
10 files changed, 45 insertions, 17 deletions
diff --git a/include/plist/Array.h b/include/plist/Array.h
index f990928..106555d 100644
--- a/include/plist/Array.h
+++ b/include/plist/Array.h
@@ -34,9 +34,11 @@ class Array : public Structure
Array();
Array(plist_t node);
Array(Array& a);
- Array& operator=(const Array& a);
+ Array& operator=(Array& a);
virtual ~Array();
-
+
+ Node* Clone();
+
Node* operator[](unsigned int index);
void Append(Node* node);
void Insert(Node* node, unsigned int pos);
diff --git a/include/plist/Boolean.h b/include/plist/Boolean.h
index 01b5b85..917bc9d 100644
--- a/include/plist/Boolean.h
+++ b/include/plist/Boolean.h
@@ -32,9 +32,13 @@ class Boolean : public Node
public :
Boolean();
Boolean(plist_t node);
+ Boolean(Boolean& b);
+ Boolean& operator=(Boolean& b);
Boolean(bool b);
virtual ~Boolean();
+ Node* Clone();
+
void SetValue(bool b);
bool GetValue();
};
diff --git a/include/plist/Data.h b/include/plist/Data.h
index 92bda0a..86a26d9 100644
--- a/include/plist/Data.h
+++ b/include/plist/Data.h
@@ -33,10 +33,14 @@ class Data : public Node
public :
Data();
Data(plist_t node);
- Data(std::vector<char>& buff);
+ Data(Data& d);
+ Data& operator=(Data& d);
+ Data(const std::vector<char>& buff);
virtual ~Data();
- void SetValue(std::vector<char>& buff);
+ Node* Clone();
+
+ void SetValue(const std::vector<char>& buff);
std::vector<char> GetValue();
};
diff --git a/include/plist/Date.h b/include/plist/Date.h
index 78d8601..e9645aa 100644
--- a/include/plist/Date.h
+++ b/include/plist/Date.h
@@ -32,9 +32,13 @@ class Date : public Node
public :
Date();
Date(plist_t node);
+ Date(Date& d);
+ Date& operator=(Date& d);
Date(uint64_t i);
virtual ~Date();
+ Node* Clone();
+
void SetValue(uint64_t i);
uint64_t GetValue();
};
diff --git a/include/plist/Dictionary.h b/include/plist/Dictionary.h
index 8468ab5..6169774 100644
--- a/include/plist/Dictionary.h
+++ b/include/plist/Dictionary.h
@@ -35,17 +35,19 @@ class Dictionary : public Structure
Dictionary();
Dictionary(plist_t node);
Dictionary(Dictionary& d);
- Dictionary& operator=(const Dictionary& d);
+ Dictionary& operator=(Dictionary& d);
virtual ~Dictionary();
-
+
+ Node* Clone();
+
typedef std::map<std::string,Node*>::iterator iterator;
- Node* operator[](std::string& key);
+ Node* operator[](const std::string& key);
iterator Begin();
iterator End();
- void Insert(std::string& key, Node* node);
+ void Insert(const std::string& key, Node* node);
void Remove(Node* node);
- void Remove(std::string& key);
+ void Remove(const std::string& key);
private :
std::map<std::string,Node*> _map;
diff --git a/include/plist/Integer.h b/include/plist/Integer.h
index 823e3a0..3a3a0e3 100644
--- a/include/plist/Integer.h
+++ b/include/plist/Integer.h
@@ -32,9 +32,13 @@ class Integer : public Node
public :
Integer();
Integer(plist_t node);
+ Integer(Integer& i);
+ Integer& operator=(Integer& i);
Integer(uint64_t i);
virtual ~Integer();
+ Node* Clone();
+
void SetValue(uint64_t i);
uint64_t GetValue();
};
diff --git a/include/plist/Node.h b/include/plist/Node.h
index 3be900a..a59d469 100644
--- a/include/plist/Node.h
+++ b/include/plist/Node.h
@@ -31,11 +31,11 @@ class Node
{
public :
virtual ~Node();
- Node(Node& node);
- Node& operator=(const Node& node);
-
+
+ virtual Node* Clone() = 0;
+
plist_type GetType();
- plist_t GetPlist() const;
+ plist_t GetPlist();
protected:
Node();
diff --git a/include/plist/Real.h b/include/plist/Real.h
index 8d898c7..c0095e4 100644
--- a/include/plist/Real.h
+++ b/include/plist/Real.h
@@ -32,9 +32,13 @@ class Real : public Node
public :
Real();
Real(plist_t node);
+ Real(Real& d);
+ Real& operator=(Real& d);
Real(double d);
virtual ~Real();
+ Node* Clone();
+
void SetValue(double d);
double GetValue();
};
diff --git a/include/plist/String.h b/include/plist/String.h
index 5314065..769c98b 100644
--- a/include/plist/String.h
+++ b/include/plist/String.h
@@ -33,10 +33,14 @@ class String : public Node
public :
String();
String(plist_t node);
- String(std::string& s);
+ String(String& s);
+ String& operator=(String& s);
+ String(const std::string& s);
virtual ~String();
- void SetValue(std::string& s);
+ Node* Clone();
+
+ void SetValue(const std::string& s);
std::string GetValue();
};
diff --git a/include/plist/Utils.h b/include/plist/Utils.h
index b499635..f3e2685 100644
--- a/include/plist/Utils.h
+++ b/include/plist/Utils.h
@@ -30,8 +30,8 @@ namespace PList
class Utils
{
public:
- static Structure* FromXml(std::string& in);
- static Structure* FromBin(std::vector<char>& in);
+ static Structure* FromXml(const std::string& in);
+ static Structure* FromBin(const std::vector<char>& in);
private:
Utils();