mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-14 11:54:53 +03:00
7bce096afd
We should work towards a pattern where we take StringView as function arguments, and store String as member, to push the String construction to the last possible moment.
31 lines
581 B
C++
31 lines
581 B
C++
#pragma once
|
|
|
|
#include <AK/AKString.h>
|
|
#include <dirent.h>
|
|
|
|
class CDirIterator {
|
|
public:
|
|
enum Flags
|
|
{
|
|
NoFlags = 0x0,
|
|
SkipDots = 0x1,
|
|
};
|
|
|
|
CDirIterator(const StringView& path, Flags = Flags::NoFlags);
|
|
~CDirIterator();
|
|
|
|
bool has_error() const { return m_error != 0; }
|
|
int error() const { return m_error; }
|
|
const char* error_string() const { return strerror(m_error); }
|
|
bool has_next();
|
|
String next_path();
|
|
|
|
private:
|
|
DIR* m_dir = nullptr;
|
|
int m_error = 0;
|
|
String m_next;
|
|
int m_flags;
|
|
|
|
bool advance_next();
|
|
};
|