Improve const correctness

This commit is contained in:
Martchus 2018-12-23 18:57:03 +01:00
parent a25282b3d1
commit e29457dfd0
2 changed files with 4 additions and 6 deletions

View File

@ -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<string> &path, bool includeThis, EntryType *creationType)
Entry *NodeEntry::entryByPath(list<string> &path, bool includeThis, const EntryType *creationType)
{
if (path.empty()) {
return nullptr;

View File

@ -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<std::string> path() const;
void path(std::list<std::string> &res) const;
virtual void make(std::ostream &stream) const = 0;
@ -126,7 +126,7 @@ public:
const std::vector<Entry *> &children() const;
void deleteChildren(int begin, int end);
void replaceChild(std::size_t at, Entry *newChild);
Entry *entryByPath(std::list<std::string> &path, bool includeThis = true, EntryType *creationType = nullptr);
Entry *entryByPath(std::list<std::string> &path, bool includeThis = true, const EntryType *creationType = nullptr);
bool isExpandedByDefault() const;
void setExpandedByDefault(bool expandedByDefault);
void make(std::ostream &stream) const override;