Add consts

This commit is contained in:
zvon 2019-01-07 22:21:02 +01:00
parent a50ae5d93f
commit 46528b1f29
2 changed files with 8 additions and 8 deletions

View File

@ -57,7 +57,7 @@ const char *FSLib::Directory::path() const {
return dir_path.c_str(); return dir_path.c_str();
} }
std::string FSLib::Directory::Iterator::operator*() { char const *FSLib::Directory::Iterator::operator*() const {
return current_entry->d_name; return current_entry->d_name;
} }
@ -66,7 +66,7 @@ FSLib::Directory::Iterator &FSLib::Directory::Iterator::operator++() {
return *this; return *this;
current_entry = readdir(d); current_entry = readdir(d);
if( current_entry != nullptr && ( !strcmp(current_entry->d_name, ".") || !strcmp(current_entry->d_name, "..") ) ) if( current_entry != nullptr && ( !strcmp(current_entry->d_name, ".") || !strcmp(current_entry->d_name, "..") ) )
operator++(); return operator++();
return *this; return *this;
} }
@ -76,10 +76,10 @@ FSLib::Directory::Iterator FSLib::Directory::Iterator::operator++(int) {
return ret; return ret;
} }
bool FSLib::Directory::Iterator::operator==(const Iterator &i_other) { bool FSLib::Directory::Iterator::operator==(const Iterator &i_other) const {
return i_other.current_entry == current_entry; return i_other.current_entry == current_entry;
} }
bool FSLib::Directory::Iterator::operator!=(const Iterator &i_other) { bool FSLib::Directory::Iterator::operator!=(const Iterator &i_other) const {
return i_other.current_entry != current_entry; return i_other.current_entry != current_entry;
} }

View File

@ -36,15 +36,15 @@ namespace FSLib{
closedir(d); closedir(d);
} }
std::string operator*(); char const *operator*() const;
Iterator &operator++(); Iterator &operator++();
Iterator operator++(int); Iterator operator++(int);
bool operator==(const Iterator &i_other); bool operator==(const Iterator &i_other) const;
bool operator!=(const Iterator &i_other); bool operator!=(const Iterator &i_other) const;
private: private:
DIR *d; DIR *d;