From e29457dfd02ed844c1875419b17eeb00af934718 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sun, 23 Dec 2018 18:57:03 +0100 Subject: [PATCH] Improve const correctness --- io/entry.cpp | 6 ++---- io/entry.h | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/io/entry.cpp b/io/entry.cpp index 1d55f60..8c91991 100644 --- a/io/entry.cpp +++ b/io/entry.cpp @@ -136,9 +136,8 @@ void Entry::setParent(NodeEntry *parent, int index) /*! * \brief Returns an indication whether the instance is an indirect child of the specified \a entry. - * \todo Make \a entry const in v4. */ -bool Entry::isIndirectChildOf(NodeEntry *entry) const +bool Entry::isIndirectChildOf(const NodeEntry *entry) const { if (!parent()) { return false; @@ -348,9 +347,8 @@ void NodeEntry::replaceChild(size_t at, Entry *newChild) * if the entry specified by the provided \a path does not exist. The parent of the entry * to be created must exist. Specify nullptr if no entries should be created (default). * \returns Returns the entry if found (or created); otherwise nullptr is returned. - * \todo Use dedicated flags or at least make \a creationType const in v4. */ -Entry *NodeEntry::entryByPath(list &path, bool includeThis, EntryType *creationType) +Entry *NodeEntry::entryByPath(list &path, bool includeThis, const EntryType *creationType) { if (path.empty()) { return nullptr; diff --git a/io/entry.h b/io/entry.h index 07decbb..21dae44 100644 --- a/io/entry.h +++ b/io/entry.h @@ -41,7 +41,7 @@ public: NodeEntry *parent() const; void setParent(NodeEntry *parent, int index = -1); int index() const; - bool isIndirectChildOf(NodeEntry *entry) const; + bool isIndirectChildOf(const NodeEntry *entry) const; std::list path() const; void path(std::list &res) const; virtual void make(std::ostream &stream) const = 0; @@ -126,7 +126,7 @@ public: const std::vector &children() const; void deleteChildren(int begin, int end); void replaceChild(std::size_t at, Entry *newChild); - Entry *entryByPath(std::list &path, bool includeThis = true, EntryType *creationType = nullptr); + Entry *entryByPath(std::list &path, bool includeThis = true, const EntryType *creationType = nullptr); bool isExpandedByDefault() const; void setExpandedByDefault(bool expandedByDefault); void make(std::ostream &stream) const override;