From b6c43e901c1ee3ded15261621be1aaa090dab984 Mon Sep 17 00:00:00 2001 From: Aaron Burghardt Date: Sat, 16 Aug 2014 17:48:45 -0400 Subject: Added const to Array.GetSize(), and to 3 Node methods. --- include/plist/Array.h | 2 +- include/plist/Structure.h | 6 +++--- src/Array.cpp | 4 ++-- src/Structure.cpp | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/plist/Array.h b/include/plist/Array.h index 69ff26f..745b750 100644 --- a/include/plist/Array.h +++ b/include/plist/Array.h @@ -44,7 +44,7 @@ public : void Insert(Node* node, unsigned int pos); void Remove(Node* node); void Remove(unsigned int pos); - unsigned int GetNodeIndex(Node* node); + unsigned int GetNodeIndex(Node* node) const; private : std::vector _array; diff --git a/include/plist/Structure.h b/include/plist/Structure.h index 8e609da..eded8b2 100644 --- a/include/plist/Structure.h +++ b/include/plist/Structure.h @@ -34,10 +34,10 @@ class Structure : public Node public : virtual ~Structure(); - uint32_t GetSize(); + uint32_t GetSize() const; - std::string ToXml(); - std::vector ToBin(); + std::string ToXml() const; + std::vector ToBin() const; virtual void Remove(Node* node) = 0; diff --git a/src/Array.cpp b/src/Array.cpp index 3036476..7c38a69 100644 --- a/src/Array.cpp +++ b/src/Array.cpp @@ -141,9 +141,9 @@ void Array::Remove(unsigned int pos) _array.erase(it); } -unsigned int Array::GetNodeIndex(Node* node) +unsigned int Array::GetNodeIndex(Node* node) const { - std::vector::iterator it = std::find(_array.begin(), _array.end(), node); + std::vector::const_iterator it = std::find(_array.begin(), _array.end(), node); return std::distance (_array.begin(), it); } diff --git a/src/Structure.cpp b/src/Structure.cpp index 18b19ef..70150c2 100644 --- a/src/Structure.cpp +++ b/src/Structure.cpp @@ -35,7 +35,7 @@ Structure::~Structure() { } -uint32_t Structure::GetSize() +uint32_t Structure::GetSize() const { uint32_t size = 0; plist_type type = plist_get_node_type(_node); @@ -50,7 +50,7 @@ uint32_t Structure::GetSize() return size; } -std::string Structure::ToXml() +std::string Structure::ToXml() const { char* xml = NULL; uint32_t length = 0; @@ -60,7 +60,7 @@ std::string Structure::ToXml() return ret; } -std::vector Structure::ToBin() +std::vector Structure::ToBin() const { char* bin = NULL; uint32_t length = 0; -- cgit v1.1-32-gdbae