Re-organize coral::enumerator functions for easier reading

This commit is contained in:
kayomn 2023-03-02 20:02:39 +00:00
parent e5e4f11004
commit dee82f6437
2 changed files with 13 additions and 13 deletions

View File

@ -502,14 +502,6 @@ export namespace coral {
template<typename type> struct enumerator {
virtual ~enumerator() {}
/**
* Returns the last-enumerated value.
*
* *Note*: calling this function before first having recieved a `true` value from [enumerate] will result in
* implementation-defined behaviour.
*/
virtual type value() = 0;
/**
* Attempts to retrieve the next file path in the file tree, returning true if another value was retrieved or
* `false` if there are no more values to be enumerated over.
@ -523,6 +515,14 @@ export namespace coral {
* The enumerated value may be accessed through [value].
*/
virtual bool enumerate() = 0;
/**
* Returns the last-enumerated value.
*
* *Note*: calling this function before first having recieved a `true` value from [enumerate] will result in
* implementation-defined behaviour.
*/
virtual type value() = 0;
};
}

View File

@ -26,16 +26,16 @@ export namespace coral {
struct file_walker : public enumerator<expected<slice<char const>, io_error>> {
virtual ~file_walker() {}
/**
* See [enumerator::enumerate].
*/
virtual bool enumerate() = 0;
/**
* Returns the last-enumerated path as a sequence of `char`s or an [io_error] if the last enumeration did not
* successfully complete.
*/
virtual expected<slice<char const>, io_error> value() = 0;
/**
* See [enumerator::enumerate].
*/
virtual bool enumerate() = 0;
};
/**