From 596937f8c0f92a311d93117627e583631ceced91 Mon Sep 17 00:00:00 2001 From: Konrad Lipinski Date: Mon, 7 Nov 2016 13:43:48 +0100 Subject: [PATCH] remove unused PolicyIterator Change-Id: I06de62c3359186b094b51def7beff47752bfa998 (cherry picked from commit b9c833dbfa425b51f93feff09a827b4222bb7820) --- src/internal/naive_policy_checker.cpp | 4 ++-- src/internal/naive_policy_db.cpp | 37 ++--------------------------------- src/internal/naive_policy_db.hpp | 23 ++++------------------ 3 files changed, 8 insertions(+), 56 deletions(-) diff --git a/src/internal/naive_policy_checker.cpp b/src/internal/naive_policy_checker.cpp index f136fa4..5ebaac1 100644 --- a/src/internal/naive_policy_checker.cpp +++ b/src/internal/naive_policy_checker.cpp @@ -135,12 +135,12 @@ Decision NaivePolicyChecker::checkPolicyOwn(const NaivePolicyDb::PolicyOwn& poli privilege = NULL; return Decision::DENY; } - /* Current node is prefix, remeber decision */ + /* Current node is prefix, remember decision */ if (node->__is_prefix) { ret = node->__decisionItem.getDecision(); privilege = node->__decisionItem.getPrivilege(); } - /* Node for this letter dont exist */ + /* Node for this letter don't exist */ if (node->children[childIndex] == NULL) { if(ret != Decision::ANY) return ret; diff --git a/src/internal/naive_policy_db.cpp b/src/internal/naive_policy_db.cpp index 8a10c80..74783d2 100644 --- a/src/internal/naive_policy_db.cpp +++ b/src/internal/naive_policy_db.cpp @@ -96,11 +96,11 @@ bool NaivePolicyDb::getPolicy(const ItemType item_type, } -NaivePolicyDb::PolicySR::PolicyConstIterator::PolicyConstIterator(const std::vector< ItemSendReceive* > & items, int position) +NaivePolicyDb::PolicySR::PolicyConstIterator::PolicyConstIterator(const std::vector< ItemSendReceive const *> & items, int position) : m_items(items), m_index(position) { } -ItemSendReceive* const& NaivePolicyDb::PolicySR::PolicyConstIterator::operator*() const { +ItemSendReceive const *const& NaivePolicyDb::PolicySR::PolicyConstIterator::operator*() const { return m_items[m_index]; } @@ -117,39 +117,6 @@ bool NaivePolicyDb::PolicySR::PolicyConstIterator::operator!=(const PolicyConstI } -NaivePolicyDb::PolicySR::PolicyIterator::PolicyIterator(std::vector< ItemSendReceive* > & items, int position) - : m_items(items), m_index(position) { -} - - -ItemSendReceive*& NaivePolicyDb::PolicySR::PolicyIterator::operator*() { - return m_items[m_index]; -} - - -typename NaivePolicyDb::PolicySR::PolicyIterator& NaivePolicyDb::PolicySR::PolicyIterator::operator++() { - if (m_index >= 0) - --m_index; - return *this; -} - - -bool NaivePolicyDb::PolicySR::PolicyIterator::operator!=(const PolicyIterator& it) const { - return m_index != it.m_index; -} - - -NaivePolicyDb::PolicySR::PolicyIterator NaivePolicyDb::PolicySR::begin() { - int s = m_items.size() - 1; - return NaivePolicyDb::PolicySR::PolicyIterator(m_items, s); -} - - -NaivePolicyDb::PolicySR::PolicyIterator NaivePolicyDb::PolicySR::end() { - return NaivePolicyDb::PolicySR::PolicyIterator(m_items, -1); -} - - NaivePolicyDb::PolicySR::PolicyConstIterator NaivePolicyDb::PolicySR::begin() const { int s = m_items.size() - 1; return NaivePolicyDb::PolicySR::PolicyConstIterator(m_items, s); diff --git a/src/internal/naive_policy_db.hpp b/src/internal/naive_policy_db.hpp index 161d24c..7162d91 100644 --- a/src/internal/naive_policy_db.hpp +++ b/src/internal/naive_policy_db.hpp @@ -35,38 +35,23 @@ namespace ldp_xml_parser class PolicySR { private: /** Vector with policy items */ - std::vector m_items; + std::vector m_items; public: /** Iterator used to get access to policy items */ class PolicyConstIterator { private: /** Vector with policy items */ - const std::vector& m_items; + const std::vector& m_items; /** Assistant iterator */ int m_index; public: /** Public method allowing access to policy items */ - PolicyConstIterator(const std::vector& items, int position); - ItemSendReceive* const& operator*() const; + PolicyConstIterator(const std::vector& items, int position); + ItemSendReceive const *const& operator*() const; PolicyConstIterator& operator++(); bool operator!=(const PolicyConstIterator& it) const; }; - /** Iterator used to get access to policy items */ - class PolicyIterator { - private: - /** Vector with policy items */ - std::vector& m_items; - /** Assistant iterator */ - int m_index; - public: - PolicyIterator(std::vector& items, int position); - ItemSendReceive*& operator*(); - PolicyIterator& operator++(); - bool operator!=(const PolicyIterator& it) const; - }; - PolicyIterator begin(); - PolicyIterator end(); PolicyConstIterator begin() const; PolicyConstIterator end() const; -- 2.7.4