![]() |
Gorgon Game Engine
|
This iterator allows iteration of directories. More...
Public Member Functions | |
Iterator () | |
Empty constructor. Effectively generates end iterator. More... | |
Iterator (const Iterator &other) | |
Copy constructor. More... | |
Iterator (const std::string &directory, const std::string &pattern="*") | |
Creates a new iterator from the given directory and pattern. More... | |
Iterator (Iterator &&dir) | |
Move constructor. More... | |
~Iterator () | |
Destructor. More... | |
std::string | Current () |
Returns the current path. More... | |
void | Destroy () |
Destroys the current iterator. More... | |
std::string | Get () const |
Returns the current path. More... | |
bool | IsValid () const |
Checks whether the iterator is valid. More... | |
bool | Next () |
Next path in the directory. More... | |
operator std::string () const | |
Returns the current path. More... | |
bool | operator!= (const Iterator &other) const |
Compares two iterators. More... | |
std::string | operator* () const |
Returns the current path. More... | |
Iterator & | operator++ () |
Move to the next path in the directory. More... | |
Iterator | operator++ (int) |
Move to the next path in the directory, return unmodified iterator. More... | |
Iterator & | operator+= (int i) |
Moves directory by i elements. More... | |
const std::string * | operator-> () |
Returns the current path. More... | |
Iterator & | operator= (Iterator other) |
Assignment. More... | |
bool | operator== (const Iterator &other) const |
Compares two iterators. More... | |
void | Swap (Iterator &other) |
Swaps iterators, used for move semantics. More... | |
This iterator allows iteration of directories.
It is a forward only iterator. An empty iterator can be used for end(). Also instead of comparing the iterator with end, IsValid() function could be used.
Iterator | ( | const std::string & | directory, |
const std::string & | pattern = "*" |
||
) |
Creates a new iterator from the given directory and pattern.
directory | is the directory to be iterated. Should exists, otherwise it will throw PathNotFoundError |
pattern | wildcard pattern to match paths against |
PathNotFoundError | if the given directory does not exists |
References Iterator::Destroy(), and Iterator::Next().
Copy constructor.
References Iterator::Destroy().
~Iterator | ( | ) |
Destructor.
References Iterator::Destroy().
std::string Current | ( | ) |
Returns the current path.
std::runtime_error | (debug only) if the iterator is not valid |
References Iterator::Get().
void Destroy | ( | ) |
Destroys the current iterator.
std::string Get | ( | ) | const |
Returns the current path.
std::runtime_error | (debug only) if the iterator is not vali |
bool IsValid | ( | ) | const |
Checks whether the iterator is valid.
bool Next | ( | ) |
Next path in the directory.
std::runtime_error | (debug only) if the iterator is not valid |
References Iterator::Destroy().
operator std::string | ( | ) | const |
Returns the current path.
std::runtime_error | (debug only) if the iterator is not valid |
References Iterator::Get().
bool operator!= | ( | const Iterator & | other | ) | const |
Compares two iterators.
std::string operator* | ( | ) | const |
Returns the current path.
std::runtime_error | (debug only) if the iterator is not valid |
References Iterator::Get().
Iterator& operator++ | ( | ) |
Move to the next path in the directory.
References Iterator::Next().
Iterator operator++ | ( | int | ) |
Move to the next path in the directory, return unmodified iterator.
References Iterator::Next().
Iterator& operator+= | ( | int | i | ) |
Moves directory by i elements.
const std::string* operator-> | ( | ) |
Returns the current path.
std::runtime_error | (debug only) if the iterator is not vali |
Assignment.
References Iterator::Swap().
bool operator== | ( | const Iterator & | other | ) | const |
Compares two iterators.
void Swap | ( | Iterator & | other | ) |
Swaps iterators, used for move semantics.
References Gorgon::Filesystem::swap().