From 1d44fdfab55b7879897402dca8a30a2aec7e97d4 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Fri, 17 Dec 2004 23:02:37 +0000 Subject: [PATCH] Added appendComponent() and getComponentAt() functions. --- src/utility/path.cpp | 18 ++++++++++++++++++ src/utility/path.hpp | 20 ++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/utility/path.cpp b/src/utility/path.cpp index 88ad00e5..76a938e3 100644 --- a/src/utility/path.cpp +++ b/src/utility/path.cpp @@ -192,5 +192,23 @@ const bool path::isDirectParentOf(const path& p) const } +void path::appendComponent(const path::component& c) +{ + m_list.push_back(c); +} + + +const path::component& path::getComponentAt(const int pos) const +{ + return (m_list[pos]); +} + + +path::component& path::getComponentAt(const int pos) +{ + return (m_list[pos]); +} + + } // utility } // vmime diff --git a/src/utility/path.hpp b/src/utility/path.hpp index 8a05f1a2..83bd186a 100644 --- a/src/utility/path.hpp +++ b/src/utility/path.hpp @@ -65,6 +65,26 @@ public: const bool operator==(const path& p) const; const bool operator!=(const path& p) const; + /** Append a component to the path. + * + * @param c component to add + */ + void appendComponent(const component& c); + + /** Return the component at the specified position. + * + * @param pos position + * @return component at position 'pos' + */ + const component& getComponentAt(const int pos) const; + + /** Return the component at the specified position. + * + * @param pos position + * @return component at position 'pos' + */ + component& getComponentAt(const int pos); + /** Test whether this path is empty (root). * * @return true if the path is empty (no components = root)