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();
}
std::string FSLib::Directory::Iterator::operator*() {
char const *FSLib::Directory::Iterator::operator*() const {
return current_entry->d_name;
}
@ -65,8 +65,8 @@ FSLib::Directory::Iterator &FSLib::Directory::Iterator::operator++() {
if( current_entry == nullptr )
return *this;
current_entry = readdir(d);
if( current_entry != nullptr && (!strcmp(current_entry->d_name, ".") || !strcmp(current_entry->d_name, "..")) )
operator++();
if( current_entry != nullptr && ( !strcmp(current_entry->d_name, ".") || !strcmp(current_entry->d_name, "..") ) )
return operator++();
return *this;
}
@ -76,10 +76,10 @@ FSLib::Directory::Iterator FSLib::Directory::Iterator::operator++(int) {
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;
}
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;
}

View File

@ -36,15 +36,15 @@ namespace FSLib{
closedir(d);
}
std::string operator*();
char const *operator*() const;
Iterator &operator++();
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:
DIR *d;