diff options
| -rw-r--r-- | include/plist/Array.h | 4 | ||||
| -rw-r--r-- | include/plist/Boolean.h | 6 | ||||
| -rw-r--r-- | include/plist/Data.h | 6 | ||||
| -rw-r--r-- | include/plist/Date.h | 6 | ||||
| -rw-r--r-- | include/plist/Dictionary.h | 7 | ||||
| -rw-r--r-- | include/plist/Integer.h | 6 | ||||
| -rw-r--r-- | include/plist/Key.h | 6 | ||||
| -rw-r--r-- | include/plist/Node.h | 8 | ||||
| -rw-r--r-- | include/plist/Real.h | 6 | ||||
| -rw-r--r-- | include/plist/String.h | 6 | ||||
| -rw-r--r-- | include/plist/Uid.h | 6 | ||||
| -rw-r--r-- | src/Array.cpp | 4 | ||||
| -rw-r--r-- | src/Boolean.cpp | 6 | ||||
| -rw-r--r-- | src/Data.cpp | 6 | ||||
| -rw-r--r-- | src/Date.cpp | 6 | ||||
| -rw-r--r-- | src/Dictionary.cpp | 11 | ||||
| -rw-r--r-- | src/Integer.cpp | 6 | ||||
| -rw-r--r-- | src/Key.cpp | 6 | ||||
| -rw-r--r-- | src/Node.cpp | 6 | ||||
| -rw-r--r-- | src/Real.cpp | 6 | ||||
| -rw-r--r-- | src/String.cpp | 6 | ||||
| -rw-r--r-- | src/Uid.cpp | 6 | 
22 files changed, 71 insertions, 65 deletions
| diff --git a/include/plist/Array.h b/include/plist/Array.h index 5c65588..69ff26f 100644 --- a/include/plist/Array.h +++ b/include/plist/Array.h @@ -33,11 +33,11 @@ class Array : public Structure  public :      Array(Node* parent = NULL);      Array(plist_t node, Node* parent = NULL); -    Array(Array& a); +    Array(const Array& a);      Array& operator=(Array& a);      virtual ~Array(); -    Node* Clone(); +    Node* Clone() const;      Node* operator[](unsigned int index);      void Append(Node* node); diff --git a/include/plist/Boolean.h b/include/plist/Boolean.h index 48489da..307a1ff 100644 --- a/include/plist/Boolean.h +++ b/include/plist/Boolean.h @@ -32,15 +32,15 @@ class Boolean : public Node  public :      Boolean(Node* parent = NULL);      Boolean(plist_t node, Node* parent = NULL); -    Boolean(Boolean& b); +    Boolean(const Boolean& b);      Boolean& operator=(Boolean& b);      Boolean(bool b);      virtual ~Boolean(); -    Node* Clone(); +    Node* Clone() const;      void SetValue(bool b); -    bool GetValue(); +    bool GetValue() const;  };  }; diff --git a/include/plist/Data.h b/include/plist/Data.h index 3eb6031..c9c089b 100644 --- a/include/plist/Data.h +++ b/include/plist/Data.h @@ -33,15 +33,15 @@ class Data : public Node  public :      Data(Node* parent = NULL);      Data(plist_t node, Node* parent = NULL); -    Data(Data& d); +    Data(const Data& d);      Data& operator=(Data& d);      Data(const std::vector<char>& buff);      virtual ~Data(); -    Node* Clone(); +    Node* Clone() const;      void SetValue(const std::vector<char>& buff); -    std::vector<char> GetValue(); +    std::vector<char> GetValue() const;  };  }; diff --git a/include/plist/Date.h b/include/plist/Date.h index e505b53..510a349 100644 --- a/include/plist/Date.h +++ b/include/plist/Date.h @@ -34,15 +34,15 @@ class Date : public Node  public :      Date(Node* parent = NULL);      Date(plist_t node, Node* parent = NULL); -    Date(Date& d); +    Date(const Date& d);      Date& operator=(Date& d);      Date(timeval t);      virtual ~Date(); -    Node* Clone(); +    Node* Clone() const;      void SetValue(timeval t); -    timeval GetValue(); +    timeval GetValue() const;  };  }; diff --git a/include/plist/Dictionary.h b/include/plist/Dictionary.h index c270de3..7a29f14 100644 --- a/include/plist/Dictionary.h +++ b/include/plist/Dictionary.h @@ -34,11 +34,11 @@ class Dictionary : public Structure  public :      Dictionary(Node* parent = NULL);      Dictionary(plist_t node, Node* parent = NULL); -    Dictionary(Dictionary& d); +    Dictionary(const Dictionary& d);      Dictionary& operator=(Dictionary& d);      virtual ~Dictionary(); -    Node* Clone(); +    Node* Clone() const;      typedef std::map<std::string,Node*>::iterator iterator; @@ -46,7 +46,8 @@ public :      iterator Begin();      iterator End();      iterator Find(const std::string& key); -    iterator Set(const std::string& key, Node* node); +    iterator Set(const std::string& key, const Node* node); +    iterator Set(const std::string& key, const Node& node);      iterator Insert(const std::string& key, Node* node) PLIST_WARN_DEPRECATED("use Set() instead");      void Remove(Node* node);      void Remove(const std::string& key); diff --git a/include/plist/Integer.h b/include/plist/Integer.h index 86af0dd..adbc39a 100644 --- a/include/plist/Integer.h +++ b/include/plist/Integer.h @@ -32,15 +32,15 @@ class Integer : public Node  public :      Integer(Node* parent = NULL);      Integer(plist_t node, Node* parent = NULL); -    Integer(Integer& i); +    Integer(const Integer& i);      Integer& operator=(Integer& i);      Integer(uint64_t i);      virtual ~Integer(); -    Node* Clone(); +    Node* Clone() const;      void SetValue(uint64_t i); -    uint64_t GetValue(); +    uint64_t GetValue() const;  };  }; diff --git a/include/plist/Key.h b/include/plist/Key.h index 3de09cf..c680f1c 100644 --- a/include/plist/Key.h +++ b/include/plist/Key.h @@ -33,15 +33,15 @@ class Key : public Node  public :      Key(Node* parent = NULL);      Key(plist_t node, Node* parent = NULL); -    Key(Key& s); +    Key(const Key& s);      Key& operator=(Key& s);      Key(const std::string& s);      virtual ~Key(); -    Node* Clone(); +    Node* Clone() const;      void SetValue(const std::string& s); -    std::string GetValue(); +    std::string GetValue() const;  };  }; diff --git a/include/plist/Node.h b/include/plist/Node.h index fdd26ee..9068880 100644 --- a/include/plist/Node.h +++ b/include/plist/Node.h @@ -32,11 +32,11 @@ class Node  public :      virtual ~Node(); -    virtual Node* Clone() = 0; +    virtual Node* Clone() const = 0; -    Node * GetParent(); -    plist_type GetType(); -    plist_t GetPlist(); +    Node * GetParent() const; +    plist_type GetType() const; +    plist_t GetPlist() const;      static Node* FromPlist(plist_t node, Node* parent = NULL); diff --git a/include/plist/Real.h b/include/plist/Real.h index a89eb4a..c2d55f8 100644 --- a/include/plist/Real.h +++ b/include/plist/Real.h @@ -32,15 +32,15 @@ class Real : public Node  public :      Real(Node* parent = NULL);      Real(plist_t node, Node* parent = NULL); -    Real(Real& d); +    Real(const Real& d);      Real& operator=(Real& d);      Real(double d);      virtual ~Real(); -    Node* Clone(); +    Node* Clone() const;      void SetValue(double d); -    double GetValue(); +    double GetValue() const;  };  }; diff --git a/include/plist/String.h b/include/plist/String.h index a1906aa..80290b3 100644 --- a/include/plist/String.h +++ b/include/plist/String.h @@ -33,15 +33,15 @@ class String : public Node  public :      String(Node* parent = NULL);      String(plist_t node, Node* parent = NULL); -    String(String& s); +    String(const String& s);      String& operator=(String& s);      String(const std::string& s);      virtual ~String(); -    Node* Clone(); +    Node* Clone() const;      void SetValue(const std::string& s); -    std::string GetValue(); +    std::string GetValue() const;  };  }; diff --git a/include/plist/Uid.h b/include/plist/Uid.h index e11b022..2d8375b 100644 --- a/include/plist/Uid.h +++ b/include/plist/Uid.h @@ -32,15 +32,15 @@ class Uid : public Node  public :      Uid(Node* parent = NULL);      Uid(plist_t node, Node* parent = NULL); -    Uid(Uid& i); +    Uid(const Uid& i);      Uid& operator=(Uid& i);      Uid(uint64_t i);      virtual ~Uid(); -    Node* Clone(); +    Node* Clone() const;      void SetValue(uint64_t i); -    uint64_t GetValue(); +    uint64_t GetValue() const;  };  }; diff --git a/src/Array.cpp b/src/Array.cpp index a4ea02a..3036476 100644 --- a/src/Array.cpp +++ b/src/Array.cpp @@ -43,7 +43,7 @@ Array::Array(plist_t node, Node* parent) : Structure(parent)      }  } -Array::Array(PList::Array& a) : Structure() +Array::Array(const PList::Array& a) : Structure()  {      _array.clear();      _node = plist_copy(a.GetPlist()); @@ -85,7 +85,7 @@ Array::~Array()      _array.clear();  } -Node* Array::Clone() +Node* Array::Clone() const  {      return new Array(*this);  } diff --git a/src/Boolean.cpp b/src/Boolean.cpp index e58472f..4608eaf 100644 --- a/src/Boolean.cpp +++ b/src/Boolean.cpp @@ -32,7 +32,7 @@ Boolean::Boolean(plist_t node, Node* parent) : Node(node, parent)  {  } -Boolean::Boolean(PList::Boolean& b) : Node(PLIST_BOOLEAN) +Boolean::Boolean(const PList::Boolean& b) : Node(PLIST_BOOLEAN)  {      plist_set_bool_val(_node, b.GetValue());  } @@ -53,7 +53,7 @@ Boolean::~Boolean()  {  } -Node* Boolean::Clone() +Node* Boolean::Clone() const  {      return new Boolean(*this);  } @@ -63,7 +63,7 @@ void Boolean::SetValue(bool b)      plist_set_bool_val(_node, b);  } -bool Boolean::GetValue() +bool Boolean::GetValue() const  {      uint8_t b = 0;      plist_get_bool_val(_node, &b); diff --git a/src/Data.cpp b/src/Data.cpp index df5c1c7..2e93007 100644 --- a/src/Data.cpp +++ b/src/Data.cpp @@ -32,7 +32,7 @@ Data::Data(plist_t node, Node* parent) : Node(node, parent)  {  } -Data::Data(PList::Data& d) : Node(PLIST_DATA) +Data::Data(const PList::Data& d) : Node(PLIST_DATA)  {      std::vector<char> b = d.GetValue();      plist_set_data_val(_node, &b[0], b.size()); @@ -54,7 +54,7 @@ Data::~Data()  {  } -Node* Data::Clone() +Node* Data::Clone() const  {      return new Data(*this);  } @@ -64,7 +64,7 @@ void Data::SetValue(const std::vector<char>& buff)      plist_set_data_val(_node, &buff[0], buff.size());  } -std::vector<char> Data::GetValue() +std::vector<char> Data::GetValue() const  {      char* buff = NULL;      uint64_t length = 0; diff --git a/src/Date.cpp b/src/Date.cpp index 2430184..4b5e0a1 100644 --- a/src/Date.cpp +++ b/src/Date.cpp @@ -32,7 +32,7 @@ Date::Date(plist_t node, Node* parent) : Node(node, parent)  {  } -Date::Date(PList::Date& d) : Node(PLIST_DATE) +Date::Date(const PList::Date& d) : Node(PLIST_DATE)  {      timeval t = d.GetValue();      plist_set_date_val(_node, t.tv_sec, t.tv_usec); @@ -54,7 +54,7 @@ Date::~Date()  {  } -Node* Date::Clone() +Node* Date::Clone() const  {      return new Date(*this);  } @@ -64,7 +64,7 @@ void Date::SetValue(timeval t)      plist_set_date_val(_node, t.tv_sec, t.tv_usec);  } -timeval Date::GetValue() +timeval Date::GetValue() const  {      int32_t tv_sec = 0;      int32_t tv_usec = 0; diff --git a/src/Dictionary.cpp b/src/Dictionary.cpp index 6009ea4..98eeb93 100644 --- a/src/Dictionary.cpp +++ b/src/Dictionary.cpp @@ -49,7 +49,7 @@ Dictionary::Dictionary(plist_t node, Node* parent) : Structure(parent)      free(it);  } -Dictionary::Dictionary(PList::Dictionary& d) : Structure() +Dictionary::Dictionary(const PList::Dictionary& d) : Structure()  {      for (Dictionary::iterator it = _map.begin(); it != _map.end(); it++)      { @@ -115,7 +115,7 @@ Dictionary::~Dictionary()      _map.clear();  } -Node* Dictionary::Clone() +Node* Dictionary::Clone() const  {      return new Dictionary(*this);  } @@ -140,7 +140,7 @@ Dictionary::iterator Dictionary::Find(const std::string& key)      return _map.find(key);  } -Dictionary::iterator Dictionary::Set(const std::string& key, Node* node) +Dictionary::iterator Dictionary::Set(const std::string& key, const Node* node)  {      if (node)      { @@ -154,6 +154,11 @@ Dictionary::iterator Dictionary::Set(const std::string& key, Node* node)      return iterator(this->_map.end());  } +Dictionary::iterator Dictionary::Set(const std::string& key, const Node& node) +{ +    return Set(key, &node); +} +  Dictionary::iterator Dictionary::Insert(const std::string& key, Node* node)  {      return this->Set(key, node); diff --git a/src/Integer.cpp b/src/Integer.cpp index fed03f6..04315d7 100644 --- a/src/Integer.cpp +++ b/src/Integer.cpp @@ -32,7 +32,7 @@ Integer::Integer(plist_t node, Node* parent) : Node(node, parent)  {  } -Integer::Integer(PList::Integer& i) : Node(PLIST_UINT) +Integer::Integer(const PList::Integer& i) : Node(PLIST_UINT)  {      plist_set_uint_val(_node, i.GetValue());  } @@ -53,7 +53,7 @@ Integer::~Integer()  {  } -Node* Integer::Clone() +Node* Integer::Clone() const  {      return new Integer(*this);  } @@ -63,7 +63,7 @@ void Integer::SetValue(uint64_t i)      plist_set_uint_val(_node, i);  } -uint64_t Integer::GetValue() +uint64_t Integer::GetValue() const  {      uint64_t i = 0;      plist_get_uint_val(_node, &i); diff --git a/src/Key.cpp b/src/Key.cpp index 4145f05..e3ccbe6 100644 --- a/src/Key.cpp +++ b/src/Key.cpp @@ -32,7 +32,7 @@ Key::Key(plist_t node, Node* parent) : Node(node, parent)  {  } -Key::Key(PList::Key& k) : Node(PLIST_UINT) +Key::Key(const PList::Key& k) : Node(PLIST_UINT)  {      plist_set_key_val(_node, k.GetValue().c_str());  } @@ -53,7 +53,7 @@ Key::~Key()  {  } -Node* Key::Clone() +Node* Key::Clone() const  {      return new Key(*this);  } @@ -63,7 +63,7 @@ void Key::SetValue(const std::string& s)      plist_set_key_val(_node, s.c_str());  } -std::string Key::GetValue() +std::string Key::GetValue() const  {      char* s = NULL;      plist_get_key_val(_node, &s); diff --git a/src/Node.cpp b/src/Node.cpp index 516d1ae..aaadd52 100644 --- a/src/Node.cpp +++ b/src/Node.cpp @@ -93,7 +93,7 @@ Node::~Node()      _parent = NULL;  } -plist_type Node::GetType() +plist_type Node::GetType() const  {      if (_node)      { @@ -102,12 +102,12 @@ plist_type Node::GetType()      return PLIST_NONE;  } -plist_t Node::GetPlist() +plist_t Node::GetPlist() const  {      return _node;  } -Node* Node::GetParent() +Node* Node::GetParent() const  {      return _parent;  } diff --git a/src/Real.cpp b/src/Real.cpp index 768d07c..ec300c9 100644 --- a/src/Real.cpp +++ b/src/Real.cpp @@ -32,7 +32,7 @@ Real::Real(plist_t node, Node* parent) : Node(node, parent)  {  } -Real::Real(PList::Real& d) : Node(PLIST_UINT) +Real::Real(const PList::Real& d) : Node(PLIST_UINT)  {      plist_set_real_val(_node, d.GetValue());  } @@ -53,7 +53,7 @@ Real::~Real()  {  } -Node* Real::Clone() +Node* Real::Clone() const  {      return new Real(*this);  } @@ -63,7 +63,7 @@ void Real::SetValue(double d)      plist_set_real_val(_node, d);  } -double Real::GetValue() +double Real::GetValue() const  {      double d = 0.;      plist_get_real_val(_node, &d); diff --git a/src/String.cpp b/src/String.cpp index bf65605..09b47b5 100644 --- a/src/String.cpp +++ b/src/String.cpp @@ -32,7 +32,7 @@ String::String(plist_t node, Node* parent) : Node(node, parent)  {  } -String::String(PList::String& s) : Node(PLIST_UINT) +String::String(const PList::String& s) : Node(PLIST_UINT)  {      plist_set_string_val(_node, s.GetValue().c_str());  } @@ -53,7 +53,7 @@ String::~String()  {  } -Node* String::Clone() +Node* String::Clone() const  {      return new String(*this);  } @@ -63,7 +63,7 @@ void String::SetValue(const std::string& s)      plist_set_string_val(_node, s.c_str());  } -std::string String::GetValue() +std::string String::GetValue() const  {      char* s = NULL;      plist_get_string_val(_node, &s); diff --git a/src/Uid.cpp b/src/Uid.cpp index 02a59b3..440dec4 100644 --- a/src/Uid.cpp +++ b/src/Uid.cpp @@ -32,7 +32,7 @@ Uid::Uid(plist_t node, Node* parent) : Node(node, parent)  {  } -Uid::Uid(PList::Uid& i) : Node(PLIST_UID) +Uid::Uid(const PList::Uid& i) : Node(PLIST_UID)  {      plist_set_uid_val(_node, i.GetValue());  } @@ -53,7 +53,7 @@ Uid::~Uid()  {  } -Node* Uid::Clone() +Node* Uid::Clone() const  {      return new Uid(*this);  } @@ -63,7 +63,7 @@ void Uid::SetValue(uint64_t i)      plist_set_uid_val(_node, i);  } -uint64_t Uid::GetValue() +uint64_t Uid::GetValue() const  {      uint64_t i = 0;      plist_get_uid_val(_node, &i); | 
